summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-07-24 05:03:21 +0000
committerOcke Janssen <oj@openoffice.org>2001-07-24 05:03:21 +0000
commit278c3b2660b2cd11f446312b82dbd370088b81bb (patch)
tree69e771df2b0728b10a1d5da4f684efc451cd6c4f /connectivity
parent5fb181faaae8a3696fd6126431cfe443e18bfdcb (diff)
#87724# driver pooling enabled
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/cpool/ZConnectionPool.cxx239
-rw-r--r--connectivity/source/cpool/ZPoolCollection.cxx578
-rw-r--r--connectivity/source/cpool/ZPoolCollection.hxx195
3 files changed, 857 insertions, 155 deletions
diff --git a/connectivity/source/cpool/ZConnectionPool.cxx b/connectivity/source/cpool/ZConnectionPool.cxx
index 4a387368fa41..74f91b26556a 100644
--- a/connectivity/source/cpool/ZConnectionPool.cxx
+++ b/connectivity/source/cpool/ZConnectionPool.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZConnectionPool.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: fs $ $Date: 2001-06-28 10:31:43 $
+ * last change: $Author: oj $ $Date: 2001-07-24 06:03:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,8 +82,11 @@
#ifndef CONNECTIVITY_POOLEDCONNECTION_HXX
#include "ZPooledConnection.hxx"
#endif
-#ifndef _CONNECTIVITY_CPOOL_ZDRIVERWRAPPER_HXX_
-#include "ZDriverWrapper.hxx"
+#ifndef CONNECTIVITY_POOLCOLLECTION_HXX
+#include "ZPoolCollection.hxx"
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
#endif
using namespace ::com::sun::star::uno;
@@ -91,12 +94,9 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::reflection;
using namespace ::osl;
using namespace connectivity;
-#define CONNECTION_TIMEOUT 10
-// the connection will be expiared when 10 minutes are gone
//==========================================================================
//= OPoolTimer
//==========================================================================
@@ -104,72 +104,88 @@ void SAL_CALL OPoolTimer::onShot()
{
m_pPool->invalidatePooledConnections();
}
+//--------------------------------------------------------------------
+static const ::rtl::OUString& getTimeoutNodeName()
+{
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Timeout");
+ return s_sNodeName;
+}
//==========================================================================
//= OConnectionPool
//==========================================================================
//--------------------------------------------------------------------------
-OConnectionPool::OConnectionPool(const Reference< XMultiServiceFactory >& _rxFactory)
- :m_xServiceFactory(_rxFactory)
+OConnectionPool::OConnectionPool(const Reference< XDriver >& _xDriver,
+ const Reference< XInterface >& _xDriverNode)
+ :m_xDriver(_xDriver)
+ ,m_xDriverNode(_xDriverNode)
+ ,m_nTimeOut(10)
+ ,m_nALiveCount(10)
{
- // bootstrap all objects supporting the .sdb.Driver service
- m_xManager = Reference< XDriverManager >(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.sdbc.DriverManager") ), UNO_QUERY);
- m_xDriverAccess = Reference< XDriverAccess >(m_xManager, UNO_QUERY);
-
- OSL_ENSURE(m_xDriverAccess.is(), "OConnectionPool::OConnectionPool: have no (or an invalid) driver manager!");
-
- m_xTimer = new OPoolTimer(this,::vos::TTimeValue(10,0));
+ OSL_ENSURE(m_xDriverNode.is(),"NO valid Driver node set!");
+ Reference< XComponent > xComponent(m_xDriverNode, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->addEventListener(this);
+
+ Reference<XPropertySet> xProp(m_xDriverNode,UNO_QUERY);
+ if(xProp.is())
+ xProp->addPropertyChangeListener(getTimeoutNodeName(),this);
+
+ OPoolCollection::getNodeValue(getTimeoutNodeName(),m_xDriverNode) >>= m_nALiveCount;
+ sal_Int32 nError = 10;
+ if(m_nALiveCount < 100)
+ nError = 20;
+
+ m_nTimeOut = m_nALiveCount / nError;
+ m_nALiveCount = m_nALiveCount / m_nTimeOut;
+ m_xTimer = new OPoolTimer(this,::vos::TTimeValue(m_nTimeOut,0));
m_xTimer->start();
-
- m_xProxyFactory = Reference< XProxyFactory >(
- m_xServiceFactory->createInstance(
- ::rtl::OUString::createFromAscii("com.sun.star.reflection.ProxyFactory")),
- UNO_QUERY);
- OSL_ENSURE(m_xProxyFactory.is(), "OConnectionPool::OConnectionPool: could not create a proxy factory!");
}
// -----------------------------------------------------------------------------
OConnectionPool::~OConnectionPool()
{
- {
- MutexGuard aGuard(m_aMutex);
- if(m_xTimer->isTicking())
- m_xTimer->stop();
- }
-}
-//--------------------------------------------------------------------------
-void SAL_CALL OConnectionPool::acquire() throw(RuntimeException)
-{
- osl_incrementInterlockedCount(&m_refCount);
+ clear();
}
// -----------------------------------------------------------------------------
-void SAL_CALL OConnectionPool::release() throw(RuntimeException)
-{
- osl_decrementInterlockedCount(&m_refCount);
-}
-
-//--------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL OConnectionPool::getConnection( const ::rtl::OUString& _rURL ) throw(SQLException, RuntimeException)
+void OConnectionPool::clear()
{
MutexGuard aGuard(m_aMutex);
- Reference<XConnection> xConnection;
- pair<TConnectionMap::iterator, TConnectionMap::iterator> aThisURLConns = m_aPool.equal_range(_rURL);
- TConnectionMap::iterator aIter = aThisURLConns.first;
+ if(m_xTimer->isTicking())
+ m_xTimer->stop();
- if (aIter != aThisURLConns.second)
- {// we know the url so we have to check if we found one without properties
- do
+ TConnectionMap::iterator aIter = m_aPool.begin();
+ for(;aIter != m_aPool.end();++aIter)
+ {
+ TPooledConnections::iterator aIter2 = aIter->second.aConnections.begin();
+ for(;aIter2 != aIter->second.aConnections.end();++aIter2)
{
- if(!aIter->second.aProps.size())
- xConnection = getPooledConnection(aIter);
+ Reference< XComponent > xComponent(*aIter2, UNO_QUERY);
+ if (xComponent.is())
+ {
+ xComponent->removeEventListener(this);
+ ::comphelper::disposeComponent(xComponent);
+ }
}
- while ((++aIter != aThisURLConns.second) && !xConnection.is());
+ aIter->second.aConnections.clear();
}
- if(!xConnection.is())
- xConnection = createNewConnection(_rURL,Sequence< PropertyValue >());
+ m_aPool.clear();
- return xConnection;
-}
+ TActiveConnectionMap::iterator aIter3 = m_aActiveConnections.begin();
+ for(;aIter3 != m_aActiveConnections.end();++aIter3)
+ {
+ Reference< XComponent > xComponent(aIter3->first, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->removeEventListener(this);
+ }
+ m_aActiveConnections.clear();
+ Reference< XComponent > xComponent(m_xDriverNode, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->removeEventListener(this);
+
+ m_xDriverNode = NULL;
+ m_xDriver = NULL;
+}
//--------------------------------------------------------------------------
Reference< XConnection > SAL_CALL OConnectionPool::getConnectionWithInfo( const ::rtl::OUString& _rURL, const Sequence< PropertyValue >& _rInfo ) throw(SQLException, RuntimeException)
{
@@ -198,96 +214,6 @@ Reference< XConnection > SAL_CALL OConnectionPool::getConnectionWithInfo( const
return xConnection;
}
//--------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConnectionPool::getImplementationName( ) throw(RuntimeException)
-{
- MutexGuard aGuard(m_aMutex);
- return getImplementationName_Static();
-}
-
-//--------------------------------------------------------------------------
-sal_Bool SAL_CALL OConnectionPool::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
- const ::rtl::OUString* pSupported = aSupported.getConstArray();
- const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
- for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
- ;
-
- return pSupported != pEnd;
-}
-
-//--------------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL OConnectionPool::getSupportedServiceNames( ) throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-
-//--------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL OConnectionPool::CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory)
-{
- return static_cast<XDriverManager*>(new OConnectionPool(_rxFactory));
-}
-
-//--------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConnectionPool::getImplementationName_Static( ) throw(RuntimeException)
-{
- return ::rtl::OUString::createFromAscii("com.sun.star.sdbc.OConnectionPool");
-}
-
-//--------------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL OConnectionPool::getSupportedServiceNames_Static( ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(1);
- aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ConnectionPool");
- return aSupported;
-}
-//--------------------------------------------------------------------------
-Reference< XDriver > SAL_CALL OConnectionPool::getDriverByURL( const ::rtl::OUString& _rURL ) throw(RuntimeException)
-{
- Reference< XDriver > xDriver;
- if (m_xDriverAccess.is())
- {
- xDriver = m_xDriverAccess->getDriverByURL(_rURL);
- if (xDriver.is())
- {
- Reference< XDriver > xExistentProxy;
- // look if we already have a proxy for this driver
- for ( ConstMapDriver2DriverRefIterator aLookup = m_aDriverProxies.begin();
- aLookup != m_aDriverProxies.end();
- ++aLookup
- )
- {
- // hold the proxy alive as long as we're in this loop round
- xExistentProxy = aLookup->second;
-
- if (xExistentProxy.is() && (aLookup->first.get() == xDriver.get()))
- // already created a proxy for this
- break;
- }
- if (xExistentProxy.is())
- {
- xDriver = xExistentProxy;
- }
- else
- { // create a new proxy for the driver
- // this allows us to control the connections created by it
- if (m_xProxyFactory.is())
- {
- Reference< XAggregation > xDriverProxy = m_xProxyFactory->createProxy(xDriver.get());
- OSL_ENSURE(xDriverProxy.is(), "OConnectionPool::getDriverByURL: invalid proxy returned by the proxy factory!");
-
- xDriver = new ODriverWrapper(xDriverProxy, this);
- }
- else
- OSL_ENSURE(sal_False, "OConnectionPool::getDriverByURL: could not instantiate a proxy factory!");
- }
- }
- }
-
- return xDriver;
-}
-
-//--------------------------------------------------------------------------
void SAL_CALL OConnectionPool::disposing( const ::com::sun::star::lang::EventObject& Source ) throw (RuntimeException)
{
Reference<XConnection> xConnection(Source.Source,UNO_QUERY);
@@ -298,11 +224,14 @@ void SAL_CALL OConnectionPool::disposing( const ::com::sun::star::lang::EventObj
OSL_ENSURE(aIter != m_aActiveConnections.end(),"OConnectionPool::disposing: Conenction wasn't in pool");
if(aIter != m_aActiveConnections.end())
{ // move the pooled connection back to the pool
- aIter->second.aPos->second.nALiveCount = CONNECTION_TIMEOUT;
+ aIter->second.aPos->second.nALiveCount = m_nALiveCount;
aIter->second.aPos->second.aConnections.push_back(aIter->second.xPooledConnection);
m_aActiveConnections.erase(aIter);
}
}
+ else
+ {
+ }
}
// -----------------------------------------------------------------------------
sal_Bool OConnectionPool::checkSequences(const PropertyMap& _rLh,const PropertyMap& _rRh)
@@ -319,20 +248,10 @@ sal_Bool OConnectionPool::checkSequences(const PropertyMap& _rLh,const PropertyM
return bRet;
}
// -----------------------------------------------------------------------------
-void SAL_CALL OConnectionPool::setLoginTimeout( sal_Int32 seconds ) throw(RuntimeException)
-{
- m_xManager->setLoginTimeout(seconds);
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OConnectionPool::getLoginTimeout( ) throw(RuntimeException)
-{
- return m_xManager->getLoginTimeout();
-}
-// -----------------------------------------------------------------------------
Reference< XConnection> OConnectionPool::createNewConnection(const ::rtl::OUString& _rURL,const Sequence< PropertyValue >& _rInfo)
{
// create new pooled conenction
- Reference< XPooledConnection > xPooledConnection = new ::connectivity::OPooledConnection(m_xManager->getConnectionWithInfo(_rURL,_rInfo));
+ Reference< XPooledConnection > xPooledConnection = new ::connectivity::OPooledConnection(m_xDriver->connect(_rURL,_rInfo));
// get the new connection from the pooled connection
Reference<XConnection> xConnection = xPooledConnection->getConnection();
if(xConnection.is())
@@ -347,7 +266,7 @@ Reference< XConnection> OConnectionPool::createNewConnection(const ::rtl::OUStri
createPropertyMap(_rInfo,aMap); // by ref to avoid copying
TConnectionPool aPack;
aPack.aProps = aMap;
- aPack.nALiveCount = CONNECTION_TIMEOUT;
+ aPack.nALiveCount = m_nALiveCount;
TActiveConnectionInfo aActiveInfo;
aActiveInfo.aPos = m_aPool.insert(TConnectionMap::value_type(_rURL,aPack));
aActiveInfo.xPooledConnection = xPooledConnection;
@@ -430,3 +349,13 @@ Reference< XConnection> OConnectionPool::getPooledConnection(TConnectionMap::ite
return xConnection;
}
// -----------------------------------------------------------------------------
+void SAL_CALL OConnectionPool::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException)
+{
+ evt.NewValue >>= m_nALiveCount;
+ sal_Int32 nError = 10;
+ if(m_nALiveCount < 100)
+ nError = 20;
+ m_nTimeOut = m_nALiveCount / nError;
+ m_nALiveCount = m_nALiveCount / m_nTimeOut;
+}
+// -----------------------------------------------------------------------------
diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx
new file mode 100644
index 000000000000..e04ebecf57ab
--- /dev/null
+++ b/connectivity/source/cpool/ZPoolCollection.cxx
@@ -0,0 +1,578 @@
+/*************************************************************************
+ *
+ * $RCSfile: ZPoolCollection.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-07-24 06:01:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_POOLCOLLECTION_HXX
+#include "ZPoolCollection.hxx"
+#endif
+
+#ifndef _CONNECTIVITY_CPOOL_ZDRIVERWRAPPER_HXX_
+#include "ZDriverWrapper.hxx"
+#endif
+#ifndef _CONNECTIVITY_ZCONNECTIONPOOL_HXX_
+#include "ZConnectionPool.hxx"
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _COMPHELPER_EXTRACT_HXX_
+#include <comphelper/extract.hxx>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::reflection;
+using namespace ::osl;
+using namespace connectivity;
+
+//--------------------------------------------------------------------
+static const ::rtl::OUString& getConnectionPoolNodeName()
+{
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("org.openoffice.Office.DataAccess/ConnectionPool");
+ return s_sNodeName;
+}
+//--------------------------------------------------------------------
+static const ::rtl::OUString& getEnablePoolingNodeName()
+{
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("EnablePooling");
+ return s_sNodeName;
+}
+//--------------------------------------------------------------------
+static const ::rtl::OUString& getDriverNameNodeName()
+{
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("DriverName");
+ return s_sNodeName;
+}
+// -----------------------------------------------------------------------------
+static const ::rtl::OUString& getDriverSettingsNodeName()
+{
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("DriverSettings");
+ return s_sNodeName;
+}
+//--------------------------------------------------------------------------
+static const ::rtl::OUString& getEnableNodeName()
+{
+ static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Enable");
+ return s_sNodeName;
+}
+
+//--------------------------------------------------------------------
+OPoolCollection::OPoolCollection(const Reference< XMultiServiceFactory >& _rxFactory)
+ :m_xServiceFactory(_rxFactory)
+{
+ // bootstrap all objects supporting the .sdb.Driver service
+ m_xManager = Reference< XDriverManager >(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.sdbc.DriverManager") ), UNO_QUERY);
+ m_xDriverAccess = Reference< XDriverAccess >(m_xManager, UNO_QUERY);
+ OSL_ENSURE(m_xDriverAccess.is(), "have no (or an invalid) driver manager!");
+
+ m_xProxyFactory = Reference< XProxyFactory >(
+ m_xServiceFactory->createInstance(
+ ::rtl::OUString::createFromAscii("com.sun.star.reflection.ProxyFactory")),
+ UNO_QUERY);
+ OSL_ENSURE(m_xProxyFactory.is(), "OConnectionPool::OConnectionPool: could not create a proxy factory!");
+
+ Reference<XPropertySet> xProp(getConfigPoolRoot(),UNO_QUERY);
+ if(xProp.is())
+ xProp->addPropertyChangeListener(getEnablePoolingNodeName(),this);
+}
+// -----------------------------------------------------------------------------
+OPoolCollection::~OPoolCollection()
+{
+ clearConnectionPools();
+}
+// -----------------------------------------------------------------------------
+Reference< XConnection > SAL_CALL OPoolCollection::getConnection( const ::rtl::OUString& _rURL ) throw(SQLException, RuntimeException)
+{
+ return getConnectionWithInfo(_rURL,Sequence< PropertyValue >());
+}
+// -----------------------------------------------------------------------------
+Reference< XConnection > SAL_CALL OPoolCollection::getConnectionWithInfo( const ::rtl::OUString& _rURL, const Sequence< PropertyValue >& _rInfo ) throw(SQLException, RuntimeException)
+{
+ MutexGuard aGuard(m_aMutex);
+ Reference< XConnection > xConnection;
+ Reference< XDriver > xDriver;
+ Reference< XInterface > xDriverNode;
+ ::rtl::OUString sImplName;
+ if(isPoolingEnabledByUrl(_rURL,xDriver,sImplName,xDriverNode))
+ {
+ OConnectionPool* pConnectionPool = getConnectionPool(sImplName,xDriver,xDriverNode);
+
+ if(pConnectionPool)
+ xConnection = pConnectionPool->getConnectionWithInfo(_rURL,_rInfo);
+ }
+ else
+ xConnection = xDriver->connect(_rURL,_rInfo);
+
+ return xConnection;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OPoolCollection::setLoginTimeout( sal_Int32 seconds ) throw(RuntimeException)
+{
+ MutexGuard aGuard(m_aMutex);
+ m_xManager->setLoginTimeout(seconds);
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL OPoolCollection::getLoginTimeout( ) throw(RuntimeException)
+{
+ MutexGuard aGuard(m_aMutex);
+ return m_xManager->getLoginTimeout();
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OPoolCollection::getImplementationName( ) throw(RuntimeException)
+{
+ MutexGuard aGuard(m_aMutex);
+ return getImplementationName_Static();
+}
+
+//--------------------------------------------------------------------------
+sal_Bool SAL_CALL OPoolCollection::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
+{
+ Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
+ const ::rtl::OUString* pSupported = aSupported.getConstArray();
+ const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
+ for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
+ ;
+
+ return pSupported != pEnd;
+}
+
+//--------------------------------------------------------------------------
+Sequence< ::rtl::OUString > SAL_CALL OPoolCollection::getSupportedServiceNames( ) throw(RuntimeException)
+{
+ return getSupportedServiceNames_Static();
+}
+
+//---------------------------------------OPoolCollection----------------------------------
+Reference< XInterface > SAL_CALL OPoolCollection::CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory)
+{
+ return static_cast<XDriverManager*>(new OPoolCollection(_rxFactory));
+}
+
+//--------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OPoolCollection::getImplementationName_Static( ) throw(RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii("com.sun.star.sdbc.OConnectionPool");
+}
+
+//--------------------------------------------------------------------------
+Sequence< ::rtl::OUString > SAL_CALL OPoolCollection::getSupportedServiceNames_Static( ) throw(RuntimeException)
+{
+ Sequence< ::rtl::OUString > aSupported(1);
+ aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ConnectionPool");
+ return aSupported;
+}
+// -----------------------------------------------------------------------------
+Reference< XDriver > SAL_CALL OPoolCollection::getDriverByURL( const ::rtl::OUString& _rURL ) throw(RuntimeException)
+{
+ // returns the original driver when no connection pooling is enabled else it returns the proxy
+ MutexGuard aGuard(m_aMutex);
+
+ Reference< XDriver > xDriver;
+ Reference< XInterface > xDriverNode;
+ ::rtl::OUString sImplName;
+ if(isPoolingEnabledByUrl(_rURL,xDriver,sImplName,xDriverNode))
+ {
+ Reference< XDriver > xExistentProxy;
+ // look if we already have a proxy for this driver
+ for ( ConstMapDriver2DriverRefIterator aLookup = m_aDriverProxies.begin();
+ aLookup != m_aDriverProxies.end();
+ ++aLookup
+ )
+ {
+ // hold the proxy alive as long as we're in this loop round
+ xExistentProxy = aLookup->second;
+
+ if (xExistentProxy.is() && (aLookup->first.get() == xDriver.get()))
+ // already created a proxy for this
+ break;
+ }
+ if (xExistentProxy.is())
+ {
+ xDriver = xExistentProxy;
+ }
+ else
+ { // create a new proxy for the driver
+ // this allows us to control the connections created by it
+ if (m_xProxyFactory.is())
+ {
+ Reference< XAggregation > xDriverProxy = m_xProxyFactory->createProxy(xDriver.get());
+ OSL_ENSURE(xDriverProxy.is(), "OConnectionPool::getDriverByURL: invalid proxy returned by the proxy factory!");
+
+ OConnectionPool* pConnectionPool = getConnectionPool(sImplName,xDriver,xDriverNode);
+ xDriver = new ODriverWrapper(xDriverProxy, pConnectionPool);
+ }
+ else
+ OSL_ENSURE(sal_False, "OConnectionPool::getDriverByURL: could not instantiate a proxy factory!");
+ }
+ }
+
+ return xDriver;
+}
+// -----------------------------------------------------------------------------
+sal_Bool OPoolCollection::isDriverPoolingEnabled(const ::rtl::OUString& _sDriverImplName,
+ Reference< XInterface >& _rxDriverNode)
+{
+ sal_Bool bEnabled = sal_False;
+ Reference<XInterface> xConnectionPoolRoot = getConfigPoolRoot();
+ // then look for which of them settings are stored in the configuration
+ Reference< XNameAccess > xDirectAccess(openNode(getDriverSettingsNodeName(),xConnectionPoolRoot),UNO_QUERY);
+
+ if(xDirectAccess.is())
+ {
+ Sequence< ::rtl::OUString > aDriverKeys = xDirectAccess->getElementNames();
+ const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray();
+ const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength();
+ for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys)
+ {
+ // the name of the driver in this round
+ if(_sDriverImplName == *pDriverKeys)
+ {
+ _rxDriverNode = openNode(*pDriverKeys,xDirectAccess);
+ if(_rxDriverNode.is())
+ getNodeValue(getEnableNodeName(),_rxDriverNode) >>= bEnabled;
+ break;
+ }
+ }
+ }
+ return bEnabled;
+}
+// -----------------------------------------------------------------------------
+sal_Bool OPoolCollection::isPoolingEnabled()
+{
+ // the config node where all pooling relevant info are stored under
+ Reference<XInterface> xConnectionPoolRoot = getConfigPoolRoot();
+
+ // the global "enabled" flag
+ sal_Bool bEnabled = sal_False;
+ if(xConnectionPoolRoot.is())
+ getNodeValue(getEnablePoolingNodeName(),xConnectionPoolRoot) >>= bEnabled;
+ return bEnabled;
+}
+// -----------------------------------------------------------------------------
+Reference<XInterface> OPoolCollection::getConfigPoolRoot()
+{
+ if(!m_xConfigNode.is())
+ m_xConfigNode = createWithServiceFactory(getConnectionPoolNodeName());
+ return m_xConfigNode;
+}
+// -----------------------------------------------------------------------------
+sal_Bool OPoolCollection::isPoolingEnabledByUrl(const ::rtl::OUString& _sUrl,
+ Reference< XDriver >& _rxDriver,
+ ::rtl::OUString& _rsImplName,
+ Reference< XInterface >& _rxDriverNode)
+{
+ sal_Bool bEnabled = sal_False;
+ if (m_xDriverAccess.is())
+ {
+ _rxDriver = m_xDriverAccess->getDriverByURL(_sUrl);
+ if (_rxDriver.is() && isPoolingEnabled())
+ {
+ Reference< XServiceInfo > xSerivceInfo(_rxDriver,UNO_QUERY);
+ OSL_ENSURE(xSerivceInfo.is(),"Each driver should have a XServiceInfo interface!");
+
+ if(xSerivceInfo.is())
+ {
+ // look for the implementation name of the driver
+ _rsImplName = xSerivceInfo->getImplementationName();
+ bEnabled = isDriverPoolingEnabled(_rsImplName,_rxDriverNode);
+ }
+ }
+ }
+ return bEnabled;
+}
+// -----------------------------------------------------------------------------
+void OPoolCollection::clearConnectionPools()
+{
+ OConnectionPools::const_iterator aIter = m_aPools.begin();
+ while(aIter != m_aPools.end())
+ {
+ aIter->second->clear();
+ aIter->second->release();
+ ::rtl::OUString sKeyValue = aIter->first;
+ ++aIter;
+ m_aPools.erase(sKeyValue);
+ }
+}
+// -----------------------------------------------------------------------------
+OConnectionPool* OPoolCollection::getConnectionPool(const ::rtl::OUString& _sImplName,
+ const Reference< XDriver >& _xDriver,
+ const Reference< XInterface >& _xDriverNode)
+{
+ OConnectionPools::const_iterator aFind = m_aPools.find(_sImplName);
+ if(aFind == m_aPools.end() && _xDriver.is() && _xDriverNode.is())
+ {
+ Reference<XPropertySet> xProp(_xDriverNode,UNO_QUERY);
+ if(xProp.is())
+ xProp->addPropertyChangeListener(getEnableNodeName(),this);
+ OConnectionPool* pConnectionPool = new OConnectionPool(_xDriver,_xDriverNode);
+ pConnectionPool->acquire();
+ aFind = m_aPools.insert(OConnectionPools::value_type(_sImplName,pConnectionPool)).first;
+ }
+
+ OSL_ENSURE(aFind->second,"Could not query DriverManager from ConnectionPool!");
+
+ return aFind->second;
+}
+// -----------------------------------------------------------------------------
+Reference< XInterface > OPoolCollection::createWithServiceFactory(const ::rtl::OUString& _rPath) const
+{
+ Reference< XInterface > xInterface;
+ try
+ {
+ Reference< XInterface > xProvider = m_xServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider")));
+ OSL_ENSURE(xProvider.is(), "OConfigurationTreeRoot::createWithServiceFactory: could not instantiate the config provider service!");
+ Reference< XMultiServiceFactory > xProviderAsFac(xProvider, UNO_QUERY);
+ OSL_ENSURE(xProviderAsFac.is() || !xProvider.is(), "OConfigurationTreeRoot::createWithServiceFactory: the provider is missing an interface!");
+ if (xProviderAsFac.is())
+ xInterface = createWithProvider(xProviderAsFac, _rPath);
+ }
+ catch(const Exception&)
+ {
+ OSL_ENSURE(sal_False, "createWithServiceFactory: error while instantiating the provider service!");
+ }
+ return xInterface;
+}
+//------------------------------------------------------------------------
+Reference< XInterface > OPoolCollection::createWithProvider(const Reference< XMultiServiceFactory >& _rxConfProvider,
+ const ::rtl::OUString& _rPath) const
+{
+ OSL_ENSURE(_rxConfProvider.is(), "createWithProvider: invalid provider!");
+
+ Reference< XInterface > xInterface;
+#ifdef DBG_UTIL
+ if (_rxConfProvider.is())
+ {
+ try
+ {
+ Reference< XServiceInfo > xSI(_rxConfProvider, UNO_QUERY);
+ if (!xSI.is())
+ {
+ OSL_ENSURE(sal_False, "::createWithProvider: no XServiceInfo interface on the provider!");
+ }
+ else
+ {
+ OSL_ENSURE(xSI->supportsService(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")),
+ "::createWithProvider: sure this is a provider? Missing the ConfigurationProvider service!");
+ }
+ }
+ catch(const Exception&)
+ {
+ OSL_ENSURE(sal_False, "::createWithProvider: unable to check the service conformance of the provider given!");
+ }
+ }
+#endif
+
+ if (_rxConfProvider.is())
+ {
+ try
+ {
+ Sequence< Any > aCreationArgs(3);
+ aCreationArgs[0] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), 0, makeAny(_rPath), PropertyState_DIRECT_VALUE));
+ aCreationArgs[1] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("depth")), 0, makeAny((sal_Int32)-1), PropertyState_DIRECT_VALUE));
+ aCreationArgs[2] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("lazywrite")), 0, makeAny(sal_True), PropertyState_DIRECT_VALUE));
+
+ static ::rtl::OUString sAccessService = ::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess");
+
+ xInterface = _rxConfProvider->createInstanceWithArguments(sAccessService, aCreationArgs);
+ OSL_ENSURE(xInterface.is(), "::createWithProvider: could not create the node access!");
+ }
+ catch(Exception&)
+ {
+ OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: caught an exception while creating the access object!");
+ }
+ }
+ return xInterface;
+}
+// -----------------------------------------------------------------------------
+Reference<XInterface> OPoolCollection::openNode(const ::rtl::OUString& _rPath,const Reference<XInterface>& _xTreeNode) const throw()
+{
+ Reference< XHierarchicalNameAccess > xHierarchyAccess(_xTreeNode, UNO_QUERY);
+ Reference< XNameAccess > xDirectAccess(_xTreeNode, UNO_QUERY);
+ Reference< XInterface > xNode;
+
+ try
+ {
+ if (xDirectAccess.is() && xDirectAccess->hasByName(_rPath))
+ {
+ if (!::cppu::extractInterface(xNode, xDirectAccess->getByName(_rPath)))
+ OSL_ENSURE(sal_False, "OConfigurationNode::openNode: could not open the node!");
+ }
+ else if (xHierarchyAccess.is())
+ {
+ if (!::cppu::extractInterface(xNode, xHierarchyAccess->getByHierarchicalName(_rPath)))
+ OSL_ENSURE(sal_False, "OConfigurationNode::openNode: could not open the node!");
+ }
+
+ }
+ catch(const NoSuchElementException&)
+ {
+ OSL_ENSURE(sal_False,
+ ::rtl::OString("::openNode: there is no element named ")
+ += ::rtl::OString(_rPath.getStr(), _rPath.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString("!"));
+ }
+ catch(Exception&)
+ {
+ OSL_ENSURE(sal_False, "OConfigurationNode::openNode: caught an exception while retrieving the node!");
+ }
+ return xNode;
+}
+// -----------------------------------------------------------------------------
+Any OPoolCollection::getNodeValue(const ::rtl::OUString& _rPath,const Reference<XInterface>& _xTreeNode) throw()
+{
+ Reference< XHierarchicalNameAccess > xHierarchyAccess(_xTreeNode, UNO_QUERY);
+ Reference< XNameAccess > xDirectAccess(_xTreeNode, UNO_QUERY);
+ Any aReturn;
+ try
+ {
+ if (xDirectAccess.is() && xDirectAccess->hasByName(_rPath) )
+ {
+ aReturn = xDirectAccess->getByName(_rPath);
+ }
+ else if (xHierarchyAccess.is())
+ {
+ aReturn = xHierarchyAccess->getByHierarchicalName(_rPath);
+ }
+ }
+ catch(NoSuchElementException& e)
+ {
+ e; // make compiler happy
+ OSL_ENSURE(sal_False,
+ ::rtl::OString("::getNodeValue: caught a NoSuchElementException while trying to open ")
+ += ::rtl::OString(e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US)
+ += ::rtl::OString("!"));
+ }
+ return aReturn;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OPoolCollection::disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OPoolCollection::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException)
+{
+ MutexGuard aGuard(m_aMutex);
+ if(evt.Source == m_xConfigNode)
+ {
+ sal_Bool bEnabled = sal_True;
+ evt.NewValue >>= bEnabled;
+ if(!bEnabled )
+ {
+ m_aDriverProxies.clear();
+ m_aDriverProxies = MapDriver2DriverRef();
+ OConnectionPools::iterator aIter = m_aPools.begin();
+ for(;aIter != m_aPools.end();++aIter)
+ {
+ aIter->second->clear();
+ aIter->second->release();
+ }
+ m_aPools.clear();
+ m_aPools = OConnectionPools();
+ // for ( MapDriver2DriverRefIterator aLookup = m_aDriverProxies.begin();
+ // aLookup != m_aDriverProxies.end();
+ // ++aLookup
+ // )
+ // {
+ // aLookup = NULL;
+ // }
+ }
+ }
+ else if(evt.Source.is())
+ {
+ sal_Bool bEnabled = sal_True;
+ evt.NewValue >>= bEnabled;
+ if(!bEnabled)
+ {
+ ::rtl::OUString sThisDriverName;
+ getNodeValue(getDriverNameNodeName(),evt.Source) >>= sThisDriverName;
+ // 1nd relase the driver
+ // look if we already have a proxy for this driver
+ MapDriver2DriverRefIterator aLookup = m_aDriverProxies.begin();
+ while( aLookup != m_aDriverProxies.end())
+ {
+ MapDriver2DriverRefIterator aFind = aLookup;
+ Reference<XServiceInfo> xInfo(aLookup->first,UNO_QUERY);
+ ++aLookup;
+ if(xInfo.is() && xInfo->getImplementationName() == sThisDriverName)
+ m_aDriverProxies.erase(aFind);
+ }
+
+ // 2nd clear the connectionpool
+ OConnectionPools::iterator aFind = m_aPools.find(sThisDriverName);
+ if(aFind != m_aPools.end() && aFind->second)
+ {
+ aFind->second->clear();
+ aFind->second->release();
+ m_aPools.erase(aFind);
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+
+
diff --git a/connectivity/source/cpool/ZPoolCollection.hxx b/connectivity/source/cpool/ZPoolCollection.hxx
new file mode 100644
index 000000000000..95b8336994f4
--- /dev/null
+++ b/connectivity/source/cpool/ZPoolCollection.hxx
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * $RCSfile: ZPoolCollection.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-07-24 06:01:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_POOLCOLLECTION_HXX
+#define CONNECTIVITY_POOLCOLLECTION_HXX
+
+#ifndef _CPPUHELPER_IMPLBASE4_HXX_
+#include <cppuhelper/implbase4.hxx>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XDRIVERMANAGER_HPP_
+#include <com/sun/star/sdbc/XDriverManager.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XDRIVER_HPP_
+#include <com/sun/star/sdbc/XDriver.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XDRIVERACCESS_HPP_
+#include <com/sun/star/sdbc/XDriverAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XPOOLEDCONNECTION_HPP_
+#include <com/sun/star/sdbc/XPooledConnection.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
+#include <com/sun/star/sdbc/XConnection.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
+#include <com/sun/star/lang/XEventListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_XPROXYFACTORY_HPP_
+#include <com/sun/star/reflection/XProxyFactory.hpp>
+#endif
+#ifndef _COMPHELPER_STLTYPES_HXX_
+#include <comphelper/stl_types.hxx>
+#endif
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+namespace connectivity
+{
+ class OConnectionPool;
+ //==========================================================================
+ //= OPoolCollection - the one-instance service for PooledConnections
+ //= manages the active connections and the connections in the pool
+ //==========================================================================
+ typedef ::cppu::WeakImplHelper4< ::com::sun::star::sdbc::XDriverManager,
+ ::com::sun::star::sdbc::XDriverAccess,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::beans::XPropertyChangeListener
+ > OPoolCollection_Base;
+
+ class OPoolCollection : public OPoolCollection_Base
+ {
+
+ //==========================================================================
+ typedef ::comphelper::OInterfaceCompare< ::com::sun::star::sdbc::XDriver > ODriverCompare;
+ DECLARE_STL_USTRINGACCESS_MAP(OConnectionPool*, OConnectionPools);
+
+ DECLARE_STL_MAP(
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver >,
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDriver >,
+ ODriverCompare,
+ MapDriver2DriverRef );
+
+ MapDriver2DriverRef m_aDriverProxies;
+ ::osl::Mutex m_aMutex;
+ OConnectionPools m_aPools;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriverManager > m_xManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriverAccess > m_xDriverAccess;
+ ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XProxyFactory > m_xProxyFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xConfigNode;
+
+
+ private:
+ OPoolCollection(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
+
+ // some configuration helper methods
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createWithServiceFactory(const ::rtl::OUString& _rPath) const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getConfigPoolRoot();
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createWithProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxConfProvider,
+ const ::rtl::OUString& _rPath) const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > openNode( const ::rtl::OUString& _rPath,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xTreeNode) const throw();
+ sal_Bool isPoolingEnabled();
+ sal_Bool isDriverPoolingEnabled(const ::rtl::OUString& _sDriverImplName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDriverNode);
+ sal_Bool isPoolingEnabledByUrl( const ::rtl::OUString& _sUrl,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver >& _rxDriver,
+ ::rtl::OUString& _rsImplName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDriverNode);
+
+ OConnectionPool* getConnectionPool( const ::rtl::OUString& _sImplName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver >& _xDriver,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDriverNode);
+ void clearConnectionPools();
+ protected:
+ virtual ~OPoolCollection();
+ public:
+
+ static ::com::sun::star::uno::Any getNodeValue( const ::rtl::OUString& _rPath,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xTreeNode)throw();
+
+ // XDriverManager
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnectionWithInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLoginTimeout( sal_Int32 seconds ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getLoginTimeout( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XDriverAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > SAL_CALL getDriverByURL( const ::rtl::OUString& url ) throw (::com::sun::star::uno::RuntimeException);
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo - static methods
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL CreateInstance(const::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
+ static ::rtl::OUString SAL_CALL getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
+ };
+}
+#endif // CONNECTIVITY_POOLCOLLECTION_HXX
+