1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MOZAB_MDRIVER_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MOZAB_MDRIVER_HXX
23 #include <com/sun/star/sdbc/XDriver.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 #include <cppuhelper/compbase2.hxx>
27 #include <connectivity/CommonTools.hxx>
28 #include <osl/module.h>
31 #define MOZAB_DRIVER_IMPL_NAME "com.sun.star.comp.sdbc.MozabDriver"
33 namespace connectivity
37 ::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
);
39 typedef void* (SAL_CALL
* OMozabConnection_CreateInstanceFunction
)(void* _pDriver
);
40 typedef void (SAL_CALL
* OSetMozabServiceFactory
)( void* _pFactory
);
41 typedef const void* (SAL_CALL
* OGetSdbcScheme_Function
)( short );
44 typedef ::cppu::WeakComponentImplHelper2
< ::com::sun::star::sdbc::XDriver
,
45 ::com::sun::star::lang::XServiceInfo
> ODriver_BASE
;
57 class MozabDriver
: public ODriver_BASE
60 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xMSFactory
;
62 ::osl::Mutex m_aMutex
; // mutex is need to control member access
63 connectivity::OWeakRefArray m_xConnections
; // vector containing a list
64 // of all the Connection objects
67 OMozabConnection_CreateInstanceFunction m_pCreationFunc
;
68 OGetSdbcScheme_Function m_pSchemeFunction
;
71 virtual ~MozabDriver();
74 MozabDriver(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
);
77 virtual void SAL_CALL
disposing();
79 static OUString
getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException
);
80 static ::com::sun::star::uno::Sequence
< OUString
> getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException
);
83 virtual OUString SAL_CALL
getImplementationName( ) throw(::com::sun::star::uno::RuntimeException
);
84 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
);
85 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException
);
88 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
> SAL_CALL
connect( const 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
);
89 virtual sal_Bool SAL_CALL
acceptsURL( const OUString
& url
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
90 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::sdbc::DriverPropertyInfo
> SAL_CALL
getPropertyInfo( const 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
);
91 virtual sal_Int32 SAL_CALL
getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException
);
92 virtual sal_Int32 SAL_CALL
getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException
);
94 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>
95 & getMSFactory() const { return m_xMSFactory
; }
98 EDriverType
impl_classifyURL( const OUString
& url
);
104 #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MOZAB_MDRIVER_HXX
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */