LCOV - code coverage report
Current view: top level - ucb/source/cacher - cacheddynamicresultset.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 17 60 28.3 %
Date: 2014-04-11 Functions: 10 32 31.2 %
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             : 
      21             : #include <cacheddynamicresultset.hxx>
      22             : #include <com/sun/star/sdbc/XResultSet.hpp>
      23             : #include <cachedcontentresultset.hxx>
      24             : #include <osl/diagnose.h>
      25             : #include <comphelper/processfactory.hxx>
      26             : 
      27             : using namespace com::sun::star::lang;
      28             : using namespace com::sun::star::sdbc;
      29             : using namespace com::sun::star::ucb;
      30             : using namespace com::sun::star::uno;
      31             : 
      32             : 
      33           0 : CachedDynamicResultSet::CachedDynamicResultSet(
      34             :         Reference< XDynamicResultSet > xOrigin
      35             :         , const Reference< XContentIdentifierMapping > & xContentMapping
      36             :         , const Reference< XComponentContext > & xContext )
      37             :         : DynamicResultSetWrapper( xOrigin, xContext )
      38           0 :         , m_xContentIdentifierMapping( xContentMapping )
      39             : {
      40           0 :     impl_init();
      41           0 : }
      42             : 
      43           0 : CachedDynamicResultSet::~CachedDynamicResultSet()
      44             : {
      45           0 :     impl_deinit();
      46           0 : }
      47             : 
      48             : //virtual
      49           0 : void SAL_CALL CachedDynamicResultSet
      50             :     ::impl_InitResultSetOne( const Reference< XResultSet >& xResultSet )
      51             : {
      52           0 :     DynamicResultSetWrapper::impl_InitResultSetOne( xResultSet );
      53             :     OSL_ENSURE( m_xSourceResultOne.is(), "need source resultset" );
      54             : 
      55             :     Reference< XResultSet > xCache(
      56           0 :         new CachedContentResultSet( m_xContext, m_xSourceResultOne, m_xContentIdentifierMapping ) );
      57             : 
      58           0 :     osl::Guard< osl::Mutex > aGuard( m_aMutex );
      59           0 :     m_xMyResultOne = xCache;
      60           0 : }
      61             : 
      62             : //virtual
      63           0 : void SAL_CALL CachedDynamicResultSet
      64             :     ::impl_InitResultSetTwo( const Reference< XResultSet >& xResultSet )
      65             : {
      66           0 :     DynamicResultSetWrapper::impl_InitResultSetTwo( xResultSet );
      67             :     OSL_ENSURE( m_xSourceResultTwo.is(), "need source resultset" );
      68             : 
      69             :     Reference< XResultSet > xCache(
      70           0 :         new CachedContentResultSet( m_xContext, m_xSourceResultTwo, m_xContentIdentifierMapping ) );
      71             : 
      72           0 :     osl::Guard< osl::Mutex > aGuard( m_aMutex );
      73           0 :     m_xMyResultTwo = xCache;
      74           0 : }
      75             : 
      76             : 
      77             : // XInterface methods.
      78           0 : void SAL_CALL CachedDynamicResultSet::acquire()
      79             :     throw()
      80             : {
      81           0 :     OWeakObject::acquire();
      82           0 : }
      83             : 
      84           0 : void SAL_CALL CachedDynamicResultSet::release()
      85             :     throw()
      86             : {
      87           0 :     OWeakObject::release();
      88           0 : }
      89             : 
      90           0 : Any SAL_CALL CachedDynamicResultSet
      91             :     ::queryInterface( const Type&  rType )
      92             :     throw ( RuntimeException, std::exception )
      93             : {
      94             :     //list all interfaces inclusive baseclasses of interfaces
      95             : 
      96           0 :     Any aRet = DynamicResultSetWrapper::queryInterface( rType );
      97           0 :     if( aRet.hasValue() )
      98           0 :         return aRet;
      99             : 
     100           0 :     aRet = cppu::queryInterface( rType,
     101             :                 static_cast< XTypeProvider* >( this )
     102             :                 , static_cast< XServiceInfo* >( this )
     103           0 :                 );
     104           0 :     return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
     105             : }
     106             : 
     107             : 
     108             : // XTypeProvider methods.
     109             : 
     110             : //list all interfaces exclusive baseclasses
     111           0 : XTYPEPROVIDER_IMPL_4( CachedDynamicResultSet
     112             :                     , XTypeProvider
     113             :                     , XServiceInfo
     114             :                     , XDynamicResultSet
     115             :                     , XSourceInitialization
     116             :                     );
     117             : 
     118             : 
     119             : // XServiceInfo methods.
     120             : 
     121             : 
     122           0 : XSERVICEINFO_NOFACTORY_IMPL_1( CachedDynamicResultSet,
     123             :                             OUString( "com.sun.star.comp.ucb.CachedDynamicResultSet" ),
     124             :                             OUString( CACHED_DRS_SERVICE_NAME ) );
     125             : 
     126             : 
     127             : // own methds. ( inherited )
     128             : 
     129             : //virtual
     130           0 : void SAL_CALL CachedDynamicResultSet
     131             :     ::impl_disposing( const EventObject& Source )
     132             :     throw( RuntimeException )
     133             : {
     134           0 :     DynamicResultSetWrapper::impl_disposing( Source );
     135           0 :     m_xContentIdentifierMapping.clear();
     136           0 : }
     137             : 
     138             : 
     139             : 
     140             : // class CachedDynamicResultSetFactory
     141             : 
     142             : 
     143             : 
     144           1 : CachedDynamicResultSetFactory::CachedDynamicResultSetFactory(
     145           1 :         const Reference< XComponentContext > & xContext )
     146             : {
     147           1 :     m_xContext = xContext;
     148           1 : }
     149             : 
     150           2 : CachedDynamicResultSetFactory::~CachedDynamicResultSetFactory()
     151             : {
     152           2 : }
     153             : 
     154             : 
     155             : // CachedDynamicResultSetFactory XInterface methods.
     156           6 : void SAL_CALL CachedDynamicResultSetFactory::acquire()
     157             :     throw()
     158             : {
     159           6 :     OWeakObject::acquire();
     160           6 : }
     161             : 
     162           6 : void SAL_CALL CachedDynamicResultSetFactory::release()
     163             :     throw()
     164             : {
     165           6 :     OWeakObject::release();
     166           6 : }
     167             : 
     168           2 : css::uno::Any SAL_CALL CachedDynamicResultSetFactory::queryInterface( const css::uno::Type & rType )
     169             :     throw( css::uno::RuntimeException, std::exception )
     170             : {
     171             :     css::uno::Any aRet = cppu::queryInterface( rType,
     172             :                                                (static_cast< XTypeProvider* >(this)),
     173             :                                                (static_cast< XServiceInfo* >(this)),
     174             :                                                (static_cast< XCachedDynamicResultSetFactory* >(this))
     175           2 :                                                );
     176           2 :     return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
     177             : }
     178             : 
     179             : // CachedDynamicResultSetFactory XTypeProvider methods.
     180             : 
     181             : 
     182           0 : XTYPEPROVIDER_IMPL_3( CachedDynamicResultSetFactory,
     183             :                       XTypeProvider,
     184             :                          XServiceInfo,
     185             :                       XCachedDynamicResultSetFactory );
     186             : 
     187             : 
     188             : // CachedDynamicResultSetFactory XServiceInfo methods.
     189             : 
     190             : 
     191           5 : XSERVICEINFO_IMPL_1_CTX( CachedDynamicResultSetFactory,
     192             :                          OUString( "com.sun.star.comp.ucb.CachedDynamicResultSetFactory" ),
     193             :                          OUString( CACHED_DRS_FACTORY_NAME ) );
     194             : 
     195             : 
     196             : // Service factory implementation.
     197             : 
     198             : 
     199           1 : ONE_INSTANCE_SERVICE_FACTORY_IMPL( CachedDynamicResultSetFactory );
     200             : 
     201             : 
     202             : // CachedDynamicResultSetFactory XCachedDynamicResultSetFactory methods.
     203             : 
     204             : 
     205             : //virtual
     206           0 : Reference< XDynamicResultSet > SAL_CALL CachedDynamicResultSetFactory
     207             :     ::createCachedDynamicResultSet(
     208             :           const Reference< XDynamicResultSet > & SourceStub
     209             :         , const Reference< XContentIdentifierMapping > & ContentIdentifierMapping )
     210             :         throw( RuntimeException, std::exception )
     211             : {
     212           0 :     Reference< XDynamicResultSet > xRet;
     213           0 :     xRet = new CachedDynamicResultSet( SourceStub, ContentIdentifierMapping, m_xContext );
     214           0 :     return xRet;
     215             : }
     216             : 
     217             : 
     218             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10