Update ooo320-m1
[ooovba.git] / configmgr / source / platformbe / systemintegrationmanager.hxx
blobb2c62b7d29e1ca270e6f635122f5711233cad7c2
1 #ifndef CONFIGMGR_BACKEND_SYSTEMINTEGRATIONMANAGER_HXX_
2 #define CONFIGMGR_BACKEND_SYSTEMINTEGRATIONMANAGER_HXX_
4 #include <com/sun/star/configuration/backend/XBackend.hpp>
5 #include <com/sun/star/uno/XComponentContext.hpp>
6 #include <com/sun/star/lang/XInitialization.hpp>
7 #include <com/sun/star/lang/XServiceInfo.hpp>
8 #include <com/sun/star/uno/XInterface.hpp>
9 #include <com/sun/star/configuration/backend/BackendSetupException.hpp>
10 #include <com/sun/star/configuration/backend/XBackendChangesNotifier.hpp>
11 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
12 #include <com/sun/star/configuration/backend/XSingleLayerStratum.hpp>
13 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
14 #include <cppuhelper/compbase4.hxx>
16 #ifndef INCLUDED_MAP
17 #include <map>
18 #define INCLUDED_MAP
19 #endif
21 namespace configmgr { namespace backend {
23 namespace css = com::sun::star ;
24 namespace uno = css::uno ;
25 namespace lang = css::lang ;
26 namespace backenduno = css::configuration::backend ;
28 /* Class containing a reference to a service factory(XSingleComponentFactory)
29 object and a platform backend (XSingleLayerStratum).
30 The reference to the platform backend will be NULL until the platform backend
31 is initialised
33 class BackendRef
35 uno::Reference<lang::XSingleComponentFactory> mFactory;
36 uno::Reference<backenduno::XSingleLayerStratum> mBackend;
37 public:
38 explicit
39 BackendRef(const uno::Reference<lang::XSingleComponentFactory>& aFactory)
40 :mFactory(aFactory)
41 ,mBackend()
44 uno::Reference<backenduno::XSingleLayerStratum> getBackend(uno::Reference<uno::XComponentContext> const & xContext);
45 void disposeBackend();
48 /**
49 Class implementing the Backend service for system integration backend access.
50 It creates the required backends and coordinates access to them.
52 class SystemIntegrationManager : public cppu::WeakComponentImplHelper4< backenduno::XBackend, backenduno::XBackendChangesNotifier, lang::XInitialization, lang::XServiceInfo>
54 public:
55 /**
56 Service constructor from a service factory.
58 @param xContext component context
60 explicit
61 SystemIntegrationManager( const uno::Reference<uno::XComponentContext>& xContext) ;
63 /** Destructor */
64 ~SystemIntegrationManager() ;
66 // XBackend
67 virtual uno::Sequence<uno::Reference<backenduno::XLayer> >
68 SAL_CALL listOwnLayers(const rtl::OUString& aComponent)
69 throw (backenduno::BackendAccessException,
70 lang::IllegalArgumentException,
71 uno::RuntimeException) ;
73 virtual uno::Reference<backenduno::XUpdateHandler>
74 SAL_CALL getOwnUpdateHandler(const rtl::OUString& aComponent)
75 throw (backenduno::BackendAccessException,
76 lang::IllegalArgumentException,
77 lang::NoSupportException,
78 uno::RuntimeException) ;
80 virtual uno::Sequence<uno::Reference<backenduno::XLayer> > SAL_CALL
81 listLayers(const rtl::OUString& aComponent,
82 const rtl::OUString& aEntity)
83 throw (backenduno::BackendAccessException,
84 lang::IllegalArgumentException,
85 uno::RuntimeException) ;
87 virtual uno::Reference<backenduno::XUpdateHandler> SAL_CALL
88 getUpdateHandler(const rtl::OUString& aComponent,
89 const rtl::OUString& aEntity)
90 throw (backenduno::BackendAccessException,
91 lang::IllegalArgumentException,
92 lang::NoSupportException,
93 uno::RuntimeException) ;
95 // XInitialize
96 virtual void SAL_CALL initialize(const uno::Sequence<uno::Any>& aParameters)
97 throw (uno::RuntimeException, uno::Exception,
98 lang::IllegalArgumentException,
99 backenduno::BackendSetupException) ;
101 // XServiceInfo
102 virtual rtl::OUString SAL_CALL getImplementationName()
103 throw (uno::RuntimeException) ;
105 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& aServiceName)
106 throw (uno::RuntimeException) ;
108 virtual uno::Sequence<rtl::OUString> SAL_CALL
109 getSupportedServiceNames(void) throw (uno::RuntimeException) ;
111 // XBackendChangesNotifier
112 virtual void SAL_CALL addChangesListener( const uno::Reference<backenduno::XBackendChangesListener>& xListner,
113 const rtl::OUString& aComponent)
114 throw (uno::RuntimeException);
117 virtual void SAL_CALL removeChangesListener( const uno::Reference<backenduno::XBackendChangesListener>& xListner,
118 const rtl::OUString& aComponent)
119 throw (uno::RuntimeException);
122 Provides the implementation name.
124 @return implementation name
126 static rtl::OUString SAL_CALL getSystemIntegrationManagerName(void) ;
128 Provides the list of supported services.
130 @return list of service names
132 static uno::Sequence<rtl::OUString> SAL_CALL getServiceNames(void) ;
133 protected:
134 // ComponentHelper
135 virtual void SAL_CALL disposing();
136 private :
137 /** build lookup up table
139 void buildLookupTable();
141 /** get list of supported components
143 uno::Sequence<rtl::OUString> getSupportedComponents(const uno::Reference<lang::XSingleComponentFactory>& xFactory);
146 get supporting backends from lookup table
148 std::vector< uno::Reference<backenduno::XSingleLayerStratum> > getSupportingBackends(const rtl::OUString& aComponent);
150 private :
151 /** Mutex for resource protection */
152 osl::Mutex mMutex ;
153 /** Component Context */
154 uno::Reference<uno::XComponentContext> mContext ;
156 std::multimap<rtl::OUString, BackendRef> mPlatformBackends;
159 } } // configmgr.backend
161 #endif // CONFIGMGR_BACKEND_SYSTEMINTEGRATIONMANAGER_HXX_