summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2005-03-30 10:52:17 +0000
committerRüdiger Timm <rt@openoffice.org>2005-03-30 10:52:17 +0000
commit4cd6c340923069d4d247d8bc57e03a23248f54d0 (patch)
treec18cdca252e35952319f8e97a5c13f0e3558f326 /connectivity
parent2c1749430c62e6f254431511575f78ea262846fa (diff)
INTEGRATION: CWS dba28 (1.3.22); FILE MERGED
2005/03/23 14:58:43 fs 1.3.22.2: #i45314# implement sync as flush, but *without* commit 2005/03/21 12:53:34 fs 1.3.22.1: copying the changes from CWS dba26 herein, since they're needed to fix i45314
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx94
1 files changed, 55 insertions, 39 deletions
diff --git a/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx
index 1b8b115f9bb5..6319f9b86e22 100644
--- a/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx
+++ b/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: StorageNativeOutputStream.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: vg $ $Date: 2005-03-23 09:41:52 $
+ * last change: $Author: rt $ $Date: 2005-03-30 11:52:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,6 +69,10 @@
#include "cppuhelper/compbase1.hxx"
#include "cppuhelper/component_context.hxx"
+#ifndef CONNECTIVITY_HSQLDB_ACCESSLOG_HXX
+#include "accesslog.hxx"
+#endif
+
#ifndef _COM_SUN_STAR_EMBED_XTRANSACTEDOBJECT_HPP_
#include <com/sun/star/embed/XTransactedObject.hpp>
#endif
@@ -96,14 +100,12 @@
#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
#endif
-#include "hsqldb/HStorageAccess.h"
+#include "hsqldb/HStorageAccess.hxx"
#include "hsqldb/HStorageMap.hxx"
#include "jvmaccess/virtualmachine.hxx"
#include "com/sun/star/lang/XSingleComponentFactory.hpp"
-#include <rtl/logfile.hxx>
-
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::document;
@@ -130,10 +132,8 @@ JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputSt
{
#if OSL_DEBUG_LEVEL > 1
{
- ::rtl::OUString sOrgName = StorageContainer::jstring2ustring(env,name);
- sOrgName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".output"));
- ::rtl::OString sName = ::rtl::OUStringToOString(sOrgName,RTL_TEXTENCODING_ASCII_US);
- getStreams()[sOrgName] = fopen( sName.getStr(), "a+" );
+ OperationLogFile( env, name, "output" ).logOperation( "openStream" );
+ LogFile( env, name, "output" ).create();
}
#endif
StorageContainer::registerStream(env,name,key,mode);
@@ -146,7 +146,14 @@ JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputSt
JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2_3BII
(JNIEnv * env, jobject obj_this, jstring key, jstring name, jbyteArray buffer, jint off, jint len)
{
- Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_write(env,obj_this,name,key,buffer,off,len);
+#if OSL_DEBUG_LEVEL > 1
+ OperationLogFile( env, name, "output" ).logOperation( "write( byte[], int, int )" );
+
+ DataLogFile aDataLog( env, name, "output" );
+ write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, off, len, &aDataLog );
+#else
+ write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, off, len );
+#endif
}
// -----------------------------------------------------------------------------
/*
@@ -157,7 +164,14 @@ JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputSt
JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2_3B
(JNIEnv * env, jobject obj_this, jstring key, jstring name, jbyteArray buffer)
{
- Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_write(env,obj_this,name,key,buffer,0,env->GetArrayLength(buffer));
+#if OSL_DEBUG_LEVEL > 1
+ OperationLogFile( env, name, "output" ).logOperation( "write( byte[] )" );
+
+ DataLogFile aDataLog( env, name, "output" );
+ write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, 0, env->GetArrayLength( buffer ), &aDataLog );
+#else
+ write_to_storage_stream_from_buffer( env, obj_this, name, key, buffer, 0, env->GetArrayLength( buffer ) );
+#endif
}
// -----------------------------------------------------------------------------
/*
@@ -168,6 +182,13 @@ JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputSt
JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_close
(JNIEnv * env, jobject obj_this, jstring key, jstring name)
{
+#if OSL_DEBUG_LEVEL > 1
+ OperationLogFile aOpLog( env, name, "output" );
+ aOpLog.logOperation( "close" );
+
+ LogFile aDataLog( env, name, "output" );
+#endif
+
::boost::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key);
Reference< XOutputStream> xFlush = pHelper.get() ? pHelper->getOutputStream() : Reference< XOutputStream>();
if ( xFlush.is() )
@@ -179,12 +200,8 @@ JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputSt
{}
#if OSL_DEBUG_LEVEL > 1
- {
- ::rtl::OUString sOrgName = StorageContainer::jstring2ustring(env,name);
- sOrgName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".output"));
- fclose( getStreams()[sOrgName] );
- getStreams().erase(sOrgName);
- }
+ aDataLog.close();
+ aOpLog.close();
#endif
StorageContainer::revokeStream(env,name,key);
}
@@ -197,7 +214,14 @@ JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputSt
JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2I
(JNIEnv * env, jobject obj_this, jstring key, jstring name,jint b)
{
- Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_writeInt(env,obj_this,name,key,b);
+#if OSL_DEBUG_LEVEL > 1
+ OperationLogFile( env, name, "output" ).logOperation( "write( int )" );
+
+ DataLogFile aDataLog( env, name, "output" );
+ write_to_storage_stream( env, obj_this, name, key, b, &aDataLog );
+#else
+ write_to_storage_stream( env, obj_this, name, key, b );
+#endif
}
// -----------------------------------------------------------------------------
/*
@@ -208,6 +232,9 @@ JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputSt
JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_flush
(JNIEnv * env, jobject obj_this, jstring key, jstring name)
{
+#if OSL_DEBUG_LEVEL > 1
+ OperationLogFile( env, name, "output" ).logOperation( "flush" );
+#endif
}
// -----------------------------------------------------------------------------
/*
@@ -218,32 +245,21 @@ JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputSt
JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_sync
(JNIEnv * env, jobject obj_this, jstring key, jstring name)
{
- TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key));
- Reference<XTransactedObject> xTrans(aStoragePair.first.first,UNO_QUERY);
- if ( xTrans.is() )
+#if OSL_DEBUG_LEVEL > 1
+ OperationLogFile( env, name, "output" ).logOperation( "sync" );
+#endif
+ ::boost::shared_ptr< StreamHelper > pStream = StorageContainer::getRegisteredStream( env, name, key );
+ Reference< XOutputStream > xFlush = pStream.get() ? pStream->getOutputStream() : Reference< XOutputStream>();
+ OSL_ENSURE( xFlush.is(), "StorageNativeOutputStream::sync: could not retrieve an output stream!" );
+ if ( xFlush.is() )
{
try
{
- TStreamMap::iterator aIter = aStoragePair.second.begin();
- TStreamMap::iterator aEnd = aStoragePair.second.end();
- for (;aIter != aEnd ; ++aIter)
- {
- ::boost::shared_ptr<StreamHelper> pHelper = aIter->second;
- Reference< XOutputStream> xFlush = pHelper.get() ? pHelper->getOutputStream() : Reference< XOutputStream>();
- if ( xFlush.is() )
- try
- {
- xFlush->flush();
- }
- catch(Exception&)
- {}
- }
- xTrans->commit();
+ xFlush->flush();
}
- catch(Exception& e)
+ catch(Exception&)
{
- OSL_ENSURE(0,"Exception catched! : sync();");
- StorageContainer::throwJavaException(e,env);
+ OSL_ENSURE( false, "StorageNativeOutputStream::sync: could not flush output stream!" );
}
}
}