LCOV - code coverage report
Current view: top level - connectivity/source/drivers/hsqldb - StorageNativeOutputStream.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 30 0.0 %
Date: 2012-08-25 Functions: 0 7 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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                 :            : #if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
      21                 :            : #include <config.h>
      22                 :            : #endif
      23                 :            : 
      24                 :            : #include "uno/mapping.hxx"
      25                 :            : #include "uno/environment.hxx"
      26                 :            : #include "cppuhelper/bootstrap.hxx"
      27                 :            : #include "cppuhelper/compbase1.hxx"
      28                 :            : #include "cppuhelper/component_context.hxx"
      29                 :            : #include "accesslog.hxx"
      30                 :            : #include <com/sun/star/embed/XTransactedObject.hpp>
      31                 :            : #include <comphelper/processfactory.hxx>
      32                 :            : #include <com/sun/star/io/XStream.hpp>
      33                 :            : #include <com/sun/star/container/XNameAccess.hpp>
      34                 :            : #include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
      35                 :            : #include <com/sun/star/embed/XStorage.hpp>
      36                 :            : #include <com/sun/star/embed/ElementModes.hpp>
      37                 :            : #include <comphelper/stl_types.hxx>
      38                 :            : #include <comphelper/types.hxx>
      39                 :            : #include "hsqldb/HStorageAccess.hxx"
      40                 :            : #include "hsqldb/HStorageMap.hxx"
      41                 :            : 
      42                 :            : #include "jvmaccess/virtualmachine.hxx"
      43                 :            : #include "com/sun/star/lang/XSingleComponentFactory.hpp"
      44                 :            : #include "diagnose_ex.h"
      45                 :            : 
      46                 :            : using namespace ::com::sun::star::container;
      47                 :            : using namespace ::com::sun::star::uno;
      48                 :            : using namespace ::com::sun::star::document;
      49                 :            : using namespace ::com::sun::star::embed;
      50                 :            : using namespace ::com::sun::star::io;
      51                 :            : using namespace ::com::sun::star::lang;
      52                 :            : using namespace ::connectivity::hsqldb;
      53                 :            : 
      54                 :            : // -----------------------------------------------------------------------------
      55                 :            : /*
      56                 :            :  * Class:     com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
      57                 :            :  * Method:    openStream
      58                 :            :  * Signature: (Ljava/lang/String;Ljava/lang/String;I)V
      59                 :            :  */
      60                 :          0 : extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_openStream
      61                 :            :   (JNIEnv * env, jobject /*obj_this*/, jstring name, jstring key, jint mode)
      62                 :            : {
      63                 :            : #ifdef HSQLDB_DBG
      64                 :            :     {
      65                 :            :         OperationLogFile( env, name, "output" ).logOperation( "openStream" );
      66                 :            :         LogFile( env, name, "output" ).create();
      67                 :            :     }
      68                 :            : #endif
      69                 :          0 :     StorageContainer::registerStream(env,name,key,mode);
      70                 :          0 : }
      71                 :            : /*
      72                 :            :  * Class:     com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
      73                 :            :  * Method:    write
      74                 :            :  * Signature: (Ljava/lang/String;Ljava/lang/String;[BII)V
      75                 :            :  */
      76                 :          0 : extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2_3BII
      77                 :            :   (JNIEnv * env, jobject obj_this, jstring key, jstring name, jbyteArray buffer, jint off, jint len)
      78                 :            : {
      79                 :            : #ifdef HSQLDB_DBG
      80                 :            :     OperationLogFile( env, name, "output" ).logOperation( "write( byte[], int, int )" );
      81                 :            : 
      82                 :            :     DataLogFile aDataLog( env, name, "output" );
      83                 :            :     write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, off, len, &aDataLog );
      84                 :            : #else
      85                 :          0 :     write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, off, len );
      86                 :            : #endif
      87                 :          0 : }
      88                 :            : // -----------------------------------------------------------------------------
      89                 :            : /*
      90                 :            :  * Class:     com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
      91                 :            :  * Method:    write
      92                 :            :  * Signature: (Ljava/lang/String;Ljava/lang/String;[B)V
      93                 :            :  */
      94                 :          0 : extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2_3B
      95                 :            :   (JNIEnv * env, jobject obj_this, jstring key, jstring name, jbyteArray buffer)
      96                 :            : {
      97                 :            : #ifdef HSQLDB_DBG
      98                 :            :     OperationLogFile( env, name, "output" ).logOperation( "write( byte[] )" );
      99                 :            : 
     100                 :            :     DataLogFile aDataLog( env, name, "output" );
     101                 :            :     write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, 0, env->GetArrayLength( buffer ), &aDataLog );
     102                 :            : #else
     103                 :          0 :     write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, 0, env->GetArrayLength( buffer ) );
     104                 :            : #endif
     105                 :          0 : }
     106                 :            : // -----------------------------------------------------------------------------
     107                 :            : /*
     108                 :            :  * Class:     com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
     109                 :            :  * Method:    close
     110                 :            :  * Signature: (Ljava/lang/String;Ljava/lang/String;)V
     111                 :            :  */
     112                 :          0 : extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_close
     113                 :            :   (JNIEnv * env, jobject /*obj_this*/, jstring key, jstring name)
     114                 :            : {
     115                 :            : #ifdef HSQLDB_DBG
     116                 :            :     OperationLogFile aOpLog( env, name, "output" );
     117                 :            :     aOpLog.logOperation( "close" );
     118                 :            : 
     119                 :            :     LogFile aDataLog( env, name, "output" );
     120                 :            : #endif
     121                 :            : 
     122                 :          0 :     ::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
     123                 :          0 :     Reference< XOutputStream> xFlush = pHelper.get() ? pHelper->getOutputStream() : Reference< XOutputStream>();
     124                 :          0 :     if ( xFlush.is() )
     125                 :            :         try
     126                 :            :         {
     127                 :          0 :             xFlush->flush();
     128                 :            :         }
     129                 :          0 :         catch(Exception&)
     130                 :            :         {}
     131                 :            : 
     132                 :            : #ifdef HSQLDB_DBG
     133                 :            :     aDataLog.close();
     134                 :            :     aOpLog.close();
     135                 :            : #endif
     136                 :          0 :     StorageContainer::revokeStream(env,name,key);
     137                 :          0 : }
     138                 :            : // -----------------------------------------------------------------------------
     139                 :            : /*
     140                 :            :  * Class:     com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
     141                 :            :  * Method:    write
     142                 :            :  * Signature: (Ljava/lang/String;Ljava/lang/String;I)V
     143                 :            :  */
     144                 :          0 : extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2I
     145                 :            :   (JNIEnv * env, jobject obj_this, jstring key, jstring name,jint b)
     146                 :            : {
     147                 :            : #ifdef HSQLDB_DBG
     148                 :            :     OperationLogFile( env, name, "output" ).logOperation( "write( int )" );
     149                 :            : 
     150                 :            :     DataLogFile aDataLog( env, name, "output" );
     151                 :            :     write_to_storage_stream( env, obj_this, name, key, b, &aDataLog );
     152                 :            : #else
     153                 :          0 :     write_to_storage_stream( env, obj_this, name, key, b );
     154                 :            : #endif
     155                 :          0 : }
     156                 :            : // -----------------------------------------------------------------------------
     157                 :            : /*
     158                 :            :  * Class:     com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
     159                 :            :  * Method:    flush
     160                 :            :  * Signature: (Ljava/lang/String;Ljava/lang/String;)V
     161                 :            :  */
     162                 :          0 : extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_flush
     163                 :            :   (JNIEnv * env, jobject /*obj_this*/, jstring key, jstring name)
     164                 :            : {
     165                 :            :     OSL_UNUSED( env );
     166                 :            :     OSL_UNUSED( key );
     167                 :            :     OSL_UNUSED( name );
     168                 :            : #ifdef HSQLDB_DBG
     169                 :            :     OperationLogFile( env, name, "output" ).logOperation( "flush" );
     170                 :            : 
     171                 :            :     ::rtl::OUString sKey = StorageContainer::jstring2ustring(env,key);
     172                 :            :     ::rtl::OUString sName = StorageContainer::jstring2ustring(env,name);
     173                 :            : #endif
     174                 :          0 : }
     175                 :            : // -----------------------------------------------------------------------------
     176                 :            : /*
     177                 :            :  * Class:     com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream
     178                 :            :  * Method:    sync
     179                 :            :  * Signature: (Ljava/lang/String;Ljava/lang/String;)V
     180                 :            :  */
     181                 :          0 : extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_sync
     182                 :            :   (JNIEnv * env, jobject /*obj_this*/, jstring key, jstring name)
     183                 :            : {
     184                 :            : #ifdef HSQLDB_DBG
     185                 :            :     OperationLogFile( env, name, "output" ).logOperation( "sync" );
     186                 :            : #endif
     187                 :          0 :     ::boost::shared_ptr< StreamHelper > pStream = StorageContainer::getRegisteredStream( env, name, key );
     188                 :          0 :     Reference< XOutputStream > xFlush = pStream.get() ? pStream->getOutputStream() : Reference< XOutputStream>();
     189                 :            :     OSL_ENSURE( xFlush.is(), "StorageNativeOutputStream::sync: could not retrieve an output stream!" );
     190                 :          0 :     if ( xFlush.is() )
     191                 :            :     {
     192                 :            :         try
     193                 :            :         {
     194                 :          0 :             xFlush->flush();
     195                 :            :         }
     196                 :          0 :         catch(Exception&)
     197                 :            :         {
     198                 :            :             OSL_FAIL( "StorageNativeOutputStream::sync: could not flush output stream!" );
     199                 :            :         }
     200                 :          0 :     }
     201                 :          0 : }
     202                 :            : // -----------------------------------------------------------------------------
     203                 :            : 
     204                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10