LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/ucb/source/cacher - cacheddynamicresultset.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 47 0.0 %
Date: 2013-07-09 Functions: 0 32 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             : 
      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             : //--------------------------------------------------------------------------
      79           0 : XINTERFACE_COMMON_IMPL( CachedDynamicResultSet )
      80             : 
      81           0 : Any SAL_CALL CachedDynamicResultSet
      82             :     ::queryInterface( const Type&  rType )
      83             :     throw ( RuntimeException )
      84             : {
      85             :     //list all interfaces inclusive baseclasses of interfaces
      86             : 
      87           0 :     Any aRet = DynamicResultSetWrapper::queryInterface( rType );
      88           0 :     if( aRet.hasValue() )
      89           0 :         return aRet;
      90             : 
      91           0 :     aRet = cppu::queryInterface( rType,
      92             :                 static_cast< XTypeProvider* >( this )
      93             :                 , static_cast< XServiceInfo* >( this )
      94           0 :                 );
      95           0 :     return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
      96             : }
      97             : 
      98             : //--------------------------------------------------------------------------
      99             : // XTypeProvider methods.
     100             : //--------------------------------------------------------------------------
     101             : //list all interfaces exclusive baseclasses
     102           0 : XTYPEPROVIDER_IMPL_4( CachedDynamicResultSet
     103             :                     , XTypeProvider
     104             :                     , XServiceInfo
     105             :                     , XDynamicResultSet
     106             :                     , XSourceInitialization
     107             :                     );
     108             : 
     109             : //--------------------------------------------------------------------------
     110             : // XServiceInfo methods.
     111             : //--------------------------------------------------------------------------
     112             : 
     113           0 : XSERVICEINFO_NOFACTORY_IMPL_1( CachedDynamicResultSet,
     114             :                             OUString( "com.sun.star.comp.ucb.CachedDynamicResultSet" ),
     115             :                             OUString( CACHED_DRS_SERVICE_NAME ) );
     116             : 
     117             : //--------------------------------------------------------------------------
     118             : // own methds. ( inherited )
     119             : //--------------------------------------------------------------------------
     120             : //virtual
     121           0 : void SAL_CALL CachedDynamicResultSet
     122             :     ::impl_disposing( const EventObject& Source )
     123             :     throw( RuntimeException )
     124             : {
     125           0 :     DynamicResultSetWrapper::impl_disposing( Source );
     126           0 :     m_xContentIdentifierMapping.clear();
     127           0 : }
     128             : 
     129             : //--------------------------------------------------------------------------
     130             : //--------------------------------------------------------------------------
     131             : // class CachedDynamicResultSetFactory
     132             : //--------------------------------------------------------------------------
     133             : //--------------------------------------------------------------------------
     134             : 
     135           0 : CachedDynamicResultSetFactory::CachedDynamicResultSetFactory(
     136           0 :         const Reference< XComponentContext > & xContext )
     137             : {
     138           0 :     m_xContext = xContext;
     139           0 : }
     140             : 
     141           0 : CachedDynamicResultSetFactory::~CachedDynamicResultSetFactory()
     142             : {
     143           0 : }
     144             : 
     145             : //--------------------------------------------------------------------------
     146             : // CachedDynamicResultSetFactory XInterface methods.
     147             : //--------------------------------------------------------------------------
     148             : 
     149           0 : XINTERFACE_IMPL_3( CachedDynamicResultSetFactory,
     150             :                    XTypeProvider,
     151             :                    XServiceInfo,
     152             :                    XCachedDynamicResultSetFactory );
     153             : 
     154             : //--------------------------------------------------------------------------
     155             : // CachedDynamicResultSetFactory XTypeProvider methods.
     156             : //--------------------------------------------------------------------------
     157             : 
     158           0 : XTYPEPROVIDER_IMPL_3( CachedDynamicResultSetFactory,
     159             :                       XTypeProvider,
     160             :                          XServiceInfo,
     161             :                       XCachedDynamicResultSetFactory );
     162             : 
     163             : //--------------------------------------------------------------------------
     164             : // CachedDynamicResultSetFactory XServiceInfo methods.
     165             : //--------------------------------------------------------------------------
     166             : 
     167           0 : XSERVICEINFO_IMPL_1_CTX( CachedDynamicResultSetFactory,
     168             :                          OUString( "com.sun.star.comp.ucb.CachedDynamicResultSetFactory" ),
     169             :                          OUString( CACHED_DRS_FACTORY_NAME ) );
     170             : 
     171             : //--------------------------------------------------------------------------
     172             : // Service factory implementation.
     173             : //--------------------------------------------------------------------------
     174             : 
     175           0 : ONE_INSTANCE_SERVICE_FACTORY_IMPL( CachedDynamicResultSetFactory );
     176             : 
     177             : //--------------------------------------------------------------------------
     178             : // CachedDynamicResultSetFactory XCachedDynamicResultSetFactory methods.
     179             : //--------------------------------------------------------------------------
     180             : 
     181             : //virtual
     182           0 : Reference< XDynamicResultSet > SAL_CALL CachedDynamicResultSetFactory
     183             :     ::createCachedDynamicResultSet(
     184             :           const Reference< XDynamicResultSet > & SourceStub
     185             :         , const Reference< XContentIdentifierMapping > & ContentIdentifierMapping )
     186             :         throw( RuntimeException )
     187             : {
     188           0 :     Reference< XDynamicResultSet > xRet;
     189           0 :     xRet = new CachedDynamicResultSet( SourceStub, ContentIdentifierMapping, m_xContext );
     190           0 :     return xRet;
     191             : }
     192             : 
     193             : 
     194             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10