1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ldapuserprofilelayer.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef EXTENSIONS_CONFIG_LDAP_LADPUSERPROFILELAYER_HXX_
32 #define EXTENSIONS_CONFIG_LDAP_LADPUSERPROFILELAYER_HXX_
34 #include "ldapuserprof.hxx"
35 #include "ldapaccess.hxx"
37 #include "propertysethelper.hxx"
38 #include <com/sun/star/configuration/backend/XLayer.hpp>
39 #include <com/sun/star/configuration/backend/BackendAccessException.hpp>
41 #ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_
42 #include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
44 #include <com/sun/star/util/XTimeStamped.hpp>
45 #include <cppuhelper/implbase2.hxx>
46 #include <salhelper/simplereferenceobject.hxx>
47 #include <rtl/ref.hxx>
50 namespace extensions
{ namespace config
{ namespace ldap
{
52 namespace css
= com::sun::star
;
53 namespace uno
= css::uno
;
54 namespace lang
= css::lang
;
55 namespace backend
= css::configuration::backend
;
56 namespace util
= css::util
;
58 //------------------------------------------------------------------------------
59 struct LdapUserProfileSource
: public salhelper::SimpleReferenceObject
61 LdapConnection mConnection
;
62 LdapUserProfileMap mProfileMap
;
64 rtl::OUString
getComponentName() const;
65 rtl::OUString
getConfigurationBasePath() const;
66 void getUserProfile(rtl::OUString
const & aUser
, LdapUserProfile
& aProfile
);
68 typedef rtl::Reference
< LdapUserProfileSource
> LdapUserProfileSourceRef
;
69 //------------------------------------------------------------------------------
72 Implementation of the XLayer interfaces for LdapUserProfileBe.
73 Class reads UserProfile setting form LDAP.
74 The timestamp indicates the last modification time
76 class LdapUserProfileLayer
: public cppu::ImplInheritanceHelper2
<
77 apihelper::ReadOnlyPropertySetHelper
,
84 const uno::Reference
<lang::XMultiServiceFactory
>& xFactory
,
85 const rtl::OUString
& aUser
,
86 const LdapUserProfileSourceRef
& aUserProfileSource
,
87 const rtl::OUString
& aTimestamp
);
88 // throw (uno::RuntimeException
91 ~LdapUserProfileLayer();
94 virtual void SAL_CALL
readData(
95 const uno::Reference
<backend::XLayerHandler
>& xHandler
)
96 throw ( backend::MalformedDataException
,
97 lang::NullPointerException
,
98 lang::WrappedTargetException
,
99 uno::RuntimeException
) ;
102 virtual rtl::OUString SAL_CALL
getTimestamp(void)
103 throw (uno::RuntimeException
)
104 { return mTimestamp
; }
108 virtual cppu::IPropertyArrayHelper
* SAL_CALL
newInfoHelper();
110 virtual void SAL_CALL
getFastPropertyValue( uno::Any
& rValue
, sal_Int32 nHandle
) const;
115 uno::Reference
<backend::XLayerContentDescriber
> mLayerDescriber
;
116 LdapUserProfileSourceRef mSource
;
118 rtl::OUString mTimestamp
;
119 ProfileData
* mProfile
;
121 using cppu::OPropertySetHelper::getFastPropertyValue
;
124 #endif // EXTENSIONS_CONFIG_LDAP_LADPUSERPROFILELAYER_HXX_