LCOV - code coverage report
Current view: top level - connectivity/source/manager - mdrivermanager.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 5 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 <sal/config.h>
      24             : 
      25             : #include <map>
      26             : #include <vector>
      27             : 
      28             : #include <com/sun/star/sdbc/XDriverManager2.hpp>
      29             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      30             : #include <com/sun/star/uno/XNamingService.hpp>
      31             : #include <com/sun/star/lang/XServiceInfo.hpp>
      32             : #include <com/sun/star/sdbc/XDriverAccess.hpp>
      33             : //#include <com/sun/star/lang/XSingleServiceFactory.hpp>
      34             : #include <com/sun/star/lang/XSingleComponentFactory.hpp>
      35             : 
      36             : #include <cppuhelper/implbase3.hxx>
      37             : #include <comphelper/logging.hxx>
      38             : #include <osl/mutex.hxx>
      39             : #include "connectivity/DriversConfig.hxx"
      40             : 
      41             : namespace drivermanager
      42             : {
      43             : 
      44             : 
      45             :     //= various
      46             : 
      47             :     typedef std::map< OUString, css::uno::Reference< css::sdbc::XDriver > > DriverCollection;
      48             : 
      49           0 :     struct DriverAccess
      50             :     {
      51             :         OUString           sImplementationName;        /// the implementation name of the driver
      52             :         css::uno::Reference< css::sdbc::XDriver >                  xDriver;                    /// the driver itself
      53             :         css::uno::Reference< css::lang::XSingleComponentFactory >  xComponentFactory;          /// the factory to create the driver component (if not already done so)
      54             :     };
      55             : 
      56             : 
      57             :     //= OSDBCDriverManager - the one-instance service for managing SDBC drivers
      58             : 
      59             :     typedef ::cppu::WeakImplHelper3 <   ::com::sun::star::sdbc::XDriverManager2
      60             :                                     ,   ::com::sun::star::lang::XServiceInfo
      61             :                                     ,   ::com::sun::star::uno::XNamingService
      62             :                                     >   OSDBCDriverManager_Base;
      63             : 
      64             :     class OSDBCDriverManager : public OSDBCDriverManager_Base
      65             :     {
      66             :         friend class ODriverEnumeration;
      67             : 
      68             :         ::osl::Mutex                    m_aMutex;
      69             :         css::uno::Reference<css::uno::XComponentContext>  m_xContext;
      70             :         ::comphelper::EventLogger       m_aEventLogger;
      71             : 
      72             :         typedef std::vector<DriverAccess> DriverAccessArray;
      73             :         DriverAccessArray               m_aDriversBS;
      74             : 
      75             :         // for drivers registered at runtime (not bootstrapped) we don't require an XServiceInfo interface,
      76             :         // so we have to remember their impl-name in another way
      77             :         typedef std::map< OUString, css::uno::Reference< css::sdbc::XDriver > > DriverCollection;
      78             :         DriverCollection                m_aDriversRT;
      79             : 
      80             :         ::connectivity::DriversConfig   m_aDriverConfig;
      81             :         sal_Int32                       m_nLoginTimeout;
      82             : 
      83             :     private:
      84             :         OSDBCDriverManager(
      85             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext );
      86             :         virtual ~OSDBCDriverManager();
      87             : 
      88             :     public:
      89             : 
      90             :     // XDriverManager
      91             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( const OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      92             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnectionWithInfo( 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, std::exception) SAL_OVERRIDE;
      93             :         virtual void SAL_CALL setLoginTimeout( sal_Int32 seconds ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      94             :         virtual sal_Int32 SAL_CALL getLoginTimeout(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      95             : 
      96             :     // XDriverAccess
      97             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > SAL_CALL getDriverByURL( const OUString& url ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             : 
      99             :     // XEnumerationAccess
     100             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             : 
     102             :     // XElementAccess
     103             :         virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     104             :         virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     105             : 
     106             :     // XServiceInfo
     107             :         virtual OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     108             :         virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     109             :         virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     110             : 
     111             :     // XServiceInfo - static methods
     112             :         static OUString SAL_CALL getImplementationName_static(  ) throw(::com::sun::star::uno::RuntimeException);
     113             :         static ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_static(  ) throw(::com::sun::star::uno::RuntimeException);
     114             :         static OUString SAL_CALL getSingletonName_static(  ) throw(::com::sun::star::uno::RuntimeException);
     115             :         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 );
     116             : 
     117             :     // XNamingService
     118             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRegisteredObject( const OUString& Name ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             :         virtual void SAL_CALL registerObject( const 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, std::exception) SAL_OVERRIDE;
     120             :         virtual void SAL_CALL revokeObject( const OUString& Name ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     121             : 
     122             :     protected:
     123             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > implGetDriverForURL(const OUString& _rURL);
     124             : 
     125             :         /** retrieve the driver order preferences from the configuration and
     126             :             sort m_aDriversBS accordingly.
     127             :         */
     128             :         void initializeDriverPrecedence();
     129             : 
     130             :         void bootstrapDrivers();
     131             :     };
     132             : 
     133             : }   // namespace drivermanager
     134             : 
     135             : #endif // _CONNECTIVITY_DRIVERMANAGER_HXX_
     136             : 
     137             : 
     138             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10