1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX_
29 #define EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX_
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <com/sun/star/lang/XInitialization.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
36 #include <com/sun/star/container/XNameAccess.hpp>
37 #include <com/sun/star/lang/IllegalArgumentException.hpp>
38 #include <cppuhelper/compbase2.hxx>
40 #include "ldapaccess.hxx"
42 namespace extensions
{ namespace config
{ namespace ldap
{
44 namespace css
= com::sun::star
;
45 namespace uno
= css::uno
;
46 namespace lang
= css::lang
;
47 namespace container
= css::container
;
49 struct LdapDefinition
;
51 typedef cppu::WeakComponentImplHelper2
<css::beans::XPropertySet
,
52 lang::XServiceInfo
> BackendBase
;
54 struct LdapProfileMutexHolder
{ osl::Mutex mMutex
; };
56 Implements the PlatformBackend service, a specialization of the
57 XPropertySet service for retreiving LDAP user profile
58 configuration settings from a LDAP repsoitory.
60 class LdapUserProfileBe
: private LdapProfileMutexHolder
, public BackendBase
64 LdapUserProfileBe(const uno::Reference
<uno::XComponentContext
>& xContext
);
65 ~LdapUserProfileBe(void) ;
68 virtual rtl::OUString SAL_CALL
69 getImplementationName( )
70 throw (uno::RuntimeException
) ;
72 virtual sal_Bool SAL_CALL
73 supportsService( const rtl::OUString
& aServiceName
)
74 throw (uno::RuntimeException
) ;
76 virtual uno::Sequence
<rtl::OUString
> SAL_CALL
77 getSupportedServiceNames( )
78 throw (uno::RuntimeException
) ;
81 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
82 getPropertySetInfo() throw (css::uno::RuntimeException
)
83 { return css::uno::Reference
< css::beans::XPropertySetInfo
>(); }
85 virtual void SAL_CALL
setPropertyValue(
86 rtl::OUString
const &, css::uno::Any
const &)
88 css::beans::UnknownPropertyException
,
89 css::beans::PropertyVetoException
,
90 css::lang::IllegalArgumentException
,
91 css::lang::WrappedTargetException
, css::uno::RuntimeException
);
93 virtual css::uno::Any SAL_CALL
getPropertyValue(
94 rtl::OUString
const & PropertyName
)
96 css::beans::UnknownPropertyException
,
97 css::lang::WrappedTargetException
, css::uno::RuntimeException
);
99 virtual void SAL_CALL
addPropertyChangeListener(
100 rtl::OUString
const &,
101 css::uno::Reference
< css::beans::XPropertyChangeListener
> const &)
103 css::beans::UnknownPropertyException
,
104 css::lang::WrappedTargetException
, css::uno::RuntimeException
)
107 virtual void SAL_CALL
removePropertyChangeListener(
108 rtl::OUString
const &,
109 css::uno::Reference
< css::beans::XPropertyChangeListener
> const &)
111 css::beans::UnknownPropertyException
,
112 css::lang::WrappedTargetException
, css::uno::RuntimeException
)
115 virtual void SAL_CALL
addVetoableChangeListener(
116 rtl::OUString
const &,
117 css::uno::Reference
< css::beans::XVetoableChangeListener
> const &)
119 css::beans::UnknownPropertyException
,
120 css::lang::WrappedTargetException
, css::uno::RuntimeException
)
123 virtual void SAL_CALL
removeVetoableChangeListener(
124 rtl::OUString
const &,
125 css::uno::Reference
< css::beans::XVetoableChangeListener
> const &)
127 css::beans::UnknownPropertyException
,
128 css::lang::WrappedTargetException
, css::uno::RuntimeException
)
132 Provides the implementation name.
133 @return implementation name
135 static rtl::OUString SAL_CALL
getLdapUserProfileBeName(void) ;
137 Provides the supported services names
138 @return service names
140 static uno::Sequence
<rtl::OUString
> SAL_CALL
141 getLdapUserProfileBeServiceNames(void) ;
144 /** Check if LDAP is configured */
145 bool readLdapConfiguration(
146 uno::Reference
<lang::XMultiServiceFactory
> const & factory
,
147 LdapDefinition
* definition
, rtl::OUString
* loggedOnUser
);
149 bool getLdapStringParam(uno::Reference
<container::XNameAccess
>& xAccess
,
150 const rtl::OUString
& aLdapSetting
,
151 rtl::OString
& aServerParameter
);
155 //------------------------------------------------------------------------------
158 #endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_