diff options
author | Stephan Bergmann <sb@openoffice.org> | 2002-10-04 08:41:05 +0000 |
---|---|---|
committer | Stephan Bergmann <sb@openoffice.org> | 2002-10-04 08:41:05 +0000 |
commit | 762f2cf5d8c4c4db1938185a0fdff7989542db82 (patch) | |
tree | 490cf0bf7eaa08fa9ab822d6fe465341c11eda72 /remotebridges | |
parent | 8f3c1275f5121bb469e7bef4dbe011341ec8755b (diff) |
#99853# Adapted to new cppuhelper/unourl.hxx.
Diffstat (limited to 'remotebridges')
-rw-r--r-- | remotebridges/source/factory/bridgefactory.cxx | 23 | ||||
-rw-r--r-- | remotebridges/source/unourl_resolver/unourl_resolver.cxx | 34 |
2 files changed, 26 insertions, 31 deletions
diff --git a/remotebridges/source/factory/bridgefactory.cxx b/remotebridges/source/factory/bridgefactory.cxx index e0659aa2da16..ac02c6c74f6a 100644 --- a/remotebridges/source/factory/bridgefactory.cxx +++ b/remotebridges/source/factory/bridgefactory.cxx @@ -2,9 +2,9 @@ * * $RCSfile: bridgefactory.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: hr $ $Date: 2001-09-11 13:51:37 $ + * last change: $Author: sb $ $Date: 2002-10-04 09:40:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,6 +70,8 @@ #include <cppuhelper/implementationentry.hxx> #include <cppuhelper/component.hxx> #include <cppuhelper/typeprovider.hxx> +#include "cppuhelper/unourl.hxx" +#include "rtl/malformeduriexception.hxx" #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -253,11 +255,14 @@ namespace remotebridges_factory { init(); OUString sService; - OUString sProtocolName = sProtocol.toAsciiLowerCase(); - sal_Int32 nIndex = sProtocol.indexOf( (sal_Unicode)',' ); - if( nIndex > 0 ) + OUString sProtocolName; + try { - sProtocolName = sProtocol.copy( 0 , nIndex ); + sProtocolName = cppu::UnoUrlDescriptor(sProtocol).getName(); + } + catch (rtl::MalformedUriException &) + { + OSL_ENSURE(false, "MalformedUriException"); } ServiceHashMap::iterator ii = m_mapProtocolToService.find( sProtocolName ); if( ii != m_mapProtocolToService.end() ) @@ -268,12 +273,6 @@ namespace remotebridges_factory { // fallback to the old solution, deprecated, should be removed ! 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; } return sService; diff --git a/remotebridges/source/unourl_resolver/unourl_resolver.cxx b/remotebridges/source/unourl_resolver/unourl_resolver.cxx index 39f2c295b38c..96570bda0692 100644 --- a/remotebridges/source/unourl_resolver/unourl_resolver.cxx +++ b/remotebridges/source/unourl_resolver/unourl_resolver.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unourl_resolver.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: jbu $ $Date: 2001-06-22 16:39:16 $ + * last change: $Author: sb $ $Date: 2002-10-04 09:41:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,6 +67,8 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/implbase2.hxx> #include <cppuhelper/implementationentry.hxx> +#include "cppuhelper/unourl.hxx" +#include "rtl/malformeduriexception.hxx" #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -190,19 +192,19 @@ Sequence< OUString > ResolverImpl::getSupportedServiceNames() Reference< XInterface > ResolverImpl::resolve( const OUString & rUnoUrl ) throw (NoConnectException, ConnectionSetupException, RuntimeException) { - sal_Int32 nTokenCount = 0; - sal_Int32 nIndex = 0; - do + OUString aProtocolDescr; + OUString aConnectDescr; + OUString aInstanceName; + try { - rUnoUrl.getToken( 0 , ';' , nIndex ); - nTokenCount++; + cppu::UnoUrl aUrl(rUnoUrl); + aProtocolDescr = aUrl.getProtocol().getDescriptor(); + aConnectDescr = aUrl.getConnection().getDescriptor(); + aInstanceName = aUrl.getObjectName(); } - while ( nIndex >= 0 ); - - if (nTokenCount != 3 || rUnoUrl.getLength() < 10 || - !rUnoUrl.copy( 0, 4 ).equalsIgnoreAsciiCase( OUString( RTL_CONSTASCII_USTRINGPARAM("uno:") ) )) + catch (rtl::MalformedUriException & rEx) { - throw ConnectionSetupException( OUString( RTL_CONSTASCII_USTRINGPARAM("illegal uno url given!" ) ), Reference< XInterface >() ); + throw ConnectionSetupException(rEx.getMessage(), 0); } Reference< XConnector > xConnector( @@ -214,11 +216,6 @@ Reference< XInterface > ResolverImpl::resolve( const OUString & rUnoUrl ) if (! xConnector.is()) throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM("no connector!" ) ), Reference< XInterface >() ); - nIndex = 0; - OUString aConnectDescr( rUnoUrl.getToken( 0, ';', nIndex ).copy( 4 ) ); // uno:CONNECTDESCR;iiop;InstanceName - nIndex = 0; - OUString aInstanceName( rUnoUrl.getToken( 2, ';', nIndex ) ); - Reference< XConnection > xConnection( xConnector->connect( aConnectDescr ) ); // As soon as singletons are ready, switch to singleton ! @@ -232,9 +229,8 @@ Reference< XInterface > ResolverImpl::resolve( const OUString & rUnoUrl ) throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM("no bridge factory!" ) ), Reference< XInterface >() ); // bridge - nIndex = 0; Reference< XBridge > xBridge( xBridgeFactory->createBridge( - OUString(), rUnoUrl.getToken( 1, ';', nIndex ), + OUString(), aProtocolDescr, xConnection, Reference< XInstanceProvider >() ) ); Reference< XInterface > xRet( xBridge->getInstance( aInstanceName ) ); |