summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stoc/source/defaultregistry/defaultregistry.cxx145
-rw-r--r--stoc/source/defaultregistry/makefile.mk6
-rw-r--r--stoc/source/implementationregistration/implreg.cxx184
-rw-r--r--stoc/source/implementationregistration/makefile.mk6
-rw-r--r--stoc/source/invocation/inv.map10
-rw-r--r--stoc/source/invocation/inv.xml4
-rw-r--r--stoc/source/invocation/invocation.cxx218
-rw-r--r--stoc/source/invocation/makefile.mk6
-rw-r--r--stoc/source/invocation_adapterfactory/iafactory.cxx125
-rw-r--r--stoc/source/invocation_adapterfactory/invadp.map10
-rw-r--r--stoc/source/invocation_adapterfactory/makefile.mk7
-rw-r--r--stoc/source/javaloader/javaloader.cxx204
-rw-r--r--stoc/source/javaloader/javaloader.map9
-rw-r--r--stoc/source/javaloader/makefile.mk7
-rw-r--r--stoc/source/javavm/javavm.cxx219
-rw-r--r--stoc/source/javavm/jen.map9
-rw-r--r--stoc/source/javavm/makefile.mk7
-rw-r--r--stoc/source/loader/dllcomponentloader.cxx157
-rw-r--r--stoc/source/loader/makefile.mk6
-rw-r--r--stoc/source/namingservice/namingservice.cxx119
-rw-r--r--stoc/source/namingservice/namingservice.map10
-rw-r--r--stoc/source/proxy_factory/makefile.mk5
-rw-r--r--stoc/source/proxy_factory/proxyfac.cxx129
-rw-r--r--stoc/source/proxy_factory/proxyfac.map10
-rw-r--r--stoc/source/registry_tdprovider/base.hxx31
-rw-r--r--stoc/source/registry_tdprovider/tdcomp.cxx5
-rw-r--r--stoc/source/registry_tdprovider/tdef.cxx8
-rw-r--r--stoc/source/registry_tdprovider/tdenum.cxx5
-rw-r--r--stoc/source/registry_tdprovider/tdiface.cxx29
-rw-r--r--stoc/source/registry_tdprovider/tdprovider.cxx106
-rw-r--r--stoc/source/servicemanager/makefile.mk6
-rw-r--r--stoc/source/servicemanager/servicemanager.cxx221
-rw-r--r--stoc/source/simpleregistry/simpleregistry.cxx129
-rw-r--r--stoc/source/tdmanager/makefile.mk6
-rw-r--r--stoc/source/tdmanager/tdmgr.cxx121
-rw-r--r--stoc/source/typeconv/convert.cxx145
-rw-r--r--stoc/test/makefile.mk28
-rw-r--r--stoc/test/testcorefl.cxx6
-rw-r--r--stoc/test/testcorefl.idl5
-rw-r--r--stoc/test/testintrosp.cxx10
-rw-r--r--stoc/test/testloader.cxx37
-rw-r--r--stoc/test/testproxyfac.cxx65
-rw-r--r--stoc/test/testregistry.cxx12
43 files changed, 1455 insertions, 1132 deletions
diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx
index bb2c1fdaa64c..e11702f9eac3 100644
--- a/stoc/source/defaultregistry/defaultregistry.cxx
+++ b/stoc/source/defaultregistry/defaultregistry.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: defaultregistry.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jsc $ $Date: 2001-03-19 12:40:58 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:20:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,6 +81,9 @@
#ifndef _CPPUHELPER_IMPLBASE3_HXX_
#include <cppuhelper/implbase3.hxx>
#endif
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
+#include <cppuhelper/implementationentry.hxx>
+#endif
#ifndef _REGISTRY_REGISTRY_HXX_
#include <registry/registry.hxx>
@@ -101,11 +104,43 @@ using namespace osl;
using namespace rtl;
-#define NESTED_SERVICENAME "com.sun.star.registry.NestedRegistry"
-#define NESTED_IMPLNAME "com.sun.star.comp.stoc.NestedRegistry"
+#define SERVICENAME "com.sun.star.registry.NestedRegistry"
+#define IMPLNAME "com.sun.star.comp.stoc.NestedRegistry"
namespace stoc_defreg
{
+rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
+
+static Sequence< OUString > defreg_getSupportedServiceNames()
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME));
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+OUString defreg_getImplementationName()
+{
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
+}
//*************************************************************************
// NestedRegistryImpl
@@ -115,11 +150,7 @@ class NestedKeyImpl;
class NestedRegistryImpl : public WeakAggImplHelper3 < XSimpleRegistry, XInitialization, XServiceInfo >
{
public:
- NestedRegistryImpl( const Reference<XMultiServiceFactory> & rXSMgr );
-
- NestedRegistryImpl( const Reference<XMultiServiceFactory> & rXSMgr,
- Reference<XSimpleRegistry>& localReg,
- Reference<XSimpleRegistry>& systemReg );
+ NestedRegistryImpl( );
~NestedRegistryImpl();
@@ -127,8 +158,6 @@ public:
virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException);
- static OUString SAL_CALL getImplementationName_Static( );
- static Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( );
// XInitialization
virtual void SAL_CALL initialize( const Sequence< Any >& aArguments )
@@ -151,8 +180,6 @@ protected:
Reference<XSimpleRegistry> m_localReg;
Reference<XSimpleRegistry> m_defaultReg;
-private:
- Reference<XMultiServiceFactory> m_xSMgr;
};
//*************************************************************************
@@ -1174,32 +1201,23 @@ OUString SAL_CALL NestedKeyImpl::getResolvedName( const OUString& aKeyName )
// DefaultRegistry Implementation
//
//*************************************************************************
-NestedRegistryImpl::NestedRegistryImpl( const Reference<XMultiServiceFactory> & rSMgr )
+NestedRegistryImpl::NestedRegistryImpl( )
: m_state(0)
- , m_xSMgr(rSMgr)
-{
-}
-
-NestedRegistryImpl::NestedRegistryImpl( const Reference<XMultiServiceFactory> & rSMgr,
- Reference<XSimpleRegistry>& localReg,
- Reference<XSimpleRegistry>& defaultReg)
- : m_state(0)
- , m_localReg(localReg)
- , m_defaultReg(defaultReg)
- , m_xSMgr(rSMgr)
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
}
//*************************************************************************
NestedRegistryImpl::~NestedRegistryImpl()
{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
//*************************************************************************
OUString SAL_CALL NestedRegistryImpl::getImplementationName( )
throw(RuntimeException)
{
- return OUString::createFromAscii( NESTED_IMPLNAME );
+ return defreg_getImplementationName();
}
//*************************************************************************
@@ -1219,14 +1237,7 @@ sal_Bool SAL_CALL NestedRegistryImpl::supportsService( const OUString& ServiceNa
Sequence<OUString> SAL_CALL NestedRegistryImpl::getSupportedServiceNames( )
throw(RuntimeException)
{
- return getSupportedServiceNames_Static();
-}
-
-//*************************************************************************
-Sequence<OUString> SAL_CALL NestedRegistryImpl::getSupportedServiceNames_Static( )
-{
- OUString aStr( OUString::createFromAscii( NESTED_SERVICENAME ) );
- return Sequence< OUString >( &aStr, 1 );
+ return defreg_getSupportedServiceNames();
}
//*************************************************************************
@@ -1360,11 +1371,11 @@ void SAL_CALL NestedRegistryImpl::mergeKey( const OUString& aKeyName, const OUSt
}
//*************************************************************************
-Reference<XInterface> SAL_CALL NestedRegistry_CreateInstance( const Reference<XMultiServiceFactory>& rSMgr )
+Reference<XInterface> SAL_CALL NestedRegistry_CreateInstance( const Reference<XComponentContext>& xCtx )
throw(Exception)
{
Reference<XInterface> xRet;
- XSimpleRegistry *pRegistry = (XSimpleRegistry*) new NestedRegistryImpl(rSMgr);
+ XSimpleRegistry *pRegistry = (XSimpleRegistry*) new NestedRegistryImpl;
if (pRegistry)
{
@@ -1376,8 +1387,26 @@ Reference<XInterface> SAL_CALL NestedRegistry_CreateInstance( const Reference<XM
} // namespace stco_defreg
+using namespace stoc_defreg;
+
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ NestedRegistry_CreateInstance, defreg_getImplementationName,
+ defreg_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 )
@@ -1388,52 +1417,12 @@ void SAL_CALL component_getImplementationEnvironment(
sal_Bool SAL_CALL component_writeInfo(
void * pServiceManager, void * pRegistryKey )
{
- if (pRegistryKey)
- {
- try
- {
- // NestedRegistry
- Reference< XRegistryKey > xNewKey(
- reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
- OUString::createFromAscii( "/" NESTED_IMPLNAME "/UNO/SERVICES" ) ) );
-
- Sequence< OUString > & rSNL = ::stoc_defreg::NestedRegistryImpl::getSupportedServiceNames_Static();
- 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 ( rtl_str_compare( pImplName, NESTED_IMPLNAME ) == 0 )
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- ::stoc_defreg::NestedRegistry_CreateInstance,
- ::stoc_defreg::NestedRegistryImpl::getSupportedServiceNames_Static() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
}
}
-
-
-
diff --git a/stoc/source/defaultregistry/makefile.mk b/stoc/source/defaultregistry/makefile.mk
index 35ec135e6d7d..689e103c0013 100644
--- a/stoc/source/defaultregistry/makefile.mk
+++ b/stoc/source/defaultregistry/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.8 $
+# $Revision: 1.9 $
#
-# last change: $Author: obo $ $Date: 2001-05-07 13:50:42 $
+# last change: $Author: jbu $ $Date: 2001-06-22 16:20:56 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -88,13 +88,13 @@ SHL1STDLIBS= \
$(CPPUHELPERLIB) \
$(SALLIB)
+SHL1VERSIONMAP= $(TARGET).map
SHL1DEPN=
SHL1IMPLIB= i$(TARGET)
SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index 9508cb001096..266e203f2497 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: implreg.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: pl $ $Date: 2001-05-11 11:30:27 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:20:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,6 +77,9 @@
#ifndef _CPPUHELPER_IMPLBASE3_HXX
#include <cppuhelper/implbase3.hxx>
#endif
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
+#include <cppuhelper/implementationentry.hxx>
+#endif
#include <uno/mapping.hxx>
#include <osl/thread.h>
@@ -89,8 +92,6 @@
#endif
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/loader/XImplementationLoader.hpp>
#include <com/sun/star/registry/XImplementationRegistration.hpp>
@@ -100,7 +101,6 @@
#include <io.h>
#endif
-
using namespace com::sun::star::uno;
using namespace com::sun::star::loader;
using namespace com::sun::star::beans;
@@ -108,12 +108,46 @@ using namespace com::sun::star::lang;
using namespace com::sun::star::registry;
using namespace cppu;
using namespace rtl;
+using namespace osl;
namespace stoc_impreg
{
-#define IMPLEMENTATION_NAME "com.sun.star.comp.stoc.ImplementationRegistration"
-#define SERVICE_NAME "com.sun.star.registry.ImplementationRegistration"
+#define IMPLNAME "com.sun.star.comp.stoc.ImplementationRegistration"
+#define SERVICENAME "com.sun.star.registry.ImplementationRegistration"
+
+rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
+
+static Sequence< OUString > impreg_getSupportedServiceNames()
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME));
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+static OUString impreg_getImplementationName()
+{
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
+}
//*************************************************************************
// static getTempName()
@@ -1152,14 +1186,13 @@ class ImplementationRegistration
: public WeakImplHelper3< XImplementationRegistration, XServiceInfo, XInitialization >
{
public:
- ImplementationRegistration( const Reference < XMultiServiceFactory > & rSMgr );
+ ImplementationRegistration( const Reference < XComponentContext > & rSMgr );
~ImplementationRegistration();
// XServiceInfo
OUString SAL_CALL getImplementationName() throw();
sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw();
Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw();
- static Sequence< OUString > SAL_CALL getSupportedServiceNames_Static(void) throw();
// Methoden von XImplementationRegistration
virtual void SAL_CALL registerImplementation(
@@ -1188,7 +1221,8 @@ public: // XInitialization
private: // helper methods
- static sal_Bool doRegistration( const Reference < XMultiServiceFactory >& xSMgr,
+ static sal_Bool doRegistration( const Reference < XMultiComponentFactory >& xSMgr,
+ const Reference < XComponentContext > &xCtx,
const Reference < XImplementationLoader >& xAct,
const Reference < XSimpleRegistry >& xDest,
const OUString& implementationLoaderUrl,
@@ -1197,18 +1231,23 @@ private: // helper methods
Reference< XSimpleRegistry > getRegistryFromServiceManager();
- static Reference< XSimpleRegistry > createTemporarySimpleRegistry( const Reference < XMultiServiceFactory > & r );
+ static Reference< XSimpleRegistry > createTemporarySimpleRegistry(
+ const Reference< XMultiComponentFactory > &rSMgr,
+ const Reference < XComponentContext > & rCtx );
private: // members
- Reference < XMultiServiceFactory > m_xSMgr;
+ Reference < XMultiComponentFactory > m_xSMgr;
+ Reference < XComponentContext > m_xCtx;
};
//*************************************************************************
// ImplementationRegistration()
//
-ImplementationRegistration::ImplementationRegistration( const Reference < XMultiServiceFactory > & rSMgr )
- : m_xSMgr( rSMgr )
+ImplementationRegistration::ImplementationRegistration( const Reference < XComponentContext > & xCtx )
+ : m_xSMgr( xCtx->getServiceManager() )
+ , m_xCtx( xCtx )
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
}
//*************************************************************************
@@ -1216,13 +1255,14 @@ ImplementationRegistration::ImplementationRegistration( const Reference < XMulti
//
ImplementationRegistration::~ImplementationRegistration()
{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
// XServiceInfo
OUString ImplementationRegistration::getImplementationName() throw()
{
- return OUString::createFromAscii( IMPLEMENTATION_NAME );
+ return impreg_getImplementationName();
}
// XServiceInfo
@@ -1239,18 +1279,9 @@ sal_Bool ImplementationRegistration::supportsService(const OUString& ServiceName
// XServiceInfo
Sequence< OUString > ImplementationRegistration::getSupportedServiceNames(void) throw()
{
- return getSupportedServiceNames_Static();
-}
-
-// ORegistryServiceManager_Static
-Sequence< OUString > ImplementationRegistration::getSupportedServiceNames_Static(void) throw ()
-{
- OUString aServiceName( OUString::createFromAscii( SERVICE_NAME ) );
- Sequence< OUString > aSNS( &aServiceName, 1 );
- return aSNS;
+ return impreg_getSupportedServiceNames();
}
-
Reference< XSimpleRegistry > ImplementationRegistration::getRegistryFromServiceManager()
{
Reference < XPropertySet > xPropSet =
@@ -1332,7 +1363,7 @@ void ImplementationRegistration::initialize(
// TODO : SimpleRegistry in doRegistration von hand anziehen !
- if (!doRegistration(m_xSMgr, rLoader , rReg, loaderServiceName , locationUrl, sal_True)) {
+ if (!doRegistration(m_xSMgr, m_xCtx, rLoader , rReg, loaderServiceName , locationUrl, sal_True)) {
throw Exception();
}
@@ -1365,7 +1396,8 @@ void ImplementationRegistration::registerImplementation(
}
if( m_xSMgr.is() ) {
- Reference < XImplementationLoader > xAct( m_xSMgr->createInstance(activatorName) , UNO_QUERY );
+ Reference < XImplementationLoader > xAct(
+ m_xSMgr->createInstanceWithContext(activatorName, m_xCtx) , UNO_QUERY );
if (xAct.is())
{
Reference < XSimpleRegistry > xRegistry;
@@ -1382,7 +1414,7 @@ void ImplementationRegistration::registerImplementation(
if ( xRegistry.is())
{
- if (!doRegistration(m_xSMgr, xAct, xRegistry, implLoaderUrl, locationUrl, sal_True))
+ if (!doRegistration(m_xSMgr, m_xCtx, xAct, xRegistry, implLoaderUrl, locationUrl, sal_True))
throw CannotRegisterImplementationException();
return;
@@ -1426,7 +1458,7 @@ sal_Bool ImplementationRegistration::revokeImplementation(const OUString& locati
if (xRegistry.is())
{
- ret = doRegistration(m_xSMgr, Reference< XImplementationLoader > (), xRegistry, OUString(), location, sal_False);
+ ret = doRegistration(m_xSMgr, m_xCtx, Reference< XImplementationLoader > (), xRegistry, OUString(), location, sal_False);
}
return ret;
@@ -1456,12 +1488,14 @@ Sequence< OUString > ImplementationRegistration::getImplementations(
if( m_xSMgr.is() ) {
- Reference < XImplementationLoader > xAct( m_xSMgr->createInstance( activatorName ), UNO_QUERY );
+ Reference < XImplementationLoader > xAct(
+ m_xSMgr->createInstanceWithContext( activatorName, m_xCtx ), UNO_QUERY );
if (xAct.is())
{
- Reference < XSimpleRegistry > xReg = createTemporarySimpleRegistry( m_xSMgr);
+ Reference < XSimpleRegistry > xReg =
+ createTemporarySimpleRegistry( m_xSMgr, m_xCtx);
if (xReg.is())
{
@@ -1539,7 +1573,8 @@ Sequence< OUString > ImplementationRegistration::checkInstantiation(const OUStri
// helper function doRegistration
//
sal_Bool ImplementationRegistration::doRegistration(
- const Reference< XMultiServiceFactory > & xSMgr,
+ const Reference< XMultiComponentFactory > & xSMgr,
+ const Reference< XComponentContext > &xCtx,
const Reference < XImplementationLoader > & xAct,
const Reference < XSimpleRegistry >& xDest,
const OUString& implementationLoaderUrl,
@@ -1592,7 +1627,8 @@ sal_Bool ImplementationRegistration::doRegistration(
}
} else
{
- Reference < XSimpleRegistry > xReg = createTemporarySimpleRegistry( xSMgr );
+ Reference < XSimpleRegistry > xReg =
+ createTemporarySimpleRegistry( xSMgr, xCtx );
Reference < XRegistryKey > xSourceKey;
if (xAct.is() && xReg.is() && xDest.is())
@@ -1663,40 +1699,46 @@ sal_Bool ImplementationRegistration::doRegistration(
Reference< XSimpleRegistry > ImplementationRegistration::createTemporarySimpleRegistry(
- const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+ const Reference< XMultiComponentFactory > &rSMgr,
+ const Reference < XComponentContext > & xCtx)
{
Reference < XSimpleRegistry > xReg = Reference< XSimpleRegistry >::query(
- rSMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.SimpleRegistry") ) ) );
+ rSMgr->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.SimpleRegistry") ),
+ xCtx ));
OSL_ASSERT( xReg.is() );
-// if( ! xReg.is() ) {
-// // use as fallback ( bootstrap )
-
-// Reference< XInterface > r = ::cppu::__loadLibComponentFactory(
-// "simreg",
-// "com.sun.star.comp.stoc.SimpleRegistry",
-// rSMgr ,
-// Reference < XRegistryKey >() )->createInstance();
-
-// xReg = Reference< XSimpleRegistry > ( r , UNO_QUERY );
-// }
-
return xReg;
}
//*************************************************************************
-static Reference<XInterface> SAL_CALL ImplementationRegistration_CreateInstance( const Reference<XMultiServiceFactory> & rSMgr ) throw(Exception)
+static Reference<XInterface> SAL_CALL ImplementationRegistration_CreateInstance( const Reference<XComponentContext> & xCtx ) throw(Exception)
{
- return (XImplementationRegistration *)new ImplementationRegistration(rSMgr);
+ return (XImplementationRegistration *)new ImplementationRegistration(xCtx);
}
}
+using namespace stoc_impreg;
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ ImplementationRegistration_CreateInstance, impreg_getImplementationName,
+ impreg_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 )
@@ -1707,51 +1749,13 @@ 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 =
- ::stoc_impreg::ImplementationRegistration::getSupportedServiceNames_Static();
- 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 ),
- ::stoc_impreg::ImplementationRegistration_CreateInstance,
- ::stoc_impreg::ImplementationRegistration::getSupportedServiceNames_Static() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
}
}
diff --git a/stoc/source/implementationregistration/makefile.mk b/stoc/source/implementationregistration/makefile.mk
index cb6c5d57d8a7..094c271de704 100644
--- a/stoc/source/implementationregistration/makefile.mk
+++ b/stoc/source/implementationregistration/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.7 $
+# $Revision: 1.8 $
#
-# last change: $Author: obo $ $Date: 2001-05-07 13:51:24 $
+# last change: $Author: jbu $ $Date: 2001-06-22 16:20:57 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -81,6 +81,7 @@ SLOFILES= \
$(SLO)$/implreg.obj
SHL1TARGET= $(TARGET)
+SHL1VERSIONMAP=$(TARGET).map
SHL1STDLIBS= \
$(CPPULIB) \
@@ -93,7 +94,6 @@ SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
diff --git a/stoc/source/invocation/inv.map b/stoc/source/invocation/inv.map
new file mode 100644
index 000000000000..f76809fbd37b
--- /dev/null
+++ b/stoc/source/invocation/inv.map
@@ -0,0 +1,10 @@
+UDK_3_0_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ component_canUnload;
+ component_getDescriptionFunc;
+ local:
+ *;
+};
diff --git a/stoc/source/invocation/inv.xml b/stoc/source/invocation/inv.xml
index f6a7b3cdabe3..01b5045b4335 100644
--- a/stoc/source/invocation/inv.xml
+++ b/stoc/source/invocation/inv.xml
@@ -50,9 +50,13 @@ XNameContainer and XEnumerationContainer
<type> com.sun.star.lang.XServiceInfo </type>
<type> com.sun.star.lang.XSingleServiceFactory </type>
<type> com.sun.star.lang.XMultiServiceFactory </type>
+ <type> com.sun.star.lang.XMultiComponentFactory </type>
+ <type> com.sun.star.lang.XSingleComponentFactory </type>
<type> com.sun.star.registry.XRegistryKey </type>
<type> com.sun.star.uno.XAggregation </type>
<type> com.sun.star.uno.XWeak </type>
+ <type> com.sun.star.uno.XComponentContext </type>
+ <type> com.sun.star.uno.XWeak </type>
<type> com.sun.star.uno.TypeClass </type>
<type> com.sun.star.container.XEnumerationAccess </type>
<type> com.sun.star.container.XNameContainer </type>
diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index a7a52128d58b..1cb84d1fa6c4 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: invocation.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: pl $ $Date: 2001-05-11 11:47:36 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:20:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -72,6 +72,9 @@
#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX__
+#include <cppuhelper/implementationentry.hxx>
+#endif
#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/script/FailReason.hpp>
@@ -103,8 +106,8 @@
#include <search.h>
#endif
-#define SERVICE_NAME "com.sun.star.script.Invocation"
-#define IMPL_NAME "com.sun.star.comp.stoc.Invocation"
+#define SERVICENAME "com.sun.star.script.Invocation"
+#define IMPLNAME "com.sun.star.comp.stoc.Invocation"
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -120,6 +123,38 @@ using namespace osl;
namespace stoc_inv
{
+static rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
+
+static Sequence< OUString > inv_getSupportedServiceNames()
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME));
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+static OUString inv_getImplementationName()
+{
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
+}
// TODO: Zentral implementieren
inline Reference<XIdlClass> TypeToIdlClass( const Type& rType, const Reference< XIdlReflection > & xRefl )
@@ -143,13 +178,12 @@ public:
Invocation_Impl( const Any & rAdapted, const Reference<XTypeConverter> &,
const Reference<XIntrospection> &,
const Reference<XIdlReflection> & );
-
+ virtual ~Invocation_Impl();
// XInterface
virtual Any SAL_CALL queryInterface( const Type & aType) throw( RuntimeException );
virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
virtual void SAL_CALL release() throw() { OWeakObject::release(); }
- //void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
// XTypeProvider
@@ -291,9 +325,15 @@ Invocation_Impl::Invocation_Impl
, xTypeConverter( rTC )
, xCoreReflection( rCR )
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
setMaterial( rAdapted );
}
+Invocation_Impl::~Invocation_Impl()
+{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+}
+
//##################################################################################################
//### INTERFACE IMPLEMENTATIONS ####################################################################
//##################################################################################################
@@ -999,8 +1039,6 @@ void Invocation_Impl::fillInfoForMethod
}
-// XIdlClassProvider
-
// XTypeProvider
Sequence< Type > SAL_CALL Invocation_Impl::getTypes(void) throw( RuntimeException )
{
@@ -1024,39 +1062,6 @@ Sequence< sal_Int8 > SAL_CALL Invocation_Impl::getImplementationId( ) throw( Ru
return (*pId).getImplementationId();
}
-/*
-Sequence< Reference<XIdlClass> > Invocation_Impl::getIdlClasses(void) throw( RuntimeException )
-{
- Reflection * ppReflection[7];
- Usal_Int16 i = 0;
- ppReflection[i++] = XInvocation_getReflection();
- if( _xElementAccess.is() )
- ppReflection[i++] = XElementAccess_getReflection();
- if( _xEnumerationAccess.is() )
- ppReflection[i++] = XEnumerationAccess_getReflection();
- if( _xIndexAccess.is() )
- ppReflection[i++] = XIndexAccess_getReflection();
- if( _xNameAccess.is() )
- ppReflection[i++] = XNameAccess_getReflection();
- if( _xIndexContainer.is() )
- ppReflection[i++] = XIndexContainer_getReflection();
- if( _xNameContainer.is() )
- ppReflection[i++] = XNameContainer_getReflection();
-
- // Ivocation does not support XExactName, if direct object supports
- // XInvocation, but not XExactName.
- if ((_xDirect.is() && _xENDirect.is()) ||
- (!_xDirect.is() && (_xENIntrospection.is() || _xENNameAccess.is())))
- {
- ppReflection[i++] = XExactName_getReflection();
- }
-
- Reference<XIdlClass> xClass = createStandardClass( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.Invocation")),
- OWeakObject::getStaticIdlClass(), i,
- ppReflection );
- return Sequence<Reference<XIdlClass>>( &xClass, 1 );
-}
-*/
//==================================================================================================
//==================================================================================================
//==================================================================================================
@@ -1067,21 +1072,14 @@ class InvocationService
, public XTypeProvider
{
public:
- InvocationService( const Reference<XMultiServiceFactory> & rSMgr )
- : mxSMgr( rSMgr )
- , xTypeConverter( Reference<XTypeConverter>::query( rSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter")) ) ) )
- , xIntrospection( Reference<XIntrospection>::query( rSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.Introspection")) ) ) )
- , xCoreReflection( Reference<XIdlReflection>::query( rSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection")) ) ) )
- {}
+ InvocationService( const Reference<XComponentContext> & xCtx );
+ virtual ~InvocationService();
// XInterface
virtual Any SAL_CALL queryInterface( const Type & aType ) throw( RuntimeException );
virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
virtual void SAL_CALL release() throw() { OWeakObject::release(); }
- //void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
- // XIdlClassProvider
- // virtual Sequence< Reference<XIdlClass> > SAL_CALL getIdlClasses(void) throw( RuntimeException );
// XTypeProvider
virtual Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( )
throw(RuntimeException);
@@ -1090,26 +1088,48 @@ public:
// XServiceInfo
OUString SAL_CALL getImplementationName() throw( RuntimeException );
- static OUString SAL_CALL getImplementationName_Static() throw( RuntimeException )
- {
- return OUString::createFromAscii( IMPL_NAME );
- }
sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( RuntimeException );
Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( RuntimeException );
- static Sequence< OUString > SAL_CALL getSupportedServiceNames_Static(void) throw( RuntimeException );
// XSingleServiceFactory
Reference<XInterface> SAL_CALL createInstance(void) throw( Exception, RuntimeException );
Reference<XInterface> SAL_CALL createInstanceWithArguments(
const Sequence<Any>& rArguments ) throw( Exception, RuntimeException );
private:
-
- Reference<XMultiServiceFactory> mxSMgr;
+ Reference<XComponentContext> mxCtx;
+ Reference<XMultiComponentFactory> mxSMgr;
Reference<XTypeConverter> xTypeConverter;
Reference<XIntrospection> xIntrospection;
Reference<XIdlReflection> xCoreReflection;
};
+InvocationService::InvocationService( const Reference<XComponentContext> & xCtx )
+ : mxSMgr( xCtx->getServiceManager() )
+ , mxCtx( xCtx )
+{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ xTypeConverter = Reference<XTypeConverter>(
+ mxSMgr->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter")),
+ xCtx ),
+ UNO_QUERY );
+ xIntrospection = Reference<XIntrospection>(
+ mxSMgr->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.Introspection")),
+ xCtx),
+ UNO_QUERY);
+ xCoreReflection = Reference<XIdlReflection>(
+ mxSMgr->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection")),
+ xCtx),
+ UNO_QUERY);
+}
+
+InvocationService::~InvocationService()
+{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+}
+
//--------------------------------------------------------------------------------------------------
Any SAL_CALL InvocationService::queryInterface( const Type & aType )
throw( RuntimeException )
@@ -1127,7 +1147,6 @@ Any SAL_CALL InvocationService::queryInterface( const Type & aType )
return OWeakObject::queryInterface( aType );
}
-
// XTypeProvider
Sequence< Type > SAL_CALL InvocationService::getTypes(void) throw( RuntimeException )
{
@@ -1162,18 +1181,10 @@ Sequence< sal_Int8 > SAL_CALL InvocationService::getImplementationId( ) throw(
return (*pId).getImplementationId();
}
-// // XIdlClassProvider
-// Sequence< Reference<XIdlClass> > InvocationService::getIdlClasses(void) throw( RuntimeException )
-// {
-// Sequence< Reference<XIdlClass> > aSeq( &getStaticIdlClass(), 1 );
-// return aSeq;
-// }
-
-
// XServiceInfo
OUString InvocationService::getImplementationName() throw( RuntimeException )
{
- return getImplementationName_Static();
+ return inv_getImplementationName();
}
// XServiceInfo
@@ -1190,15 +1201,7 @@ sal_Bool InvocationService::supportsService(const OUString& ServiceName) throw(
// XServiceInfo
Sequence< OUString > InvocationService::getSupportedServiceNames(void) throw( RuntimeException )
{
- return getSupportedServiceNames_Static();
-}
-
-// ORegistryServiceManager_Static
-Sequence< OUString > InvocationService::getSupportedServiceNames_Static(void) throw( RuntimeException )
-{
- Sequence< OUString > aSNS( 1 );
- aSNS.getArray()[0] = OUString::createFromAscii( SERVICE_NAME );
- return aSNS;
+ return inv_getSupportedServiceNames();
}
//--------------------------------------------------------------------------------------------------
@@ -1227,17 +1230,33 @@ Reference<XInterface> InvocationService::createInstanceWithArguments(
//*************************************************************************
-Reference<XInterface> SAL_CALL InvocationService_CreateInstance( const Reference<XMultiServiceFactory> & rSMgr )
+Reference<XInterface> SAL_CALL InvocationService_CreateInstance( const Reference<XComponentContext> & xCtx )
throw( RuntimeException )
{
- Reference<XInterface> xService = Reference< XInterface > ( *new InvocationService( rSMgr ) );
+ Reference<XInterface> xService = Reference< XInterface > ( *new InvocationService( xCtx ) );
return xService;
}
}
+using namespace stoc_inv;
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ InvocationService_CreateInstance, inv_getImplementationName,
+ inv_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 )
@@ -1248,52 +1267,15 @@ 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( "/" IMPL_NAME "/UNO/SERVICES" ) ) );
-
- const Sequence< OUString > & rSNL =
- stoc_inv::InvocationService::getSupportedServiceNames_Static();
- 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, IMPL_NAME ) == 0)
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- stoc_inv::InvocationService_CreateInstance,
- stoc_inv::InvocationService::getSupportedServiceNames_Static() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
}
}
+
diff --git a/stoc/source/invocation/makefile.mk b/stoc/source/invocation/makefile.mk
index c11668ba4102..a1eccf26b1d7 100644
--- a/stoc/source/invocation/makefile.mk
+++ b/stoc/source/invocation/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.6 $
+# $Revision: 1.7 $
#
-# last change: $Author: pluby $ $Date: 2001-03-02 07:18:34 $
+# last change: $Author: jbu $ $Date: 2001-06-22 16:20:57 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -86,10 +86,10 @@ SHL1STDLIBS= \
$(CPPUHELPERLIB) \
$(SALLIB)
+SHL1VERSIONMAP=$(TARGET).map
SHL1DEPN=
SHL1IMPLIB= i$(TARGET)
SHL1LIBS= $(SLB)$/$(TARGET).lib
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx
index d28a271f54aa..2edae1853170 100644
--- a/stoc/source/invocation_adapterfactory/iafactory.cxx
+++ b/stoc/source/invocation_adapterfactory/iafactory.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: iafactory.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jl $ $Date: 2001-03-12 15:34:20 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:20:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -85,6 +85,9 @@
#ifndef _CPPUHELPER_IMPLBASE3_HXX_
#include <cppuhelper/implbase3.hxx>
#endif
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
+#include <cppuhelper/implementationentry.hxx>
+#endif
#include <com/sun/star/uno/XAggregation.hpp>
#include <com/sun/star/script/XInvocationAdapterFactory.hpp>
@@ -111,11 +114,37 @@ using namespace com::sun::star::lang;
namespace stoc_invadp
{
-//--------------------------------------------------------------------------------------------------
-static inline Sequence< OUString > getSupportedServiceNames()
+static rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
+
+static Sequence< OUString > invadp_getSupportedServiceNames()
{
- OUString aName( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME ) );
- return Sequence< OUString >( &aName, 1 );
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME));
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+static OUString invadp_getImplementationName()
+{
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
}
//==================================================================================================
@@ -127,6 +156,7 @@ class FactoryImpl
public:
FactoryImpl();
+ virtual ~FactoryImpl();
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
@@ -608,6 +638,7 @@ inline AdapterImpl::~AdapterImpl()
//__________________________________________________________________________________________________
FactoryImpl::FactoryImpl()
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
OUString aCppEnvTypeName( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) );
OUString aUnoEnvTypeName( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO) );
@@ -616,6 +647,10 @@ FactoryImpl::FactoryImpl()
OSL_ENSURE( _aUno2Cpp.is() && _aCpp2Uno.is(), "### no uno / c++ mappings!" );
}
+FactoryImpl::~FactoryImpl()
+{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+}
// XInvocationAdapterFactory
//__________________________________________________________________________________________________
Reference< XInterface > FactoryImpl::createAdapter(
@@ -652,7 +687,7 @@ Reference< XInterface > FactoryImpl::createAdapter(
OUString FactoryImpl::getImplementationName()
throw (RuntimeException)
{
- return OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) );
+ return invadp_getImplementationName();
}
//__________________________________________________________________________________________________
sal_Bool FactoryImpl::supportsService( const OUString & rServiceName )
@@ -671,15 +706,27 @@ sal_Bool FactoryImpl::supportsService( const OUString & rServiceName )
Sequence< OUString > FactoryImpl::getSupportedServiceNames()
throw (RuntimeException)
{
- return stoc_invadp::getSupportedServiceNames();
+ return invadp_getSupportedServiceNames();
}
//==================================================================================================
static Reference< XInterface > SAL_CALL FactoryImpl_create(
- const Reference< XMultiServiceFactory > & xMgr )
+ const Reference< XComponentContext > & xMgr )
throw (Exception)
{
- return Reference< XInterface >( *new FactoryImpl() );
+ Reference< XInterface > rRet;
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ static WeakReference < XInterface > rwInstance;
+ rRet = rwInstance;
+
+ if( ! rRet.is() )
+ {
+ rRet = (OWeakObject *)new FactoryImpl();
+ rwInstance = rRet;
+ }
+ }
+ return rRet;
}
}
@@ -688,10 +735,25 @@ static Reference< XInterface > SAL_CALL FactoryImpl_create(
//##################################################################################################
//##################################################################################################
//##################################################################################################
+using namespace stoc_invadp;
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ FactoryImpl_create, invadp_getImplementationName,
+ invadp_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 )
@@ -702,51 +764,12 @@ 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( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) );
-
- const Sequence< OUString > & rSNL = stoc_invadp::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, IMPLNAME ) == 0)
- {
- Reference< XSingleServiceFactory > xFactory( createOneInstanceFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) ),
- stoc_invadp::FactoryImpl_create,
- stoc_invadp::getSupportedServiceNames() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
}
}
-
-
diff --git a/stoc/source/invocation_adapterfactory/invadp.map b/stoc/source/invocation_adapterfactory/invadp.map
new file mode 100644
index 000000000000..71fc44a85ff2
--- /dev/null
+++ b/stoc/source/invocation_adapterfactory/invadp.map
@@ -0,0 +1,10 @@
+UDK_3_0_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ component_canUnload;
+ component_getDescriptionFunc;
+ local:
+ *;
+}; \ No newline at end of file
diff --git a/stoc/source/invocation_adapterfactory/makefile.mk b/stoc/source/invocation_adapterfactory/makefile.mk
index 91389bd8a7cb..73ff17bbe606 100644
--- a/stoc/source/invocation_adapterfactory/makefile.mk
+++ b/stoc/source/invocation_adapterfactory/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.7 $
+# $Revision: 1.8 $
#
-# last change: $Author: pluby $ $Date: 2001-03-02 07:18:37 $
+# last change: $Author: jbu $ $Date: 2001-06-22 16:20:57 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -86,13 +86,14 @@ SHL1STDLIBS= \
$(CPPUHELPERLIB) \
$(SALLIB)
+SHL1VERSIONMAP= $(TARGET).map
+
SHL1DEPN=
SHL1IMPLIB= i$(TARGET)
SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx
index bd07856acbbb..b284d8bf33e5 100644
--- a/stoc/source/javaloader/javaloader.cxx
+++ b/stoc/source/javaloader/javaloader.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: javaloader.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: kr $ $Date: 2001-04-18 09:16:56 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:20:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -84,6 +84,7 @@
#include "jni.h"
#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/implbase2.hxx>
@@ -103,23 +104,52 @@ using namespace ::com::sun::star::registry;
using namespace ::cppu;
using namespace ::rtl;
+using namespace ::osl;
+
+namespace stoc_javaloader {
+ static Sequence< OUString > loader_getSupportedServiceNames()
+ {
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.loader.Java2") );
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+ }
+
+ static OUString loader_getImplementationName()
+ {
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.stoc.JavaComponentLoader" ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
+ }
-namespace loader {
class JavaComponentLoader : public WeakImplHelper2<XImplementationLoader, XServiceInfo> {
- Reference<XMultiServiceFactory> _xSMgr;
+ Reference<XMultiComponentFactory> _xSMgr;
+ Reference<XComponentContext> _xCtx;
Reference<XImplementationLoader> _javaLoader;
- protected:
- JavaComponentLoader(const Reference<XMultiServiceFactory> & rXSMgr) throw(RuntimeException);
+ public:
+ JavaComponentLoader(const Reference<XComponentContext> & xCtx) throw(RuntimeException);
virtual ~JavaComponentLoader() throw();
public:
- static const OUString implname;
- static const OUString servname;
-
- static Reference<XInterface> SAL_CALL CreateInstance(const Reference<XMultiServiceFactory> & rSMgr) throw(Exception);
- static Sequence<OUString> SAL_CALL getSupportedServiceNames_Static() throw();
-
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(RuntimeException);
@@ -130,32 +160,9 @@ namespace loader {
virtual sal_Bool SAL_CALL writeRegistryInfo(const Reference<XRegistryKey>& xKey, const OUString& implementationLoaderUrl, const OUString& locationUrl) throw(CannotRegisterImplementationException, RuntimeException);
};
- const OUString JavaComponentLoader::implname = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.JavaComponentLoader"));
- const OUString JavaComponentLoader::servname = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.Java2"));
-
- Sequence<OUString> SAL_CALL JavaComponentLoader::getSupportedServiceNames_Static() throw() {
- return Sequence<OUString>(&servname, 1);
- }
-
-
- Reference<XInterface> SAL_CALL JavaComponentLoader::CreateInstance(const Reference<XMultiServiceFactory> & rSMgr) throw(Exception) {
- Reference<XInterface> xRet;
-
- try {
- XImplementationLoader *pXLoader = (XImplementationLoader *)new JavaComponentLoader(rSMgr);
-
- xRet = Reference<XInterface>::query(pXLoader);
- }
- catch(RuntimeException & runtimeException) {
- OString message = OUStringToOString(runtimeException.Message, RTL_TEXTENCODING_ASCII_US);
- osl_trace("javaloader - could not init javaloader cause of %s", message.getStr());
- }
-
- return xRet;
- }
-
- JavaComponentLoader::JavaComponentLoader(const Reference<XMultiServiceFactory> & rSMgr) throw(RuntimeException)
- : _xSMgr(rSMgr)
+ JavaComponentLoader::JavaComponentLoader(const Reference<XComponentContext> & xCtx) throw(RuntimeException)
+ : _xSMgr(xCtx->getServiceManager())
+ , _xCtx( xCtx )
{
sal_Int32 size = 0;
uno_Environment ** ppJava_environments = NULL;
@@ -169,7 +176,9 @@ namespace loader {
try {
// get a java vm, where we can create a loader
- javaVM = rSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine")));
+ javaVM = _xSMgr->createInstanceWithContext(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine")),
+ xCtx );
if(!javaVM.is()) throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("javaloader error - 10")), Reference<XInterface>());
Reference<XJavaVM> javaVM_xJavaVM(javaVM, UNO_QUERY);
if(!javaVM_xJavaVM.is()) throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("javaloader error - 11")), Reference<XInterface>());
@@ -281,8 +290,9 @@ namespace loader {
}
// XServiceInfo
- OUString SAL_CALL JavaComponentLoader::getImplementationName() throw(::com::sun::star::uno::RuntimeException) {
- return implname;
+ OUString SAL_CALL JavaComponentLoader::getImplementationName() throw(::com::sun::star::uno::RuntimeException)
+ {
+ return loader_getImplementationName();
}
sal_Bool SAL_CALL JavaComponentLoader::supportsService(const OUString & ServiceName) throw(::com::sun::star::uno::RuntimeException) {
@@ -296,8 +306,9 @@ namespace loader {
return bSupport;
}
- Sequence<OUString> SAL_CALL JavaComponentLoader::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) {
- return getSupportedServiceNames_Static();
+ Sequence<OUString> SAL_CALL JavaComponentLoader::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
+ {
+ return loader_getSupportedServiceNames();
}
@@ -319,59 +330,82 @@ namespace loader {
{
return _javaLoader->activate(rImplName, blabla, rLibName, xKey);
}
-}
-
-extern "C"
-{
- SAL_DLLEXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv) {
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+ static Mutex & getInitMutex()
+ {
+ static Mutex * pMutex = 0;
+ if( ! pMutex )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pMutex )
+ {
+ static Mutex mutex;
+ pMutex = &mutex;
+ }
+ }
+ return *pMutex;
}
+ Reference<XInterface> SAL_CALL JavaComponentLoader_CreateInstance(const Reference<XComponentContext> & xCtx) throw(Exception)
+ {
+ Reference<XInterface> xRet;
- SAL_DLLEXPORT sal_Bool SAL_CALL component_writeInfo(XMultiServiceFactory * pServiceManager, XRegistryKey * pRegistryKey) {
- sal_Bool bRes = sal_False;
-
- if (pRegistryKey) {
- try {
- OUString x = OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- x += ::loader::JavaComponentLoader::implname;
- x += OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES"));
-
- Reference<XRegistryKey> xNewKey(pRegistryKey->createKey(x));
-
- const Sequence<OUString> rSNL = ::loader::JavaComponentLoader::getSupportedServiceNames_Static();
- const OUString * pArray = rSNL.getConstArray();
- for (sal_Int32 nPos = rSNL.getLength(); nPos--;)
- xNewKey->createKey(pArray[nPos]);
-
- bRes = sal_True;
+ try {
+ MutexGuard guard( getInitMutex() );
+ // The javaloader is never destroyed and there can be only one!
+ // Note that the first context wins ....
+ static Reference< XInterface > *pStaticRef = 0;
+ if( pStaticRef )
+ {
+ xRet = *pStaticRef;
}
- catch (InvalidRegistryException &) {
- OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ else
+ {
+ xRet = *new JavaComponentLoader(xCtx);
+ pStaticRef = new Reference< XInterface > ( xRet );
}
}
+ catch(RuntimeException & runtimeException) {
+ OString message = OUStringToOString(runtimeException.Message, RTL_TEXTENCODING_ASCII_US);
+ osl_trace("javaloader - could not init javaloader cause of %s", message.getStr());
+ }
- return bRes;
+ return xRet;
}
+}
- SAL_DLLEXPORT void * SAL_CALL component_getFactory(const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, XRegistryKey * pRegistryKey) {
- void * pRet = 0;
+using namespace stoc_javaloader;
- if (pServiceManager && ::loader::JavaComponentLoader::implname.equals(OUString::createFromAscii(pImplName)))
- {
- Reference<XSingleServiceFactory> xFactory(createOneInstanceFactory(pServiceManager,
- OUString::createFromAscii(pImplName),
- ::loader::JavaComponentLoader::CreateInstance,
- ::loader::JavaComponentLoader::getSupportedServiceNames_Static()));
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ JavaComponentLoader_CreateInstance, loader_getImplementationName,
+ loader_getSupportedServiceNames, createSingleComponentFactory,
+ 0 , 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+};
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
+extern "C"
+{
+// NOTE: component_canUnload is not exported, as the library cannot be unloaded.
- return pRet;
- }
+//==================================================================================================
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+sal_Bool SAL_CALL component_writeInfo(
+ void * pServiceManager, void * pRegistryKey )
+{
+ return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
+}
+//==================================================================================================
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
+}
}
diff --git a/stoc/source/javaloader/javaloader.map b/stoc/source/javaloader/javaloader.map
new file mode 100644
index 000000000000..d3ce9e89b559
--- /dev/null
+++ b/stoc/source/javaloader/javaloader.map
@@ -0,0 +1,9 @@
+UDK_3_0_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ component_getDescriptionFunc;
+ local:
+ *;
+};
diff --git a/stoc/source/javaloader/makefile.mk b/stoc/source/javaloader/makefile.mk
index 3b13c23243c3..0888b8e4650b 100644
--- a/stoc/source/javaloader/makefile.mk
+++ b/stoc/source/javaloader/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.10 $
+# $Revision: 1.11 $
#
-# last change: $Author: obo $ $Date: 2001-05-07 13:49:39 $
+# last change: $Author: jbu $ $Date: 2001-06-22 16:20:58 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -85,14 +85,13 @@ SHL1STDLIBS=\
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB)
-
+SHL1VERSIONMAP=$(TARGET).map
SHL1DEPN=
SHL1IMPLIB= i$(TARGET)
SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index e13d7368d121..7a7861a3aaca 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: javavm.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: jl $ $Date: 2001-06-11 15:31:34 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:20:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,6 +86,7 @@
#include <uno/environment.h>
#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/implbase3.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -140,6 +141,40 @@ using namespace cppu;
using namespace osl;
namespace stoc_javavm {
+
+ static Sequence< OUString > javavm_getSupportedServiceNames()
+ {
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.java.JavaVirtualMachine") );
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+ }
+
+ static OUString javavm_getImplementationName()
+ {
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.stoc.JavaVirtualMachine" ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
+ }
+
static jint JNICALL vm_vfprintf( FILE *fp, const char *format, va_list args ) {
#ifdef DEBUG
char buff[1024];
@@ -194,14 +229,15 @@ namespace stoc_javavm {
uno_Environment * _pJava_environment;
JavaVMContext * _pVMContext;
- Reference<XMultiServiceFactory> _xSMgr;
+ Reference<XComponentContext> _xCtx;
+ Reference<XMultiComponentFactory > _xSMgr;
Module _javaLib;
public:
OUString _error;
- JavaVirtualMachine_Impl(const Reference<XMultiServiceFactory> & rSMgr) throw();
+ JavaVirtualMachine_Impl(const Reference<XComponentContext> & xCtx) throw();
~JavaVirtualMachine_Impl() throw();
// XJavaVM
@@ -220,15 +256,6 @@ namespace stoc_javavm {
virtual Sequence<OUString> SAL_CALL getSupportedServiceNames(void) throw(RuntimeException);
- static OUString SAL_CALL getImplementationName_Static() throw() {
- return OUString::createFromAscii("com.sun.star.comp.stoc.JavaVirtualMachine");
- }
-
- static Sequence<OUString> SAL_CALL getSupportedServiceNames_Static() throw() {
- Sequence<OUString> aSNS(1);
- aSNS.getArray()[0] = OUString::createFromAscii("com.sun.star.java.JavaVirtualMachine");
- return aSNS;
- }
JavaVM * createJavaVM(const JVM & jvm) throw(RuntimeException);
void disposeJavaVM() throw();
@@ -297,8 +324,9 @@ namespace stoc_javavm {
// XServiceInfo
- OUString SAL_CALL JavaVirtualMachine_Impl::getImplementationName() throw(RuntimeException) {
- return JavaVirtualMachine_Impl::getImplementationName_Static();
+ OUString SAL_CALL JavaVirtualMachine_Impl::getImplementationName() throw(RuntimeException)
+ {
+ return javavm_getImplementationName();
}
// XServiceInfo
@@ -314,13 +342,18 @@ namespace stoc_javavm {
}
// XServiceInfo
- Sequence<OUString> SAL_CALL JavaVirtualMachine_Impl::getSupportedServiceNames() throw(RuntimeException) {
- return getSupportedServiceNames_Static();
+ Sequence<OUString> SAL_CALL JavaVirtualMachine_Impl::getSupportedServiceNames() throw(RuntimeException)
+ {
+ return javavm_getSupportedServiceNames();
}
-
- static void getDefaultLocaleFromConfig(JVM * pjvm, const Reference<XMultiServiceFactory> & xSMgr) throw(Exception) {
- Reference<XInterface> xConfRegistry = xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationRegistry")));
+ static void getDefaultLocaleFromConfig(JVM * pjvm,
+ const Reference<XMultiComponentFactory> & xSMgr,
+ const Reference<XComponentContext> &xCtx ) throw(Exception)
+ {
+ Reference<XInterface> xConfRegistry = xSMgr->createInstanceWithContext(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationRegistry")),
+ xCtx );
if(!xConfRegistry.is()) throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("javavm.cxx: couldn't get ConfigurationRegistry")), Reference<XInterface>());
Reference<XSimpleRegistry> xConfRegistry_simple(xConfRegistry, UNO_QUERY);
@@ -381,8 +414,13 @@ namespace stoc_javavm {
pjvm->pushProp(OUString::createFromAscii("user.timezone=ECT"));
}
- static void getINetPropsFromConfig(JVM * pjvm, const Reference<XMultiServiceFactory> & xSMgr) throw (Exception) {
- Reference<XInterface> xConfRegistry = xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationRegistry")));
+ static void getINetPropsFromConfig(JVM * pjvm,
+ const Reference<XMultiComponentFactory> & xSMgr,
+ const Reference<XComponentContext> &xCtx ) throw (Exception)
+ {
+ Reference<XInterface> xConfRegistry = xSMgr->createInstanceWithContext(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationRegistry")),
+ xCtx );
if(!xConfRegistry.is()) throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("javavm.cxx: couldn't get ConfigurationRegistry")), Reference<XInterface>());
Reference<XSimpleRegistry> xConfRegistry_simple(xConfRegistry, UNO_QUERY);
@@ -428,8 +466,13 @@ namespace stoc_javavm {
xConfRegistry_simple->close();
}
- static void getJavaPropsFromConfig(JVM * pjvm, const Reference<XMultiServiceFactory> & xSMgr) throw(Exception) {
- Reference<XInterface> xConfRegistry = xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationRegistry")));
+ static void getJavaPropsFromConfig(JVM * pjvm,
+ const Reference<XMultiComponentFactory> & xSMgr,
+ const Reference<XComponentContext> &xCtx) throw(Exception)
+ {
+ Reference<XInterface> xConfRegistry = xSMgr->createInstanceWithContext(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationRegistry")),
+ xCtx);
if(!xConfRegistry.is()) throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("javavm.cxx: couldn't get ConfigurationRegistry")), Reference<XInterface>());
Reference<XSimpleRegistry> xConfRegistry_simple(xConfRegistry, UNO_QUERY);
@@ -444,7 +487,9 @@ namespace stoc_javavm {
OUString rcPath = key_InstallPath->getStringValue();
- Reference<XInterface> xIniManager(xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.config.INIManager"))));
+ Reference<XInterface> xIniManager(xSMgr->createInstanceWithContext(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.config.INIManager")),
+ xCtx));
if(!xIniManager.is()) throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("javavm.cxx: couldn't get: com.sun.star.config.INIManager")), Reference<XInterface>());
Reference<XSimpleRegistry> xIniManager_simple(xIniManager, UNO_QUERY);
@@ -510,11 +555,13 @@ namespace stoc_javavm {
}
}
- static void initVMConfiguration(JVM * pjvm, const Reference<XMultiServiceFactory> & xSMgr) throw() {
+ static void initVMConfiguration(JVM * pjvm,
+ const Reference<XMultiComponentFactory> & xSMgr,
+ const Reference<XComponentContext > &xCtx) throw() {
try {
JVM jvm;
- getINetPropsFromConfig(&jvm, xSMgr);
+ getINetPropsFromConfig(&jvm, xSMgr, xCtx);
*pjvm = jvm;
}
@@ -528,7 +575,7 @@ namespace stoc_javavm {
try {
JVM jvm;
- getDefaultLocaleFromConfig(&jvm, xSMgr);
+ getDefaultLocaleFromConfig(&jvm, xSMgr,xCtx);
}
catch(Exception & exception) {
#ifdef DEBUG
@@ -541,7 +588,7 @@ namespace stoc_javavm {
JVM jvm;
- getJavaPropsFromConfig(&jvm, xSMgr);
+ getJavaPropsFromConfig(&jvm, xSMgr,xCtx);
*pjvm = jvm;
}
@@ -562,11 +609,12 @@ namespace stoc_javavm {
// pjvm->setAbort(vm_abort);
}
- JavaVirtualMachine_Impl::JavaVirtualMachine_Impl(const Reference<XMultiServiceFactory> & rSMgr) throw()
- : _pVMContext(NULL),
- _xSMgr(rSMgr),
- _creatorThread(this),
- _pJava_environment(NULL)
+ JavaVirtualMachine_Impl::JavaVirtualMachine_Impl(const Reference< XComponentContext > &xCtx) throw()
+ : _pVMContext(NULL)
+ , _creatorThread(this)
+ , _pJava_environment(NULL)
+ , _xSMgr( xCtx->getServiceManager() )
+ , _xCtx( xCtx )
{
}
@@ -681,7 +729,7 @@ namespace stoc_javavm {
JVM jvm;
JavaVM * pJavaVM;
- initVMConfiguration(&jvm, _xSMgr);
+ initVMConfiguration(&jvm, _xSMgr, _xCtx);
if (jvm.isEnabled()) {
// create the java vm
@@ -728,7 +776,7 @@ namespace stoc_javavm {
sal_Bool JavaVirtualMachine_Impl::isVMEnabled(void) throw(RuntimeException) {
JVM jvm;
- initVMConfiguration(&jvm, _xSMgr);
+ initVMConfiguration(&jvm, _xSMgr, _xCtx);
return jvm.isEnabled();
}
@@ -759,11 +807,26 @@ namespace stoc_javavm {
// JavaVirtualMachine_Impl_CreateInstance()
- static Reference<XInterface> SAL_CALL JavaVirtualMachine_Impl_createInstance(const Reference<XMultiServiceFactory> & rSMgr)
+ static Reference<XInterface> SAL_CALL JavaVirtualMachine_Impl_createInstance(const Reference<XComponentContext> & xCtx)
throw (RuntimeException)
{
- XJavaVM *pJVM= static_cast<XJavaVM *>(new JavaVirtualMachine_Impl(rSMgr));
- return Reference<XInterface>(pJVM);
+ Reference< XInterface > xRet;
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ // The javavm is never destroyed !
+ static Reference< XInterface > *pStaticRef = 0;
+ if( pStaticRef )
+ {
+ xRet = *pStaticRef;
+ }
+ else
+ {
+ xRet = *new JavaVirtualMachine_Impl( xCtx);
+ pStaticRef = new Reference< XInterface> ( xRet );
+ }
+ }
+
+ return xRet;
}
@@ -776,50 +839,38 @@ namespace stoc_javavm {
}
}
-extern "C" {
- void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv){
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
- }
-
- sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * pRegistryKey) throw() {
- if (pRegistryKey) {
- try {
- Reference<XRegistryKey> xNewKey(reinterpret_cast<XRegistryKey *>(pRegistryKey)->createKey(
- OUString::createFromAscii("/") +
- stoc_javavm::JavaVirtualMachine_Impl::getImplementationName_Static() +
- OUString::createFromAscii("/UNO/SERVICES")));
-
- const Sequence<OUString> & rSNL = stoc_javavm::JavaVirtualMachine_Impl::getSupportedServiceNames_Static();
- 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;
- }
-
- void * SAL_CALL component_getFactory(const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey) throw() {
- void * pRet = 0;
-
- if (stoc_javavm::JavaVirtualMachine_Impl::getImplementationName_Static().equals(OUString::createFromAscii(pImplName))) {
- Reference<XSingleServiceFactory> xFactory( createOneInstanceFactory(
- reinterpret_cast<XMultiServiceFactory *>(pServiceManager),
- stoc_javavm::JavaVirtualMachine_Impl::getImplementationName_Static(),
- stoc_javavm::JavaVirtualMachine_Impl_createInstance,
- stoc_javavm::JavaVirtualMachine_Impl::getSupportedServiceNames_Static()));
+using namespace stoc_javavm;
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
- }
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ JavaVirtualMachine_Impl_createInstance, javavm_getImplementationName,
+ javavm_getSupportedServiceNames, createSingleComponentFactory,
+ 0 , 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+extern "C"
+{
+// NOTE: component_canUnload is not exported, as the library cannot be unloaded.
+
+//==================================================================================================
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+sal_Bool SAL_CALL component_writeInfo(
+ void * pServiceManager, void * pRegistryKey )
+{
+ return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
+}
+//==================================================================================================
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
+}
}
diff --git a/stoc/source/javavm/jen.map b/stoc/source/javavm/jen.map
new file mode 100644
index 000000000000..d3ce9e89b559
--- /dev/null
+++ b/stoc/source/javavm/jen.map
@@ -0,0 +1,9 @@
+UDK_3_0_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ component_getDescriptionFunc;
+ local:
+ *;
+};
diff --git a/stoc/source/javavm/makefile.mk b/stoc/source/javavm/makefile.mk
index cfff1f0d6486..be3555876b66 100644
--- a/stoc/source/javavm/makefile.mk
+++ b/stoc/source/javavm/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.9 $
+# $Revision: 1.10 $
#
-# last change: $Author: obo $ $Date: 2001-05-07 13:48:36 $
+# last change: $Author: jbu $ $Date: 2001-06-22 16:20:58 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -88,7 +88,7 @@ SLOFILES= \
$(SLO)$/jvmargs.obj
SHL1TARGET= $(TARGET)
-
+SHL1VERSIONMAP=$(TARGET).map
SHL1STDLIBS= \
$(CPPUHELPERLIB) \
$(CPPULIB) \
@@ -105,7 +105,6 @@ SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
diff --git a/stoc/source/loader/dllcomponentloader.cxx b/stoc/source/loader/dllcomponentloader.cxx
index d4cd95072222..f07bd1419200 100644
--- a/stoc/source/loader/dllcomponentloader.cxx
+++ b/stoc/source/loader/dllcomponentloader.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dllcomponentloader.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: jl $ $Date: 2001-03-12 15:35:30 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:20:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -103,6 +103,9 @@
#ifndef _CPPUHELPER_IMPLBASE3_HXX_
#include <cppuhelper/implbase3.hxx>
#endif
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX__
+#include <cppuhelper/implementationentry.hxx>
+#endif
#include <com/sun/star/loader/XImplementationLoader.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
@@ -117,12 +120,46 @@ using namespace com::sun::star::lang;
using namespace com::sun::star::registry;
using namespace cppu;
using namespace rtl;
+using namespace osl;
+
+#define SERVICENAME "com.sun.star.loader.SharedLibrary"
+#define IMPLNAME "com.sun.star.comp.stoc.DLLComponentLoader"
namespace stoc_loader
{
+static rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
+
+static Sequence< OUString > loader_getSupportedServiceNames()
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME));
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+static OUString loader_getImplementationName()
+{
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
+}
-#define SERVICENAME "com.sun.star.loader.SharedLibrary"
-#define IMPLNAME "com.sun.star.comp.stoc.DLLComponentLoader"
//*************************************************************************
// DllComponentLoader
@@ -133,14 +170,13 @@ class DllComponentLoader
XServiceInfo >
{
public:
- DllComponentLoader( const Reference<XMultiServiceFactory> & rXSMgr );
+ DllComponentLoader( const Reference<XComponentContext> & xCtx );
~DllComponentLoader();
// XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
- static Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( );
// XInitialization
virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
@@ -154,21 +190,23 @@ private:
};
//*************************************************************************
-DllComponentLoader::DllComponentLoader( const Reference<XMultiServiceFactory> & rXSMgr )
- : m_xSMgr( rXSMgr )
+DllComponentLoader::DllComponentLoader( const Reference<XComponentContext> & xCtx )
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ m_xSMgr = Reference< XMultiServiceFactory > ( xCtx->getServiceManager(), UNO_QUERY );
}
//*************************************************************************
DllComponentLoader::~DllComponentLoader()
{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
//*************************************************************************
OUString SAL_CALL DllComponentLoader::getImplementationName( )
throw(::com::sun::star::uno::RuntimeException)
{
- return OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) );
+ return loader_getImplementationName();
}
//*************************************************************************
@@ -187,38 +225,32 @@ sal_Bool SAL_CALL DllComponentLoader::supportsService( const OUString& ServiceNa
Sequence<OUString> SAL_CALL DllComponentLoader::getSupportedServiceNames( )
throw(::com::sun::star::uno::RuntimeException)
{
- return getSupportedServiceNames_Static();
-}
-
-//*************************************************************************
-Sequence<OUString> SAL_CALL DllComponentLoader::getSupportedServiceNames_Static( )
-{
- OUString aName( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) );
- return Sequence< OUString >( &aName, 1 );
+ return loader_getSupportedServiceNames();
}
//*************************************************************************
void DllComponentLoader::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArgs )
throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- if( aArgs.getLength() != 1 )
- {
- throw IllegalArgumentException();
- }
+ OSL_ENSURE( 0, "dllcomponentloader::initialize should not be called !" );
+// if( aArgs.getLength() != 1 )
+// {
+// throw IllegalArgumentException();
+// }
- Reference< XMultiServiceFactory > rServiceManager;
+// Reference< XMultiServiceFactory > rServiceManager;
- if( aArgs.getConstArray()[0].getValueType().getTypeClass() == TypeClass_INTERFACE )
- {
- aArgs.getConstArray()[0] >>= rServiceManager;
- }
+// if( aArgs.getConstArray()[0].getValueType().getTypeClass() == TypeClass_INTERFACE )
+// {
+// aArgs.getConstArray()[0] >>= rServiceManager;
+// }
- if( !rServiceManager.is() )
- {
- throw IllegalArgumentException();
- }
+// if( !rServiceManager.is() )
+// {
+// throw IllegalArgumentException();
+// }
- m_xSMgr = rServiceManager;
+// m_xSMgr = rServiceManager;
}
@@ -245,11 +277,11 @@ sal_Bool SAL_CALL DllComponentLoader::writeRegistryInfo(
//*************************************************************************
-Reference<XInterface> SAL_CALL DllComponentLoader_CreateInstance( const Reference<XMultiServiceFactory> & rSMgr ) throw(Exception)
+Reference<XInterface> SAL_CALL DllComponentLoader_CreateInstance( const Reference<XComponentContext> & xCtx ) throw(Exception)
{
Reference<XInterface> xRet;
- XImplementationLoader *pXLoader = (XImplementationLoader *)new DllComponentLoader(rSMgr);
+ XImplementationLoader *pXLoader = (XImplementationLoader *)new DllComponentLoader(xCtx);
if (pXLoader)
{
@@ -261,8 +293,24 @@ Reference<XInterface> SAL_CALL DllComponentLoader_CreateInstance( const Referenc
}
+using namespace stoc_loader;
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ DllComponentLoader_CreateInstance, loader_getImplementationName,
+ loader_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 )
@@ -273,54 +321,15 @@ 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( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) );
-
- const Sequence< OUString > & rSNL =
- ::stoc_loader::DllComponentLoader::getSupportedServiceNames_Static();
- 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 (rtl_str_compare( pImplName, IMPLNAME ) == 0)
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) ),
- ::stoc_loader::DllComponentLoader_CreateInstance,
- ::stoc_loader::DllComponentLoader::getSupportedServiceNames_Static() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
}
}
-
diff --git a/stoc/source/loader/makefile.mk b/stoc/source/loader/makefile.mk
index d37a36c5acb0..54627768f91b 100644
--- a/stoc/source/loader/makefile.mk
+++ b/stoc/source/loader/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.6 $
+# $Revision: 1.7 $
#
-# last change: $Author: obo $ $Date: 2001-05-07 13:52:15 $
+# last change: $Author: jbu $ $Date: 2001-06-22 16:20:59 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -87,13 +87,13 @@ SHL1STDLIBS= \
$(CPPUHELPERLIB) \
$(SALLIB)
+SHL1VERSIONMAP=$(TARGET).map
SHL1DEPN=
SHL1IMPLIB= i$(TARGET)
SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
diff --git a/stoc/source/namingservice/namingservice.cxx b/stoc/source/namingservice/namingservice.cxx
index 98914012f85f..e41342bf5eb2 100644
--- a/stoc/source/namingservice/namingservice.cxx
+++ b/stoc/source/namingservice/namingservice.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: namingservice.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jl $ $Date: 2001-03-12 15:36:04 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:20:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -90,6 +90,9 @@
#ifndef _CPPUHELPER_IMPLBASE2_HXX_
#include <cppuhelper/implbase2.hxx>
#endif
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
+#include <cppuhelper/implementationentry.hxx>
+#endif
#include <com/sun/star/uno/XNamingService.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -108,6 +111,38 @@ using namespace com::sun::star::registry;
namespace stoc_namingservice
{
+static rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
+
+static Sequence< OUString > ns_getSupportedServiceNames()
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME));
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+static OUString ns_getImplementationName()
+{
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
+}
struct equalOWString_Impl
{
@@ -158,36 +193,28 @@ public:
};
//==================================================================================================
-static Reference<XInterface> SAL_CALL NamingService_Impl_create( const Reference<XMultiServiceFactory> & )
+static Reference<XInterface> SAL_CALL NamingService_Impl_create( const Reference<XComponentContext> & )
{
- static Reference<XNamingService> * pNS = 0;
-
- if( !pNS )
- {
- Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
- // only one Naming Service for the hole process
- static Reference<XNamingService> xNS = new NamingService_Impl();
- pNS = &xNS;
- }
-
- return *pNS;
+ return *new NamingService_Impl();
}
//==================================================================================================
NamingService_Impl::NamingService_Impl()
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
}
//==================================================================================================
NamingService_Impl::~NamingService_Impl()
{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
// XServiceInfo
OUString NamingService_Impl::getImplementationName()
throw(::com::sun::star::uno::RuntimeException)
{
- return OUString::createFromAscii( IMPLNAME );
+ return ns_getImplementationName();
}
// XServiceInfo
@@ -208,7 +235,7 @@ sal_Bool NamingService_Impl::supportsService( const OUString & rServiceName )
Sequence< OUString > NamingService_Impl::getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException)
{
- return getSupportedServiceNames_Static();
+ return ns_getSupportedServiceNames();
}
// XServiceInfo
@@ -238,8 +265,24 @@ void NamingService_Impl::revokeObject( const OUString& Name )
}
+using namespace stoc_namingservice;
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ NamingService_Impl_create, ns_getImplementationName,
+ ns_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 )
@@ -250,52 +293,12 @@ void SAL_CALL component_getImplementationEnvironment(
sal_Bool SAL_CALL component_writeInfo(
void * pServiceManager, void * pRegistryKey )
{
- if (pRegistryKey)
- {
- try
- {
- // NamingService
- Reference< XRegistryKey > xNewKey(
- reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
- OUString::createFromAscii( "/" IMPLNAME "/UNO/SERVICES" ) ) );
-
- Sequence< OUString > & rSNL =
- ::stoc_namingservice::NamingService_Impl::getSupportedServiceNames_Static();
- 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 (rtl_str_compare( pImplName, IMPLNAME ) == 0)
- {
- Reference< XSingleServiceFactory > xFactory( createOneInstanceFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- ::stoc_namingservice::NamingService_Impl_create,
- ::stoc_namingservice::NamingService_Impl::getSupportedServiceNames_Static() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
}
}
-
diff --git a/stoc/source/namingservice/namingservice.map b/stoc/source/namingservice/namingservice.map
new file mode 100644
index 000000000000..f76809fbd37b
--- /dev/null
+++ b/stoc/source/namingservice/namingservice.map
@@ -0,0 +1,10 @@
+UDK_3_0_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ component_canUnload;
+ component_getDescriptionFunc;
+ local:
+ *;
+};
diff --git a/stoc/source/proxy_factory/makefile.mk b/stoc/source/proxy_factory/makefile.mk
index 4e8c962bdc27..0fbf634b223e 100644
--- a/stoc/source/proxy_factory/makefile.mk
+++ b/stoc/source/proxy_factory/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.5 $
+# $Revision: 1.6 $
#
-# last change: $Author: pluby $ $Date: 2001-03-02 07:18:57 $
+# last change: $Author: jbu $ $Date: 2001-06-22 16:20:59 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -82,6 +82,7 @@ SLOFILES= \
$(SLO)$/proxyfac.obj
SHL1TARGET=$(TARGET)
+SHL1VERSIONMAP=$(TARGET).map
SHL1STDLIBS= \
$(CPPULIB) \
diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx
index 51cfcf100d10..12b8b9484d5d 100644
--- a/stoc/source/proxy_factory/proxyfac.cxx
+++ b/stoc/source/proxy_factory/proxyfac.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: proxyfac.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2001-03-12 15:36:16 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:20:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,6 +71,7 @@
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/weakagg.hxx>
#include <cppuhelper/queryinterface.hxx>
+#include <cppuhelper/implementationentry.hxx>
#include <vector>
@@ -95,6 +96,38 @@ using namespace com::sun::star::registry;
namespace stoc_proxyfac
{
+static rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
+
+static Sequence< OUString > proxyfac_getSupportedServiceNames()
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) );
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+static OUString proxyfac_getImplementationName()
+{
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
+}
//--------------------------------------------------------------------------------------------------
static inline uno_Interface * uno_queryInterface(
@@ -173,6 +206,7 @@ struct FactoryImpl : public WeakImplHelper2< XServiceInfo, XProxyFactory >
Mapping aCpp2Uno;
FactoryImpl();
+ virtual ~FactoryImpl();
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
@@ -244,6 +278,7 @@ inline ProxyRoot::ProxyRoot( FactoryImpl * pFactory_, const Reference< XInterfac
: pFactory( pFactory_ )
, pTarget( 0 )
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
pFactory->acquire();
pFactory->aCpp2Uno.mapInterface( (void **)&pTarget, xTarget_.get(), ::getCppuType( &xTarget_ ) );
OSL_ENSURE( pTarget, "### mapping interface failed!" );
@@ -262,6 +297,7 @@ ProxyRoot::~ProxyRoot()
}
(*pTarget->release)( pTarget );
pFactory->release();
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
//--------------------------------------------------------------------------------------------------
@@ -343,12 +379,17 @@ FactoryImpl::FactoryImpl()
: aUno2Cpp( OUString( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO) ),
OUString( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ) )
, aCpp2Uno( OUString( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO) ) )
+ OUString( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO) ) )
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
OSL_ENSURE( aUno2Cpp.is(), "### cannot get bridge uno <-> C++!" );
- OSL_ENSURE( aCpp2Uno.is(), "### cannot get bridge C++ <-> uno!" );
+ OSL_ENSURE( aCpp2Uno.is(), "### cannot get bridge C++ <-> uno!" );
}
+FactoryImpl::~FactoryImpl()
+{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+}
// XProxyFactory
//__________________________________________________________________________________________________
Reference< XAggregation > FactoryImpl::createProxy( const Reference< XInterface > & xTarget )
@@ -361,7 +402,7 @@ Reference< XAggregation > FactoryImpl::createProxy( const Reference< XInterface
OUString FactoryImpl::getImplementationName()
throw(::com::sun::star::uno::RuntimeException)
{
- return OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) );
+ return proxyfac_getImplementationName();
}
//__________________________________________________________________________________________________
sal_Bool FactoryImpl::supportsService( const OUString & rServiceName )
@@ -380,14 +421,27 @@ sal_Bool FactoryImpl::supportsService( const OUString & rServiceName )
Sequence< OUString > FactoryImpl::getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException)
{
- return stoc_proxyfac::getSupportedServiceNames();
+ return proxyfac_getSupportedServiceNames();
}
//==================================================================================================
-static Reference< XInterface > SAL_CALL FactoryImpl_create( const Reference< XMultiServiceFactory > & xMgr )
+static Reference< XInterface > SAL_CALL FactoryImpl_create(
+ const Reference< XComponentContext > & xMgr )
throw(::com::sun::star::uno::Exception)
{
- return Reference< XInterface >( *new FactoryImpl() );
+ Reference< XInterface > rRet;
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ static WeakReference < XInterface > rwInstance;
+ rRet = rwInstance;
+
+ if( ! rRet.is() )
+ {
+ rRet = (OWeakObject*)new FactoryImpl();
+ rwInstance = rRet;
+ }
+ }
+ return rRet;
}
}
@@ -398,8 +452,25 @@ static Reference< XInterface > SAL_CALL FactoryImpl_create( const Reference< XMu
//##################################################################################################
+using namespace stoc_proxyfac;
+
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ FactoryImpl_create, proxyfac_getImplementationName,
+ proxyfac_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 )
@@ -410,50 +481,12 @@ 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( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) );
-
- const Sequence< OUString > & rSNL = stoc_proxyfac::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, IMPLNAME ) == 0)
- {
- Reference< XSingleServiceFactory > xFactory( createOneInstanceFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) ),
- stoc_proxyfac::FactoryImpl_create,
- stoc_proxyfac::getSupportedServiceNames() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
}
}
-
diff --git a/stoc/source/proxy_factory/proxyfac.map b/stoc/source/proxy_factory/proxyfac.map
new file mode 100644
index 000000000000..f76809fbd37b
--- /dev/null
+++ b/stoc/source/proxy_factory/proxyfac.map
@@ -0,0 +1,10 @@
+UDK_3_0_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ component_canUnload;
+ component_getDescriptionFunc;
+ local:
+ *;
+};
diff --git a/stoc/source/registry_tdprovider/base.hxx b/stoc/source/registry_tdprovider/base.hxx
index fb19c08fcf16..ee726b77e432 100644
--- a/stoc/source/registry_tdprovider/base.hxx
+++ b/stoc/source/registry_tdprovider/base.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: base.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: dbo $ $Date: 2001-05-16 08:02:28 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,6 +75,9 @@
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx>
#endif
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
+#include <cppuhelper/implementationentry.hxx>
+#endif
#include <vector>
@@ -100,7 +103,7 @@ using namespace com::sun::star::reflection;
namespace stoc_rdbtdp
{
-
+extern rtl_StandardModuleCount g_moduleCount;
//--------------------------------------------------------------------------------------------------
inline sal_Int32 getRTValueAsInt32( const RTConstValue & rVal )
{
@@ -183,7 +186,10 @@ public:
TypeDescriptionImpl( TypeClass eTypeClass, const OUString & rName )
: _eTypeClass( eTypeClass )
, _aName( rName )
- {}
+ {
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ }
+ virtual ~TypeDescriptionImpl();
// XTypeDescription
virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException);
@@ -250,7 +256,9 @@ public:
, _aBaseType( rBaseName )
, _pMembers( 0 )
, _pMemberNames( 0 )
- {}
+ {
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ }
virtual ~CompoundTypeDescriptionImpl();
// XTypeDescription
@@ -299,7 +307,9 @@ public:
, _pMemberDiscriminants( 0 )
, _pMembers( 0 )
, _pMemberNames( 0 )
- {}
+ {
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ }
virtual ~UnionTypeDescriptionImpl();
// XTypeDescription
@@ -338,7 +348,9 @@ public:
, _aBytes( rBytes )
, _pEnumNames( 0 )
, _pEnumValues( 0 )
- {}
+ {
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ }
virtual ~EnumTypeDescriptionImpl();
// XTypeDescription
@@ -367,7 +379,10 @@ public:
: _xTDMgr( xTDMgr )
, _aName( rName )
, _aRefName( rRefName )
- {}
+ {
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ }
+ virtual ~TypedefTypeDescriptionImpl();
// XTypeDescription
virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException);
diff --git a/stoc/source/registry_tdprovider/tdcomp.cxx b/stoc/source/registry_tdprovider/tdcomp.cxx
index df1454bf0fd0..f250d335e7c5 100644
--- a/stoc/source/registry_tdprovider/tdcomp.cxx
+++ b/stoc/source/registry_tdprovider/tdcomp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tdcomp.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: dbo $ $Date: 2001-05-16 08:02:28 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,6 +69,7 @@ CompoundTypeDescriptionImpl::~CompoundTypeDescriptionImpl()
{
delete _pMembers;
delete _pMemberNames;
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
// XTypeDescription
diff --git a/stoc/source/registry_tdprovider/tdef.cxx b/stoc/source/registry_tdprovider/tdef.cxx
index 95f29ab9eb10..74b664efb26c 100644
--- a/stoc/source/registry_tdprovider/tdef.cxx
+++ b/stoc/source/registry_tdprovider/tdef.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tdef.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: dbo $ $Date: 2001-05-16 08:02:28 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,6 +63,10 @@
namespace stoc_rdbtdp
{
+TypedefTypeDescriptionImpl::~TypedefTypeDescriptionImpl()
+{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+}
// XTypeDescription
//__________________________________________________________________________________________________
diff --git a/stoc/source/registry_tdprovider/tdenum.cxx b/stoc/source/registry_tdprovider/tdenum.cxx
index 313fa3d9234b..d1ed504fd9ee 100644
--- a/stoc/source/registry_tdprovider/tdenum.cxx
+++ b/stoc/source/registry_tdprovider/tdenum.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tdenum.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dbo $ $Date: 2001-05-16 08:02:28 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,6 +69,7 @@ EnumTypeDescriptionImpl::~EnumTypeDescriptionImpl()
{
delete _pEnumNames;
delete _pEnumValues;
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
// XTypeDescription
diff --git a/stoc/source/registry_tdprovider/tdiface.cxx b/stoc/source/registry_tdprovider/tdiface.cxx
index 78f9034d9f68..e67087ee7b8b 100644
--- a/stoc/source/registry_tdprovider/tdiface.cxx
+++ b/stoc/source/registry_tdprovider/tdiface.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tdiface.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: dbo $ $Date: 2001-05-16 08:02:28 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -101,7 +101,10 @@ public:
, _bIn( bIn )
, _bOut( bOut )
, _nPosition( nPosition )
- {}
+ {
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ }
+ virtual ~MethodParameterImpl();
// XMethodParameter
virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
@@ -111,6 +114,10 @@ public:
virtual sal_Int32 SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException);
};
+MethodParameterImpl::~MethodParameterImpl()
+{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+}
// XMethodParameter
//__________________________________________________________________________________________________
OUString MethodParameterImpl::getName()
@@ -209,7 +216,9 @@ public:
, _pExceptions( 0 )
, _bIsOneWay( bIsOneWay )
, _nPosition( nPosition )
- {}
+ {
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ }
virtual ~InterfaceMethodImpl();
// XTypeDescription
@@ -231,6 +240,7 @@ InterfaceMethodImpl::~InterfaceMethodImpl()
{
delete _pParams;
delete _pExceptions;
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
// XTypeDescription
@@ -415,7 +425,10 @@ public:
, _aMemberTypeName( rMemberTypeName )
, _bReadOnly( bReadOnly )
, _nPosition( nPosition )
- {}
+ {
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ }
+ virtual ~InterfaceAttributeImpl();
// XTypeDescription
virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException);
@@ -430,6 +443,10 @@ public:
virtual Reference< XTypeDescription > SAL_CALL getType() throw(::com::sun::star::uno::RuntimeException);
};
+InterfaceAttributeImpl::~InterfaceAttributeImpl()
+{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+}
// XTypeDescription
//__________________________________________________________________________________________________
TypeClass InterfaceAttributeImpl::getTypeClass()
@@ -512,6 +529,7 @@ InterfaceTypeDescriptionImpl::InterfaceTypeDescriptionImpl(
, _pMethods( 0 )
{
// uik
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
_aUik.m_Data1 = rUik.m_Data1;
_aUik.m_Data2 = rUik.m_Data2;
_aUik.m_Data3 = rUik.m_Data3;
@@ -523,6 +541,7 @@ InterfaceTypeDescriptionImpl::~InterfaceTypeDescriptionImpl()
{
delete _pAttributes;
delete _pMethods;
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
// XTypeDescription
diff --git a/stoc/source/registry_tdprovider/tdprovider.cxx b/stoc/source/registry_tdprovider/tdprovider.cxx
index 99147cee8e70..6f1002e65985 100644
--- a/stoc/source/registry_tdprovider/tdprovider.cxx
+++ b/stoc/source/registry_tdprovider/tdprovider.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tdprovider.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: dbo $ $Date: 2001-05-10 14:34:44 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -100,19 +100,43 @@
using namespace com::sun::star::beans;
using namespace com::sun::star::registry;
-
namespace stoc_rdbtdp
{
+rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
-typedef ::std::list< Reference< XRegistryKey > > RegistryKeyList;
+static Sequence< OUString > rdbtdp_getSupportedServiceNames()
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME));
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
-//--------------------------------------------------------------------------------------------------
-inline static Sequence< OUString > getSupportedServiceNames()
+static OUString rdbtdp_getImplementationName()
{
- OUString aName( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) );
- return Sequence< OUString >( &aName, 1 );
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
}
+typedef ::std::list< Reference< XRegistryKey > > RegistryKeyList;
+
struct MutexHolder
{
Mutex _aComponentMutex;
@@ -149,6 +173,7 @@ ProviderImpl::ProviderImpl( const Reference< XComponentContext > & xContext )
: WeakComponentImplHelper2< XServiceInfo, XHierarchicalNameAccess >( _aComponentMutex )
, _xContext( xContext )
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
xContext->getValueByName(
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.TypeDescriptionManager") ) ) >>= _xTDMgr;
OSL_ENSURE( _xTDMgr.is(), "### cannot get single instance \"TypeDescriptionManager\" from context!" );
@@ -176,7 +201,9 @@ ProviderImpl::ProviderImpl( const Reference< XComponentContext > & xContext )
//__________________________________________________________________________________________________
ProviderImpl::~ProviderImpl()
{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
+
//__________________________________________________________________________________________________
void ProviderImpl::disposing()
{
@@ -196,7 +223,7 @@ void ProviderImpl::disposing()
OUString ProviderImpl::getImplementationName()
throw(::com::sun::star::uno::RuntimeException)
{
- return OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) );
+ return rdbtdp_getImplementationName();
}
//__________________________________________________________________________________________________
sal_Bool ProviderImpl::supportsService( const OUString & rServiceName )
@@ -215,7 +242,7 @@ sal_Bool ProviderImpl::supportsService( const OUString & rServiceName )
Sequence< OUString > ProviderImpl::getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException)
{
- return stoc_rdbtdp::getSupportedServiceNames();
+ return rdbtdp_getSupportedServiceNames();
}
// XHierarchicalNameAccess
@@ -375,10 +402,25 @@ static Reference< XInterface > SAL_CALL ProviderImpl_create(
//##################################################################################################
//##################################################################################################
//##################################################################################################
+using namespace stoc_rdbtdp;
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ ProviderImpl_create, rdbtdp_getImplementationName,
+ rdbtdp_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 )
@@ -389,52 +431,12 @@ 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( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) );
-
- const Sequence< OUString > & rSNL = stoc_rdbtdp::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, IMPLNAME ) == 0)
- {
- Reference< XInterface > xFactory( createSingleComponentFactory(
- stoc_rdbtdp::ProviderImpl_create,
- OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) ),
- stoc_rdbtdp::getSupportedServiceNames() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
}
}
-
-
diff --git a/stoc/source/servicemanager/makefile.mk b/stoc/source/servicemanager/makefile.mk
index dbb0e4f95705..35d0cd76a158 100644
--- a/stoc/source/servicemanager/makefile.mk
+++ b/stoc/source/servicemanager/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.6 $
+# $Revision: 1.7 $
#
-# last change: $Author: pluby $ $Date: 2001-03-02 07:19:06 $
+# last change: $Author: jbu $ $Date: 2001-06-22 16:21:00 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -81,6 +81,7 @@ SLOFILES= \
$(SLO)$/servicemanager.obj
SHL1TARGET= $(TARGET)
+SHL1VERSIONMAP=$(TARGET).map
SHL1STDLIBS= \
$(CPPULIB) \
@@ -93,7 +94,6 @@ SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index a49b62108471..f903096eb543 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: servicemanager.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: jl $ $Date: 2001-06-19 08:40:44 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -97,6 +97,9 @@
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
#endif
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
+#include <cppuhelper/implementationentry.hxx>
+#endif
#ifndef _RTL_UNLOAD_H_
#include <rtl/unload.h>
#endif
@@ -136,6 +139,74 @@ using namespace std;
namespace stoc_smgr
{
+static rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
+
+static Sequence< OUString > smgr_getSupportedServiceNames()
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(2);
+ seqNames.getArray()[0] = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.MultiServiceFactory") );
+ seqNames.getArray()[1] = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.ServiceManager") );
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+static OUString smgr_getImplementationName()
+{
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.stoc.OServiceManager" ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
+}
+
+static Sequence< OUString > regsmgr_getSupportedServiceNames()
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(2);
+ seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.MultiServiceFactory"));
+ seqNames.getArray()[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.RegistryServiceManager"));
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+static OUString regsmgr_getImplementationName()
+{
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.stoc.ORegistryServiceManager" ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
+}
@@ -194,8 +265,13 @@ public:
ServiceEnumeration_Impl( const Sequence< Reference<XInterface > > & rFactories )
: aFactories( rFactories )
, nIt( 0 )
- {}
- virtual ~ServiceEnumeration_Impl() {};
+ {
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ }
+ virtual ~ServiceEnumeration_Impl()
+ {
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+ };
// XEnumeration
sal_Bool SAL_CALL hasMoreElements()
@@ -235,7 +311,9 @@ public:
ImplementationEnumeration_Impl( const HashSet_Ref & rImplementationMap )
: aImplementationMap( rImplementationMap )
, aIt( aImplementationMap.begin() )
- {}
+ {
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ }
virtual ~ImplementationEnumeration_Impl();
// XEnumeration
@@ -254,6 +332,7 @@ private:
ImplementationEnumeration_Impl::~ImplementationEnumeration_Impl()
{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
// XEnumeration
@@ -377,7 +456,7 @@ public:
friend void SAL_CALL smgrUnloadingListener(void* id);
OServiceManager( Reference< XComponentContext > const & xContext );
- ~OServiceManager();
+ virtual ~OServiceManager();
virtual Any SAL_CALL queryInterface( const Type & rType ) throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL acquire() throw()
@@ -388,10 +467,9 @@ public:
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
static OUString getImplementationName_Static() throw(::com::sun::star::uno::RuntimeException)
- { return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.OServiceManager") ); }
+ { return smgr_getImplementationName(); }
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(::com::sun::star::uno::RuntimeException);
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
- static Sequence< OUString > getSupportedServiceNames_Static() throw(::com::sun::star::uno::RuntimeException);
// XMultiComponentFactory
virtual Reference< XInterface > SAL_CALL createInstanceWithContext(
@@ -462,6 +540,7 @@ OServiceManager::OServiceManager( Reference< XComponentContext > const & xContex
: OComponentHelper( m_mutex )
, m_xContext( xContext )
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
m_nUnloadingListenerId= rtl_addUnloadingListener( smgrUnloadingListener, this);
}
@@ -472,6 +551,8 @@ OServiceManager::~OServiceManager()
{
if( m_nUnloadingListenerId != 0)
rtl_removeUnloadingListener( m_nUnloadingListenerId );
+
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
// OComponentHelper
@@ -725,18 +806,9 @@ sal_Bool OServiceManager::supportsService(const OUString& ServiceName)
Sequence< OUString > OServiceManager::getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException)
{
- return getSupportedServiceNames_Static();
+ return smgr_getSupportedServiceNames();
}
-// OServiceManager_Static
-Sequence< OUString > OServiceManager::getSupportedServiceNames_Static()
- throw(::com::sun::star::uno::RuntimeException)
-{
- Sequence< OUString > aSNS( 2 );
- aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.MultiServiceFactory") );
- aSNS.getArray()[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.ServiceManager") );
- return aSNS;
-}
Reference< XInterface > OServiceManager::queryServiceFactory( const OUString& aServiceName )
{
@@ -976,13 +1048,10 @@ public:
throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
// XServiceInfo
- OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
- static OUString getImplementationName_Static() throw(::com::sun::star::uno::RuntimeException)
- { return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.ORegistryServiceManager") ); }
+ OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException)
+ { return regsmgr_getImplementationName(); }
- //sal_Bool supportsService(const OUString& ServiceName) throw( () );
Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
- static Sequence< OUString > getSupportedServiceNames_Static() throw(::com::sun::star::uno::RuntimeException);
// XMultiServiceFactory
Sequence< OUString > SAL_CALL getAvailableServiceNames() throw(::com::sun::star::uno::RuntimeException);
@@ -1043,6 +1112,7 @@ ORegistryServiceManager::ORegistryServiceManager( Reference< XComponentContext >
, m_init( false )
#endif
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
}
/**
@@ -1050,6 +1120,7 @@ ORegistryServiceManager::ORegistryServiceManager( Reference< XComponentContext >
*/
ORegistryServiceManager::~ORegistryServiceManager()
{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
// OComponentHelper
@@ -1285,28 +1356,12 @@ Sequence< OUString > ORegistryServiceManager::getAvailableServiceNames()
}
// XServiceInfo
-OUString ORegistryServiceManager::getImplementationName()
- throw(::com::sun::star::uno::RuntimeException)
-{
- return getImplementationName_Static();
-}
-
-// XServiceInfo
Sequence< OUString > ORegistryServiceManager::getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException)
{
- return getSupportedServiceNames_Static();
+ return regsmgr_getSupportedServiceNames();
}
-// ORegistryServiceManager_Static
-Sequence< OUString > ORegistryServiceManager::getSupportedServiceNames_Static()
- throw(::com::sun::star::uno::RuntimeException)
-{
- Sequence< OUString > aSNS( 2 );
- aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.MultiServiceFactory") );
- aSNS.getArray()[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.RegistryServiceManager") );
- return aSNS;
-}
// OServiceManager
Reference< XInterface > ORegistryServiceManager::queryServiceFactory(
@@ -1496,9 +1551,30 @@ extern "C" void SAL_CALL smgrUnloadingListener(void* id)
//##################################################################################################
//##################################################################################################
+using namespace stoc_smgr;
+
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ OServiceManager_CreateInstance, smgr_getImplementationName,
+ smgr_getSupportedServiceNames, createSingleComponentFactory,
+ &g_moduleCount.modCnt , 0
+ },
+ {
+ ORegistryServiceManager_CreateInstance, regsmgr_getImplementationName,
+ regsmgr_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 )
@@ -1509,73 +1585,12 @@ void SAL_CALL component_getImplementationEnvironment(
sal_Bool SAL_CALL component_writeInfo(
void * pServiceManager, void * pRegistryKey )
{
- if (pRegistryKey)
- {
- try
- {
- OUStringBuffer buf( 32 );
- // OServiceManager
- buf.append( (sal_Unicode)'/' );
- buf.append( stoc_smgr::OServiceManager::getImplementationName_Static() );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("/UNO/SERVICES") );
- Reference<XRegistryKey> xNewKey(
- reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( buf.makeStringAndClear() ) );
- const Sequence<OUString > & rSMnames =
- stoc_smgr::OServiceManager::getSupportedServiceNames_Static();
- const OUString * pNames = rSMnames.getConstArray();
- sal_Int32 nPos;
- for ( nPos = rSMnames.getLength(); nPos--; )
- xNewKey->createKey( pNames[nPos] );
-
- // ORegistryServiceManager
- buf.append( (sal_Unicode)'/' );
- buf.append( stoc_smgr::ORegistryServiceManager::getImplementationName_Static() );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("/UNO/SERVICES") );
- xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
- buf.makeStringAndClear() );
- const Sequence<OUString > & rRSMnames =
- stoc_smgr::ORegistryServiceManager::getSupportedServiceNames_Static();
- pNames = rRSMnames.getConstArray();
- for ( nPos = rRSMnames.getLength(); nPos--; )
- xNewKey->createKey( pNames[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 )
{
- Reference< XInterface > xFactory;
-
- if (stoc_smgr::OServiceManager::getImplementationName_Static().compareToAscii( pImplName ) == 0)
- {
- xFactory = createSingleComponentFactory(
- stoc_smgr::OServiceManager_CreateInstance,
- stoc_smgr::OServiceManager::getImplementationName_Static(),
- stoc_smgr::OServiceManager::getSupportedServiceNames_Static() );
- }
- else if (stoc_smgr::ORegistryServiceManager::getImplementationName_Static().compareToAscii( pImplName ) == 0)
- {
- xFactory = createSingleComponentFactory(
- stoc_smgr::ORegistryServiceManager_CreateInstance,
- stoc_smgr::ORegistryServiceManager::getImplementationName_Static(),
- stoc_smgr::ORegistryServiceManager::getSupportedServiceNames_Static() );
- }
-
- if (xFactory.is())
- {
- xFactory->acquire();
- return xFactory.get();
- }
- return 0;
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
}
}
-
-
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index 23607a40bef9..8df814323a46 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: simpleregistry.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2001-03-12 15:37:29 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -84,6 +84,9 @@
#ifndef _CPPUHELPER_IMPLBASE2_HXX_
#include <cppuhelper/implbase2.hxx>
#endif
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
+#include <cppuhelper/implementationentry.hxx>
+#endif
#ifndef _REGISTRY_REGISTRY_HXX_
#include <registry/registry.hxx>
@@ -106,6 +109,39 @@ using namespace rtl;
namespace stoc_simreg {
+rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
+
+static Sequence< OUString > simreg_getSupportedServiceNames()
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME));
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+OUString simreg_getImplementationName()
+{
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
+}
+
//*************************************************************************
// class RegistryKeyImpl the implenetation of interface XRegistryKey
//*************************************************************************
@@ -117,8 +153,7 @@ class RegistryKeyImpl;
class SimpleRegistryImpl : public WeakImplHelper2< XSimpleRegistry, XServiceInfo >
{
public:
- SimpleRegistryImpl( const Reference<XMultiServiceFactory> & rXSMgr,
- const Registry& rRegistry );
+ SimpleRegistryImpl( const Registry& rRegistry );
~SimpleRegistryImpl();
@@ -126,7 +161,6 @@ public:
virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException);
- static Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( );
// XSimpleRegistry
virtual OUString SAL_CALL getURL() throw(RuntimeException);
@@ -143,8 +177,6 @@ protected:
Mutex m_mutex;
OUString m_url;
Registry m_registry;
-
- Reference<XMultiServiceFactory> m_xSMgr;
};
@@ -995,24 +1027,23 @@ OUString SAL_CALL RegistryKeyImpl::getResolvedName( const OUString& aKeyName )
}
//*************************************************************************
-SimpleRegistryImpl::SimpleRegistryImpl( const Reference<XMultiServiceFactory> & rXSMgr,
- const Registry& rRegistry )
- : m_xSMgr(rXSMgr)
- , m_registry(rRegistry)
+SimpleRegistryImpl::SimpleRegistryImpl( const Registry& rRegistry )
+ : m_registry(rRegistry)
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
}
//*************************************************************************
SimpleRegistryImpl::~SimpleRegistryImpl()
{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
//*************************************************************************
OUString SAL_CALL SimpleRegistryImpl::getImplementationName( )
throw(RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- return OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) );
+ return simreg_getImplementationName();
}
//*************************************************************************
@@ -1032,15 +1063,7 @@ sal_Bool SAL_CALL SimpleRegistryImpl::supportsService( const OUString& ServiceNa
Sequence<OUString> SAL_CALL SimpleRegistryImpl::getSupportedServiceNames( )
throw(RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- return getSupportedServiceNames_Static();
-}
-
-//*************************************************************************
-Sequence<OUString> SAL_CALL SimpleRegistryImpl::getSupportedServiceNames_Static( )
-{
- OUString aName( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) );
- return Sequence< OUString >( &aName, 1 );
+ return simreg_getSupportedServiceNames();
}
//*************************************************************************
@@ -1178,7 +1201,7 @@ void SAL_CALL SimpleRegistryImpl::mergeKey( const OUString& aKeyName, const OUSt
}
//*************************************************************************
-Reference<XInterface> SAL_CALL SimpleRegistry_CreateInstance( const Reference<XMultiServiceFactory>& rSMgr )
+Reference<XInterface> SAL_CALL SimpleRegistry_CreateInstance( const Reference<XComponentContext>& xCtx )
{
Reference<XInterface> xRet;
RegistryLoader aLoader;
@@ -1187,7 +1210,7 @@ Reference<XInterface> SAL_CALL SimpleRegistry_CreateInstance( const Reference<XM
{
Registry reg(aLoader);
- XSimpleRegistry *pRegistry = (XSimpleRegistry*) new SimpleRegistryImpl(rSMgr, reg);
+ XSimpleRegistry *pRegistry = (XSimpleRegistry*) new SimpleRegistryImpl(reg);
if (pRegistry)
{
@@ -1200,9 +1223,25 @@ Reference<XInterface> SAL_CALL SimpleRegistry_CreateInstance( const Reference<XM
}
+using namespace stoc_simreg;
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ SimpleRegistry_CreateInstance, simreg_getImplementationName,
+ simreg_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 )
@@ -1213,51 +1252,13 @@ 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( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) );
-
- const Sequence< OUString > & rSNL =
- ::stoc_simreg::SimpleRegistryImpl::getSupportedServiceNames_Static();
- 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 (rtl_str_compare( pImplName, IMPLNAME ) == 0)
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) ),
- ::stoc_simreg::SimpleRegistry_CreateInstance,
- ::stoc_simreg::SimpleRegistryImpl::getSupportedServiceNames_Static() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
}
}
diff --git a/stoc/source/tdmanager/makefile.mk b/stoc/source/tdmanager/makefile.mk
index c0fd356e27f9..7a8331e1588c 100644
--- a/stoc/source/tdmanager/makefile.mk
+++ b/stoc/source/tdmanager/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.6 $
+# $Revision: 1.7 $
#
-# last change: $Author: dbo $ $Date: 2001-05-10 14:35:25 $
+# last change: $Author: jbu $ $Date: 2001-06-22 16:21:01 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -86,6 +86,7 @@ SHL1STDLIBS= \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(SALLIB)
+SHL1VERSIONMAP=$(TARGET).map
SHL1DEPN=
SHL1IMPLIB= i$(TARGET)
@@ -93,7 +94,6 @@ SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
diff --git a/stoc/source/tdmanager/tdmgr.cxx b/stoc/source/tdmanager/tdmgr.cxx
index be31bf42f277..8d88fb8a1565 100644
--- a/stoc/source/tdmanager/tdmgr.cxx
+++ b/stoc/source/tdmanager/tdmgr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tdmgr.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: pl $ $Date: 2001-05-11 11:31:37 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,6 +75,9 @@
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx>
#endif
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
+#include <cppuhelper/implementationentry.hxx>
+#endif
#include "lrucache.hxx"
@@ -115,10 +118,37 @@ static const sal_Int32 CACHE_SIZE = 512;
#define IMPLNAME "com.sun.star.comp.stoc.TypeDescriptionManager"
//--------------------------------------------------------------------------------------------------
-inline static Sequence< OUString > getSupportedServiceNames()
+static rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
+
+static Sequence< OUString > tdmgr_getSupportedServiceNames()
{
- OUString aName( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) );
- return Sequence< OUString >( &aName, 1 );
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME));
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+static OUString tdmgr_getImplementationName()
+{
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
}
typedef vector< Reference< XHierarchicalNameAccess > > ProviderVector;
@@ -134,7 +164,10 @@ class EventListenerImpl : public ImplHelper1< XEventListener >
public:
EventListenerImpl( ManagerImpl * pMgr )
: _pMgr( pMgr )
- {}
+ {
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ }
+ virtual ~EventListenerImpl();
// lifetime delegated to manager
virtual void SAL_CALL acquire() throw();
@@ -144,6 +177,11 @@ public:
virtual void SAL_CALL disposing( const EventObject & rEvt ) throw(::com::sun::star::uno::RuntimeException);
};
+EventListenerImpl::~EventListenerImpl()
+{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+}
+
//==================================================================================================
class ManagerImpl
: public WeakComponentImplHelper3< XServiceInfo, XSet, XHierarchicalNameAccess >
@@ -281,12 +319,14 @@ ManagerImpl::ManagerImpl(
, _aElements( nCacheSize )
, _bProviderInit( sal_False )
{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
}
//__________________________________________________________________________________________________
ManagerImpl::~ManagerImpl()
{
OSL_ENSURE( _aProviders.size() == 0, "### still providers left!" );
OSL_TRACE( "> TypeDescriptionManager shut down. <\n" );
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
}
//__________________________________________________________________________________________________
void ManagerImpl::disposing()
@@ -295,6 +335,7 @@ void ManagerImpl::disposing()
_bCaching = sal_False;
_aElements.clear();
_xContext.clear();
+ _aProviders.clear();
}
//__________________________________________________________________________________________________
inline void ManagerImpl::initProviders()
@@ -366,7 +407,7 @@ inline void ManagerImpl::initProviders()
OUString ManagerImpl::getImplementationName()
throw(::com::sun::star::uno::RuntimeException)
{
- return OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) );
+ return tdmgr_getImplementationName();
}
//__________________________________________________________________________________________________
sal_Bool ManagerImpl::supportsService( const OUString & rServiceName )
@@ -385,7 +426,7 @@ sal_Bool ManagerImpl::supportsService( const OUString & rServiceName )
Sequence< OUString > ManagerImpl::getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException)
{
- return stoc_tdmgr::getSupportedServiceNames();
+ return tdmgr_getSupportedServiceNames();
}
// XElementAccess
@@ -851,14 +892,28 @@ static Reference< XInterface > SAL_CALL ManagerImpl_create(
//##################################################################################################
//##################################################################################################
//##################################################################################################
+using namespace stoc_tdmgr;
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ ManagerImpl_create, tdmgr_getImplementationName,
+ tdmgr_getSupportedServiceNames, createSingleComponentFactory,
+ &g_moduleCount.modCnt , 0
+ },
+ { 0, 0, 0, 0, 0, 0 }
+};
extern "C"
{
-typedef struct _uno_Environment uno_Environment;
+sal_Bool SAL_CALL component_canUnload( TimeValue *pTime )
+{
+ return g_moduleCount.canUnload( &g_moduleCount , pTime );
+}
+
//==================================================================================================
void SAL_CALL component_getImplementationEnvironment(
- sal_Char const ** ppEnvTypeName, uno_Environment ** ppEnv )
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
@@ -866,52 +921,12 @@ 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( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) );
-
- const Sequence< OUString > & rSNL = stoc_tdmgr::getSupportedServiceNames();
- const OUString * pArray = rSNL.getConstArray();
- for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
- {
- xNewKey->createKey( pArray[nPos] );
- }
-
- return sal_True;
- }
- catch (InvalidRegistryException &)
- {
- OSL_ENSURE( 0, "### InvalidRegistryException!" );
- }
- }
- return sal_False;
+ return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
}
//==================================================================================================
void * SAL_CALL component_getFactory(
- sal_Char const * pImplName, void * pServiceManager, void * pRegistryKey )
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
- void * pRet = 0;
-
- if (0 == ::rtl_str_compare( pImplName, IMPLNAME ))
- {
- Reference< XSingleComponentFactory > xFactory( createSingleComponentFactory(
- stoc_tdmgr::ManagerImpl_create,
- OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) ),
- stoc_tdmgr::getSupportedServiceNames() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
}
}
-
-
diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx
index 47f4fba07629..afa05301a457 100644
--- a/stoc/source/typeconv/convert.cxx
+++ b/stoc/source/typeconv/convert.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: convert.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: pl $ $Date: 2001-05-11 11:33:34 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,6 +61,7 @@
#include <osl/diagnose.h>
#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/implbase2.hxx>
#include <typelib/typedescription.hxx>
@@ -86,6 +87,7 @@ using namespace com::sun::star::script;
using namespace com::sun::star::registry;
using namespace cppu;
using namespace rtl;
+using namespace osl;
#define SERVICENAME "com.sun.star.script.Converter"
#define IMPLNAME "com.sun.star.comp.stoc.TypeConverter"
@@ -93,6 +95,39 @@ using namespace rtl;
namespace stoc_tcv
{
+static rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
+
+static Sequence< OUString > tcv_getSupportedServiceNames()
+{
+ static Sequence < OUString > *pNames = 0;
+ if( ! pNames )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( !pNames )
+ {
+ static Sequence< OUString > seqNames(1);
+ seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME));
+ pNames = &seqNames;
+ }
+ }
+ return *pNames;
+}
+
+static OUString tcv_getImplementationName()
+{
+ static OUString *pImplName = 0;
+ if( ! pImplName )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pImplName )
+ {
+ static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
+ pImplName = &implName;
+ }
+ }
+ return *pImplName;
+}
+
const double MIN_DOUBLE = -DBL_MAX;
const double MAX_DOUBLE = DBL_MAX;
const double MIN_FLOAT = -FLT_MAX;
@@ -264,8 +299,8 @@ class TypeConverter_Impl : public WeakImplHelper2< XTypeConverter, XServiceInfo
throw( CannotConvertException );
public:
- static OUString getImplementationName_Static(void);
- static Sequence< OUString > getSupportedServiceNames_Static(void) throw( RuntimeException );
+ TypeConverter_Impl();
+ ~TypeConverter_Impl();
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() throw( RuntimeException );
@@ -277,16 +312,20 @@ public:
virtual Any SAL_CALL convertToSimpleType( const Any& aFrom, TypeClass aDestinationType ) throw( IllegalArgumentException, CannotConvertException, RuntimeException);
};
-// XServiceInfo
-OUString TypeConverter_Impl::getImplementationName() throw( RuntimeException )
+TypeConverter_Impl::TypeConverter_Impl()
{
- return getImplementationName_Static();
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
}
-// XServiceInfo Helper
-OUString TypeConverter_Impl::getImplementationName_Static(void)
+TypeConverter_Impl::~TypeConverter_Impl()
+{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+}
+
+// XServiceInfo
+OUString TypeConverter_Impl::getImplementationName() throw( RuntimeException )
{
- return OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
+ return tcv_getImplementationName();
}
// XServiceInfo
@@ -303,15 +342,7 @@ sal_Bool TypeConverter_Impl::supportsService(const OUString& ServiceName) throw(
// XServiceInfo
Sequence< OUString > TypeConverter_Impl::getSupportedServiceNames(void) throw( RuntimeException )
{
- return getSupportedServiceNames_Static();
-}
-
-// ORegistryServiceManager_Static
-Sequence< OUString > TypeConverter_Impl::getSupportedServiceNames_Static(void) throw( RuntimeException )
-{
- Sequence< OUString > aSNS( 1 );
- aSNS[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME ) );
- return aSNS;
+ return tcv_getSupportedServiceNames();
}
//--------------------------------------------------------------------------------------------------
@@ -926,10 +957,22 @@ Any TypeConverter_Impl::convertToSimpleType( const Any& rVal, TypeClass aDestina
//*************************************************************************
Reference< XInterface > SAL_CALL TypeConverter_Impl_CreateInstance(
- const Reference< XMultiServiceFactory > & rSMgr )
+ const Reference< XComponentContext > & rSMgr )
throw( RuntimeException )
{
- return (XWeak *)(OWeakObject *)new TypeConverter_Impl();
+ Reference< XInterface > rRet;
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ static WeakReference < XInterface > rwInstance;
+ rRet = rwInstance;
+
+ if( ! rRet.is() )
+ {
+ rRet = (OWeakObject *)new TypeConverter_Impl();
+ rwInstance = rRet;
+ }
+ }
+ return rRet;
}
}
@@ -938,10 +981,25 @@ Reference< XInterface > SAL_CALL TypeConverter_Impl_CreateInstance(
//##################################################################################################
//##################################################################################################
//##################################################################################################
+using namespace stoc_tcv;
+static struct ImplementationEntry g_entries[] =
+{
+ {
+ TypeConverter_Impl_CreateInstance, tcv_getImplementationName,
+ tcv_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 )
@@ -952,53 +1010,12 @@ 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( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) );
-
- const Sequence< OUString > & rSNL =
- stoc_tcv::TypeConverter_Impl::getSupportedServiceNames_Static();
-
- 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, IMPLNAME ) == 0)
- {
- Reference< XSingleServiceFactory > xFactory( createOneInstanceFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- stoc_tcv::TypeConverter_Impl_CreateInstance,
- stoc_tcv::TypeConverter_Impl::getSupportedServiceNames_Static() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
+ return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
}
}
-
-
diff --git a/stoc/test/makefile.mk b/stoc/test/makefile.mk
index 860597b88ce7..b190b171dfbd 100644
--- a/stoc/test/makefile.mk
+++ b/stoc/test/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.12 $
+# $Revision: 1.13 $
#
-# last change: $Author: dbo $ $Date: 2001-05-08 15:58:11 $
+# last change: $Author: jbu $ $Date: 2001-06-22 16:21:01 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -203,7 +203,7 @@ ALLIDLFILES:= testcorefl.idl language_binding.idl testintrosp.idl
# --- Target ------------------------------------------------
.IF "$(depend)" == ""
-ALL : unoheader \
+ALL : $(MISC)$/test_types_generated.flag \
ALLTAR
.ELSE
ALL: ALLDEP
@@ -216,7 +216,20 @@ CPPUMAKERFLAGS =
CPPUMAKERFLAGS = -L
.ENDIF
-FACTORYTYPES:=com.sun.star.lang.XSingleComponentFactory;com.sun.star.uno.XComponentContext;com.sun.star.container.XEnumeration;com.sun.star.lang.XComponent;com.sun.star.registry.XSimpleRegistry;com.sun.star.lang.XInitialization;com.sun.star.lang.XMultiServiceFactory;com.sun.star.loader.XImplementationLoader;com.sun.star.registry.XImplementationRegistration;com.sun.star.container.XSet;com.sun.star.lang.XSingleServiceFactory;com.sun.star.lang.XServiceInfo
+FACTORYTYPES:= -T com.sun.star.lang.XSingleComponentFactory \
+ -T com.sun.star.uno.XComponentContext \
+ -T com.sun.star.uno.XWeak \
+ -T com.sun.star.container.XEnumeration \
+ -T com.sun.star.lang.XComponent \
+ -T com.sun.star.registry.XSimpleRegistry \
+ -T com.sun.star.lang.XInitialization \
+ -T com.sun.star.lang.XMultiServiceFactory\
+ -T com.sun.star.loader.XImplementationLoader \
+ -T com.sun.star.registry.XImplementationRegistration \
+ -T com.sun.star.container.XSet \
+ -T com.sun.star.lang.XSingleServiceFactory\
+ -T com.sun.star.lang.XServiceInfo
+
TESTCOREFL:=ModuleC;ModuleC.XInterfaceA;ModuleC.XInterfaceB;ModuleA.XInterface1;com.sun.star.reflection.XIdlReflection;com.sun.star.reflection.XIdlField;com.sun.star.reflection.XIdlArray;com.sun.star.reflection.XIdlMethod;com.sun.star.reflection.XIdlClass;com.sun.star.beans.XPropertySet;com.sun.star.lang.XComponent;com.sun.star.container.XHierarchicalNameAccess
TESTIADAPTER:=com.sun.star.beans.XIntrospection;com.sun.star.beans.MethodConcept;com.sun.star.beans.XExactName;com.sun.star.lang.XTypeProvider;com.sun.star.uno.XAggregation;com.sun.star.script.XInvocationAdapterFactory;com.sun.star.script.XInvocation;com.sun.star.lang.XMultiServiceFactory;com.sun.star.registry.XSimpleRegistry;com.sun.star.lang.XInitialization;test.XLanguageBindingTest
TESTINTROSP:=ModuleA;ModuleA.XIntroTest;com.sun.star.beans.XPropertySet;com.sun.star.container.XIndexAccess;com.sun.star.container.XNameAccess;com.sun.star.beans.PropertyAttribute;com.sun.star.beans.PropertyConcept
@@ -229,10 +242,11 @@ $(BIN)$/stoctest.rdb: $(ALLIDLFILES)
+regmerge $@ / $(SOLARBINDIR)$/udkapi.rdb
touch $@
-unoheader: $(BIN)$/stoctest.rdb
- +cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TESTIADAPTER);$(FACTORYTYPES)" $(BIN)$/stoctest.rdb
+$(MISC)$/test_types_generated.flag : $(BIN)$/stoctest.rdb makefile.mk
+ -rm -f $(MISC)$/test_types_generated.flag
+ +cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) $(FACTORYTYPES) -T"$(TESTIADAPTER)" $(BIN)$/stoctest.rdb
+cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TESTCOREFL)" $(BIN)$/stoctest.rdb
+cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TESTINTROSP)" $(BIN)$/stoctest.rdb
+cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TESTCONV)" $(BIN)$/stoctest.rdb
+cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TESTPROXYFAC)" $(BIN)$/stoctest.rdb
-
+ touch $(MISC)$/test_types_generated.flag
diff --git a/stoc/test/testcorefl.cxx b/stoc/test/testcorefl.cxx
index 93692dec4eab..c60501aa2e3d 100644
--- a/stoc/test/testcorefl.cxx
+++ b/stoc/test/testcorefl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: testcorefl.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jl $ $Date: 2001-03-12 15:27:20 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -146,7 +146,6 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl )
TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstULong")) == aConstULong, "test_RegCoreReflection(): error 4m");
TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstFloat")) == aConstFloat, "test_RegCoreReflection(): error 4o");
TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstDouble")) == aConstDouble, "test_RegCoreReflection(): error 4q");
- TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstString")) == aConstString, "test_RegCoreReflection(): error 4s");
// Enums
@@ -247,7 +246,6 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl )
aStructC.aShort = aConstShort;
aStructC.aFloat = aConstFloat;
aStructC.aDouble = aConstDouble;
- aStructC.aString = aConstString;
aStructC.aInterfaceSeq = Sequence<Reference<XInterface > >();
Any aAny;
diff --git a/stoc/test/testcorefl.idl b/stoc/test/testcorefl.idl
index d5ecaa85fefc..85e722a9b469 100644
--- a/stoc/test/testcorefl.idl
+++ b/stoc/test/testcorefl.idl
@@ -2,9 +2,9 @@
*
* $RCSfile: testcorefl.idl,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dbo $ $Date: 2001-03-30 11:03:33 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -118,7 +118,6 @@ module ModuleC
// const unsigned hyper aConstUHyper = 3;
const float aConstFloat = 3.14;
const double aConstDouble = 3.14e-10;
- const string aConstString = "test";
interface XInterfaceA : com::sun::star::uno::XInterface
diff --git a/stoc/test/testintrosp.cxx b/stoc/test/testintrosp.cxx
index 2a54d05b3240..79edc32c54f8 100644
--- a/stoc/test/testintrosp.cxx
+++ b/stoc/test/testintrosp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: testintrosp.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: dbo $ $Date: 2001-05-15 13:13:28 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1608,8 +1608,10 @@ int __cdecl main( int argc, char * argv[] )
#endif
#endif
// ORealDynamicLoader::computeLibraryName( OUString::createFromAscii("corefl"), libName);
+ fprintf(stderr, "1\n" );
xImplReg->registerImplementation(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"),
libName, Reference< XSimpleRegistry >() );
+ fprintf(stderr, "2\n" );
Reference< XIdlReflection > xRefl( xMgr->createInstance( OUString::createFromAscii("com.sun.star.reflection.CoreReflection") ), UNO_QUERY );
OSL_ENSURE( xRefl.is(), "### no corereflection!" );
@@ -1624,12 +1626,16 @@ int __cdecl main( int argc, char * argv[] )
#endif
#endif
// ORealDynamicLoader::computeLibraryName( OUString::createFromAscii("insp"), libName);
+ fprintf(stderr, "3\n" );
xImplReg->registerImplementation(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"),
libName, Reference< XSimpleRegistry >() );
+ fprintf(stderr, "4\n" );
Reference< XIntrospection > xIntrosp( xMgr->createInstance( OUString::createFromAscii("com.sun.star.beans.Introspection") ), UNO_QUERY );
OSL_ENSURE( xRefl.is(), "### no corereflection!" );
+ fprintf(stderr, "before test_introsp\n" );
bSucc = test_introsp( xMgr, xRefl, xIntrosp );
+ fprintf(stderr, "after test_introsp\n" );
//bSucc = test_corefl( xRefl );
}
catch (Exception & rExc)
diff --git a/stoc/test/testloader.cxx b/stoc/test/testloader.cxx
index 8970ec4d689c..bc02ee83bbfc 100644
--- a/stoc/test/testloader.cxx
+++ b/stoc/test/testloader.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: testloader.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jl $ $Date: 2001-03-19 10:39:31 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,11 +69,12 @@
#include <osl/diagnose.h>
#endif
-
#include <com/sun/star/loader/XImplementationLoader.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
+#include <cppuhelper/implbase1.hxx>
#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
@@ -88,6 +89,7 @@ using namespace com::sun::star::loader;
using namespace com::sun::star::lang;
using namespace osl;
using namespace rtl;
+using namespace cppu;
#ifdef _DEBUG
#define TEST_ENSHURE(c, m) OSL_ENSURE(c, m)
@@ -95,6 +97,23 @@ using namespace rtl;
#define TEST_ENSHURE(c, m) OSL_VERIFY(c)
#endif
+class EmptyComponentContext : public WeakImplHelper1< XComponentContext >
+{
+public:
+ virtual Any SAL_CALL getValueByName( const OUString& Name )
+ throw (RuntimeException)
+ {
+ return Any();
+ }
+ virtual Reference< XMultiComponentFactory > SAL_CALL getServiceManager( )
+ throw (RuntimeException)
+ {
+ return Reference< XMultiComponentFactory > ();
+ }
+
+};
+
+
#if (defined UNX) || (defined OS2)
int main( int argc, char * argv[] )
#else
@@ -103,7 +122,7 @@ int _cdecl main( int argc, char * argv[] )
{
Reference<XInterface> xIFace;
- Module* pModule = new Module(OUString());
+ Module module;
#ifdef SAL_W32
OUString dllName( OUString::createFromAscii("cpld.dll") );
@@ -115,11 +134,11 @@ int _cdecl main( int argc, char * argv[] )
#endif
#endif
- if (pModule->load(dllName))
+ if (module.load(dllName))
{
// try to get provider from module
component_getFactoryFunc pCompFactoryFunc = (component_getFactoryFunc)
- pModule->getSymbol( OUString::createFromAscii(COMPONENT_GETFACTORY) );
+ module.getSymbol( OUString::createFromAscii(COMPONENT_GETFACTORY) );
if (pCompFactoryFunc)
{
@@ -135,11 +154,11 @@ int _cdecl main( int argc, char * argv[] )
TEST_ENSHURE( xIFace.is(), "testloader error1");
- Reference<XSingleServiceFactory> xFactory( Reference<XSingleServiceFactory>::query(xIFace) );
+ Reference<XSingleComponentFactory> xFactory( Reference<XSingleComponentFactory>::query(xIFace) );
TEST_ENSHURE( xFactory.is(), "testloader error2");
- Reference<XInterface> xLoader = xFactory->createInstance();
+ Reference<XInterface> xLoader = xFactory->createInstanceWithContext( new EmptyComponentContext );
TEST_ENSHURE( xLoader.is(), "testloader error3");
@@ -156,8 +175,6 @@ int _cdecl main( int argc, char * argv[] )
xLoader.clear();
xServInfo.clear();
- delete pModule;
-
printf("Test Dll ComponentLoader, OK!\n");
return(0);
diff --git a/stoc/test/testproxyfac.cxx b/stoc/test/testproxyfac.cxx
index 5872a5e27c9c..8d780fa2c1ca 100644
--- a/stoc/test/testproxyfac.cxx
+++ b/stoc/test/testproxyfac.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: testproxyfac.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2001-03-12 15:27:20 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -72,9 +72,11 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/registry/XSimpleRegistry.hpp>
#include <com/sun/star/registry/XImplementationRegistration.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/reflection/XProxyFactory.hpp>
#include <rtl/ustrbuf.hxx>
+#include <rtl/unload.h>
#include <stdio.h>
@@ -86,6 +88,7 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::reflection;
using namespace com::sun::star::lang;
using namespace com::sun::star::registry;
+using namespace com::sun::star::beans;
static sal_Int32 s_n = 0;
@@ -208,40 +211,48 @@ int main( int argc, char * argv[] )
int __cdecl main( int argc, char * argv[] )
#endif
{
- Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory(
- OUString( RTL_CONSTASCII_USTRINGPARAM("stoctest.rdb") ) ) );
-
sal_Bool bSucc = sal_False;
- try
{
- Reference< XImplementationRegistration > xImplReg(
- xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration") ) ), UNO_QUERY );
- OSL_ENSURE( xImplReg.is(), "### no impl reg!" );
+ Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("stoctest.rdb") ) ) );
+
+ try
+ {
+ Reference< XImplementationRegistration > xImplReg(
+ xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration") ) ), UNO_QUERY );
+ OSL_ENSURE( xImplReg.is(), "### no impl reg!" );
- OUString aLibName( OUString::createFromAscii(REG_PREFIX) );
- aLibName += OUString::createFromAscii("proxyfac");
+ OUString aLibName( OUString::createFromAscii(REG_PREFIX) );
+ aLibName += OUString::createFromAscii("proxyfac");
#ifndef OS2
- aLibName += OUString::createFromAscii(DLL_POSTFIX);
+ aLibName += OUString::createFromAscii(DLL_POSTFIX);
#endif
- xImplReg->registerImplementation(
- OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), aLibName, Reference< XSimpleRegistry >() );
+ xImplReg->registerImplementation(
+ OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), aLibName, Reference< XSimpleRegistry >() );
- Reference< XProxyFactory > xProxyFac( xMgr->createInstance( OUString::createFromAscii("com.sun.star.reflection.ProxyFactory") ), UNO_QUERY );
- OSL_ENSURE( xProxyFac.is(), "### no proxy factory!" );
+ Reference< XInterface > r = xMgr->createInstance( OUString::createFromAscii("com.sun.star.reflection.ProxyFactory") );
+ Reference< XProxyFactory > xProxyFac(r , UNO_QUERY );
+ OSL_ENSURE( xProxyFac.is(), "### no proxy factory!" );
- bSucc = test_proxyfac( xProxyFac );
- }
- catch (Exception & rExc)
- {
- OSL_ENSURE( sal_False, "### exception occured!" );
- OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
- OSL_TRACE( "### exception occured: " );
- OSL_TRACE( aMsg.getStr() );
- OSL_TRACE( "\n" );
- }
+ bSucc = test_proxyfac( xProxyFac );
+ }
+ catch (Exception & rExc)
+ {
+ OSL_ENSURE( sal_False, "### exception occured!" );
+ OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_TRACE( "### exception occured: " );
+ OSL_TRACE( aMsg.getStr() );
+ OSL_TRACE( "\n" );
+ }
- Reference< XComponent >( xMgr, UNO_QUERY )->dispose();
+ Reference< XPropertySet > rProps( xMgr , UNO_QUERY );
+ Any a = rProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) );
+ Reference< XComponent > rComp;
+ a >>= rComp;
+ rComp->dispose();
+ }
+ rtl_unloadUnusedModules(0);
printf( "testproxyfac %s !\n", (bSucc ? "succeeded" : "failed") );
return (bSucc ? 0 : -1);
}
diff --git a/stoc/test/testregistry.cxx b/stoc/test/testregistry.cxx
index cc105db7bdd9..31ea91b9cd00 100644
--- a/stoc/test/testregistry.cxx
+++ b/stoc/test/testregistry.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: testregistry.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: jl $ $Date: 2001-03-19 11:02:16 $
+ * last change: $Author: jbu $ $Date: 2001-06-22 16:21:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -187,7 +187,7 @@ void setLinkInDefaultRegistry(const OUString& linkName, const OUString& linkTarg
void test_SimpleRegistry()
{
Reference<XInterface> xIFace;
- Module* pModule = new Module(OUString());
+ Module module;
#ifdef SAL_W32
OUString dllName( OUString::createFromAscii("simreg.dll") );
@@ -199,11 +199,11 @@ void test_SimpleRegistry()
#endif
#endif
- if (pModule->load(dllName))
+ if (module.load(dllName))
{
// try to get provider from module
component_getFactoryFunc pCompFactoryFunc = (component_getFactoryFunc)
- pModule->getSymbol( OUString::createFromAscii(COMPONENT_GETFACTORY) );
+ module.getSymbol( OUString::createFromAscii(COMPONENT_GETFACTORY) );
if (pCompFactoryFunc)
{
@@ -450,8 +450,6 @@ void test_SimpleRegistry()
xReg.clear();
- delete pModule;
-
printf("Test SimpleRegistry, OK!\n");
}