Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*************************************************************************
3 : *
4 : * Effective License of whole file:
5 : *
6 : * This library is free software; you can redistribute it and/or
7 : * modify it under the terms of the GNU Lesser General Public
8 : * License version 2.1, as published by the Free Software Foundation.
9 : *
10 : * This library is distributed in the hope that it will be useful,
11 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 : * Lesser General Public License for more details.
14 : *
15 : * You should have received a copy of the GNU Lesser General Public
16 : * License along with this library; if not, write to the Free Software
17 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18 : * MA 02111-1307 USA
19 : *
20 : * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
21 : *
22 : * The Contents of this file are made available subject to the terms of
23 : * the GNU Lesser General Public License Version 2.1
24 : *
25 : * Copyright: 2000 by Sun Microsystems, Inc.
26 : *
27 : * Contributor(s): Joerg Budischewski
28 : *
29 : * All parts contributed on or after August 2011:
30 : *
31 : * Version: MPL 1.1 / GPLv3+ / LGPLv2.1+
32 : *
33 : * The contents of this file are subject to the Mozilla Public License Version
34 : * 1.1 (the "License"); you may not use this file except in compliance with
35 : * the License or as specified alternatively below. You may obtain a copy of
36 : * the License at http://www.mozilla.org/MPL/
37 : *
38 : * Software distributed under the License is distributed on an "AS IS" basis,
39 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
40 : * for the specific language governing rights and limitations under the
41 : * License.
42 : *
43 : * Major Contributor(s):
44 : * [ Copyright (C) 2011 Lionel Elie Mamane <lionel@mamane.lu> ]
45 : *
46 : * All Rights Reserved.
47 : *
48 : * For minor contributions see the git repository.
49 : *
50 : * Alternatively, the contents of this file may be used under the terms of
51 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
52 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPLv2.1+"),
53 : * in which case the provisions of the GPLv3+ or the LGPLv2.1+ are applicable
54 : * instead of those above.
55 : *
56 : ************************************************************************/
57 :
58 : #ifndef _PG_DRIVER_HXX_
59 : #define _PG_DRIVER_HXX_
60 :
61 : #include <osl/mutex.hxx>
62 :
63 : #include <cppuhelper/compbase2.hxx>
64 : #include <cppuhelper/compbase3.hxx>
65 :
66 : #include <com/sun/star/lang/XServiceInfo.hpp>
67 :
68 : #include <com/sun/star/sdbc/XDriver.hpp>
69 : #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
70 :
71 : #include <com/sun/star/uno/XComponentContext.hpp>
72 :
73 : namespace pq_sdbc_driver
74 : {
75 :
76 : #define MY_STRINGIFY( x ) #x
77 :
78 : #define PQ_SDBC_DRIVER_VERSION MY_STRINGIFY(PQ_SDBC_MAJOR) "." \
79 : MY_STRINGIFY(PQ_SDBC_MINOR) "." \
80 : MY_STRINGIFY(PQ_SDBC_MICRO)
81 :
82 0 : struct MutexHolder { osl::Mutex m_mutex; };
83 : // use this to switch off sdbc support !
84 : // typedef cppu::WeakComponentImplHelper2<
85 : // com::sun::star::sdbc::XDriver,
86 : // com::sun::star::lang::XServiceInfo
87 : // > DriverBase ;
88 : typedef cppu::WeakComponentImplHelper3<
89 : com::sun::star::sdbc::XDriver,
90 : com::sun::star::lang::XServiceInfo,
91 : com::sun::star::sdbcx::XDataDefinitionSupplier > DriverBase ;
92 0 : class Driver : public MutexHolder, public DriverBase
93 : {
94 : com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_ctx;
95 : com::sun::star::uno::Reference< com::sun::star::lang::XMultiComponentFactory > m_smgr;
96 :
97 : public:
98 0 : Driver ( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > & ctx )
99 : : DriverBase( this->m_mutex ),
100 : m_ctx( ctx ),
101 0 : m_smgr( ctx->getServiceManager() )
102 0 : {}
103 :
104 : public: // XDriver
105 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect(
106 : const ::rtl::OUString& url,
107 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info )
108 : throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
109 :
110 : virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url )
111 : throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
112 :
113 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(
114 : const ::rtl::OUString& url,
115 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info )
116 : throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
117 :
118 : virtual sal_Int32 SAL_CALL getMajorVersion( ) throw (::com::sun::star::uno::RuntimeException);
119 : virtual sal_Int32 SAL_CALL getMinorVersion( ) throw (::com::sun::star::uno::RuntimeException);
120 :
121 : public: // XServiceInfo
122 : // XServiceInfo
123 : virtual rtl::OUString SAL_CALL getImplementationName()
124 : throw(::com::sun::star::uno::RuntimeException);
125 : virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
126 : throw(::com::sun::star::uno::RuntimeException);
127 :
128 : virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void)
129 : throw(::com::sun::star::uno::RuntimeException);
130 :
131 : public: // XDataDefinitionSupplier
132 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL
133 : getDataDefinitionByConnection(
134 : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection )
135 : throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
136 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL
137 : getDataDefinitionByURL(
138 : const ::rtl::OUString& url,
139 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info )
140 : throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
141 :
142 : // XComponent
143 : virtual void SAL_CALL disposing();
144 :
145 : };
146 :
147 :
148 : }
149 :
150 : #endif
|