Branch libreoffice-5-0-4
[LibreOffice.git] / include / connectivity / sdbcx / VCatalog.hxx
blob264cc33e1568a5b0842433013ef7a5bb7a76f32e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_SDBCX_VCATALOG_HXX
21 #define INCLUDED_CONNECTIVITY_SDBCX_VCATALOG_HXX
23 #include <osl/diagnose.h>
24 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
25 #include <com/sun/star/sdbcx/XViewsSupplier.hpp>
26 #include <com/sun/star/sdbcx/XUsersSupplier.hpp>
27 #include <com/sun/star/sdbcx/XGroupsSupplier.hpp>
28 #include <com/sun/star/sdbc/XConnection.hpp>
29 #include <com/sun/star/sdbc/XRow.hpp>
30 #include <cppuhelper/compbase5.hxx>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <connectivity/CommonTools.hxx>
33 #include <connectivity/OSubComponent.hxx>
34 #include <connectivity/sdbcx/IRefreshable.hxx>
35 #include <connectivity/StdTypeDefs.hxx>
36 #include <connectivity/dbtoolsdllapi.hxx>
38 namespace connectivity
40 namespace sdbcx
43 class OCollection;
44 // OCatalog is a general catalog class
45 // other drivers can be derived their catalog from this class when they want to support sdbcx
46 // it holds already tables, views, groups and users
48 typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbcx::XTablesSupplier,
49 ::com::sun::star::sdbcx::XViewsSupplier,
50 ::com::sun::star::sdbcx::XUsersSupplier,
51 ::com::sun::star::sdbcx::XGroupsSupplier,
52 ::com::sun::star::lang::XServiceInfo> OCatalog_BASE;
55 class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCatalog :
56 public OCatalog_BASE,
57 public IRefreshableGroups,
58 public IRefreshableUsers,
59 public connectivity::OSubComponent<OCatalog, OCatalog_BASE>
61 friend class connectivity::OSubComponent<OCatalog, OCatalog_BASE>;
62 protected:
64 ::osl::Mutex m_aMutex;
66 // this members are deleted when the dtor is called
67 // they are hold weak
68 OCollection* m_pTables;
69 OCollection* m_pViews;
70 OCollection* m_pGroups;
71 OCollection* m_pUsers;
73 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier
75 /** builds the name which should be used to access the object later on in the collection.
76 Will only be called in fillNames.
77 @param _xRow
78 The current row from the resultset given to fillNames.
80 virtual OUString buildName( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >& _xRow);
82 /** fills a vector with the necessary names which can be used in combination with the collections.
83 For each row buildName will be called.
84 @param _xResult
85 The resultset which should be used to fill the names. Will be disposed after return and set to NULL.
86 @param _rNames
87 The vector who will be filled.
89 void fillNames(::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xResult,TStringVector& _rNames);
91 public:
92 OCatalog(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> &_xConnection);
93 virtual ~OCatalog();
95 DECLARE_SERVICE_INFO();
97 // refreshTables is called when the method getTables had been called
98 // the member m_pTables has to be created
99 virtual void refreshTables() = 0;
100 // refreshViews is called when the method getViews had been called
101 virtual void refreshViews() = 0;
103 // the other refresh methods come from base classes IRefreshableGroups and IRefreshableUsers
105 // ::cppu::OComponentHelper
106 virtual void SAL_CALL disposing() SAL_OVERRIDE;
107 // XInterface
108 void SAL_CALL acquire() throw() SAL_OVERRIDE;
109 void SAL_CALL release() throw() SAL_OVERRIDE;
110 // XTablesSupplier
111 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 // XViewsSupplier
113 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getViews( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
114 // XUsersSupplier
115 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getUsers( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 // XGroupsSupplier
117 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getGroups( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 #endif // INCLUDED_CONNECTIVITY_SDBCX_VCATALOG_HXX
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */