diff options
author | Jörg Budischewski <jbu@openoffice.org> | 2001-06-22 15:39:16 +0000 |
---|---|---|
committer | Jörg Budischewski <jbu@openoffice.org> | 2001-06-22 15:39:16 +0000 |
commit | e03c41fe2e1b4c564e83128499020343e9f1047c (patch) | |
tree | c7210bedf386848c6fcedc8280c8ba786e696990 /remotebridges/source/bridge | |
parent | 4409e1cfb5d33e57c1eba238bd5ab9d153cbbacd (diff) |
#67468# Added unloading and context support
Diffstat (limited to 'remotebridges/source/bridge')
-rw-r--r-- | remotebridges/source/bridge/bridge_connection.cxx | 10 | ||||
-rw-r--r-- | remotebridges/source/bridge/bridge_connection.hxx | 5 | ||||
-rw-r--r-- | remotebridges/source/bridge/bridge_provider.cxx | 6 | ||||
-rw-r--r-- | remotebridges/source/bridge/makefile.mk | 6 | ||||
-rw-r--r-- | remotebridges/source/bridge/remote_bridge.cxx | 83 | ||||
-rw-r--r-- | remotebridges/source/bridge/remote_bridge.hxx | 6 | ||||
-rw-r--r-- | remotebridges/source/bridge/remotebridge.map | 10 |
7 files changed, 74 insertions, 52 deletions
diff --git a/remotebridges/source/bridge/bridge_connection.cxx b/remotebridges/source/bridge/bridge_connection.cxx index 4a1744e3d3ae..7f12efa6731c 100644 --- a/remotebridges/source/bridge/bridge_connection.cxx +++ b/remotebridges/source/bridge/bridge_connection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: bridge_connection.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: jbu $ $Date: 2000-09-28 08:47:30 $ + * last change: $Author: jbu $ $Date: 2001-06-22 16:39:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,6 +59,7 @@ * ************************************************************************/ #include "bridge_connection.hxx" +#include "remote_bridge.hxx" #include <rtl/byteseq.hxx> #include <string.h> @@ -71,6 +72,7 @@ namespace remotebridges_bridge m_r( r ), m_nRef( 0 ) { + g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); acquire = thisAcquire; release = thisRelease; read = thisRead; @@ -79,6 +81,10 @@ namespace remotebridges_bridge close = thisClose; } + OConnectionWrapper::~OConnectionWrapper() + { + g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); +} void OConnectionWrapper::thisAcquire( remote_Connection *p) { diff --git a/remotebridges/source/bridge/bridge_connection.hxx b/remotebridges/source/bridge/bridge_connection.hxx index d6f190c13d16..0bfcfe06647d 100644 --- a/remotebridges/source/bridge/bridge_connection.hxx +++ b/remotebridges/source/bridge/bridge_connection.hxx @@ -2,9 +2,9 @@ * * $RCSfile: bridge_connection.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: jbu $ $Date: 2000-09-28 08:47:30 $ + * last change: $Author: jbu $ $Date: 2001-06-22 16:39:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,6 +73,7 @@ namespace remotebridges_bridge public: OConnectionWrapper( const ::com::sun::star::uno::Reference < ::com::sun::star::connection::XConnection > & ); + ~OConnectionWrapper(); static void SAL_CALL thisAcquire( remote_Connection *); static void SAL_CALL thisRelease( remote_Connection *); diff --git a/remotebridges/source/bridge/bridge_provider.cxx b/remotebridges/source/bridge/bridge_provider.cxx index b505f13c0ca2..27a409e84eef 100644 --- a/remotebridges/source/bridge/bridge_provider.cxx +++ b/remotebridges/source/bridge/bridge_provider.cxx @@ -2,9 +2,9 @@ * * $RCSfile: bridge_provider.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jbu $ $Date: 2001-05-03 06:32:08 $ + * last change: $Author: jbu $ $Date: 2001-06-22 16:39:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,6 +84,7 @@ namespace remotebridges_bridge m_pBridgeCallback( pBridgeCallback ), m_nRef( 0 ) { + g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); acquire = thisAcquire; release = thisRelease; getInstance = thisGetInstance; @@ -91,6 +92,7 @@ namespace remotebridges_bridge OInstanceProviderWrapper::~OInstanceProviderWrapper() { + g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); } void OInstanceProviderWrapper::thisAcquire( remote_InstanceProvider *p ) diff --git a/remotebridges/source/bridge/makefile.mk b/remotebridges/source/bridge/makefile.mk index 396f141f3c83..5ad1600fe531 100644 --- a/remotebridges/source/bridge/makefile.mk +++ b/remotebridges/source/bridge/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.4 $ +# $Revision: 1.5 $ # -# last change: $Author: obo $ $Date: 2001-05-07 14:00:43 $ +# last change: $Author: jbu $ $Date: 2001-06-22 16:39:16 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -84,6 +84,7 @@ SLOFILES= \ $(SLO)$/bridge_connection.obj\ $(SLO)$/bridge_provider.obj SHL1TARGET= $(TARGET) +SHL1VERSIONMAP= $(TARGET).map SHL1STDLIBS= \ $(SALLIB) \ @@ -97,7 +98,6 @@ SHL1LIBS= $(SLB)$/$(TARGET).lib SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) -DEF1EXPORTFILE= exports.dxp # --- Targets ------------------------------------------------------ .INCLUDE : target.mk diff --git a/remotebridges/source/bridge/remote_bridge.cxx b/remotebridges/source/bridge/remote_bridge.cxx index 08ed60856475..8d3dfb06b1a7 100644 --- a/remotebridges/source/bridge/remote_bridge.cxx +++ b/remotebridges/source/bridge/remote_bridge.cxx @@ -2,9 +2,9 @@ * * $RCSfile: remote_bridge.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: tbe $ $Date: 2001-05-11 10:56:30 $ + * last change: $Author: jbu $ $Date: 2001-06-22 16:39:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,6 +62,7 @@ #include "remote_bridge.hxx" #include "bridge_connection.hxx" +#include <cppuhelper/implementationentry.hxx> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/bridge/BridgeExistsException.hpp> @@ -80,11 +81,14 @@ using namespace ::com::sun::star::connection; namespace remotebridges_bridge { + rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT; + ORemoteBridge::ORemoteBridge() : OComponentHelper( m_mutex ), m_pContext( 0 ), m_pEnvRemote(0 ) { + g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); remote_DisposingListener::acquire = thisAcquire; remote_DisposingListener::release = thisRelease; remote_DisposingListener::disposing = thisDisposing; @@ -100,6 +104,7 @@ namespace remotebridges_bridge { m_pEnvRemote->release( m_pEnvRemote ); } + g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); } void ORemoteBridge::objectMappedSuccesfully() @@ -419,11 +424,27 @@ namespace remotebridges_bridge //--------------------------------- // //--------------------------------- - Reference< XInterface > SAL_CALL CreateInstance( const Reference< XMultiServiceFactory > &) + Reference< XInterface > SAL_CALL CreateInstance( const Reference< XComponentContext > &) { return Reference< XInterface > ( ( OWeakObject * ) new ORemoteBridge ); } + OUString getImplementationName() + { + static OUString *pImplName = 0; + if( ! pImplName ) + { + MutexGuard guard( Mutex::getGlobalMutex() ); + if( ! pImplName ) + { + static OUString implName( + RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) ); + pImplName = &implName; + } + } + return *pImplName; + } + Sequence< OUString > getSupportedServiceNames() { static Sequence < OUString > *pNames = 0; @@ -446,8 +467,23 @@ namespace remotebridges_bridge using namespace remotebridges_bridge; +static struct ImplementationEntry g_entries[] = +{ + { + remotebridges_bridge::CreateInstance, remotebridges_bridge::getImplementationName, + remotebridges_bridge::getSupportedServiceNames, createSingleComponentFactory, + &g_moduleCount.modCnt , 0 + }, + { 0, 0, 0, 0, 0, 0 } +}; + extern "C" { +sal_Bool SAL_CALL component_canUnload( TimeValue *pTime ) +{ + return g_moduleCount.canUnload( &g_moduleCount , pTime ); +} + //================================================================================================== void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) @@ -458,52 +494,17 @@ void SAL_CALL component_getImplementationEnvironment( sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey ) { - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( - OUString::createFromAscii( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) ); - - const Sequence< OUString > & rSNL = getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; + return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); } //================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { - void * pRet = 0; - - if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0) - { - Reference< XSingleServiceFactory > xFactory( createSingleFactory( - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), - OUString::createFromAscii( pImplName ), - CreateInstance, getSupportedServiceNames() ) ); - - if (xFactory.is()) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - - return pRet; + return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries ); } } + diff --git a/remotebridges/source/bridge/remote_bridge.hxx b/remotebridges/source/bridge/remote_bridge.hxx index 06cf8d0ae0cf..b33b04831ec4 100644 --- a/remotebridges/source/bridge/remote_bridge.hxx +++ b/remotebridges/source/bridge/remote_bridge.hxx @@ -2,9 +2,9 @@ * * $RCSfile: remote_bridge.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jbu $ $Date: 2001-05-02 14:13:35 $ + * last change: $Author: jbu $ $Date: 2001-06-22 16:39:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,6 +81,8 @@ namespace remotebridges_bridge { + extern rtl_StandardModuleCount g_moduleCount; + struct MyMutex { ::osl::Mutex m_mutex; diff --git a/remotebridges/source/bridge/remotebridge.map b/remotebridges/source/bridge/remotebridge.map new file mode 100644 index 000000000000..f76809fbd37b --- /dev/null +++ b/remotebridges/source/bridge/remotebridge.map @@ -0,0 +1,10 @@ +UDK_3_0_0 { + global: + component_getImplementationEnvironment; + component_writeInfo; + component_getFactory; + component_canUnload; + component_getDescriptionFunc; + local: + *; +}; |