1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _CONNECTIVITY_EVOAB_DRIVER_HXX_
25 #define _CONNECTIVITY_EVOAB_DRIVER_HXX_
26 
27 #include <com/sun/star/sdbc/XDriver.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <cppuhelper/compbase2.hxx>
30 #include "connectivity/CommonTools.hxx"
31 #include <osl/module.h>
32 
33 #define EVOAB_EVOLUTION_SCHEMA	"evolution"
34 /*In Future, when separate schema is required for ldap, groupwise*/
35 #define EVOAB_LDAP_SCHEMA	"ldap"
36 #define EVOAB_GWISE_SCHEMA	"groupwise"
37 
38 #define EVOAB_DRIVER_IMPL_NAME	"com.sun.star.comp.sdbc.evoab.OEvoabDriver"
39 
40 namespace connectivity
41 {
42 	namespace evoab
43 	{
44 
45 		::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OEvoabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception );
46 
47 
48 		typedef ::cppu::WeakComponentImplHelper2<	::com::sun::star::sdbc::XDriver,
49 								::com::sun::star::lang::XServiceInfo > ODriver_BASE;
50 
51 
52 		class OEvoabDriver : public ODriver_BASE
53 		{
54 
55 		protected:
56 			::osl::Mutex										m_aMutex;
57 			connectivity::OWeakRefArray							m_xConnections;
58 			::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
59 
60 		public:
61 			OEvoabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
62 			virtual ~OEvoabDriver();
63 
64 			// OComponentHelper
65 			virtual void SAL_CALL disposing(void);
66 
67 			// XInterface
68 			static ::rtl::OUString getImplementationName_Static(  ) throw(::com::sun::star::uno::RuntimeException);
69 			static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(  ) throw (::com::sun::star::uno::RuntimeException);
70 
71 			// XServiceInfo
72 			virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
73 			virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
74 			virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
75 
76 
77 			// XDriver
78 			virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
79 			virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
80 			virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
81 			virtual sal_Int32 SAL_CALL getMajorVersion(  ) throw(::com::sun::star::uno::RuntimeException);
82 			virtual sal_Int32 SAL_CALL getMinorVersion(  ) throw(::com::sun::star::uno::RuntimeException);
83 
84 		public:
85             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
getMSFactory(void) const86                         & getMSFactory(void) const { return m_xFactory; }
87 
88 			// static methods
89 			static sal_Bool acceptsURL_Stat( const ::rtl::OUString& url );
90 		};
91 	}
92 
93 }
94 #endif //_CONNECTIVITY_EVOAB_DRIVER_HXX_
95