update dev300-m58
[ooovba.git] / extensions / source / config / ldap / ldapuserprofilelayer.hxx
blob06cad90bf27743ccbe381e0cbf25166f96b58dfa
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ldapuserprofilelayer.hxx,v $
10 * $Revision: 1.7 $
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>
43 #endif
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 //------------------------------------------------------------------------------
71 /**
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,
78 backend::XLayer,
79 util::XTimeStamped>
81 public :
82 /** Constructor */
83 LdapUserProfileLayer(
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
90 /** Destructor */
91 ~LdapUserProfileLayer();
93 // XLayer
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) ;
101 // XTimeStamped
102 virtual rtl::OUString SAL_CALL getTimestamp(void)
103 throw (uno::RuntimeException)
104 { return mTimestamp; }
106 protected:
107 // PropertySetHelper
108 virtual cppu::IPropertyArrayHelper * SAL_CALL newInfoHelper();
110 virtual void SAL_CALL getFastPropertyValue( uno::Any& rValue, sal_Int32 nHandle ) const;
111 private :
112 struct ProfileData;
113 bool readProfile();
115 uno::Reference<backend::XLayerContentDescriber> mLayerDescriber;
116 LdapUserProfileSourceRef mSource;
117 rtl::OUString mUser;
118 rtl::OUString mTimestamp;
119 ProfileData * mProfile;
120 private:
121 using cppu::OPropertySetHelper::getFastPropertyValue;
124 #endif // EXTENSIONS_CONFIG_LDAP_LADPUSERPROFILELAYER_HXX_