Changes to the Java directory structure.
git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@247 0109f412-320b-0410-ab79-c3e0c5ffbbe6
This commit is contained in:
353
xflaim/java/jni/src/jbackup.cpp
Normal file
353
xflaim/java/jni/src/jbackup.cpp
Normal file
@@ -0,0 +1,353 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Desc:
|
||||
//
|
||||
// Tabs: 3
|
||||
//
|
||||
// Copyright (c) 2003-2006 Novell, Inc. All Rights Reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of version 2 of the GNU General Public
|
||||
// License as published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, contact Novell, Inc.
|
||||
//
|
||||
// To contact Novell about this file by physical or electronic mail,
|
||||
// you may find current contact information at www.novell.com
|
||||
//
|
||||
// $Id: $
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "jniftk.h"
|
||||
#include "xflaim_Backup.h"
|
||||
|
||||
#define THIS_BACKUP() \
|
||||
((IF_Backup *)(FLMUINT)lThis)
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
class JNIBackupClient : public IF_BackupClient
|
||||
{
|
||||
public:
|
||||
|
||||
JNIBackupClient(
|
||||
jobject jClient,
|
||||
JavaVM * pJvm)
|
||||
{
|
||||
flmAssert( jClient);
|
||||
flmAssert( pJvm);
|
||||
m_jClient = jClient;
|
||||
m_pJvm = pJvm;
|
||||
}
|
||||
|
||||
RCODE XFLMAPI JNIBackupClient::WriteData(
|
||||
const void * pvBuffer,
|
||||
FLMUINT uiBytesToWrite);
|
||||
|
||||
FINLINE FLMUINT getRefCount( void)
|
||||
{
|
||||
return( IF_BackupClient::getRefCount());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI AddRef( void)
|
||||
{
|
||||
return( IF_BackupClient::AddRef());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI Release( void)
|
||||
{
|
||||
return( IF_BackupClient::Release());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
jobject m_jClient;
|
||||
JavaVM * m_pJvm;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
class JNIBackupStatus : public IF_BackupStatus
|
||||
{
|
||||
public:
|
||||
|
||||
JNIBackupStatus(
|
||||
jobject jStatus,
|
||||
JavaVM * pJvm)
|
||||
{
|
||||
flmAssert(jStatus);
|
||||
flmAssert(pJvm);
|
||||
m_jStatus = jStatus;
|
||||
m_pJvm = pJvm;
|
||||
}
|
||||
|
||||
RCODE XFLMAPI backupStatus(
|
||||
FLMUINT64 ui64BytesToDo,
|
||||
FLMUINT64 ui64BytesDone);
|
||||
|
||||
FINLINE FLMUINT getRefCount( void)
|
||||
{
|
||||
return( IF_BackupStatus::getRefCount());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI AddRef( void)
|
||||
{
|
||||
return( IF_BackupStatus::AddRef());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI Release( void)
|
||||
{
|
||||
return( IF_BackupStatus::Release());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
jobject m_jStatus;
|
||||
JavaVM * m_pJvm;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
RCODE JNIBackupClient::WriteData(
|
||||
const void * pvBuffer,
|
||||
FLMUINT uiBytesToWrite)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
JNIEnv * pEnv;
|
||||
jclass Cls;
|
||||
jmethodID MId;
|
||||
jbyteArray jBuff;
|
||||
void * pvBuff;
|
||||
FLMBOOL bMustDetach = FALSE;
|
||||
|
||||
if (m_pJvm->GetEnv( (void **)&pEnv, JNI_VERSION_1_2) != JNI_OK)
|
||||
{
|
||||
if (m_pJvm->AttachCurrentThread( (void **)&pEnv, NULL) != 0)
|
||||
{
|
||||
rc = RC_SET( NE_XFLM_FAILURE);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
bMustDetach = TRUE;
|
||||
}
|
||||
|
||||
Cls = pEnv->GetObjectClass( m_jClient);
|
||||
MId = pEnv->GetMethodID( Cls, "WriteData", "([B)I");
|
||||
|
||||
flmAssert( MId);
|
||||
|
||||
jBuff = pEnv->NewByteArray( uiBytesToWrite);
|
||||
pvBuff = pEnv->GetPrimitiveArrayCritical(jBuff, NULL);
|
||||
memcpy(pvBuff, pvBuffer, uiBytesToWrite);
|
||||
pEnv->ReleasePrimitiveArrayCritical( jBuff, pvBuff, 0);
|
||||
|
||||
if( RC_BAD( rc = (RCODE)pEnv->CallIntMethod( m_jClient, MId, jBuff)))
|
||||
{
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (bMustDetach)
|
||||
{
|
||||
if (m_pJvm->DetachCurrentThread() != 0)
|
||||
{
|
||||
flmAssert( 0);
|
||||
rc = RC_SET( NE_XFLM_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
return( rc);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
RCODE JNIBackupStatus::backupStatus(
|
||||
FLMUINT64 ui64BytesToDo,
|
||||
FLMUINT64 ui64BytesDone)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
JNIEnv * pEnv;
|
||||
jclass Cls;
|
||||
jmethodID MId;
|
||||
FLMBOOL bMustDetach = FALSE;
|
||||
|
||||
if (m_pJvm->GetEnv( (void **)&pEnv, JNI_VERSION_1_2) != JNI_OK)
|
||||
{
|
||||
if (m_pJvm->AttachCurrentThread( (void **)&pEnv, NULL) != 0)
|
||||
{
|
||||
rc = RC_SET(NE_XFLM_FAILURE);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
bMustDetach = TRUE;
|
||||
}
|
||||
|
||||
Cls = pEnv->GetObjectClass( m_jStatus);
|
||||
MId = pEnv->GetMethodID( Cls, "backupStatus", "(JJ)I");
|
||||
flmAssert( MId);
|
||||
|
||||
rc = (RCODE)pEnv->CallIntMethod( m_jStatus, MId, (jlong)ui64BytesToDo,
|
||||
(jlong)ui64BytesDone);
|
||||
|
||||
Exit:
|
||||
|
||||
if (bMustDetach)
|
||||
{
|
||||
if (m_pJvm->DetachCurrentThread() != 0)
|
||||
{
|
||||
flmAssert( 0);
|
||||
rc = RC_SET( NE_XFLM_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
return( rc);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_Backup__1backup(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jstring sBackupPath,
|
||||
jstring sPassword,
|
||||
jobject Client,
|
||||
jobject Status)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Backup * pBackup = THIS_BACKUP();
|
||||
FLMUINT uiSeqNum = 0;
|
||||
JavaVM * pJvm;
|
||||
char * pszBackupPath = NULL;
|
||||
char * pszPassword = NULL;
|
||||
JNIBackupClient * pClient;
|
||||
JNIBackupStatus * pStatus = NULL;
|
||||
|
||||
|
||||
flmAssert( Client);
|
||||
|
||||
pEnv->GetJavaVM( &pJvm);
|
||||
if( (pClient = new JNIBackupClient( Client, pJvm)) == NULL)
|
||||
{
|
||||
rc = RC_SET( NE_XFLM_MEM);
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (sBackupPath)
|
||||
{
|
||||
pszBackupPath = (char *)pEnv->GetStringUTFChars( sBackupPath, NULL);
|
||||
}
|
||||
|
||||
if (sPassword)
|
||||
{
|
||||
pszPassword = (char *)pEnv->GetStringUTFChars( sPassword, NULL);
|
||||
}
|
||||
|
||||
if (Status)
|
||||
{
|
||||
if( (pStatus = new JNIBackupStatus( Status, pJvm)) == NULL)
|
||||
{
|
||||
rc = RC_SET( NE_XFLM_MEM);
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = pBackup->backup( pszBackupPath, pszPassword, pClient,
|
||||
pStatus, &uiSeqNum)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if( pszBackupPath)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sBackupPath, pszBackupPath);
|
||||
}
|
||||
|
||||
if( pszPassword)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sPassword, pszPassword);
|
||||
}
|
||||
|
||||
if (pClient)
|
||||
{
|
||||
pClient->Release();
|
||||
}
|
||||
|
||||
if (pStatus)
|
||||
{
|
||||
pStatus->Release();
|
||||
}
|
||||
|
||||
return( uiSeqNum);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Backup__1endBackup(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Backup * pThisBackup = THIS_BACKUP();
|
||||
|
||||
if (RC_BAD( rc = pThisBackup->endBackup()))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_Backup__1getBackupTransId(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
return( THIS_BACKUP()->getBackupTransId());
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_Backup__1getLastBackupTransId(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
return( THIS_BACKUP()->getLastBackupTransId());
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Backup__1release(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
THIS_BACKUP()->Release();
|
||||
}
|
||||
779
xflaim/java/jni/src/jdatavector.cpp
Normal file
779
xflaim/java/jni/src/jdatavector.cpp
Normal file
@@ -0,0 +1,779 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Desc:
|
||||
//
|
||||
// Tabs: 3
|
||||
//
|
||||
// Copyright (c) 2003-2006 Novell, Inc. All Rights Reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of version 2 of the GNU General Public
|
||||
// License as published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, contact Novell, Inc.
|
||||
//
|
||||
// To contact Novell about this file by physical or electronic mail,
|
||||
// you may find current contact information at www.novell.com
|
||||
//
|
||||
// $Id: $
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "xflaim.h"
|
||||
#include "xflaim_DataVector.h"
|
||||
#include "jniftk.h"
|
||||
|
||||
#define THIS_VECTOR() \
|
||||
((IF_DataVector *)(FLMUINT)lThis)
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1release(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
THIS_VECTOR()->Release();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1setDocumentId(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jlong lDocumentId)
|
||||
{
|
||||
THIS_VECTOR()->setDocumentID( (FLMUINT64)lDocumentId);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1setID(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementId,
|
||||
jlong lID)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->setID( (FLMUINT)iElementId, (FLMUINT64)lID)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1setNameId(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber,
|
||||
jint iNameId,
|
||||
jboolean bIsAttr,
|
||||
jboolean bIsData)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->setNameId( (FLMUINT)iElementNumber,
|
||||
(FLMUINT)iNameId, (FLMBOOL)(bIsAttr ? TRUE : FALSE),
|
||||
(FLMBOOL)(bIsData ? TRUE : FALSE))))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1setINT(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber,
|
||||
jint iNum)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
|
||||
if (iNum > 0x7FFFFFFF)
|
||||
{
|
||||
ThrowError( NE_XFLM_CONV_DEST_OVERFLOW, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->setINT(
|
||||
(FLMUINT)iElementNumber, (FLMINT)iNum)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1setUINT(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber,
|
||||
jint iUNum)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
FLMUINT uiNum = (FLMUINT)iUNum;
|
||||
|
||||
if (uiNum > 0xFFFFFFFF)
|
||||
{
|
||||
ThrowError( NE_XFLM_CONV_DEST_OVERFLOW, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->setUINT( (FLMUINT)iElementNumber, uiNum)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1setLong(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber,
|
||||
jlong lNum)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->setINT64(
|
||||
(FLMUINT)iElementNumber, (FLMUINT64)lNum)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1setString(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber,
|
||||
jstring sValue)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
jchar * puzValue = NULL;
|
||||
FLMBOOL bMustRelease = FALSE;
|
||||
|
||||
if (sValue)
|
||||
{
|
||||
puzValue = (jchar *)pEnv->GetStringCritical( sValue, NULL);
|
||||
bMustRelease = TRUE;
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->setUnicode(
|
||||
(FLMUINT)iElementNumber, puzValue)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (bMustRelease)
|
||||
{
|
||||
pEnv->ReleaseStringCritical( sValue, puzValue);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1setBinary(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber,
|
||||
jbyteArray Value)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
FLMUINT uiLength = pEnv->GetArrayLength( Value);
|
||||
void * pvValue = NULL;
|
||||
jboolean bIsCopy = false;
|
||||
FLMBOOL bMustRelease = false;
|
||||
|
||||
if ( (pvValue = pEnv->GetPrimitiveArrayCritical( Value, &bIsCopy)) == NULL)
|
||||
{
|
||||
rc = RC_SET( NE_XFLM_MEM);
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
bMustRelease = true;
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->setBinary( (FLMUINT)iElementNumber,
|
||||
pvValue, uiLength)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (bMustRelease)
|
||||
{
|
||||
pEnv->ReleasePrimitiveArrayCritical( Value, pvValue, JNI_ABORT);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1setRightTruncated(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
THIS_VECTOR()->setRightTruncated( (FLMUINT)iElementNumber);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1setLeftTruncated(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
THIS_VECTOR()->setLeftTruncated( (FLMUINT)iElementNumber);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1clearRightTruncated(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
THIS_VECTOR()->clearRightTruncated( (FLMUINT)iElementNumber);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1clearLeftTruncated(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
THIS_VECTOR()->clearLeftTruncated( (FLMUINT)iElementNumber);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_DataVector__1getDocumentID(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
return( (jlong)(THIS_VECTOR()->getDocumentID()));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_DataVector__1getID(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
return( (jlong)THIS_VECTOR()->getID( (FLMUINT)iElementNumber));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jint JNICALL Java_xflaim_DataVector__1getNameId(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
return( (jint)THIS_VECTOR()->getNameId( (FLMUINT)iElementNumber));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jboolean JNICALL Java_xflaim_DataVector__1isAttr(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
return( THIS_VECTOR()->isAttr( (FLMUINT)iElementNumber) ? true : false);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jboolean JNICALL Java_xflaim_DataVector__1isDataComponent(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
return( THIS_VECTOR()->isDataComponent(
|
||||
(FLMUINT)iElementNumber) ? true : false);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jboolean JNICALL Java_xflaim_DataVector__1isKeyComponent(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
return( THIS_VECTOR()->isKeyComponent(
|
||||
(FLMUINT)iElementNumber) ? true : false);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jint JNICALL Java_xflaim_DataVector__1getDataLength(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
return( (jint)THIS_VECTOR()->getDataLength( (FLMUINT)iElementNumber));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jint JNICALL Java_xflaim_DataVector__1getDataType(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
return( (jint)(THIS_VECTOR()->getDataType( (FLMUINT)iElementNumber)));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jint JNICALL Java_xflaim_DataVector__1getINT(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
FLMINT iINT;
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->getINT( (FLMUINT)iElementNumber, &iINT)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return( (jint)iINT);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jint JNICALL Java_xflaim_DataVector__1getUINT(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
FLMINT iINT;
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->getUINT( (FLMUINT)iElementNumber,
|
||||
(FLMUINT *)&iINT)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return( (jint)iINT);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_DataVector__1getLong(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
FLMINT64 i64INT;
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->getINT64( (FLMUINT)iElementNumber, &i64INT)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return( (jlong)i64INT);
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jstring JNICALL Java_xflaim_DataVector__1getString(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
FLMUNICODE uzBuffer[ 128];
|
||||
FLMUNICODE * puzBuf = uzBuffer;
|
||||
FLMUINT uiBufSize = sizeof( uzBuffer);
|
||||
FLMUINT uiNumChars;
|
||||
jstring sBuf = NULL;
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->getUnicode( (FLMUINT)iElementNumber,
|
||||
NULL, &uiNumChars)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (uiNumChars * sizeof( FLMUNICODE) >= uiBufSize)
|
||||
{
|
||||
uiBufSize = (uiNumChars + 1) * sizeof( FLMUNICODE);
|
||||
if (RC_BAD( rc = f_alloc( uiBufSize, &puzBuf)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->getUnicode( (FLMUINT)iElementNumber,
|
||||
puzBuf, &uiBufSize)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
sBuf = pEnv->NewString( puzBuf, uiBufSize / sizeof( FLMUNICODE));
|
||||
|
||||
Exit:
|
||||
|
||||
if (puzBuf != uzBuffer)
|
||||
{
|
||||
f_free( &puzBuf);
|
||||
}
|
||||
|
||||
return( sBuf);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jbyteArray JNICALL Java_xflaim_DataVector__1getBinary(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iElementNumber)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
FLMUINT uiLength;
|
||||
jbyteArray Data;
|
||||
void * pvData = NULL;
|
||||
jboolean bIsCopy = false;
|
||||
FLMBOOL bMustRelease = false;
|
||||
|
||||
uiLength = THIS_VECTOR()->getDataLength( (FLMUINT)iElementNumber);
|
||||
Data = pEnv->NewByteArray( uiLength);
|
||||
|
||||
if ( (pvData = pEnv->GetPrimitiveArrayCritical( Data, &bIsCopy)) == NULL)
|
||||
{
|
||||
rc = RC_SET( NE_XFLM_MEM);
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
bMustRelease = true;
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->getBinary( (FLMUINT)iElementNumber,
|
||||
pvData, &uiLength)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (bMustRelease)
|
||||
{
|
||||
if (RC_BAD( rc))
|
||||
{
|
||||
pEnv->ReleasePrimitiveArrayCritical( Data, pvData, JNI_ABORT);
|
||||
pEnv->DeleteLocalRef( Data);
|
||||
Data = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
pEnv->ReleasePrimitiveArrayCritical( Data, pvData, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return( Data);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jbyteArray JNICALL Java_xflaim_DataVector__1outputKey(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jlong ljDbRef,
|
||||
jint iIndexNum,
|
||||
jboolean bOutputIds)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = (IF_Db *)(FLMUINT)ljDbRef;
|
||||
FLMUINT uiLength;
|
||||
jbyteArray Key;
|
||||
void * pvKey = NULL;
|
||||
jboolean bIsCopy = false;
|
||||
FLMBOOL bMustRelease = false;
|
||||
|
||||
uiLength = XFLM_MAX_KEY_SIZE;
|
||||
Key = pEnv->NewByteArray( uiLength);
|
||||
|
||||
if( (pvKey = pEnv->GetPrimitiveArrayCritical( Key, &bIsCopy)) == NULL)
|
||||
{
|
||||
rc = RC_SET( NE_XFLM_MEM);
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
bMustRelease = true;
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->outputKey( pDb, (FLMUINT)iIndexNum,
|
||||
(bOutputIds ? TRUE : FALSE), (FLMBYTE *)pvKey,
|
||||
uiLength, &uiLength)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (bMustRelease)
|
||||
{
|
||||
if (RC_BAD( rc))
|
||||
{
|
||||
pEnv->ReleasePrimitiveArrayCritical( Key, pvKey, JNI_ABORT);
|
||||
pEnv->DeleteLocalRef( Key);
|
||||
Key = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
pEnv->ReleasePrimitiveArrayCritical( Key, pvKey, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return( Key);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jbyteArray JNICALL Java_xflaim_DataVector__1outputData(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jlong ljDbRef,
|
||||
jint iIndexNum)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = (IF_Db *)(FLMUINT)ljDbRef;
|
||||
FLMUINT uiLength;
|
||||
jbyteArray Data;
|
||||
void * pvData = NULL;
|
||||
jboolean bIsCopy = false;
|
||||
FLMBOOL bMustRelease = false;
|
||||
|
||||
uiLength = XFLM_MAX_KEY_SIZE;
|
||||
Data = pEnv->NewByteArray( uiLength);
|
||||
|
||||
if ( (pvData = pEnv->GetPrimitiveArrayCritical( Data, &bIsCopy)) == NULL)
|
||||
{
|
||||
rc = RC_SET( NE_XFLM_MEM);
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
bMustRelease = true;
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->outputData( pDb, (FLMUINT)iIndexNum,
|
||||
(FLMBYTE *)pvData, uiLength, &uiLength)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (bMustRelease)
|
||||
{
|
||||
if (RC_BAD( rc))
|
||||
{
|
||||
pEnv->ReleasePrimitiveArrayCritical( Data, pvData, JNI_ABORT);
|
||||
pEnv->DeleteLocalRef( Data);
|
||||
Data = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
pEnv->ReleasePrimitiveArrayCritical( Data, pvData, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return( Data);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1inputKey(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jlong ljDbRef,
|
||||
jint iIndexNum,
|
||||
jbyteArray Key,
|
||||
jint iKeyLen)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = (IF_Db *)(FLMUINT)ljDbRef;
|
||||
void * pvKey = NULL;
|
||||
jboolean bIsCopy = false;
|
||||
FLMBOOL bMustRelease = false;
|
||||
|
||||
if ( (pvKey = pEnv->GetPrimitiveArrayCritical( Key, &bIsCopy)) == NULL)
|
||||
{
|
||||
rc = RC_SET( NE_XFLM_MEM);
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
bMustRelease = true;
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->inputKey( pDb, (FLMUINT)iIndexNum,
|
||||
(FLMBYTE *)pvKey, (FLMUINT)iKeyLen)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (bMustRelease)
|
||||
{
|
||||
pEnv->ReleasePrimitiveArrayCritical( Key, pvKey, JNI_ABORT);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1inputData(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jlong ljDbRef,
|
||||
jint iIndexNum,
|
||||
jbyteArray Data,
|
||||
jint iDataLen)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = (IF_Db *)(FLMUINT)ljDbRef;
|
||||
void * pvData = NULL;
|
||||
jboolean bIsCopy = false;
|
||||
FLMBOOL bMustRelease = false;
|
||||
|
||||
if( (pvData = pEnv->GetPrimitiveArrayCritical( Data, &bIsCopy)) == NULL)
|
||||
{
|
||||
rc = RC_SET( NE_XFLM_MEM);
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
bMustRelease = true;
|
||||
|
||||
if (RC_BAD( rc = THIS_VECTOR()->inputKey( pDb, (FLMUINT)iIndexNum,
|
||||
(FLMBYTE *)pvData, (FLMUINT)iDataLen)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (bMustRelease)
|
||||
{
|
||||
pEnv->ReleasePrimitiveArrayCritical( Data, pvData, JNI_ABORT);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DataVector__1reset(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
THIS_VECTOR()->reset();
|
||||
}
|
||||
378
xflaim/java/jni/src/jdb.cpp
Normal file
378
xflaim/java/jni/src/jdb.cpp
Normal file
@@ -0,0 +1,378 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Desc:
|
||||
//
|
||||
// Tabs: 3
|
||||
//
|
||||
// Copyright (c) 2003-2006 Novell, Inc. All Rights Reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of version 2 of the GNU General Public
|
||||
// License as published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, contact Novell, Inc.
|
||||
//
|
||||
// To contact Novell about this file by physical or electronic mail,
|
||||
// you may find current contact information at www.novell.com
|
||||
//
|
||||
// $Id: $
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "xflaim.h"
|
||||
#include "xflaim_Db.h"
|
||||
#include "jniftk.h"
|
||||
|
||||
#define THIS_FDB() \
|
||||
((IF_Db *)(FLMUINT)lThis)
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1release(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
THIS_FDB()->Release();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1transBegin(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iTransactionType,
|
||||
jint iMaxLockWait,
|
||||
jint iFlags)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
|
||||
if (RC_BAD( rc = pDb->transBegin( (eDbTransType)iTransactionType,
|
||||
(FLMUINT)iMaxLockWait, (FLMUINT)iFlags)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1transCommit(
|
||||
JNIEnv * pEnv,
|
||||
jobject obj,
|
||||
jlong lThis)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
|
||||
(void)obj;
|
||||
|
||||
if (RC_BAD( rc = pDb->transCommit()))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1transAbort(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
|
||||
if (RC_BAD( rc = pDb->transAbort()))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1import(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jobject jIStream,
|
||||
jint iCollection)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_PosIStream * pIStream = NULL;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
|
||||
jclass class_JIStream = pEnv->FindClass( "xflaim/PosIStream");
|
||||
jfieldID fid_this = pEnv->GetFieldID( class_JIStream, "m_this", "J");
|
||||
pIStream = (IF_PosIStream *)((FLMUINT)pEnv->GetLongField( jIStream, fid_this));
|
||||
|
||||
if (!pIStream)
|
||||
{
|
||||
ThrowError( NE_XFLM_FAILURE, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = pDb->import( pIStream, (FLMUINT)iCollection)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_Db__1getFirstDocument(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iCollection,
|
||||
jobject jNode)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_DOMNode * pNode = NULL;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
|
||||
// Get the real pNode if one was passed in so we can pass it to the
|
||||
// getFirstDocument method.
|
||||
|
||||
if (jNode)
|
||||
{
|
||||
jclass class_JDOMNode = pEnv->FindClass( "xflaim.DOMNode");
|
||||
jfieldID fid_this = pEnv->GetFieldID( class_JDOMNode, "m_this", "Z");
|
||||
|
||||
pNode = (IF_DOMNode *)(FLMUINT)pEnv->GetLongField( jNode, fid_this);
|
||||
|
||||
// Clear the jNode's reference to this node as it is going to go away.
|
||||
|
||||
pEnv->SetLongField( jNode, fid_this, (jlong)0);
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = pDb->getFirstDocument( (FLMUINT)iCollection, &pNode)))
|
||||
{
|
||||
ThrowError(rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return( (jlong)(FLMUINT)pNode);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_Db__1getNode(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iCollection,
|
||||
jlong lNodeId,
|
||||
jlong lpOldNodeRef)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
IF_DOMNode * ifpNewNode = NULL;
|
||||
|
||||
if (lpOldNodeRef)
|
||||
{
|
||||
ifpNewNode = (IF_DOMNode *)(FLMUINT)lpOldNodeRef;
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = pDb->getNode( (FLMUINT)iCollection, (FLMUINT64)lNodeId,
|
||||
&ifpNewNode)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return( (jlong)(FLMUINT)ifpNewNode);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_Db__1createDocument(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iCollection)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
IF_DOMNode * ifpNewNode = NULL;
|
||||
|
||||
if (RC_BAD( rc = pDb->createDocument((FLMUINT)iCollection, &ifpNewNode)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return( (jlong)(FLMUINT)ifpNewNode);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_Db__1createRootElement(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iCollection,
|
||||
jint iTag)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
IF_DOMNode * ifpNewNode = NULL;
|
||||
|
||||
if (RC_BAD( rc = pDb->createRootElement((FLMUINT)iCollection,
|
||||
(FLMUINT)iTag, &ifpNewNode)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return( (jlong)(FLMUINT)ifpNewNode);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jint JNICALL Java_xflaim_Db__1createElementDef(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jstring sNamespaceURI,
|
||||
jstring sElementName,
|
||||
jint iDataType,
|
||||
jint iRequestedNum)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
FLMUINT uiNameId = iRequestedNum;
|
||||
jchar * pszNamespaceURI = NULL;
|
||||
jchar * pszElementName;
|
||||
|
||||
if (sNamespaceURI)
|
||||
{
|
||||
pszNamespaceURI = (jchar *)pEnv->GetStringCritical( sNamespaceURI, NULL);
|
||||
}
|
||||
|
||||
flmAssert( sElementName);
|
||||
pszElementName = (jchar *)pEnv->GetStringCritical( sElementName, NULL);
|
||||
|
||||
if (RC_BAD( rc = pDb->createElementDef( pszNamespaceURI, pszElementName,
|
||||
(FLMUINT)iDataType, &uiNameId, NULL)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (pszNamespaceURI)
|
||||
{
|
||||
pEnv->ReleaseStringCritical( sNamespaceURI, pszNamespaceURI);
|
||||
}
|
||||
|
||||
pEnv->ReleaseStringCritical( sElementName, pszElementName);
|
||||
return( (jlong)uiNameId);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_Db__1backupBegin(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint eBackupType,
|
||||
jint eTransType,
|
||||
jint iMaxLockWait,
|
||||
jlong lReusedRef)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
IF_Backup * ifpBackup = NULL;
|
||||
|
||||
if (lReusedRef)
|
||||
{
|
||||
ifpBackup = (IF_Backup *)(FLMUINT)lReusedRef;
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = pDb->backupBegin( (eDbBackupType)eBackupType,
|
||||
(eDbTransType)eTransType, (FLMUINT)iMaxLockWait, &ifpBackup)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return( (jlong)(FLMUINT)ifpBackup);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1keyRetrieve(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iIndex,
|
||||
jlong lKey,
|
||||
jint iFlags,
|
||||
jlong lFoundKey)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_DataVector * pSearchKey = (IF_DataVector *)(FLMUINT)lKey;
|
||||
IF_DataVector * pFoundKey = (IF_DataVector *)(FLMUINT)lFoundKey;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
FLMUINT uiIndex = (FLMUINT)iIndex;
|
||||
FLMUINT uiFlags = (FLMUINT)iFlags;
|
||||
|
||||
if (RC_BAD( rc = pDb->keyRetrieve( uiIndex, pSearchKey, uiFlags, pFoundKey)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
755
xflaim/java/jni/src/jdbsystem.cpp
Normal file
755
xflaim/java/jni/src/jdbsystem.cpp
Normal file
@@ -0,0 +1,755 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Desc:
|
||||
//
|
||||
// Tabs: 3
|
||||
//
|
||||
// Copyright (c) 2003-2006 Novell, Inc. All Rights Reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of version 2 of the GNU General Public
|
||||
// License as published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, contact Novell, Inc.
|
||||
//
|
||||
// To contact Novell about this file by physical or electronic mail,
|
||||
// you may find current contact information at www.novell.com
|
||||
//
|
||||
// $Id: $
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "xflaim_DbSystem.h"
|
||||
#include "flaimsys.h"
|
||||
#include "jniftk.h"
|
||||
#include "jnirestore.h"
|
||||
#include "jnistatus.h"
|
||||
|
||||
#define THIS_DBSYS() \
|
||||
((F_DbSystem *)(FLMUINT)lThis)
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_DbSystem__1createDbSystem(
|
||||
JNIEnv * pEnv,
|
||||
jobject) // obj)
|
||||
{
|
||||
F_DbSystem * pDbSystem;
|
||||
|
||||
if( (pDbSystem = new F_DbSystem()) == NULL)
|
||||
{
|
||||
ThrowError( NE_XFLM_MEM, pEnv);
|
||||
}
|
||||
|
||||
return( (jlong)(FLMUINT)pDbSystem);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DbSystem__1init(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
|
||||
if (RC_BAD( rc = THIS_DBSYS()->init()))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DbSystem__1exit(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
THIS_DBSYS()->exit();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_DbSystem__1dbCreate(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jstring sDbFileName,
|
||||
jstring sDataDir,
|
||||
jstring sRflDir,
|
||||
jstring sDictFileName,
|
||||
jstring sDictBuf,
|
||||
jobject CreateOpts)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
F_Db * pDb = NULL;
|
||||
XFLM_CREATE_OPTS Opts;
|
||||
XFLM_CREATE_OPTS * pOpts = &Opts;
|
||||
char * pszFilePath = NULL;
|
||||
char * pszDataDir = NULL;
|
||||
char * pszRflDir = NULL;
|
||||
char * pszDictFileName = NULL;
|
||||
char * pszDictBuf = NULL;
|
||||
|
||||
flmAssert( sDbFileName);
|
||||
pszFilePath = (char *)pEnv->GetStringUTFChars( sDbFileName, NULL);
|
||||
|
||||
if (sDataDir)
|
||||
{
|
||||
pszDataDir = (char *)pEnv->GetStringUTFChars( sDataDir, NULL);
|
||||
}
|
||||
|
||||
if (sRflDir)
|
||||
{
|
||||
pszRflDir = (char *)pEnv->GetStringUTFChars( sRflDir, NULL);
|
||||
}
|
||||
|
||||
if (sDictFileName)
|
||||
{
|
||||
pszDictFileName = (char *)pEnv->GetStringUTFChars( sDictFileName, NULL);
|
||||
}
|
||||
|
||||
if (sDictBuf)
|
||||
{
|
||||
pszDictBuf = (char *)pEnv->GetStringUTFChars( sDictBuf, NULL);
|
||||
}
|
||||
|
||||
if (!CreateOpts)
|
||||
{
|
||||
pOpts = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
jclass class_CREATEOPTS = pEnv->FindClass( "xflaim/CREATEOPTS");
|
||||
|
||||
Opts.uiBlockSize = pEnv->GetIntField( CreateOpts,
|
||||
pEnv->GetFieldID( class_CREATEOPTS, "iBlockSize", "I"));
|
||||
|
||||
Opts.uiVersionNum = pEnv->GetIntField( CreateOpts,
|
||||
pEnv->GetFieldID( class_CREATEOPTS, "iVersionNum", "I"));
|
||||
|
||||
Opts.uiMinRflFileSize = pEnv->GetIntField( CreateOpts,
|
||||
pEnv->GetFieldID( class_CREATEOPTS, "iMinRflFileSize", "I"));
|
||||
|
||||
Opts.uiMaxRflFileSize = pEnv->GetIntField( CreateOpts,
|
||||
pEnv->GetFieldID( class_CREATEOPTS, "iMaxRflFileSize", "I"));
|
||||
|
||||
Opts.bKeepRflFiles = pEnv->GetBooleanField( CreateOpts,
|
||||
pEnv->GetFieldID( class_CREATEOPTS, "bKeepRflFiles", "Z"))
|
||||
? TRUE
|
||||
: FALSE;
|
||||
|
||||
Opts.bLogAbortedTransToRfl = pEnv->GetBooleanField( CreateOpts,
|
||||
pEnv->GetFieldID( class_CREATEOPTS, "bLogAbortedTransToRfl", "Z"))
|
||||
? TRUE
|
||||
: FALSE;
|
||||
|
||||
Opts.uiDefaultLanguage = pEnv->GetIntField( CreateOpts,
|
||||
pEnv->GetFieldID( class_CREATEOPTS, "iDefaultLanguage", "I"));
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = THIS_DBSYS()->dbCreate( pszFilePath, pszDataDir,
|
||||
pszRflDir, pszDictFileName, pszDictBuf, pOpts, (IF_Db **)&pDb)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
pEnv->ReleaseStringUTFChars( sDbFileName, pszFilePath);
|
||||
|
||||
if (pszDataDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sDataDir, pszDataDir);
|
||||
}
|
||||
|
||||
if (pszRflDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sRflDir, pszRflDir);
|
||||
}
|
||||
|
||||
if (pszDictFileName)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sDictFileName, pszDictFileName);
|
||||
}
|
||||
|
||||
if (pszDictBuf)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sDictBuf, pszDictBuf);
|
||||
}
|
||||
|
||||
return( (jlong)((FLMUINT)pDb));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_DbSystem__1dbOpen(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jstring sDbFileName,
|
||||
jstring sDataDir,
|
||||
jstring sRflDir,
|
||||
jstring sPassword,
|
||||
jboolean bAllowLimited)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
F_Db * pDb = NULL;
|
||||
char * pszFilePath;
|
||||
char * pszDataDir = NULL;
|
||||
char * pszRflDir = NULL;
|
||||
char * pszPassword = NULL;
|
||||
|
||||
flmAssert( sDbFileName);
|
||||
|
||||
pszFilePath = (char *)pEnv->GetStringUTFChars( sDbFileName, NULL);
|
||||
|
||||
if (sDataDir)
|
||||
{
|
||||
pszDataDir = (char *)pEnv->GetStringUTFChars( sDataDir, NULL);
|
||||
}
|
||||
|
||||
if (sRflDir)
|
||||
{
|
||||
pszRflDir = (char *)pEnv->GetStringUTFChars( sRflDir, NULL);
|
||||
}
|
||||
|
||||
if (sPassword)
|
||||
{
|
||||
pszPassword = (char *)pEnv->GetStringUTFChars( sPassword, NULL);
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = THIS_DBSYS()->dbOpen( pszFilePath, pszDataDir,
|
||||
pszRflDir, pszPassword, bAllowLimited ? TRUE : FALSE,
|
||||
(IF_Db **)&pDb)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
pEnv->ReleaseStringUTFChars( sDbFileName, pszFilePath);
|
||||
|
||||
if (pszDataDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sDataDir, pszDataDir);
|
||||
}
|
||||
|
||||
if (pszRflDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sRflDir, pszRflDir);
|
||||
}
|
||||
|
||||
if( pszPassword)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sPassword, pszPassword);
|
||||
}
|
||||
|
||||
return( (jlong)(FLMUINT)pDb);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DbSystem__1dbRemove(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jstring sDbName,
|
||||
jstring sDataDir,
|
||||
jstring sRflDir,
|
||||
jboolean bRemove)
|
||||
{
|
||||
char * pszName;
|
||||
char * pszDataDir = NULL;
|
||||
char * pszRflDir = NULL;
|
||||
|
||||
flmAssert( sDbName);
|
||||
pszName = (char *)pEnv->GetStringUTFChars( sDbName, NULL);
|
||||
|
||||
if (sDataDir)
|
||||
{
|
||||
pszDataDir = (char *)pEnv->GetStringUTFChars( sDataDir, NULL);
|
||||
}
|
||||
|
||||
if (sRflDir)
|
||||
{
|
||||
pszRflDir = (char *)pEnv->GetStringUTFChars( sRflDir, NULL);
|
||||
}
|
||||
|
||||
THIS_DBSYS()->dbRemove( pszName, pszDataDir,
|
||||
pszRflDir, bRemove ? TRUE : FALSE);
|
||||
|
||||
pEnv->ReleaseStringUTFChars( sDbName, pszName);
|
||||
|
||||
if (pszDataDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sDataDir, pszDataDir);
|
||||
}
|
||||
|
||||
if (pszRflDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sRflDir, pszRflDir);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DbSystem__1dbRestore(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jstring sDbPath,
|
||||
jstring sDataDir,
|
||||
jstring sRflDir,
|
||||
jstring sBackupPath,
|
||||
jstring sPassword,
|
||||
jobject RestoreClient,
|
||||
jobject RestoreStatus)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
char * pszName;
|
||||
char * pszDataDir = NULL;
|
||||
char * pszRflDir = NULL;
|
||||
char * pszBackupPath = NULL;
|
||||
char * pszPassword = NULL;
|
||||
JavaVM * pJvm = NULL;
|
||||
JNIRestoreClient * pRestoreClient = NULL;
|
||||
JNIRestoreStatus * pRestoreStatus = NULL;
|
||||
|
||||
pEnv->GetJavaVM( &pJvm);
|
||||
|
||||
flmAssert( sDbPath);
|
||||
pszName = (char *)pEnv->GetStringUTFChars( sDbPath, NULL);
|
||||
|
||||
if (sDataDir)
|
||||
{
|
||||
pszDataDir = (char *)pEnv->GetStringUTFChars( sDataDir, NULL);
|
||||
}
|
||||
|
||||
if (sRflDir)
|
||||
{
|
||||
pszRflDir = (char *)pEnv->GetStringUTFChars( sRflDir, NULL);
|
||||
}
|
||||
|
||||
if (sBackupPath)
|
||||
{
|
||||
pszBackupPath = (char *)pEnv->GetStringUTFChars( sBackupPath, NULL);
|
||||
}
|
||||
|
||||
if (sPassword)
|
||||
{
|
||||
pszPassword = (char *)pEnv->GetStringUTFChars( sPassword, NULL);
|
||||
}
|
||||
|
||||
flmAssert( RestoreClient);
|
||||
if ((pRestoreClient = new JNIRestoreClient( RestoreClient, pJvm)) == NULL)
|
||||
{
|
||||
ThrowError( NE_XFLM_MEM, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (RestoreStatus != NULL)
|
||||
{
|
||||
if ((pRestoreStatus = new JNIRestoreStatus( RestoreStatus, pJvm)) == NULL)
|
||||
{
|
||||
ThrowError( NE_XFLM_MEM, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = THIS_DBSYS()->dbRestore( pszName, pszDataDir, pszBackupPath,
|
||||
pszRflDir, pszPassword, pRestoreClient, pRestoreStatus)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (pRestoreClient)
|
||||
{
|
||||
pRestoreClient->Release();
|
||||
}
|
||||
|
||||
if (pRestoreStatus)
|
||||
{
|
||||
pRestoreStatus->Release();
|
||||
}
|
||||
|
||||
pEnv->ReleaseStringUTFChars( sDbPath, pszName);
|
||||
|
||||
if (pszDataDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sDataDir, pszDataDir);
|
||||
}
|
||||
|
||||
if (pszRflDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sRflDir, pszRflDir);
|
||||
}
|
||||
|
||||
if (pszBackupPath)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sBackupPath, pszBackupPath);
|
||||
}
|
||||
|
||||
if (pszPassword)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sPassword, pszPassword);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DbSystem__1dbRename(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jstring sDbName,
|
||||
jstring sDataDir,
|
||||
jstring sRflDir,
|
||||
jstring sNewDbName,
|
||||
jboolean bOverwriteDestOk,
|
||||
jobject Status)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
char * pszDbName = NULL;
|
||||
char * pszDataDir = NULL;
|
||||
char * pszRflDir = NULL;
|
||||
char * pszNewDbName = NULL;
|
||||
JavaVM * pJvm;
|
||||
JNIRenameStatus * pStatus = NULL;
|
||||
|
||||
flmAssert( sDbName);
|
||||
flmAssert( sNewDbName);
|
||||
pszDbName = (char *)pEnv->GetStringUTFChars( sDbName, NULL);
|
||||
pszNewDbName = (char *)pEnv->GetStringUTFChars( sNewDbName, NULL);
|
||||
|
||||
if (sDataDir)
|
||||
{
|
||||
pszDataDir = (char *)pEnv->GetStringUTFChars( sDataDir, NULL);
|
||||
}
|
||||
|
||||
if (sRflDir)
|
||||
{
|
||||
pszRflDir = (char *)pEnv->GetStringUTFChars( sRflDir, NULL);
|
||||
}
|
||||
|
||||
if (Status != NULL)
|
||||
{
|
||||
pEnv->GetJavaVM( &pJvm);
|
||||
if ((pStatus = new JNIRenameStatus( Status, pJvm)) == NULL)
|
||||
{
|
||||
ThrowError( NE_XFLM_MEM, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (RC_BAD(rc = THIS_DBSYS()->dbRename( pszDbName, pszDataDir, pszRflDir,
|
||||
pszNewDbName, bOverwriteDestOk ? TRUE : FALSE, pStatus)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (pStatus)
|
||||
{
|
||||
pStatus->Release();
|
||||
}
|
||||
|
||||
pEnv->ReleaseStringUTFChars( sDbName, pszDbName);
|
||||
pEnv->ReleaseStringUTFChars( sNewDbName, pszNewDbName);
|
||||
|
||||
if (pszDataDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sDataDir, pszDataDir);
|
||||
}
|
||||
|
||||
if (pszRflDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sRflDir, pszRflDir);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_DbSystem__1dbCopy(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jstring sSrcDbName,
|
||||
jstring sSrcDataDir,
|
||||
jstring sSrcRflDir,
|
||||
jstring sDestDbName,
|
||||
jstring sDestDataDir,
|
||||
jstring sDestRflDir,
|
||||
jobject Status)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
char * pszSrcDbName = NULL;
|
||||
char * pszSrcDataDir = NULL;
|
||||
char * pszSrcRflDir = NULL;
|
||||
char * pszDestDbName = NULL;
|
||||
char * pszDestDataDir = NULL;
|
||||
char * pszDestRflDir = NULL;
|
||||
JavaVM * pJvm;
|
||||
JNICopyStatus * pStatus = NULL;
|
||||
|
||||
flmAssert( sSrcDbName);
|
||||
pszSrcDbName = (char *)pEnv->GetStringUTFChars( sSrcDbName, NULL);
|
||||
|
||||
if (sSrcDataDir)
|
||||
{
|
||||
pszSrcDataDir = (char *)pEnv->GetStringUTFChars( sSrcDataDir, NULL);
|
||||
}
|
||||
|
||||
if (sSrcRflDir)
|
||||
{
|
||||
pszSrcRflDir = (char *)pEnv->GetStringUTFChars( sSrcRflDir, NULL);
|
||||
}
|
||||
|
||||
flmAssert( sSrcDbName);
|
||||
pszDestDbName = (char *)pEnv->GetStringUTFChars( sDestDbName, NULL);
|
||||
|
||||
if (sDestDataDir)
|
||||
{
|
||||
pszDestDataDir = (char *)pEnv->GetStringUTFChars( sDestDataDir, NULL);
|
||||
}
|
||||
|
||||
if (sDestRflDir)
|
||||
{
|
||||
pszDestRflDir = (char *)pEnv->GetStringUTFChars( sDestRflDir, NULL);
|
||||
}
|
||||
|
||||
if (Status)
|
||||
{
|
||||
pEnv->GetJavaVM( &pJvm);
|
||||
if ( (pStatus = new JNICopyStatus( Status, pJvm)) == NULL)
|
||||
{
|
||||
ThrowError( NE_XFLM_MEM, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = THIS_DBSYS()->dbCopy( pszSrcDbName, pszSrcDataDir,
|
||||
pszSrcRflDir, pszDestDbName, pszDestDataDir, pszDestRflDir, pStatus)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (pStatus)
|
||||
{
|
||||
pStatus->Release();
|
||||
}
|
||||
|
||||
pEnv->ReleaseStringUTFChars( sSrcDbName, pszSrcDbName);
|
||||
|
||||
if (pszSrcDataDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sSrcDataDir, pszSrcDataDir);
|
||||
}
|
||||
|
||||
if (pszSrcRflDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sSrcRflDir, pszSrcRflDir);
|
||||
}
|
||||
|
||||
pEnv->ReleaseStringUTFChars( sDestDbName, pszDestDbName);
|
||||
|
||||
if (pszDestDataDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sDestDataDir, pszDestDataDir);
|
||||
}
|
||||
|
||||
if (pszDestRflDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sDestRflDir, pszDestRflDir);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_DbSystem__1dbCheck(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jstring sDbName,
|
||||
jstring sDataDir,
|
||||
jstring sRflDir,
|
||||
jstring sPassword,
|
||||
jint iFlags,
|
||||
jobject Status)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
char * pszDbName = NULL;
|
||||
char * pszDataDir = NULL;
|
||||
char * pszRflDir = NULL;
|
||||
char * pszPassword = NULL;
|
||||
JNICheckStatus * pStatus = NULL;
|
||||
F_DbInfo * pDbInfo = NULL;
|
||||
|
||||
flmAssert( sDbName);
|
||||
pszDbName = (char *)pEnv->GetStringUTFChars( sDbName, NULL);
|
||||
|
||||
if (sDataDir)
|
||||
{
|
||||
pszDataDir = (char *)pEnv->GetStringUTFChars( sDataDir, NULL);
|
||||
}
|
||||
|
||||
if (sRflDir)
|
||||
{
|
||||
pszDataDir = (char *)pEnv->GetStringUTFChars( sRflDir, NULL);
|
||||
}
|
||||
|
||||
if (sPassword)
|
||||
{
|
||||
pszPassword = (char *)pEnv->GetStringUTFChars( sPassword, NULL);
|
||||
}
|
||||
|
||||
if (Status != NULL)
|
||||
{
|
||||
JavaVM * pJvm = NULL;
|
||||
|
||||
pEnv->GetJavaVM( &pJvm);
|
||||
|
||||
if ((pStatus = new JNICheckStatus( Status, pJvm)) == NULL)
|
||||
{
|
||||
ThrowError( NE_XFLM_MEM, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = THIS_DBSYS()->dbCheck( pszDbName, pszDataDir, pszRflDir,
|
||||
pszPassword, (FLMUINT)iFlags, (IF_DbInfo **)&pDbInfo, pStatus)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (pStatus)
|
||||
{
|
||||
pStatus->Release();
|
||||
}
|
||||
|
||||
pEnv->ReleaseStringUTFChars( sDbName, pszDbName);
|
||||
|
||||
if (pszDataDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sDataDir, pszDataDir);
|
||||
}
|
||||
|
||||
if (pszRflDir)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sRflDir, pszRflDir);
|
||||
}
|
||||
|
||||
if (pszPassword)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sPassword, pszPassword);
|
||||
}
|
||||
|
||||
return (jlong)(FLMUINT)pDbInfo;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_DbSystem__1openBufferIStream(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jstring sBuffer)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_PosIStream * pIStream = NULL;
|
||||
|
||||
char * pcBuffer = (char *)pEnv->GetStringUTFChars(sBuffer, NULL);
|
||||
FLMUINT uiBufLen = pEnv->GetStringUTFLength( sBuffer);
|
||||
|
||||
if (RC_BAD( rc = THIS_DBSYS()->openBufferIStream( pcBuffer,
|
||||
uiBufLen, &pIStream)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return( (jlong)((FLMUINT)pIStream));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_DbSystem__1openFileIStream(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jstring sPath)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
char * pszPath = (char *)pEnv->GetStringUTFChars( sPath, NULL);
|
||||
IF_PosIStream * pIStream = NULL;
|
||||
|
||||
if (RC_BAD( rc = THIS_DBSYS()->openFileIStream( pszPath, &pIStream)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
pEnv->ReleaseStringUTFChars( sPath, pszPath);
|
||||
return( (jlong)(FLMUINT)pIStream);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jlong JNICALL Java_xflaim_DbSystem__1createJDataVector(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_DataVector * ifpDataVector = NULL;
|
||||
|
||||
if (RC_BAD( rc = THIS_DBSYS()->createIFDataVector( &ifpDataVector)))
|
||||
{
|
||||
ThrowError(rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return( (jlong)(FLMUINT)ifpDataVector);
|
||||
}
|
||||
1573
xflaim/java/jni/src/jdomnode.cpp
Normal file
1573
xflaim/java/jni/src/jdomnode.cpp
Normal file
File diff suppressed because it is too large
Load Diff
52
xflaim/java/jni/src/jniftk.cpp
Normal file
52
xflaim/java/jni/src/jniftk.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Desc:
|
||||
//
|
||||
// Tabs: 3
|
||||
//
|
||||
// Copyright (c) 2003-2006 Novell, Inc. All Rights Reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of version 2 of the GNU General Public
|
||||
// License as published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, contact Novell, Inc.
|
||||
//
|
||||
// To contact Novell about this file by physical or electronic mail,
|
||||
// you may find current contact information at www.novell.com
|
||||
//
|
||||
// $Id: $
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "xflaim.h"
|
||||
#include "jniftk.h"
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
void ThrowError(
|
||||
RCODE rc,
|
||||
JNIEnv * pEnv)
|
||||
{
|
||||
char szMsg[ 128];
|
||||
jclass class_XFlaimException;
|
||||
jmethodID id_Constructor;
|
||||
jobject Exception;
|
||||
|
||||
f_sprintf( szMsg, "Error code from XFLAIM was %08X", (unsigned)rc);
|
||||
|
||||
class_XFlaimException = pEnv->FindClass( "xflaim/XFlaimException");
|
||||
|
||||
id_Constructor = pEnv->GetMethodID( class_XFlaimException,
|
||||
"<init>", "(ILjava/lang/String;)V");
|
||||
|
||||
Exception = pEnv->NewObject( class_XFlaimException, id_Constructor,
|
||||
(jint)rc, pEnv->NewStringUTF( szMsg));
|
||||
|
||||
pEnv->Throw( reinterpret_cast<jthrowable>(Exception));
|
||||
}
|
||||
41
xflaim/java/jni/src/jniftk.h
Normal file
41
xflaim/java/jni/src/jniftk.h
Normal file
@@ -0,0 +1,41 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Desc:
|
||||
//
|
||||
// Tabs: 3
|
||||
//
|
||||
// Copyright (c) 2003-2006 Novell, Inc. All Rights Reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of version 2 of the GNU General Public
|
||||
// License as published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, contact Novell, Inc.
|
||||
//
|
||||
// To contact Novell about this file by physical or electronic mail,
|
||||
// you may find current contact information at www.novell.com
|
||||
//
|
||||
// $Id: $
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef JNIFTK_H
|
||||
#define JNIFTK_H
|
||||
|
||||
#ifndef FLM_DONT_USE_COM
|
||||
#define FLM_DONT_USE_COM
|
||||
#endif
|
||||
|
||||
#include "xflaim.h"
|
||||
#include "ftk.h"
|
||||
#include "jni.h"
|
||||
|
||||
void ThrowError(
|
||||
RCODE rc,
|
||||
JNIEnv * pEnv);
|
||||
|
||||
#endif // JNIFTK_H
|
||||
1638
xflaim/java/jni/src/jnirestore.cpp
Normal file
1638
xflaim/java/jni/src/jnirestore.cpp
Normal file
File diff suppressed because it is too large
Load Diff
279
xflaim/java/jni/src/jnirestore.h
Normal file
279
xflaim/java/jni/src/jnirestore.h
Normal file
@@ -0,0 +1,279 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Desc:
|
||||
//
|
||||
// Tabs: 3
|
||||
//
|
||||
// Copyright (c) 2003-2006 Novell, Inc. All Rights Reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of version 2 of the GNU General Public
|
||||
// License as published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, contact Novell, Inc.
|
||||
//
|
||||
// To contact Novell about this file by physical or electronic mail,
|
||||
// you may find current contact information at www.novell.com
|
||||
//
|
||||
// $Id: $
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
class JNIRestoreClient : public IF_RestoreClient, public XF_Base
|
||||
{
|
||||
public:
|
||||
|
||||
JNIRestoreClient(
|
||||
jobject jClient,
|
||||
JavaVM * pJvm)
|
||||
{
|
||||
flmAssert( jClient);
|
||||
flmAssert( pJvm);
|
||||
m_jClient = jClient;
|
||||
m_pJvm = pJvm;
|
||||
}
|
||||
|
||||
RCODE XFLMAPI openBackupSet( void);
|
||||
|
||||
RCODE XFLMAPI openRflFile(
|
||||
FLMUINT uiFileNum);
|
||||
|
||||
RCODE XFLMAPI openIncFile(
|
||||
FLMUINT uiFileNum);
|
||||
|
||||
RCODE XFLMAPI read(
|
||||
FLMUINT uiLength,
|
||||
void * pvBuffer,
|
||||
FLMUINT * puiBytesRead);
|
||||
|
||||
RCODE XFLMAPI close( void);
|
||||
|
||||
RCODE XFLMAPI abortFile( void);
|
||||
|
||||
FINLINE FLMUINT getRefCount( void)
|
||||
{
|
||||
return( IF_RestoreClient::getRefCount());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI AddRef( void)
|
||||
{
|
||||
return( IF_RestoreClient::AddRef());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI Release( void)
|
||||
{
|
||||
return( IF_RestoreClient::Release());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
jobject m_jClient;
|
||||
JavaVM * m_pJvm;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
class JNIRestoreStatus : public IF_RestoreStatus, public XF_Base
|
||||
{
|
||||
public:
|
||||
|
||||
JNIRestoreStatus(
|
||||
jobject jStatus,
|
||||
JavaVM * pJvm)
|
||||
{
|
||||
flmAssert( jStatus);
|
||||
flmAssert( pJvm);
|
||||
m_jStatus = jStatus;
|
||||
m_pJvm = pJvm;
|
||||
}
|
||||
|
||||
RCODE XFLMAPI reportProgress(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64BytesToDo,
|
||||
FLMUINT64 ui64BytesDone);
|
||||
|
||||
RCODE XFLMAPI reportError(
|
||||
eRestoreAction * peAction,
|
||||
RCODE rcErr);
|
||||
|
||||
RCODE XFLMAPI reportOpenRflFile(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT uiFileNum);
|
||||
|
||||
RCODE XFLMAPI reportRflRead(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT uiFileNum,
|
||||
FLMUINT uiBytesRead);
|
||||
|
||||
RCODE XFLMAPI reportBeginTrans(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId);
|
||||
|
||||
RCODE XFLMAPI reportCommitTrans(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId);
|
||||
|
||||
RCODE XFLMAPI reportAbortTrans(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId);
|
||||
|
||||
RCODE XFLMAPI reportBlockChainFree(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT64 ui64MaintDocNum,
|
||||
FLMUINT uiStartBlkAddr,
|
||||
FLMUINT uiEndBlkAddr,
|
||||
FLMUINT uiCount);
|
||||
|
||||
RCODE XFLMAPI reportIndexSuspend(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiIndexNum);
|
||||
|
||||
RCODE XFLMAPI reportIndexResume(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiIndexNum);
|
||||
|
||||
RCODE XFLMAPI reportReduce(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCount);
|
||||
|
||||
RCODE XFLMAPI reportUpgrade(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiOldDbVersion,
|
||||
FLMUINT uiNewDbVersion);
|
||||
|
||||
RCODE XFLMAPI reportEnableEncryption(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId);
|
||||
|
||||
RCODE XFLMAPI reportWrapKey(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId);
|
||||
|
||||
RCODE XFLMAPI reportRollOverDbKey(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId);
|
||||
|
||||
RCODE XFLMAPI reportDocumentDone(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64NodeId);
|
||||
|
||||
RCODE XFLMAPI reportNodeDelete(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64NodeId);
|
||||
|
||||
RCODE XFLMAPI reportAttributeDelete(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64ElementId,
|
||||
FLMUINT uiAttrNameId);
|
||||
|
||||
RCODE XFLMAPI reportNodeChildrenDelete(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64NodeId,
|
||||
FLMUINT uiNameId);
|
||||
|
||||
RCODE XFLMAPI reportNodeCreate(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64RefNodeId,
|
||||
eDomNodeType eNodeType,
|
||||
FLMUINT uiNameId,
|
||||
eNodeInsertLoc eLocation);
|
||||
|
||||
RCODE XFLMAPI reportInsertBefore(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64ParentId,
|
||||
FLMUINT64 ui64NewChildId,
|
||||
FLMUINT64 ui64RefChildId);
|
||||
|
||||
RCODE XFLMAPI reportNodeUpdate(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64NodeId);
|
||||
|
||||
RCODE XFLMAPI reportNodeSetValue(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64NodeId);
|
||||
|
||||
RCODE XFLMAPI reportAttributeSetValue(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64ElementNodeId,
|
||||
FLMUINT uiAttrNameId);
|
||||
|
||||
RCODE XFLMAPI reportNodeFlagsUpdate(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64NodeId,
|
||||
FLMUINT uiFlags,
|
||||
FLMBOOL bAdd);
|
||||
|
||||
RCODE XFLMAPI reportNodeSetPrefixId(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64NodeId,
|
||||
FLMUINT uiAttrNameId,
|
||||
FLMUINT uiPrefixId);
|
||||
|
||||
RCODE XFLMAPI reportNodeSetMetaValue(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64NodeId,
|
||||
FLMUINT64 ui64MetaValue);
|
||||
|
||||
RCODE XFLMAPI reportSetNextNodeId(
|
||||
eRestoreAction * peAction,
|
||||
FLMUINT64 ui64TransId,
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64NextNodeId);
|
||||
|
||||
FINLINE FLMUINT getRefCount( void)
|
||||
{
|
||||
return( IF_RestoreStatus::getRefCount());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI AddRef( void)
|
||||
{
|
||||
return( IF_RestoreStatus::AddRef());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI Release( void)
|
||||
{
|
||||
return( IF_RestoreStatus::Release());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
jobject m_jStatus;
|
||||
JavaVM * m_pJvm;
|
||||
};
|
||||
204
xflaim/java/jni/src/jnistatus.cpp
Normal file
204
xflaim/java/jni/src/jnistatus.cpp
Normal file
@@ -0,0 +1,204 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Desc:
|
||||
//
|
||||
// Tabs: 3
|
||||
//
|
||||
// Copyright (c) 2003-2006 Novell, Inc. All Rights Reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of version 2 of the GNU General Public
|
||||
// License as published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, contact Novell, Inc.
|
||||
//
|
||||
// To contact Novell about this file by physical or electronic mail,
|
||||
// you may find current contact information at www.novell.com
|
||||
//
|
||||
// $Id: $
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "jnistatus.h"
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
RCODE XFLMAPI JNIRenameStatus::dbRenameStatus(
|
||||
const char * pszSrcFileName,
|
||||
const char * pszDstFileName)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
JNIEnv * pEnv;
|
||||
jclass Cls;
|
||||
jmethodID MId;
|
||||
jstring sSrcName;
|
||||
jstring sDstName;
|
||||
FLMBOOL bMustDetach = FALSE;
|
||||
|
||||
if (m_pJvm->GetEnv( (void **)&pEnv, JNI_VERSION_1_2) != JNI_OK)
|
||||
{
|
||||
if (m_pJvm->AttachCurrentThread( (void **)&pEnv, NULL) != 0)
|
||||
{
|
||||
rc = RC_SET( NE_XFLM_FAILURE);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
bMustDetach = TRUE;
|
||||
}
|
||||
|
||||
Cls = pEnv->GetObjectClass( m_jStatus);
|
||||
MId = pEnv->GetMethodID( Cls, "dbRenameStatus",
|
||||
"(Ljava/lang/String;Ljava/lang/String)I");
|
||||
flmAssert( MId);
|
||||
|
||||
sSrcName = pEnv->NewStringUTF( pszSrcFileName);
|
||||
sDstName = pEnv->NewStringUTF( pszDstFileName);
|
||||
|
||||
if( RC_BAD( rc = (RCODE)pEnv->CallIntMethod( m_jStatus,
|
||||
MId, sSrcName, sDstName)))
|
||||
{
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (bMustDetach)
|
||||
{
|
||||
if (m_pJvm->DetachCurrentThread() != 0)
|
||||
{
|
||||
flmAssert( 0);
|
||||
rc = RC_SET( NE_XFLM_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
return( rc);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
RCODE XFLMAPI JNICopyStatus::dbCopyStatus(
|
||||
FLMUINT64 ui64BytesToCopy,
|
||||
FLMUINT64 ui64BytesCopied,
|
||||
FLMBOOL bNewSrcFile,
|
||||
const char * pszSrcFileName,
|
||||
const char * pszDestFileName)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
JNIEnv * pEnv;
|
||||
jclass Cls;
|
||||
jmethodID MId;
|
||||
jstring sSrcName;
|
||||
jstring sDstName;
|
||||
FLMBOOL bMustDetach = FALSE;
|
||||
|
||||
if (m_pJvm->GetEnv( (void **)&pEnv, JNI_VERSION_1_2) != JNI_OK)
|
||||
{
|
||||
if (m_pJvm->AttachCurrentThread( (void **)&pEnv, NULL) != 0)
|
||||
{
|
||||
rc = RC_SET( NE_XFLM_FAILURE);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
bMustDetach = TRUE;
|
||||
}
|
||||
|
||||
Cls = pEnv->GetObjectClass( m_jStatus);
|
||||
MId = pEnv->GetMethodID( Cls, "dbCopyStatus",
|
||||
"(JJZLjava/lang/String;Ljava/lang/String)I");
|
||||
flmAssert( MId);
|
||||
|
||||
sSrcName = pEnv->NewStringUTF( pszSrcFileName);
|
||||
sDstName = pEnv->NewStringUTF( pszDestFileName);
|
||||
|
||||
if( RC_BAD( rc = (RCODE)pEnv->CallIntMethod( m_jStatus, MId,
|
||||
(jlong)ui64BytesToCopy, (jlong)ui64BytesCopied,
|
||||
(bNewSrcFile) ? true : false, sSrcName, sDstName)))
|
||||
{
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (bMustDetach)
|
||||
{
|
||||
if (m_pJvm->DetachCurrentThread() != 0)
|
||||
{
|
||||
flmAssert( 0);
|
||||
rc = RC_SET( NE_XFLM_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
return( rc);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
RCODE XFLMAPI JNICheckStatus::reportProgress(
|
||||
XFLM_PROGRESS_CHECK_INFO *) // pProgCheck)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
JNIEnv * pEnv;
|
||||
jclass Cls;
|
||||
jmethodID MId;
|
||||
jobject JProgCheck;
|
||||
FLMBOOL bMustDetach = FALSE;
|
||||
|
||||
if (m_pJvm->GetEnv( (void **)&pEnv, JNI_VERSION_1_2) != JNI_OK)
|
||||
{
|
||||
if (m_pJvm->AttachCurrentThread( (void **)&pEnv, NULL) != 0)
|
||||
{
|
||||
rc = RC_SET( NE_XFLM_FAILURE);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
bMustDetach = TRUE;
|
||||
}
|
||||
|
||||
// Have to create a new XFLM_PROGRESS_CHECK_INFO java class
|
||||
// and copy everything from pProgCheck into it.
|
||||
|
||||
Cls = pEnv->FindClass( "xflaim/Structures/PROGRESS_CHECK");
|
||||
MId = pEnv->GetMethodID( Cls, "<init>", "()V");
|
||||
flmAssert( MId);
|
||||
|
||||
JProgCheck = pEnv->NewObject( Cls, MId);
|
||||
Cls = pEnv->GetObjectClass( m_jStatus);
|
||||
MId = pEnv->GetMethodID( Cls, "reportProgress",
|
||||
"(Lxflaim/Structures/PROGRESS_CHECK)I");
|
||||
flmAssert( MId);
|
||||
|
||||
if( RC_BAD( rc = (RCODE)pEnv->CallIntMethod( m_jStatus, MId, JProgCheck)))
|
||||
{
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (bMustDetach)
|
||||
{
|
||||
if (m_pJvm->DetachCurrentThread() != 0)
|
||||
{
|
||||
flmAssert( 0);
|
||||
rc = RC_SET( NE_XFLM_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
return( rc);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
RCODE XFLMAPI JNICheckStatus::reportCheckErr(
|
||||
XFLM_CORRUPT_INFO *, // pCorruptInfo,
|
||||
FLMBOOL *) // pbFix)
|
||||
{
|
||||
return( NE_XFLM_NOT_IMPLEMENTED);
|
||||
}
|
||||
160
xflaim/java/jni/src/jnistatus.h
Normal file
160
xflaim/java/jni/src/jnistatus.h
Normal file
@@ -0,0 +1,160 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Desc:
|
||||
//
|
||||
// Tabs: 3
|
||||
//
|
||||
// Copyright (c) 2003-2006 Novell, Inc. All Rights Reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of version 2 of the GNU General Public
|
||||
// License as published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, contact Novell, Inc.
|
||||
//
|
||||
// To contact Novell about this file by physical or electronic mail,
|
||||
// you may find current contact information at www.novell.com
|
||||
//
|
||||
// $Id: $
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "xflaim.h"
|
||||
#include "flaimsys.h"
|
||||
#include <jni.h>
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
class JNIRenameStatus : public IF_DbRenameStatus, public XF_Base
|
||||
{
|
||||
public:
|
||||
|
||||
JNIRenameStatus(
|
||||
jobject jStatus,
|
||||
JavaVM * pJvm)
|
||||
{
|
||||
flmAssert( jStatus);
|
||||
flmAssert( pJvm);
|
||||
m_jStatus = jStatus;
|
||||
m_pJvm = pJvm;
|
||||
}
|
||||
|
||||
RCODE XFLMAPI dbRenameStatus(
|
||||
const char * pszSrcFileName,
|
||||
const char * pszDstFileName);
|
||||
|
||||
FINLINE FLMUINT getRefCount( void)
|
||||
{
|
||||
return( IF_DbRenameStatus::getRefCount());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI AddRef( void)
|
||||
{
|
||||
return( IF_DbRenameStatus::AddRef());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI Release( void)
|
||||
{
|
||||
return( IF_DbRenameStatus::Release());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
JavaVM * m_pJvm;
|
||||
jobject m_jStatus;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
class JNICopyStatus : public IF_DbCopyStatus, public XF_Base
|
||||
{
|
||||
public:
|
||||
|
||||
JNICopyStatus(
|
||||
jobject jStatus,
|
||||
JavaVM * pJvm)
|
||||
{
|
||||
flmAssert( jStatus);
|
||||
flmAssert( pJvm);
|
||||
m_jStatus = jStatus;
|
||||
m_pJvm = pJvm;
|
||||
}
|
||||
|
||||
RCODE XFLMAPI dbCopyStatus(
|
||||
FLMUINT64 ui64BytesToCopy,
|
||||
FLMUINT64 ui64BytesCopied,
|
||||
FLMBOOL bNewSrcFile,
|
||||
const char * pszSrcFileName,
|
||||
const char * pszDestFileName);
|
||||
|
||||
FINLINE FLMUINT getRefCount( void)
|
||||
{
|
||||
return( IF_DbCopyStatus::getRefCount());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI AddRef( void)
|
||||
{
|
||||
return( IF_DbCopyStatus::AddRef());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI Release( void)
|
||||
{
|
||||
return( IF_DbCopyStatus::Release());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
JavaVM * m_pJvm;
|
||||
jobject m_jStatus;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
class JNICheckStatus : public IF_DbCheckStatus, public XF_Base
|
||||
{
|
||||
public:
|
||||
|
||||
JNICheckStatus(
|
||||
jobject jStatus,
|
||||
JavaVM * pJvm)
|
||||
{
|
||||
flmAssert( jStatus);
|
||||
flmAssert( pJvm);
|
||||
m_jStatus = jStatus;
|
||||
m_pJvm = pJvm;
|
||||
}
|
||||
|
||||
RCODE XFLMAPI reportProgress(
|
||||
XFLM_PROGRESS_CHECK_INFO * pProgCheck);
|
||||
|
||||
RCODE XFLMAPI reportCheckErr(
|
||||
XFLM_CORRUPT_INFO * pCorruptInfo,
|
||||
FLMBOOL * pbFix);
|
||||
|
||||
FINLINE FLMUINT getRefCount( void)
|
||||
{
|
||||
return( IF_DbCheckStatus::getRefCount());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI AddRef( void)
|
||||
{
|
||||
return( IF_DbCheckStatus::AddRef());
|
||||
}
|
||||
|
||||
virtual FINLINE FLMUINT32 XFLMAPI Release( void)
|
||||
{
|
||||
return( IF_DbCheckStatus::Release());
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
JavaVM * m_pJvm;
|
||||
jobject m_jStatus;
|
||||
};
|
||||
42
xflaim/java/jni/src/jposistream.cpp
Normal file
42
xflaim/java/jni/src/jposistream.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Desc:
|
||||
//
|
||||
// Tabs: 3
|
||||
//
|
||||
// Copyright (c) 2003-2006 Novell, Inc. All Rights Reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of version 2 of the GNU General Public
|
||||
// License as published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, contact Novell, Inc.
|
||||
//
|
||||
// To contact Novell about this file by physical or electronic mail,
|
||||
// you may find current contact information at www.novell.com
|
||||
//
|
||||
// $Id: $
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "xflaim_PosIStream.h"
|
||||
#include "flaimsys.h"
|
||||
#include "jniftk.h"
|
||||
|
||||
#define THIS_STREAM() \
|
||||
((F_PosIStream *)(FLMUINT)lThis)
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_PosIStream__1release(
|
||||
JNIEnv *, // pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
THIS_STREAM()->Release();
|
||||
}
|
||||
Reference in New Issue
Block a user