1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef CONNECTIVITY_POOLEDCONNECTION_HXX
24 #define CONNECTIVITY_POOLEDCONNECTION_HXX
25 
26 #include <cppuhelper/compbase2.hxx>
27 #include <com/sun/star/sdbc/XPooledConnection.hpp>
28 #include <com/sun/star/lang/XEventListener.hpp>
29 #include <comphelper/broadcasthelper.hxx>
30 #include <com/sun/star/reflection/XProxyFactory.hpp>
31 
32 
33 namespace connectivity
34 {
35 	//==========================================================================
36 	//= OPooledConnection -
37 	//= allows to pool a real connection
38 	//==========================================================================
39 	typedef	::cppu::WeakComponentImplHelper2<	 ::com::sun::star::sdbc::XPooledConnection
40 												,::com::sun::star::lang::XEventListener>	OPooledConnection_Base;
41 
42 	class OPooledConnection : public ::comphelper::OBaseMutex
43 							 ,public OPooledConnection_Base
44 	{
45 		::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >				m_xRealConnection;	// the connection fom driver
46 		::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >				m_xComponent;		// the connection which wraps the real connection
47 		::com::sun::star::uno::Reference< ::com::sun::star::reflection::XProxyFactory >		m_xProxyFactory;
48 	public:
49 		// OComponentHelper
50 		virtual void SAL_CALL disposing(void);
51 
52 		OPooledConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
53 						  const ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XProxyFactory >& _rxProxyFactory);
54 
55 		//XPooledConnection
56 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection(  ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
57 
58 		// XEventListener
59 		virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
60 	};
61 
62 }
63 #endif // CONNECTIVITY_POOLEDCONNECTION_HXX
64 
65