diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-18 14:29:57 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-18 14:29:57 +0000 |
commit | b525a3115f54576017a576ff842dede5e2e3545d (patch) | |
tree | c534b95a9e572b63896467624293a5ca1887d3a3 /remotebridges/source | |
parent | 9399c662f36c385b0c705eb34e636a9aec450282 (diff) |
initial import
Diffstat (limited to 'remotebridges/source')
-rw-r--r-- | remotebridges/source/factory/brdgfctr.xml | 57 | ||||
-rw-r--r-- | remotebridges/source/factory/bridgefactory.cxx | 412 | ||||
-rw-r--r-- | remotebridges/source/factory/bridgeimpl.cxx | 263 | ||||
-rw-r--r-- | remotebridges/source/factory/bridgeimpl.hxx | 139 | ||||
-rw-r--r-- | remotebridges/source/factory/makefile.mk | 108 | ||||
-rw-r--r-- | remotebridges/source/unourl_resolver/makefile.mk | 127 | ||||
-rw-r--r-- | remotebridges/source/unourl_resolver/unourl_resolver.cxx | 269 | ||||
-rw-r--r-- | remotebridges/source/unourl_resolver/uuresolver.xml | 51 |
8 files changed, 1426 insertions, 0 deletions
diff --git a/remotebridges/source/factory/brdgfctr.xml b/remotebridges/source/factory/brdgfctr.xml new file mode 100644 index 000000000000..fde129c103c7 --- /dev/null +++ b/remotebridges/source/factory/brdgfctr.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "componentdescription.dtd"> + +<COMPONENTDESCRIPTION + xmlns:xlink="http://www.w3.org/1999/xlink/Namespace" > + +<Author> Joerg Budischewski </Author> + +<Name> com.sun.star.comp.remotebridges.BridgeFactory </Name> + +<Description> + This component allows + to establish a connection to another process. +</Description> + +<ModuleName> brdgfctr </ModuleName> + +<LoaderName> com.sun.star.loader.SharedLibrary </LoaderName> + +<Language> c++ </Language> + +<Status StatusValue="final"/> + +<SupportedService> com.sun.star.bridge.BridgeFactory </SupportedService> + +<ServiceDependency> ... </ServiceDependency> + +<ProjectBuildDependency> cppuhelper </ProjectBuildDependency> +<ProjectBuildDependency> cppu </ProjectBuildDependency> +<ProjectBuildDependency> vos </ProjectBuildDependency> +<ProjectBuildDependency> sal </ProjectBuildDependency> + +<RuntimeModuleDependency> cppuhelper2 </RuntimeModuleDependency> +<RuntimeModuleDependency> cppu2 </RuntimeModuleDependency> +<RuntimeModuleDependency> vos2 </RuntimeModuleDependency> +<RuntimeModuleDependency> sal2 </RuntimeModuleDependency> + + +<Type> com.sun.star.bridge.XBridgeFactory </Type> +<Type> com.sun.star.bridge.XInstanceProvider </Type> +<Type> com.sun.star.bridge.XBridge </Type> +<Type> com.sun.star.bridge.BridgeExistsException </Type> +<Type> com.sun.star.lang.XMultiServiceFactory </Type> +<Type> com.sun.star.lang.XSingleServiceFactory </Type> +<Type> com.sun.star.lang.XInitialization </Type> +<Type> com.sun.star.lang.XComponent </Type> +<Type> com.sun.star.lang.XServiceInfo </Type> +<Type> com.sun.star.lang.XTypeProvider </Type> +<Type> com.sun.star.lang.IllegalArgumentException </Type> +<Type> com.sun.star.lang.XInitialization </Type> +<Type> com.sun.star.registry.XRegistryKey </Type> +<Type> com.sun.star.uno.XWeak </Type> +<Type> com.sun.star.uno.TypeClass </Type> +<Type> com.sun.star.uno.XAggregation </Type> + +</COMPONENTDESCRIPTION> + diff --git a/remotebridges/source/factory/bridgefactory.cxx b/remotebridges/source/factory/bridgefactory.cxx new file mode 100644 index 000000000000..e58a4b99017a --- /dev/null +++ b/remotebridges/source/factory/bridgefactory.cxx @@ -0,0 +1,412 @@ +/************************************************************************* + * + * $RCSfile: bridgefactory.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:29:56 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include <hash_map> +#include <vector> + +#include <rtl/alloc.h> + +#include <uno/mapping.hxx> + +#include <bridges/remote/context.h> + +#include <cppuhelper/factory.hxx> +#include <cppuhelper/component.hxx> +#include <cppuhelper/typeprovider.hxx> + +#include <com/sun/star/lang/XInitialization.hpp> + +#include <com/sun/star/bridge/XBridgeFactory.hpp> + +#include <com/sun/star/registry/XRegistryKey.hpp> + +#include "bridgeimpl.hxx" + +using namespace ::rtl; +using namespace ::osl; +using namespace ::cppu; +using namespace ::std; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::bridge; +using namespace ::com::sun::star::connection; +using namespace ::com::sun::star::registry; + +#define SERVICE_NAME "com.sun.star.bridge.BridgeFactory" +#define IMPLEMENTATION_NAME "com.sun.star.comp.remotebridges.BridgeFactory" + +namespace remotebridges_factory +{ + struct hashOWString + { + size_t operator()(const OUString & s) const + { return s.hashCode(); } + }; + + struct equalOWString + { + sal_Bool operator()(const OUString & s1 , const OUString &s2 ) const + { + return s1 == s2; + } + }; + + typedef ::std::hash_map + < + OUString, + WeakReference< XBridge >, + hashOWString, + equalOWString + > BridgeHashMap; + + + class OBridgeFactory : + public MyMutex, + public OComponentHelper, + public XBridgeFactory + { + public: + OBridgeFactory( const Reference < XMultiServiceFactory > &rSMgr ); + + public: // XInterface + ::com::sun::star::uno::Any SAL_CALL + queryInterface( const ::com::sun::star::uno::Type & aType ); + + void SAL_CALL acquire() + { OComponentHelper::acquire(); } + void SAL_CALL release() + { OComponentHelper::release(); } + + public: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::bridge::XBridge > SAL_CALL + createBridge( + const ::rtl::OUString& sName, + const ::rtl::OUString& sProtocol, + const ::com::sun::star::uno::Reference< ::com::sun::star::connection::XConnection >& aConnection, + const ::com::sun::star::uno::Reference< ::com::sun::star::bridge::XInstanceProvider >& anInstanceProvider ) + throw(::com::sun::star::bridge::BridgeExistsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::bridge::XBridge > SAL_CALL + getBridge( const ::rtl::OUString& sName ) + throw(::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::bridge::XBridge > > SAL_CALL + getExistingBridges( ) throw(::com::sun::star::uno::RuntimeException); + + public: //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL + getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL + getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + + private: + Reference < XMultiServiceFactory > m_rSMgr; + BridgeHashMap m_mapBridge; + }; + + OBridgeFactory::OBridgeFactory( const Reference < XMultiServiceFactory > &rSMgr ) : + OComponentHelper( m_mutex ), + m_rSMgr( rSMgr ) + { + + } + + Any OBridgeFactory::queryInterface( const Type &aType ) + { + Any a = ::cppu::queryInterface( + aType , + ( XBridgeFactory * ) this ); + if( a.hasValue() ) + { + return a; + } + + return OComponentHelper::queryInterface( aType ); + + } + + Reference< XBridge > OBridgeFactory::createBridge( + const OUString& sName, + const OUString& sProtocol, + const Reference< XConnection >& aConnection, + const Reference< XInstanceProvider >& anInstanceProvider ) + throw(::com::sun::star::bridge::BridgeExistsException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException) + { + OUString sService = OUString::createFromAscii( "com.sun.star.bridge.Bridge." ); + OUString sProtocolName = sProtocol; + sal_Int32 nIndex = sProtocol.indexOf( (sal_Unicode)',' ); + if( nIndex > 0 ) + { + sProtocolName = sProtocol.copy( 0 , nIndex ); + } + sService += sProtocolName; + + Reference < XInterface > rXInterface = m_rSMgr->createInstance ( sService ); + Reference < XInitialization > rInit = Reference< XInitialization > ( + rXInterface, + UNO_QUERY ); + + Reference < XBridge > rBridge( rInit , UNO_QUERY ); + if( rInit.is() && rBridge.is() ) + { + Sequence < Any > seqAny( 4 ); + seqAny.getArray()[0] <<= sName; + seqAny.getArray()[1] <<= sProtocol; + seqAny.getArray()[2] <<= aConnection; + seqAny.getArray()[3] <<= anInstanceProvider; + + // let the Exceptions fly .... + rInit->initialize( seqAny ); + } + else + { + throw IllegalArgumentException(); + } + + if( sName.getLength() ) + { + MutexGuard guard( m_mutex ); + // put the bridge into the hashmap + m_mapBridge[ sName ] = rBridge; + } + return rBridge; + } + + Reference< XBridge > OBridgeFactory::getBridge( const ::rtl::OUString& sName ) + throw(::com::sun::star::uno::RuntimeException ) + + { + MutexGuard guard( m_mutex ); + BridgeHashMap::iterator ii = m_mapBridge.find( sName ); + + Reference < XBridge > rBridge; + + if( ii != m_mapBridge.end() ) + { + rBridge = (*ii).second; + if( ! rBridge.is() ) + { + m_mapBridge.erase( ii ); + } + } + + if( ! rBridge.is() ) + { + // try to get it via the C-Context + remote_Context * pRemoteC = remote_getContext( sName.pData ); + + if( pRemoteC ) + { + rBridge = Reference < XBridge > ((XBridge *) new OBridge( pRemoteC ) ); + pRemoteC->aBase.release( (uno_Context * )pRemoteC ); + m_mapBridge[ sName ] = rBridge; + } + } + return rBridge; + } + + Sequence< Reference< XBridge > > OBridgeFactory::getExistingBridges( ) + throw(::com::sun::star::uno::RuntimeException) + { + MutexGuard guard( m_mutex ); + + sal_Int32 nCount; + + rtl_uString **ppName = remote_getContextList( + &nCount, + rtl_allocateMemory ); + + Sequence < Reference < XBridge > > seq( nCount ); + if( nCount ) + { + + for( sal_Int32 i = 0; + i < nCount ; + i ++ ) + { + seq.getArray()[i] = getBridge( OUString( ppName[i]) ); + rtl_uString_release( ppName[i] ); + } + rtl_freeMemory( ppName ); + } + + return seq; + } + + // XTypeProvider + Sequence< Type > SAL_CALL OBridgeFactory::getTypes(void) throw( RuntimeException ) + { + static OTypeCollection *pCollection = 0; + if( ! pCollection ) + { + MutexGuard guard( Mutex::getGlobalMutex() ); + if( ! pCollection ) + { + static OTypeCollection collection( + getCppuType( (Reference< XBridgeFactory > * ) 0 ), + OComponentHelper::getTypes() ); + pCollection = &collection; + } + } + return (*pCollection).getTypes(); + } + + Sequence< sal_Int8 > SAL_CALL OBridgeFactory::getImplementationId( ) throw( RuntimeException) + { + static OImplementationId *pId = 0; + if( ! pId ) + { + MutexGuard guard( Mutex::getGlobalMutex() ); + if( ! pId ) + { + static OImplementationId id( sal_False ); + pId = &id; + } + } + return (*pId).getImplementationId(); + } + + + + Reference< XInterface > SAL_CALL CreateInstance( const Reference< XMultiServiceFactory > &r) + { + return Reference < XInterface > (( OWeakObject * ) new OBridgeFactory( r ) ); + } + + Sequence< OUString > getSupportedServiceNames() + { + static Sequence < OUString > *pNames = 0; + if( ! pNames ) + { + MutexGuard guard( Mutex::getGlobalMutex() ); + if( !pNames ) + { + static Sequence< OUString > seqNames(1); + seqNames.getArray()[0] = OUString::createFromAscii( SERVICE_NAME ); + pNames = &seqNames; + } + } + return *pNames; + } +} + +using namespace remotebridges_factory; + +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 ) +{ + if (pRegistryKey) + { + try + { + Reference< XRegistryKey > xNewKey( + reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( + OUString::createFromAscii("/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) ); + + const Sequence< OUString > & rSNL = getSupportedServiceNames(); + const OUString * pArray = rSNL.getConstArray(); + for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) + xNewKey->createKey( pArray[nPos] ); + + return sal_True; + } + catch (InvalidRegistryException &) + { + OSL_ENSHURE( sal_False, "### InvalidRegistryException!" ); + } + } + return sal_False; +} +//================================================================================================== +void * SAL_CALL component_getFactory( + const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) +{ + void * pRet = 0; + + if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0) + { + Reference< XSingleServiceFactory > xFactory( createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + OUString::createFromAscii( pImplName ), CreateInstance, getSupportedServiceNames() ) ); + + if (xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} +} + + + + diff --git a/remotebridges/source/factory/bridgeimpl.cxx b/remotebridges/source/factory/bridgeimpl.cxx new file mode 100644 index 000000000000..1aaac99a00d0 --- /dev/null +++ b/remotebridges/source/factory/bridgeimpl.cxx @@ -0,0 +1,263 @@ +/************************************************************************* + * + * $RCSfile: bridgeimpl.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:29:56 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "bridgeimpl.hxx" + +using namespace ::rtl; +using namespace ::osl; +using namespace ::cppu; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::bridge; + +namespace remotebridges_factory { + + + OBridge::OBridge( remote_Context *pContext ) : + OComponentHelper( m_mutex ), + m_pContext( pContext ) + { + remote_DisposingListener::acquire = thisAcquire; + remote_DisposingListener::release = thisRelease; + remote_DisposingListener::disposing = thisDisposing; + + m_pContext->aBase.acquire( (uno_Context*)m_pContext ); + m_pContext->addDisposingListener( m_pContext, ( remote_DisposingListener * ) this ); + } + + OBridge::~OBridge() + { + if( m_pContext ) + { + m_pContext->aBase.release( (uno_Context * ) m_pContext ); + } + } + + ::com::sun::star::uno::Any OBridge::queryInterface( const ::com::sun::star::uno::Type & aType ) + { + Any a = ::cppu::queryInterface( + aType , + SAL_STATIC_CAST( XBridge * , this ), + SAL_STATIC_CAST( XTypeProvider * , this ) ); + if( a.hasValue() ) + { + return a; + } + + return OComponentHelper::queryInterface( aType ); + } + + void OBridge::disposing() + { + if( m_pContext ) + { + m_pContext->removeDisposingListener( m_pContext , ( remote_DisposingListener * )this); + + uno_Environment *pEnvRemote = 0; + if( m_pContext->m_pConnection ) + { + OUString sProtocol = OUString( m_pContext->m_pProtocol ).getToken( 0 , ',' ); + uno_getEnvironment( &pEnvRemote , sProtocol.pData , m_pContext ); + OSL_ASSERT( pEnvRemote ); + } + else + { + // within disposing from the context, no further dispose necessary ! + } + + if( pEnvRemote ) + { + pEnvRemote->dispose( pEnvRemote ); + pEnvRemote->release( pEnvRemote ); + pEnvRemote = 0; + } + + m_pContext->aBase.release( (uno_Context*)m_pContext ); + m_pContext = 0; + } + + } + + + Reference< XInterface > OBridge::getInstance( const ::rtl::OUString& sInstanceName ) + throw(::com::sun::star::uno::RuntimeException) + { + + Reference < XInterface > rReturn; + + if( m_pContext && m_pContext->getRemoteInstance ) + { + // get the appropriate remote environment + OUString sRemote( RTL_CONSTASCII_USTRINGPARAM( UNO_LB_REMOTE )); + uno_Environment *pEnvRemote = 0; + uno_getEnvironment( &pEnvRemote , sRemote.pData , m_pContext ); + + OSL_ASSERT( pEnvRemote ); + + Type type = getCppuType( (Reference < XInterface > * ) 0 ); + + remote_Interface *pRemoteI = 0; + m_pContext->getRemoteInstance( + pEnvRemote, + &pRemoteI, + sInstanceName.pData, + type.getTypeLibType() ); + + + if( pRemoteI ) + { + // got an interface ! + OUString sCppu ( RTL_CONSTASCII_USTRINGPARAM( CPPU_CURRENT_LANGUAGE_BINDING_NAME )); + uno_Environment *pEnvCpp =0; + uno_getEnvironment( &pEnvCpp , sCppu.pData , 0 ); + + Mapping map( pEnvRemote , pEnvCpp ); + + XInterface * pCppI = ( XInterface * ) map.mapInterface( pRemoteI,type ); + + rReturn = Reference<XInterface > ( pCppI ); + + pCppI->release( ); + + pRemoteI->release( pRemoteI ); + pEnvCpp->release( pEnvCpp ); + } + + pEnvRemote->release( pEnvRemote ); + } + return rReturn; + } + + ::rtl::OUString SAL_CALL OBridge::getName( ) + throw(::com::sun::star::uno::RuntimeException) + + { + return OUString( m_pContext->m_pName ); + } + + ::rtl::OUString OBridge::getDescription( ) + throw(::com::sun::star::uno::RuntimeException) + { + return OUString( m_pContext->m_pDescription ); + } + + // XTypeProvider + Sequence< Type > SAL_CALL OBridge::getTypes(void) throw( RuntimeException ) + { + static OTypeCollection *pCollection = 0; + if( ! pCollection ) + { + MutexGuard guard( Mutex::getGlobalMutex() ); + if( ! pCollection ) + { + static OTypeCollection collection( + getCppuType( (Reference< XTypeProvider> * )0), + getCppuType( (Reference< XBridge > * ) 0 ), + OComponentHelper::getTypes() ); + pCollection = &collection; + } + } + + return (*pCollection).getTypes(); + } + + Sequence< sal_Int8 > SAL_CALL OBridge::getImplementationId( ) throw( RuntimeException) + { + static OImplementationId *pId = 0; + if( ! pId ) + { + MutexGuard guard( Mutex::getGlobalMutex() ); + if( ! pId ) + { + static OImplementationId id( sal_False ); + pId = &id; + } + } + return (*pId).getImplementationId(); + } + + //---------------------- + // static methods + //---------------------- + void OBridge::thisAcquire( remote_DisposingListener *p ) + { + OBridge *m = (OBridge * ) p; + m->acquire(); + } + + void OBridge::thisRelease( remote_DisposingListener *p ) + { + OBridge *m = (OBridge * ) p; + m->release(); + } + + void OBridge::thisDisposing( remote_DisposingListener * p, + rtl_uString *pString ) + { + OBridge *m = (OBridge * ) p; + m->dispose(); + } + + +} + + + diff --git a/remotebridges/source/factory/bridgeimpl.hxx b/remotebridges/source/factory/bridgeimpl.hxx new file mode 100644 index 000000000000..03a144a23358 --- /dev/null +++ b/remotebridges/source/factory/bridgeimpl.hxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * $RCSfile: bridgeimpl.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:29:56 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <osl/mutex.hxx> +#include <osl/diagnose.h> + +#include <uno/mapping.hxx> +#include <uno/environment.h> + +#include <bridges/remote/context.h> +#include <bridges/remote/remote.h> + +#include <cppuhelper/factory.hxx> +#include <cppuhelper/component.hxx> +#include <cppuhelper/typeprovider.hxx> + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XInitialization.hpp> + +#include <com/sun/star/bridge/XBridge.hpp> +#include <com/sun/star/bridge/XInstanceProvider.hpp> + +namespace remotebridges_factory { + + struct MyMutex + { + ::osl::Mutex m_mutex; + }; + + class OBridge : + public MyMutex, + public remote_DisposingListener, + public ::com::sun::star::bridge::XBridge, + public ::cppu::OComponentHelper + { + public: + OBridge( remote_Context *pContext ); + ~OBridge(); + + // XInterface + public: + ::com::sun::star::uno::Any SAL_CALL + queryInterface( const ::com::sun::star::uno::Type & aType ); + + void SAL_CALL acquire() + { OComponentHelper::acquire(); } + void SAL_CALL release() + { OComponentHelper::release(); } + + public: + virtual void SAL_CALL disposing(); // called by OComponentHelper + + public: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + getInstance( const ::rtl::OUString& sInstanceName ) + throw(::com::sun::star::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL getName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDescription( ) + throw(::com::sun::star::uno::RuntimeException); + + public: + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL + getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL + getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + + public: + static void SAL_CALL thisAcquire( remote_DisposingListener * ); + static void SAL_CALL thisRelease( remote_DisposingListener * ); + static void SAL_CALL thisDisposing( remote_DisposingListener * , + rtl_uString * pBridgeName ); + + public: + remote_Context *m_pContext; + ::rtl::OString m_sName; + ::rtl::OString m_sDescription; + }; +} + diff --git a/remotebridges/source/factory/makefile.mk b/remotebridges/source/factory/makefile.mk new file mode 100644 index 000000000000..1101522fab67 --- /dev/null +++ b/remotebridges/source/factory/makefile.mk @@ -0,0 +1,108 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 15:29:56 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=remotebridges +TARGET=brdgfctr +ENABLE_EXCEPTIONS=TRUE +NO_BSYMBOLIC=TRUE +COMP1TYPELIST=$(TARGET) +COMPRDB=$(SOLARBINDIR)$/applicat.rdb + +# --- Settings ----------------------------------------------------- +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk +# ------------------------------------------------------------------ +UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb +UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb +UNOUCROUT=$(OUT)$/inc$/factory +INCPRE+= $(UNOUCROUT) +UNOTYPES=$($(TARGET)_XML2CMPTYPES) + +SLOFILES= \ + $(SLO)$/bridgefactory.obj\ + $(SLO)$/bridgeimpl.obj \ + $(SLO)$/$(COMP1TYPELIST)_description.obj + + +SHL1TARGET= $(TARGET) + +SHL1STDLIBS= \ + $(SALLIB) \ + $(VOSLIB) \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(RMCXTLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(TARGET) +SHL1LIBS= $(SLB)$/$(TARGET).lib +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1EXPORTFILE= exports.dxp + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/remotebridges/source/unourl_resolver/makefile.mk b/remotebridges/source/unourl_resolver/makefile.mk new file mode 100644 index 000000000000..8c6815c3027e --- /dev/null +++ b/remotebridges/source/unourl_resolver/makefile.mk @@ -0,0 +1,127 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 15:29:57 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* +PRJ=..$/.. + +PRJNAME=remotebridges +TARGET=uuresolver +USE_DEFFILE=TRUE +NO_BSYMBOLIC=TRUE +ENABLE_EXCEPTIONS=TRUE +COMP1TYPELIST=$(TARGET) + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# ------------------------------------------------------------------ +UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb +UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb +UNOUCROUT=$(OUT)$/inc$/uuresolver +INCPRE+= $(UNOUCROUT) +UNOTYPES=$($(TARGET)_XML2CMPTYPES) + + +UNOTYPES= \ + com.sun.star.uno.TypeClass \ + com.sun.star.lang.XTypeProvider \ + com.sun.star.lang.XServiceInfo \ + com.sun.star.lang.XSingleServiceFactory \ + com.sun.star.lang.XMultiServiceFactory \ + com.sun.star.lang.XComponent \ + com.sun.star.registry.XRegistryKey \ + com.sun.star.connection.XConnector \ + com.sun.star.bridge.XBridgeFactory \ + com.sun.star.bridge.XUnoUrlResolver \ + com.sun.star.uno.XAggregation \ + com.sun.star.uno.XWeak + +SLOFILES= \ + $(SLO)$/unourl_resolver.obj \ + $(SLO)$/$(COMP1TYPELIST)_description.obj + +# NETBSD: somewhere we have to instantiate the static data members. +# NETBSD-1.2.1 doesn't know about weak symbols so the default mechanism for GCC won't work. +# SCO and MACOSX: the linker does know about weak symbols, but we can't ignore multiple defined symbols +.IF "$(OS)"=="NETBSD" || "$(OS)"=="SCO" || "$(OS)$(COM)"=="OS2GCC" || "$(OS)"=="MACOSX" +SLOFILES+=$(SLO)$/staticmb.obj +.ENDIF + +SHL1TARGET= $(TARGET) + +SHL1STDLIBS= \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(TARGET) +SHL1LIBS= $(SLB)$/$(TARGET).lib +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1EXPORTFILE= exports.dxp + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/remotebridges/source/unourl_resolver/unourl_resolver.cxx b/remotebridges/source/unourl_resolver/unourl_resolver.cxx new file mode 100644 index 000000000000..c21601305e11 --- /dev/null +++ b/remotebridges/source/unourl_resolver/unourl_resolver.cxx @@ -0,0 +1,269 @@ +/************************************************************************* + * + * $RCSfile: unourl_resolver.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:29:57 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +// #define TRACE(x) OSL_TRACE(x) +#define TRACE(x) + +#include <osl/diagnose.h> +#include <osl/mutex.hxx> +#include <cppuhelper/factory.hxx> +#include <cppuhelper/implbase2.hxx> + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <com/sun/star/connection/XConnector.hpp> +#include <com/sun/star/bridge/XBridgeFactory.hpp> +#include <com/sun/star/bridge/XUnoUrlResolver.hpp> + +using namespace cppu; +using namespace rtl; +using namespace osl; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::connection; +using namespace com::sun::star::bridge; +using namespace com::sun::star::registry; + +#define SERVICENAME "com.sun.star.bridge.UnoUrlResolver" +#define IMPLNAME "com.sun.star.comp.bridge.UnoUrlResolver" + +namespace unourl_resolver +{ + +//-------------------------------------------------------------------------------------------------- +inline static Sequence< OUString > getSupportedServiceNames() +{ + OUString aName( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) ); + return Sequence< OUString >( &aName, 1 ); +} + +//================================================================================================== +class ResolverImpl : public WeakImplHelper2< XServiceInfo, XUnoUrlResolver > +{ + Reference< XMultiServiceFactory > _xSMgr; + +public: + ResolverImpl( const Reference< XMultiServiceFactory > & xSMgr ); + virtual ~ResolverImpl(); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XUnoUrlResolver + virtual Reference< XInterface > SAL_CALL resolve( const OUString & rUnoUrl ) + throw (NoConnectException, ConnectionSetupException, RuntimeException); +}; + +//################################################################################################## + +//__________________________________________________________________________________________________ +ResolverImpl::ResolverImpl( const Reference< XMultiServiceFactory > & xSMgr ) + : _xSMgr( xSMgr ) +{ +} +//__________________________________________________________________________________________________ +ResolverImpl::~ResolverImpl() +{ +} + +// XServiceInfo +//__________________________________________________________________________________________________ +OUString ResolverImpl::getImplementationName() + throw(::com::sun::star::uno::RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) ); +} +//__________________________________________________________________________________________________ +sal_Bool ResolverImpl::supportsService( const OUString & rServiceName ) + throw(::com::sun::star::uno::RuntimeException) +{ + const Sequence< OUString > & rSNL = getSupportedServiceNames(); + const OUString * pArray = rSNL.getConstArray(); + for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) + { + if (pArray[nPos] == rServiceName) + return sal_True; + } + return sal_False; +} +//__________________________________________________________________________________________________ +Sequence< OUString > ResolverImpl::getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException) +{ + return unourl_resolver::getSupportedServiceNames(); +} + +// XUnoUrlResolver +//__________________________________________________________________________________________________ +Reference< XInterface > ResolverImpl::resolve( const OUString & rUnoUrl ) + throw (NoConnectException, ConnectionSetupException, RuntimeException) +{ + if (rUnoUrl.getTokenCount( ';' ) != 3 || rUnoUrl.getLength() < 10 || + !rUnoUrl.copy( 0, 4 ).equalsIgnoreCase( OUString( RTL_CONSTASCII_USTRINGPARAM("uno:") ) )) + { + throw ConnectionSetupException( OUString( RTL_CONSTASCII_USTRINGPARAM("illegal uno url given!" ) ), Reference< XInterface >() ); + } + + Reference< XConnector > xConnector( _xSMgr->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Connector") ) ), UNO_QUERY ); + if (! xConnector.is()) + throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM("no connector!" ) ), Reference< XInterface >() ); + + OUString aConnectDescr( rUnoUrl.getToken( 0 ).copy( 4 ) ); // uno:CONNECTDESCR;iiop;InstanceName + OUString aInstanceName( rUnoUrl.getToken( 2 ) ); + + Reference< XConnection > xConnection( xConnector->connect( aConnectDescr ) ); + + Reference< XBridgeFactory > xBridgeFactory( _xSMgr->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.BridgeFactory") ) ), UNO_QUERY ); + if (! xBridgeFactory.is()) + throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM("no bridge factory!" ) ), Reference< XInterface >() ); + + // bridge + Reference< XBridge > xBridge( xBridgeFactory->createBridge( + OUString(), rUnoUrl.getToken( 1 ), + xConnection, Reference< XInstanceProvider >() ) ); + + Reference< XInterface > xRet( xBridge->getInstance( aInstanceName ) ); + +// if (! xRet.is()) // dispose bridge manually +// { +// Reference< XComponent > xComp( xBridge, UNO_QUERY ); +// if (xComp.is()) +// xComp->dispose(); +// } + + return xRet; +} + +//================================================================================================== +static Reference< XInterface > SAL_CALL ResolverImpl_create( const Reference< XMultiServiceFactory > & xSMgr ) +{ + return Reference< XInterface >( *new ResolverImpl( xSMgr ) ); +} + +} + + +//################################################################################################## +//################################################################################################## +//################################################################################################## + + +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 ) +{ + if (pRegistryKey) + { + try + { + Reference< XRegistryKey > xNewKey( + reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( + OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) ); + xNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) ) ); + + return sal_True; + } + catch (InvalidRegistryException &) + { + OSL_ENSHURE( sal_False, "### InvalidRegistryException!" ); + } + } + return sal_False; +} +//================================================================================================== +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( createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) ), + unourl_resolver::ResolverImpl_create, + unourl_resolver::getSupportedServiceNames() ) ); + + if (xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} +} + + diff --git a/remotebridges/source/unourl_resolver/uuresolver.xml b/remotebridges/source/unourl_resolver/uuresolver.xml new file mode 100644 index 000000000000..82645f838d2e --- /dev/null +++ b/remotebridges/source/unourl_resolver/uuresolver.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "componentdescription.dtd"> + +<COMPONENTDESCRIPTION + xmlns:xlink="http://www.w3.org/1999/xlink/Namespace" > + +<Author> Daniel Boelzle </Author> + +<Name> com.sun.star.comp.bridge.UnoUrlResolver </Name> + +<Description> + This component allows + to retrieve an object reference from another process. +</Description> + +<ModuleName> uuresolver </ModuleName> + +<LoaderName> com.sun.star.loader.SharedLibrary </LoaderName> + +<Language> c++ </Language> + +<Status StatusValue="final"/> + +<SupportedService> com.sun.star.bridge.UnoUrlResolver </SupportedService> + +<ServiceDependency> ... </ServiceDependency> + +<ProjectBuildDependency> cppuhelper </ProjectBuildDependency> +<ProjectBuildDependency> cppu </ProjectBuildDependency> +<ProjectBuildDependency> sal </ProjectBuildDependency> + +<RuntimeModuleDependency> cppuhelper2 </RuntimeModuleDependency> +<RuntimeModuleDependency> cppu2 </RuntimeModuleDependency> +<RuntimeModuleDependency> sal2 </RuntimeModuleDependency> + + +<Type> com.sun.star.uno.TypeClass </Type> +<Type> com.sun.star.lang.XTypeProvider </Type> +<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.XComponent </Type> +<Type> com.sun.star.registry.XRegistryKey </Type> +<Type> com.sun.star.connection.XConnector </Type> +<Type> com.sun.star.bridge.XBridgeFactory </Type> +<Type> com.sun.star.bridge.XUnoUrlResolver </Type> +<Type> com.sun.star.uno.XAggregation </Type> +<Type> com.sun.star.uno.XWeak </Type> + +</COMPONENTDESCRIPTION> + |