diff options
author | Jörg Barfurth <jb@openoffice.org> | 2002-09-02 16:24:41 +0000 |
---|---|---|
committer | Jörg Barfurth <jb@openoffice.org> | 2002-09-02 16:24:41 +0000 |
commit | 23d910fb64a3053abdc58c82cee63c3ab47b3c46 (patch) | |
tree | fc26eb4a363e04908cdf3c1004ce91d1310c8b2c /configmgr | |
parent | b25559bfff5c5a2254d7eee0f9ced48276e3dcc5 (diff) |
#102804# Unified declarations of service support for backend registration and construction
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/backend/singlebackendadapter.cxx | 45 | ||||
-rw-r--r-- | configmgr/source/localbe/localsinglebackend.cxx | 23 |
2 files changed, 39 insertions, 29 deletions
diff --git a/configmgr/source/backend/singlebackendadapter.cxx b/configmgr/source/backend/singlebackendadapter.cxx index d2617d272369..cfee4a2282fd 100644 --- a/configmgr/source/backend/singlebackendadapter.cxx +++ b/configmgr/source/backend/singlebackendadapter.cxx @@ -2,9 +2,9 @@ * * $RCSfile: singlebackendadapter.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: jb $ $Date: 2002-07-11 16:58:30 $ + * last change: $Author: jb $ $Date: 2002-09-02 17:24:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,6 +71,10 @@ #include "serviceinfohelper.hxx" #endif // CONFIGMGR_SERVICEINFOHELPER_HXX_ +#ifndef _COM_SUN_STAR_CONFIGURATION_CANNOTLOADCONFIGURATIONEXCEPTION_HPP_ +#include <com/sun/star/configuration/CannotLoadConfigurationException.hpp> +#endif + namespace configmgr { namespace backend { //============================================================================== @@ -98,11 +102,9 @@ void SAL_CALL SingleBackendAdapter::initialize( if (!mBackend.is()) { - const rtl::OUString kSingleBackend(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.backend.SingleBackend")) ; - - mBackend.set( mFactory->createInstanceWithArguments(kSingleBackend, aParameters), - uno::UNO_QUERY) ; + throw com::sun::star::configuration::CannotLoadConfigurationException( + OUString::createFromAscii("Online Backend Adapter: Cannot operate without real (Single)Backend"), + *this); } } //------------------------------------------------------------------------------ @@ -170,11 +172,14 @@ SAL_CALL SingleBackendAdapter::getUpdateHandler(const rtl::OUString& aComponent, } //------------------------------------------------------------------------------ -static const sal_Char *kService = "com.sun.star.configuration.backend.Backend" ; -static const sal_Char *kImplementation = +static const sal_Char * const kBackendService = "com.sun.star.configuration.backend.Backend" ; +static const sal_Char * const kAdapterService = "com.sun.star.configuration.backend.BackendAdapter" ; +static const sal_Char * const kOnlineService = "com.sun.star.configuration.backend.OnlineBackend" ; + +static const sal_Char * const kImplementation = "com.sun.star.comp.configuration.backend.SingleBackendAdapter" ; -static AsciiServiceName kServiceNames [] = { kService, 0 } ; +static const AsciiServiceName kServiceNames [] = { kOnlineService, kAdapterService, kBackendService, 0 } ; static const ServiceInfo kServiceInfo = { kImplementation, kServiceNames } ; const ServiceInfo *getSingleBackendAdapterServiceInfo(void) { @@ -202,20 +207,22 @@ rtl::OUString SAL_CALL SingleBackendAdapter::getImplementationName(void) } //------------------------------------------------------------------------------ -static const rtl::OUString kBackendServiceName( - RTL_CONSTASCII_USTRINGPARAM(kService)) ; - -sal_Bool SAL_CALL SingleBackendAdapter::supportsService( - const rtl::OUString& aServiceName) +sal_Bool SAL_CALL SingleBackendAdapter::supportsService(const rtl::OUString& aServiceName) throw (uno::RuntimeException) { - return aServiceName.equals(kBackendServiceName) ; + return aServiceName.equalsAscii(kOnlineService) || + aServiceName.equalsAscii(kAdapterService) || + aServiceName.equalsAscii(kBackendService) ; } //------------------------------------------------------------------------------ -uno::Sequence<rtl::OUString> SAL_CALL SingleBackendAdapter::getServices(void) { - return uno::Sequence<rtl::OUString>( - &kBackendServiceName, 1) ; +uno::Sequence<rtl::OUString> SAL_CALL SingleBackendAdapter::getServices() +{ + uno::Sequence< OUString > ret(3); + ret[0] = OUString::createFromAscii(kOnlineService); + ret[1] = OUString::createFromAscii(kAdapterService); + ret[2] = OUString::createFromAscii(kBackendService); + return ret; } //------------------------------------------------------------------------------ diff --git a/configmgr/source/localbe/localsinglebackend.cxx b/configmgr/source/localbe/localsinglebackend.cxx index 87ddbb668904..409852d7f376 100644 --- a/configmgr/source/localbe/localsinglebackend.cxx +++ b/configmgr/source/localbe/localsinglebackend.cxx @@ -2,9 +2,9 @@ * * $RCSfile: localsinglebackend.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: jb $ $Date: 2002-07-14 16:49:41 $ + * last change: $Author: jb $ $Date: 2002-09-02 17:24:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -474,12 +474,14 @@ void LocalSingleBackend::getLayerDirectories(sal_Int32 aLayerIndex, } //------------------------------------------------------------------------------ -static const sal_Char *kImplementation = +static const sal_Char * const kImplementation = "com.sun.star.comp.configuration.backend.LocalSingleBackend" ; -static const sal_Char *kService = +static const sal_Char * const kBackendService = "com.sun.star.configuration.backend.SingleBackend" ; +static const sal_Char * const kLocalService = + "com.sun.star.configuration.backend.LocalSingleBackend" ; -static AsciiServiceName kServiceNames [] = { kService, 0 } ; +static AsciiServiceName kServiceNames [] = { kLocalService, kBackendService, 0 } ; static const ServiceInfo kServiceInfo = { kImplementation, kServiceNames } ; const ServiceInfo *getLocalBackendServiceInfo(void) { return &kServiceInfo ; } @@ -505,19 +507,20 @@ rtl::OUString SAL_CALL LocalSingleBackend::getImplementationName(void) } //------------------------------------------------------------------------------ -static const rtl::OUString kSingleBackendServiceName( - RTL_CONSTASCII_USTRINGPARAM(kService)) ; - sal_Bool SAL_CALL LocalSingleBackend::supportsService( const rtl::OUString& aServiceName) throw (uno::RuntimeException) { - return aServiceName.equals(kSingleBackendServiceName) ; + return aServiceName.equalsAscii(kLocalService) || + aServiceName.equalsAscii(kBackendService); } //------------------------------------------------------------------------------ uno::Sequence<rtl::OUString> SAL_CALL LocalSingleBackend::getServices(void) { - return uno::Sequence<rtl::OUString>(&kSingleBackendServiceName, 1) ; + uno::Sequence< OUString > ret(2); + ret[0] = OUString::createFromAscii(kLocalService); + ret[1] = OUString::createFromAscii(kBackendService); + return ret; } //------------------------------------------------------------------------------ |