update dev300-m58
[ooovba.git] / connectivity / source / drivers / mozab / MDriver.hxx
blobd7f68ff7bc6b9d6dc14b365f3ee307c794c68ecd
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: MDriver.hxx,v $
10 * $Revision: 1.9 $
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 ************************************************************************/
30 #ifndef CONNECTIVITY_SDRIVER_HXX
31 #define CONNECTIVITY_SDRIVER_HXX
33 #include <com/sun/star/sdbc/XDriver.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <cppuhelper/compbase2.hxx>
36 #include "connectivity/CommonTools.hxx"
37 #include <osl/module.h>
40 #define MOZAB_DRIVER_IMPL_NAME "com.sun.star.comp.sdbc.MozabDriver"
42 namespace connectivity
44 namespace mozab
46 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MozabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception );
48 typedef void* (SAL_CALL * OMozabConnection_CreateInstanceFunction)(void* _pDriver );
49 typedef void (SAL_CALL * OSetMozabServiceFactory)( void* _pFactory );
50 typedef const void* (SAL_CALL * OGetSdbcScheme_Function)( short );
53 typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver,
54 ::com::sun::star::lang::XServiceInfo > ODriver_BASE;
56 enum EDriverType
58 Mozilla,
59 ThunderBird,
60 LDAP,
61 Outlook,
62 OutlookExpress,
63 Unknown
66 class MozabDriver : public ODriver_BASE
68 protected:
69 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xMSFactory;
71 ::osl::Mutex m_aMutex; // mutex is need to control member access
72 connectivity::OWeakRefArray m_xConnections; // vector containing a list
73 // of all the Connection objects
74 // for this Driver
75 oslModule m_hModule;
76 OMozabConnection_CreateInstanceFunction m_pCreationFunc;
77 OGetSdbcScheme_Function m_pSchemeFunction;
79 bool ensureInit();
80 virtual ~MozabDriver();
81 public:
83 MozabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
85 // OComponentHelper
86 virtual void SAL_CALL disposing(void);
87 // XInterface
88 static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
89 static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException);
91 // XServiceInfo
92 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
93 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
94 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
96 // XDriver
97 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);
98 virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
99 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);
100 virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException);
101 virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException);
103 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
104 & getMSFactory(void) const { return m_xMSFactory; }
106 private:
107 EDriverType impl_classifyURL( const ::rtl::OUString& url );
113 #endif // CONNECTIVITY_SDRIVER_HXX