Added more methods for the Db class.
git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@742 0109f412-320b-0410-ab79-c3e0c5ffbbe6
This commit is contained in:
@@ -35,6 +35,11 @@ FSTATIC RCODE getUniString(
|
||||
jstring sStr,
|
||||
F_DynaBuf * pDynaBuf);
|
||||
|
||||
FSTATIC RCODE getNativeString(
|
||||
JNIEnv * pEnv,
|
||||
jstring sStr,
|
||||
F_DynaBuf * pDynaBuf);
|
||||
|
||||
FSTATIC RCODE getDictName(
|
||||
IF_Db * pDb,
|
||||
FLMUINT uiDictType,
|
||||
@@ -471,6 +476,32 @@ Exit:
|
||||
return( (jint)uiCount);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jint JNICALL Java_xflaim_Db__1getDataType(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iDictType,
|
||||
jint iNameId)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
FLMUINT uiDataType;
|
||||
|
||||
if (RC_BAD( rc = pDb->getDataType( (FLMUINT)iDictType, (FLMUINT)iNameId,
|
||||
&uiDataType)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return( (jint)uiDataType);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
@@ -791,6 +822,46 @@ Exit:
|
||||
return( rc);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
FSTATIC RCODE getNativeString(
|
||||
JNIEnv * pEnv,
|
||||
jstring sStr,
|
||||
F_DynaBuf * pDynaBuf)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
const char * pszStr = NULL;
|
||||
FLMUINT uiStrCharCount;
|
||||
|
||||
if (sStr)
|
||||
{
|
||||
pszStr = pEnv->GetStringUTFChars( sStr, NULL);
|
||||
uiStrCharCount = (FLMUINT)pEnv->GetStringUTFLength( sStr);
|
||||
if (RC_BAD( rc = pDynaBuf->appendData( pszStr, uiStrCharCount)))
|
||||
{
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pDynaBuf->truncateData( 0);
|
||||
}
|
||||
if (RC_BAD( rc = pDynaBuf->appendByte( 0)))
|
||||
{
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
if (pszStr)
|
||||
{
|
||||
pEnv->ReleaseStringUTFChars( sStr, pszStr);
|
||||
}
|
||||
|
||||
return( rc);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
@@ -1542,3 +1613,201 @@ Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1changeItemState(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iDictType,
|
||||
jint iDictNum,
|
||||
jstring sState)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
FLMBYTE ucState [80];
|
||||
F_DynaBuf stateBuf( ucState, sizeof( ucState));
|
||||
|
||||
if (RC_BAD( rc = getNativeString( pEnv, sState, &stateBuf)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = pDb->changeItemState( (FLMUINT)iDictType,
|
||||
(FLMUINT)iDictNum,
|
||||
(const char *)stateBuf.getBufferPtr())))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jstring JNICALL Java_xflaim_Db__1getRflFileName(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iFileNum,
|
||||
jboolean bBaseOnly)
|
||||
{
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
char szRflFileName [F_PATH_MAX_SIZE];
|
||||
FLMUINT uiFileNameBufSize = sizeof( szRflFileName);
|
||||
|
||||
pDb->getRflFileName( (FLMUINT)iFileNum,
|
||||
(FLMBOOL)(bBaseOnly ? TRUE : FALSE),
|
||||
szRflFileName, &uiFileNameBufSize, NULL);
|
||||
return( pEnv->NewStringUTF( szRflFileName));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1setNextNodeId(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iCollection,
|
||||
jlong lNextNodeId)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
|
||||
if (RC_BAD( rc = pDb->setNextNodeId( (FLMUINT)iCollection,
|
||||
(FLMUINT64)lNextNodeId)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1setNextDictNum(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jint iDictType,
|
||||
jint iDictNumber)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
|
||||
if (RC_BAD( rc = pDb->setNextDictNum( (FLMUINT)iDictType,
|
||||
(FLMUINT)iDictNumber)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1setRflKeepFilesFlag(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jboolean bKeep)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
|
||||
if (RC_BAD( rc = pDb->setRflKeepFilesFlag( (FLMBOOL)(bKeep ? TRUE : FALSE))))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jboolean JNICALL Java_xflaim_Db__1getRflKeepFlag(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
FLMBOOL bKeep = FALSE;
|
||||
|
||||
if (RC_BAD( rc = pDb->getRflKeepFlag( &bKeep)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return( bKeep ? JNI_TRUE : JNI_FALSE);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1setRflDir(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis,
|
||||
jstring sRflDir)
|
||||
{
|
||||
RCODE rc = NE_XFLM_OK;
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
FLMBYTE ucDirBuf [200];
|
||||
F_DynaBuf dirBuf( ucDirBuf, sizeof( ucDirBuf));
|
||||
|
||||
if (RC_BAD( rc = getNativeString( pEnv, sRflDir, &dirBuf)))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (RC_BAD( rc = pDb->setRflDir( (const char *)dirBuf.getBufferPtr())))
|
||||
{
|
||||
ThrowError( rc, pEnv);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
JNIEXPORT jstring JNICALL Java_xflaim_Db__1getRflDir(
|
||||
JNIEnv * pEnv,
|
||||
jobject, // obj,
|
||||
jlong lThis)
|
||||
{
|
||||
IF_Db * pDb = THIS_FDB();
|
||||
char szRflDir [F_PATH_MAX_SIZE];
|
||||
|
||||
pDb->getRflDir( szRflDir);
|
||||
return( pEnv->NewStringUTF( szRflDir));
|
||||
}
|
||||
|
||||
|
||||
@@ -359,6 +359,14 @@ JNIEXPORT jstring JNICALL Java_xflaim_Db__1getElementNamespace
|
||||
JNIEXPORT jstring JNICALL Java_xflaim_Db__1getAttributeNamespace
|
||||
(JNIEnv *, jobject, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: xflaim_Db
|
||||
* Method: _getDataType
|
||||
* Signature: (JII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_xflaim_Db__1getDataType
|
||||
(JNIEnv *, jobject, jlong, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: xflaim_Db
|
||||
* Method: _backupBegin
|
||||
@@ -375,6 +383,70 @@ JNIEXPORT jlong JNICALL Java_xflaim_Db__1backupBegin
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1keyRetrieve
|
||||
(JNIEnv *, jobject, jlong, jint, jlong, jint, jlong);
|
||||
|
||||
/*
|
||||
* Class: xflaim_Db
|
||||
* Method: _changeItemState
|
||||
* Signature: (JIILjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1changeItemState
|
||||
(JNIEnv *, jobject, jlong, jint, jint, jstring);
|
||||
|
||||
/*
|
||||
* Class: xflaim_Db
|
||||
* Method: _getRflFileName
|
||||
* Signature: (JIZ)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_xflaim_Db__1getRflFileName
|
||||
(JNIEnv *, jobject, jlong, jint, jboolean);
|
||||
|
||||
/*
|
||||
* Class: xflaim_Db
|
||||
* Method: _setNextNodeId
|
||||
* Signature: (JIJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1setNextNodeId
|
||||
(JNIEnv *, jobject, jlong, jint, jlong);
|
||||
|
||||
/*
|
||||
* Class: xflaim_Db
|
||||
* Method: _setNextDictNum
|
||||
* Signature: (JII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1setNextDictNum
|
||||
(JNIEnv *, jobject, jlong, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: xflaim_Db
|
||||
* Method: _setRflKeepFilesFlag
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1setRflKeepFilesFlag
|
||||
(JNIEnv *, jobject, jlong, jboolean);
|
||||
|
||||
/*
|
||||
* Class: xflaim_Db
|
||||
* Method: _getRflKeepFlag
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_xflaim_Db__1getRflKeepFlag
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: xflaim_Db
|
||||
* Method: _setRflDir
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_xflaim_Db__1setRflDir
|
||||
(JNIEnv *, jobject, jlong, jstring);
|
||||
|
||||
/*
|
||||
* Class: xflaim_Db
|
||||
* Method: _getRflDir
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_xflaim_Db__1getRflDir
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -967,6 +967,13 @@ public class Db
|
||||
return( NewNode);
|
||||
}
|
||||
|
||||
public int getDataType(
|
||||
int iDictType,
|
||||
int iNameId) throws XFlaimException
|
||||
{
|
||||
return( _getDataType( m_this, iDictType, iNameId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up XFlaim to perform a backup operation
|
||||
* @param eBackupType The type of backup to perform. Must be one of the
|
||||
@@ -1038,6 +1045,58 @@ public class Db
|
||||
_import( m_this, jIStream, iCollection);
|
||||
}
|
||||
|
||||
public void changeItemState(
|
||||
int iDictType,
|
||||
int iDictNum,
|
||||
String sState) throws XFlaimException
|
||||
{
|
||||
_changeItemState( m_this, iDictType, iDictNum, sState);
|
||||
}
|
||||
|
||||
public String getRflFileName(
|
||||
int iFileNum,
|
||||
boolean bBaseOnly) throws XFlaimException
|
||||
{
|
||||
return( _getRflFileName( m_this, iFileNum, bBaseOnly));
|
||||
}
|
||||
|
||||
public void setNextNodeId(
|
||||
int iCollection,
|
||||
long lNextNodeId) throws XFlaimException
|
||||
{
|
||||
_setNextNodeId( m_this, iCollection, lNextNodeId);
|
||||
}
|
||||
|
||||
public void setNextDictNum(
|
||||
int iDictType,
|
||||
int iDictNumber) throws XFlaimException
|
||||
{
|
||||
_setNextDictNum( m_this, iDictType, iDictNumber);
|
||||
}
|
||||
|
||||
public void setRflKeepFilesFlag(
|
||||
boolean bKeep) throws XFlaimException
|
||||
{
|
||||
_setRflKeepFilesFlag( m_this, bKeep);
|
||||
}
|
||||
|
||||
public boolean getRflKeepFlag() throws XFlaimException
|
||||
{
|
||||
return( _getRflKeepFlag( m_this));
|
||||
}
|
||||
|
||||
public void setRflDir(
|
||||
String sRflDir) throws XFlaimException
|
||||
{
|
||||
_setRflDir( m_this, sRflDir);
|
||||
}
|
||||
|
||||
public String getRflDir() throws XFlaimException
|
||||
{
|
||||
return( _getRflDir( m_this));
|
||||
}
|
||||
|
||||
|
||||
private native void _release(
|
||||
long lThis);
|
||||
|
||||
@@ -1191,6 +1250,11 @@ public class Db
|
||||
long lThis,
|
||||
int iDictNumber) throws XFlaimException;
|
||||
|
||||
private native int _getDataType(
|
||||
long lThis,
|
||||
int iDictType,
|
||||
int iNameId) throws XFlaimException;
|
||||
|
||||
/**
|
||||
* Desc:
|
||||
*/
|
||||
@@ -1211,6 +1275,41 @@ public class Db
|
||||
int iFlags,
|
||||
long lFoundKey) throws XFlaimException;
|
||||
|
||||
private native void _changeItemState(
|
||||
long lThis,
|
||||
int iDictType,
|
||||
int iDictNum,
|
||||
String sState) throws XFlaimException;
|
||||
|
||||
private native String _getRflFileName(
|
||||
long lThis,
|
||||
int iFileNum,
|
||||
boolean bBaseOnly) throws XFlaimException;
|
||||
|
||||
private native void _setNextNodeId(
|
||||
long lThis,
|
||||
int iCollection,
|
||||
long lNextNodeId) throws XFlaimException;
|
||||
|
||||
private native void _setNextDictNum(
|
||||
long lThis,
|
||||
int iDictType,
|
||||
int iDictNumber) throws XFlaimException;
|
||||
|
||||
private native void _setRflKeepFilesFlag(
|
||||
long lThis,
|
||||
boolean bKeep) throws XFlaimException;
|
||||
|
||||
private native boolean _getRflKeepFlag(
|
||||
long lThis) throws XFlaimException;
|
||||
|
||||
private native void _setRflDir(
|
||||
long lThis,
|
||||
String sRflDir) throws XFlaimException;
|
||||
|
||||
private native String _getRflDir(
|
||||
long lThis) throws XFlaimException;
|
||||
|
||||
long m_this;
|
||||
private DbSystem m_dbSystem;
|
||||
}
|
||||
@@ -1233,28 +1332,9 @@ LIST OF METHODS NOT YET IMPLEMENTED
|
||||
|
||||
virtual RCODE FLMAPI rollOverDbKey( void) = 0;
|
||||
|
||||
virtual RCODE FLMAPI changeItemState(
|
||||
FLMUINT uiDictType,
|
||||
FLMUINT uiDictNum,
|
||||
const char * pszState) = 0;
|
||||
|
||||
virtual RCODE FLMAPI upgrade(
|
||||
IF_UpgradeClient * pUpgradeClient) = 0;
|
||||
|
||||
//here
|
||||
|
||||
virtual RCODE FLMAPI getDataType(
|
||||
FLMUINT uiDictType,
|
||||
FLMUINT uiNameId,
|
||||
FLMUINT * puiDataType) = 0;
|
||||
|
||||
virtual void FLMAPI getRflFileName(
|
||||
FLMUINT uiFileNum,
|
||||
FLMBOOL bBaseOnly,
|
||||
char * pszFileName,
|
||||
FLMUINT * puiFileNameBufSize,
|
||||
FLMBOOL * pbNameTruncated = NULL) = 0;
|
||||
|
||||
virtual RCODE FLMAPI import(
|
||||
IF_IStream * pIStream,
|
||||
FLMUINT uiCollection,
|
||||
@@ -1273,28 +1353,10 @@ LIST OF METHODS NOT YET IMPLEMENTED
|
||||
IF_OStream * pOStream,
|
||||
eExportFormatType eFormat = XFLM_EXPORT_INDENT) = 0;
|
||||
|
||||
virtual RCODE FLMAPI setNextNodeId(
|
||||
FLMUINT uiCollection,
|
||||
FLMUINT64 ui64NextNodeId) = 0;
|
||||
|
||||
virtual RCODE FLMAPI setNextDictNum(
|
||||
FLMUINT uiDictType,
|
||||
FLMUINT uiDictNumber) = 0;
|
||||
//here
|
||||
|
||||
// Configuration "set" and "get" methods
|
||||
|
||||
virtual RCODE FLMAPI setRflKeepFilesFlag(
|
||||
FLMBOOL bKeep) = 0;
|
||||
|
||||
virtual RCODE FLMAPI getRflKeepFlag(
|
||||
FLMBOOL * pbKeep) = 0;
|
||||
|
||||
virtual RCODE FLMAPI setRflDir(
|
||||
const char * pszNewRflDir) = 0;
|
||||
|
||||
virtual void FLMAPI getRflDir(
|
||||
char * pszRflDir) = 0;
|
||||
|
||||
virtual RCODE FLMAPI getRflFileNum(
|
||||
FLMUINT * puiRflFileNum) = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user