LCOV - code coverage report
Current view: top level - libreoffice/connectivity/source/manager - mdrivermanager.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-12-27 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef _CONNECTIVITY_DRIVERMANAGER_HXX_
      21             : #define _CONNECTIVITY_DRIVERMANAGER_HXX_
      22             : 
      23             : #include <com/sun/star/sdbc/XDriverManager2.hpp>
      24             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      25             : #include <com/sun/star/uno/XNamingService.hpp>
      26             : #include <com/sun/star/lang/XServiceInfo.hpp>
      27             : #include <com/sun/star/sdbc/XDriverAccess.hpp>
      28             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      29             : 
      30             : #include <cppuhelper/implbase3.hxx>
      31             : #include <comphelper/stl_types.hxx>
      32             : #include <comphelper/logging.hxx>
      33             : #include <comphelper/componentcontext.hxx>
      34             : #include <osl/mutex.hxx>
      35             : #include "connectivity/DriversConfig.hxx"
      36             : 
      37             : namespace drivermanager
      38             : {
      39             : 
      40             :     //======================================================================
      41             :     //= various
      42             :     //======================================================================
      43             :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver >                     SdbcDriver;
      44             :     DECLARE_STL_USTRINGACCESS_MAP( SdbcDriver, DriverCollection );
      45             : 
      46             :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory >       DriverFactory;
      47           0 :     struct DriverAccess
      48             :     {
      49             :         ::rtl::OUString     sImplementationName;        /// the implementation name of the driver
      50             :         DriverFactory       xComponentFactory;          /// the factory to create the driver component (if not already done so)
      51             :         SdbcDriver          xDriver;                    /// the driver itself
      52             :     };
      53             : 
      54             :     //==========================================================================
      55             :     //= OSDBCDriverManager - the one-instance service for managing SDBC drivers
      56             :     //==========================================================================
      57             :     typedef ::cppu::WeakImplHelper3 <   ::com::sun::star::sdbc::XDriverManager2
      58             :                                     ,   ::com::sun::star::lang::XServiceInfo
      59             :                                     ,   ::com::sun::star::uno::XNamingService
      60             :                                     >   OSDBCDriverManager_Base;
      61             : 
      62             :     class OSDBCDriverManager : public OSDBCDriverManager_Base
      63             :     {
      64             :         friend class ODriverEnumeration;
      65             : 
      66             :         ::osl::Mutex                    m_aMutex;
      67             :         ::comphelper::ComponentContext  m_aContext;
      68             :         ::comphelper::EventLogger       m_aEventLogger;
      69             : 
      70             :         DECLARE_STL_VECTOR(DriverAccess, DriverAccessArray);
      71             :         DriverAccessArray               m_aDriversBS;
      72             : 
      73             :         // for drivers registered at runtime (not bootstrapped) we don't require an XServiceInfo interface,
      74             :         // so we have to remember their impl-name in another way
      75             :         DECLARE_STL_USTRINGACCESS_MAP(SdbcDriver, DriverCollection);
      76             :         DriverCollection                m_aDriversRT;
      77             : 
      78             :         ::connectivity::DriversConfig   m_aDriverConfig;
      79             :         sal_Int32                       m_nLoginTimeout;
      80             : 
      81             :     private:
      82             :         OSDBCDriverManager(
      83             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext );
      84             :         ~OSDBCDriverManager();
      85             : 
      86             :     public:
      87             : 
      88             :     // XDriverManager
      89             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      90             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnectionWithInfo( 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);
      91             :         virtual void SAL_CALL setLoginTimeout( sal_Int32 seconds ) throw(::com::sun::star::uno::RuntimeException);
      92             :         virtual sal_Int32 SAL_CALL getLoginTimeout(  ) throw(::com::sun::star::uno::RuntimeException);
      93             : 
      94             :     // XDriverAccess
      95             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > SAL_CALL getDriverByURL( const ::rtl::OUString& url ) throw(::com::sun::star::uno::RuntimeException);
      96             : 
      97             :     // XEnumerationAccess
      98             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(  ) throw(::com::sun::star::uno::RuntimeException);
      99             : 
     100             :     // XElementAccess
     101             :         virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw(::com::sun::star::uno::RuntimeException);
     102             :         virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException);
     103             : 
     104             :     // XServiceInfo
     105             :         virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
     106             :         virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
     107             :         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
     108             : 
     109             :     // XServiceInfo - static methods
     110             :         static ::rtl::OUString SAL_CALL getImplementationName_static(  ) throw(::com::sun::star::uno::RuntimeException);
     111             :         static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static(  ) throw(::com::sun::star::uno::RuntimeException);
     112             :         static ::rtl::OUString SAL_CALL getSingletonName_static(  ) throw(::com::sun::star::uno::RuntimeException);
     113             :         static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxContext );
     114             : 
     115             :     // XNamingService
     116             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRegisteredObject( const ::rtl::OUString& Name ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
     117             :         virtual void SAL_CALL registerObject( const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Object ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
     118             :         virtual void SAL_CALL revokeObject( const ::rtl::OUString& Name ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
     119             : 
     120             :     protected:
     121             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > implGetDriverForURL(const ::rtl::OUString& _rURL);
     122             : 
     123             :         /** retrieve the driver order preferences from the configuration and
     124             :             sort m_aDriversBS accordingly.
     125             :         */
     126             :         void initializeDriverPrecedence();
     127             : 
     128             :         void bootstrapDrivers();
     129             :     };
     130             : 
     131             : }   // namespace drivermanager
     132             : 
     133             : #endif // _CONNECTIVITY_DRIVERMANAGER_HXX_
     134             : 
     135             : 
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10