From da50ce0a9d312a2cfada2837e967be3836027444 Mon Sep 17 00:00:00 2001 From: ahodgkinson Date: Mon, 3 Apr 2006 15:42:40 +0000 Subject: [PATCH] Renamed jni directory to java. git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@245 0109f412-320b-0410-ab79-c3e0c5ffbbe6 --- xflaim/java/java/xflaim/Backup.java | 195 ++ xflaim/java/java/xflaim/BackupClient.java | 51 + xflaim/java/java/xflaim/BackupStatus.java | 49 + xflaim/java/java/xflaim/CHECKINFO.java | 67 + xflaim/java/java/xflaim/CORRUPTINFO.java | 56 + xflaim/java/java/xflaim/CREATEOPTS.java | 51 + xflaim/java/java/xflaim/Collections.java | 35 + xflaim/java/java/xflaim/DOMNode.java | 1724 +++++++++++++++++ xflaim/java/java/xflaim/DataVector.java | 683 +++++++ xflaim/java/java/xflaim/Db.java | 496 +++++ xflaim/java/java/xflaim/DbCheckFlags.java | 38 + xflaim/java/java/xflaim/DbCheckStatus.java | 70 + xflaim/java/java/xflaim/DbCopyStatus.java | 56 + xflaim/java/java/xflaim/DbInfo.java | 59 + xflaim/java/java/xflaim/DbRebuildStatus.java | 33 + xflaim/java/java/xflaim/DbRenameStatus.java | 48 + xflaim/java/java/xflaim/DbSystem.java | 484 +++++ .../java/java/xflaim/DefaultBackupClient.java | 81 + .../java/xflaim/DefaultRestoreClient.java | 165 ++ xflaim/java/java/xflaim/FlmBackupType.java | 36 + xflaim/java/java/xflaim/FlmDataType.java | 41 + xflaim/java/java/xflaim/FlmDictIndex.java | 36 + xflaim/java/java/xflaim/FlmDomNodeType.java | 45 + xflaim/java/java/xflaim/FlmInsertLoc.java | 40 + xflaim/java/java/xflaim/KeyRetrieveFlags.java | 41 + xflaim/java/java/xflaim/PosIStream.java | 118 ++ xflaim/java/java/xflaim/RCODE.java | 405 ++++ xflaim/java/java/xflaim/ReserveID.java | 174 ++ xflaim/java/java/xflaim/RestoreAction.java | 41 + xflaim/java/java/xflaim/RestoreClient.java | 100 + xflaim/java/java/xflaim/RestoreStatus.java | 405 ++++ xflaim/java/java/xflaim/TransactionFlags.java | 35 + xflaim/java/java/xflaim/TransactionType.java | 36 + xflaim/java/java/xflaim/XFlaimException.java | 47 + xflaim/java/native/src/jbackup.cpp | 353 ++++ xflaim/java/native/src/jdatavector.cpp | 779 ++++++++ xflaim/java/native/src/jdb.cpp | 378 ++++ xflaim/java/native/src/jdbsystem.cpp | 755 ++++++++ xflaim/java/native/src/jdomnode.cpp | 1573 +++++++++++++++ xflaim/java/native/src/jniftk.cpp | 52 + xflaim/java/native/src/jniftk.h | 41 + xflaim/java/native/src/jnirestore.cpp | 1638 ++++++++++++++++ xflaim/java/native/src/jnirestore.h | 279 +++ xflaim/java/native/src/jnistatus.cpp | 204 ++ xflaim/java/native/src/jnistatus.h | 160 ++ xflaim/java/native/src/jposistream.cpp | 42 + 46 files changed, 12295 insertions(+) create mode 100644 xflaim/java/java/xflaim/Backup.java create mode 100644 xflaim/java/java/xflaim/BackupClient.java create mode 100644 xflaim/java/java/xflaim/BackupStatus.java create mode 100644 xflaim/java/java/xflaim/CHECKINFO.java create mode 100644 xflaim/java/java/xflaim/CORRUPTINFO.java create mode 100644 xflaim/java/java/xflaim/CREATEOPTS.java create mode 100644 xflaim/java/java/xflaim/Collections.java create mode 100644 xflaim/java/java/xflaim/DOMNode.java create mode 100644 xflaim/java/java/xflaim/DataVector.java create mode 100644 xflaim/java/java/xflaim/Db.java create mode 100644 xflaim/java/java/xflaim/DbCheckFlags.java create mode 100644 xflaim/java/java/xflaim/DbCheckStatus.java create mode 100644 xflaim/java/java/xflaim/DbCopyStatus.java create mode 100644 xflaim/java/java/xflaim/DbInfo.java create mode 100644 xflaim/java/java/xflaim/DbRebuildStatus.java create mode 100644 xflaim/java/java/xflaim/DbRenameStatus.java create mode 100644 xflaim/java/java/xflaim/DbSystem.java create mode 100644 xflaim/java/java/xflaim/DefaultBackupClient.java create mode 100644 xflaim/java/java/xflaim/DefaultRestoreClient.java create mode 100644 xflaim/java/java/xflaim/FlmBackupType.java create mode 100644 xflaim/java/java/xflaim/FlmDataType.java create mode 100644 xflaim/java/java/xflaim/FlmDictIndex.java create mode 100644 xflaim/java/java/xflaim/FlmDomNodeType.java create mode 100644 xflaim/java/java/xflaim/FlmInsertLoc.java create mode 100644 xflaim/java/java/xflaim/KeyRetrieveFlags.java create mode 100644 xflaim/java/java/xflaim/PosIStream.java create mode 100644 xflaim/java/java/xflaim/RCODE.java create mode 100644 xflaim/java/java/xflaim/ReserveID.java create mode 100644 xflaim/java/java/xflaim/RestoreAction.java create mode 100644 xflaim/java/java/xflaim/RestoreClient.java create mode 100644 xflaim/java/java/xflaim/RestoreStatus.java create mode 100644 xflaim/java/java/xflaim/TransactionFlags.java create mode 100644 xflaim/java/java/xflaim/TransactionType.java create mode 100644 xflaim/java/java/xflaim/XFlaimException.java create mode 100644 xflaim/java/native/src/jbackup.cpp create mode 100644 xflaim/java/native/src/jdatavector.cpp create mode 100644 xflaim/java/native/src/jdb.cpp create mode 100644 xflaim/java/native/src/jdbsystem.cpp create mode 100644 xflaim/java/native/src/jdomnode.cpp create mode 100644 xflaim/java/native/src/jniftk.cpp create mode 100644 xflaim/java/native/src/jniftk.h create mode 100644 xflaim/java/native/src/jnirestore.cpp create mode 100644 xflaim/java/native/src/jnirestore.h create mode 100644 xflaim/java/native/src/jnistatus.cpp create mode 100644 xflaim/java/native/src/jnistatus.h create mode 100644 xflaim/java/native/src/jposistream.cpp diff --git a/xflaim/java/java/xflaim/Backup.java b/xflaim/java/java/xflaim/Backup.java new file mode 100644 index 0000000..5f71254 --- /dev/null +++ b/xflaim/java/java/xflaim/Backup.java @@ -0,0 +1,195 @@ +//------------------------------------------------------------------------------ +// Desc: Backup +// +// 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: Backup.java 3109 2006-01-19 13:07:07 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; +import java.io.FileNotFoundException; + +/** + * This classes provides methods to back up an XFlaim database + */ +public class Backup +{ + // This constructor doesn't need to do much of anything; it's here mostly + // to ensure that Backup does NOT have a public constructor. (The + // application is not supposed to call new on Backup; Backup objects + // are created by a call to Db.backupBegin + + Backup( + long lThis, + Db jdb) + { + m_this = lThis; + m_jdb = jdb; + } + + /** + * Finalize method used to release native resources on garbage collection. + */ + public void finalize() + { + if (m_this != 0) + { + _release( m_this); + m_this = 0; + } + + m_jdb = null; + } + + /** + * Get the transaction ID for this backup operation + * @return Returns the transaction ID for this backup operation. + */ + public long getBackupTransId() + { + return _getBackupTransId( m_this); + } + + /** + * Gets the transaction ID for the last backup job run on this database. + * @return returns the transaction ID for the last backup job run on this + * database. + */ + public long getLastBackupTransId() + { + return _getLastBackupTransId( m_this); + } + + /** + * Performs the backup operation. sBackupPath and + * Client are mutually exclusive. If Client is null, + * then an instance of DefaultBackupClient will be created + * and sBackupPath passed into its constructor. If + * Client is non-null, sBackupPath is ignored. + * @param sBackupPath Optional. The full pathname of a file to store the + * backed up data. + * @param Client Optional. If non-null, then it will be used as the backup + * client. + * @param Status Optional. If non-null, then Status.backupStatus + * will be called periodicly to inform the application about the + * progress of the backup operation. + * @return Returns the sequence number of this backup. (This is for + * informational purposes only; for instance, users can use it to label + * their backup tapes.) + * @throws XFlaimException + */ + public long backup( + String sBackupPath, + String sPassword, + BackupClient Client, + BackupStatus Status) throws XFlaimException + { + BackupClient BackupClient; + + if (Client == null) + { + try + { + BackupClient = new DefaultBackupClient( sBackupPath); + } + catch (FileNotFoundException e) + { + throw new XFlaimException( xflaim.RCODE.NE_XFLM_OPENING_FILE, + "IOException opening " + sBackupPath + ". Message from JVM was" + + e.getMessage()); + } + } + else + { + BackupClient = Client; + } + + return _backup( m_this, sBackupPath, sPassword, BackupClient, Status); + } + + /** + * Desc: + */ + public void endBackup() throws XFlaimException + { + _endBackup( m_this); + } + + // Reassigns the object to "point" to a new F_Backup instance and a new + // Db. Called by any of the member functions that take a + // Db.backupBegin parameter. Shouldn't be called by outsiders, so it's + // not public, but it must be callable for other instances of this class. + // NOTE: This function does not result in a call to F_Backup::Release() + // because that is done by the native code when the F_Backup object is + // reused. Calling setRef() in any case except from within + // Db.backupBegin will result in a memory leak on the native side! + void setRef( + long lBackupRef, + Db jdb) + { + m_this = lBackupRef; + m_jdb = jdb; + } + + /** + * Desc: + */ + long getRef() + { + return m_this; + } + + /** + * Desc: + */ + private native long _backup( + long lThis, + String sBackupPath, + String sPassword, + BackupClient Client, + BackupStatus Status) throws XFlaimException; + + /** + * Desc: + */ + private native void _endBackup( + long lThis) throws XFlaimException; + + /** + * Desc: + */ + private native long _getBackupTransId( + long lThis); + + /** + * Desc: + */ + private native long _getLastBackupTransId( + long lThis); + + /** + * Desc: + */ + private native void _release( + long lThis); + + private long m_this; + private Db m_jdb; +} diff --git a/xflaim/java/java/xflaim/BackupClient.java b/xflaim/java/java/xflaim/BackupClient.java new file mode 100644 index 0000000..9289fa1 --- /dev/null +++ b/xflaim/java/java/xflaim/BackupClient.java @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------ +// Desc: Backup Client +// +// 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: BackupClient.java 3109 2006-01-19 13:07:07 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * This interface defines the client side interface to XFlaim's backup + * subsystem. Clients must pass an object that implements this interface + * into the call to {@link Backup#backup Backup::backup} + * See the documentation regarding Backup/Restore operations for more details. + * @see DefaultBackupClient + */ +public interface BackupClient +{ + + /** + * Called by XFlaim's backup subsystem when it has a block of data ready + * to be written. It is up to the implementation to decide what to + * do with the data (but presumably, it will write the data to disk, + * tape or some other storage medium). + * @param Buffer An array of bytes containing the data that needs to be + * written. + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * backup operation to abort an XFLaimException to be thrown. + */ + public int WriteData( + byte[] Buffer); +} diff --git a/xflaim/java/java/xflaim/BackupStatus.java b/xflaim/java/java/xflaim/BackupStatus.java new file mode 100644 index 0000000..6ff1cbb --- /dev/null +++ b/xflaim/java/java/xflaim/BackupStatus.java @@ -0,0 +1,49 @@ +//------------------------------------------------------------------------------ +// Desc: Backup Status +// +// 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: BackupStatus.java 3109 2006-01-19 13:07:07 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * This interface allows XFlaim's backup subsystem to periodicly pass + * information about the status of a backup operation (bytes completed and + * bytes remaining) while the operation is running. The implementor may do + * anything it wants with the information, such as using it to update a + * progress bar or simply ignoring it. + */ +public interface BackupStatus +{ + /** + * Called by XFlaim's backup subsystem to pass information back + * to the user + * @param lBytesToDo The number of bytes that have not been backed up yet + * @param lBytesDone The number of bytes that have been backed up. + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * backup operation to abort an XFLaimException to be thrown. + */ + public int backupStatus( + long lBytesToDo, + long lBytesDone); +} diff --git a/xflaim/java/java/xflaim/CHECKINFO.java b/xflaim/java/java/xflaim/CHECKINFO.java new file mode 100644 index 0000000..28d3126 --- /dev/null +++ b/xflaim/java/java/xflaim/CHECKINFO.java @@ -0,0 +1,67 @@ +//------------------------------------------------------------------------------ +// Desc: Progress Check Info Structure +// +// Tabs: 3 +// +// Copyright (c) 2004-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: CHECKINFO.java 3111 2006-01-19 13:10:50 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * This class contains data about the status of an ongoing database + * check operation. It is passed to the + * DbCheckStatus.reportProgress. + */ +public final class CHECKINFO +{ + public int iCheckPhase; + public boolean bStartFlag; + public long lFileSize; + public int iNumLFs; + public int iCurrLF; + public int iLfNumber; // Logical File Pass + public int iLfType; + public long lBytesExamined; + public int iNumProblemsFixed; // Number of corruptions repaired + public long lNumDomNodes; // in the current Lf + public long lNumDomLinksVerified; // in the current Lf + public long lNumBrokenDomLinks; // in the current Lf + + // Index check progress + + public long lNumKeys; // Number of keys in the result set + public long lNumDuplicateKeys; // Number of duplicate keys generated + public long lNumKeysExamined; // Number of keys checked + public long lNumKeysNotFound; // Extra keys found in indexes + public long lNumRecKeysNotFound; // Keys missing from indexes + public long lNumNonUniqueKeys; // Non-unique keys in indexes + public long lNumConflicts; // # of non-corruption conflicts + public long lNumRSUnits; // Number of rset sort items + public long lNumRSUnitsDone; // Number of rset items sorted + + public static class CheckPhaseCodes + { + public static final int CHECK_GET_DICT_INFO = 1; + public static final int CHECK_B_TREE = 2; + public static final int CHECK_AVAIL_BLOCKS = 3; + public static final int CHECK_RS_SORT = 4; + public static final int CHECK_DOM_LINKS = 5; + } +} diff --git a/xflaim/java/java/xflaim/CORRUPTINFO.java b/xflaim/java/java/xflaim/CORRUPTINFO.java new file mode 100644 index 0000000..b304144 --- /dev/null +++ b/xflaim/java/java/xflaim/CORRUPTINFO.java @@ -0,0 +1,56 @@ +//------------------------------------------------------------------------------ +// Desc: Corrupt Info Structure +// +// Tabs: 3 +// +// Copyright (c) 2004-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: CORRUPTINFO.java 3111 2006-01-19 13:10:50 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; +import xflaim.DOMNode; +import xflaim.DataVector; + +/** + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public final class CORRUPTINFO +{ + int iErrCode; // Zero means no error is being reported + int iErrLocale; + int iErrLfNumber; + int iErrLfType; + int iErrBTreeLevel; + int iErrBlkAddress; + int iErrParentBlkAddress; + int iErrElmOffset; + long lErrNodeId; + DataVector ErrIxKey; + DOMNode ErrNode; + DataVector[] ErrNodeKeyList; + + public static class LOCALE_CODES + { + public static final int LOCALE_NONE = 0; + public static final int LOCALE_LFH_LIST = 1; + public static final int LOCALE_AVAIL_LIST = 2; + public static final int LOCALE_B_TREE = 3; + public static final int LOCALE_INDEX = 4; + } +} diff --git a/xflaim/java/java/xflaim/CREATEOPTS.java b/xflaim/java/java/xflaim/CREATEOPTS.java new file mode 100644 index 0000000..679bb42 --- /dev/null +++ b/xflaim/java/java/xflaim/CREATEOPTS.java @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------ +// Desc: Create Options Structure +// +// 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: CREATEOPTS.java 3109 2006-01-19 13:07:07 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * This class encapsulates the Database create options. + */ +public final class CREATEOPTS +{ + public int iBlockSize; + public int iVersionNum; + public int iMinRflFileSize; + public int iMaxRflFileSize; + public boolean bKeepRflFiles; + public boolean bLogAbortedTransToRfl; + public int iDefaultLanguage; + + public CREATEOPTS() + { + iBlockSize = 4096; + iVersionNum = 500; + iMinRflFileSize = (100 * 1024 * 1024); + iMaxRflFileSize = 0xFFFC0000; + bKeepRflFiles = false; + bLogAbortedTransToRfl = false; + iDefaultLanguage = 0; + } +} diff --git a/xflaim/java/java/xflaim/Collections.java b/xflaim/java/java/xflaim/Collections.java new file mode 100644 index 0000000..ade0f35 --- /dev/null +++ b/xflaim/java/java/xflaim/Collections.java @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// Desc: XFLAIM Java Interface +// +// Tabs: 3 +// +// Copyright (c) 2003,2005-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: Collections.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * The Collections class is a static class that defines some predefined collections. + */ +public final class Collections +{ + public static final int DATA = 65534; + public static final int DICTIONARY = 65535; +} diff --git a/xflaim/java/java/xflaim/DOMNode.java b/xflaim/java/java/xflaim/DOMNode.java new file mode 100644 index 0000000..c783661 --- /dev/null +++ b/xflaim/java/java/xflaim/DOMNode.java @@ -0,0 +1,1724 @@ +//------------------------------------------------------------------------------ +// Desc: DOM Node +// +// 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: DOMNode.java 3109 2006-01-19 13:07:07 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * This class encapsulates the XFlaim F_DOMNode interface. + */ +public class DOMNode +{ + + /** + * Desc: + */ + DOMNode( + long lThis, + Db jdb) throws XFlaimException + { + if (lThis == 0) + { + throw new XFlaimException( -1, "No legal reference to a DOMNode"); + } + + m_this = lThis; + + if (jdb == null) + { + throw new XFlaimException( -1, "No legal jDb reference"); + } + + m_jdb = jdb; + } + + /** + * Desc: + */ + protected void finalize() + { + // The F_DOMNode and F_Db classes are not thread-safe. The proper way + // of using XFlaim is to get a new instance of Db for each thread. + // Unfortunately, the garbage collector runs in its own thread. This + // leads to a potential race condition down in the C++ code when one + // thread tries to create an already existing node (which results in a + // call to F_DOMNode::AddRef()) and the GC tries to destroy the same + // node (which results in a call to F_DOMNode::Release()). + // We protect against this by synchronizing against the instance of + // Db. Note that we are not protecting any of the accesses to the + // node; only creating and destroying. DOMNode and Db are still + // not completely thread-safe. + + synchronized( m_jdb) + { + // Release the associated DOMNode. + + if (m_this != 0) + { + _release( m_this); + } + } + + // Free our reference to the Db object. + + m_jdb = null; + } + + /** + * Desc: + */ + public void release() + { + synchronized( m_jdb) + { + if (m_this != 0) + { + _release( m_this); + } + } + + m_jdb = null; + } + + /** + * Creates a new DOM node and inserts it into the database in the + * specified position relative to the current node. An existing + * DOMNode object can optionally be passed in, and it will be reused + * instead of a new object being allocated. + * @param iNodeType An integer representing the type of node to create. + * (Use the constants in {@link xflaim.FlmDomNodeType FlmDomNodeType}.) + * @param iNameId The dictionary tag number that represents the node name. + * This value must exist in the dictionary before it can be used here. The + * value may be one of the predefined ones, or it may be created with + * {@link Db#createElementDef Db::createElementDef}. + * @param iInsertLoc An integer representing the relative position to insert + * the new node. (Use the constants in + * {@link xflaim.FlmInsertLoc FlmInsertLoc}.) + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode + * @throws XFlaimException + */ + public DOMNode createNode( + int iNodeType, + int iNameId, + int iInsertLoc, + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // call synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _createNode( m_this, m_jdb.m_this, iNodeType, iNameId, + iInsertLoc, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return( NewNode); + } + + /** + * Removes this node as well as all of it's descendants from the database. + * @throws XFlaimException + */ + public void deleteNode() throws XFlaimException + { + _deleteNode( m_this, m_jdb.m_this); + } + + /** + * Removes the children of the current node from the database. + * @throws XFlaimException + */ + public void deleteChildren() throws XFlaimException + { + _deleteChildren( m_this, m_jdb.m_this); + } + + /** + * Checks the type of node. Returned value will be one of those listed in + * {@link xflaim.FlmDomNodeType FlmDomNodeType}. + * @return Returns the type of the current node. + */ + public int getNodeType() + { + return _getNodeType( m_this); + } + + /** + * Tests the current node for the ability to hold data. + * @return Returns true if this is a node type that can have data + * associated with it. + */ + public boolean canHaveData() + { + return _canHaveData( m_this); + } + + /** + * Creates a new attribute node assigned to the current node. Note that + * some nodes are not allowed to have attributes. + * @param iNameId The dictionary tag number that represents the node name. + * This value must exist in the dictionary before it can be used here. The + * value may be one of the predefined ones, or it may be created with + * {@link Db#createElementDef Db::createElementDef}. + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode + */ + public DOMNode createAttribute( + int iNameId, + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // call synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _createAttribute( m_this, m_jdb.m_this, iNameId, + lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return( NewNode); + } + + /** + * Retrieves the first attribute node associated with the current node. + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode + * @throws XFlaimException + */ + public DOMNode getFirstAttribute( + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See the comment in the finalize function for an explanation of + // this synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _getFirstAttribute( m_this, + m_jdb.m_this, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return( NewNode); + } + + /** + * Retrieves the last attribute node associated with the current node. + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode. + * @throws XFlaimException + */ + public DOMNode getLastAttribute( + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // call synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _getLastAttribute( m_this, m_jdb.m_this, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return( NewNode); + } + + /** + * Retrieves the requested attribute node associated with this node. + * @param iAttributeId The dictionary tag number of the requested + * attribute. This value must exist in the dictionary before it can be + * used here. The value may be one of the predefined ones, or it may be + * created with {@link Db#createElementDef Db::createElementDef}. + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode + * @throws XFlaimException + */ + public DOMNode getAttribute( + int iAttributeId, + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // call synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _getAttribute( m_this, m_jdb.m_this, iAttributeId, + lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return( NewNode); + } + + /** + * Removes the specified attribute node from the current node. + * @param iAttributeId The dictionary tag number representing the + * attribute node to be deleted. + * @throws XFlaimException + */ + public void deleteAttribute( + int iAttributeId) throws XFlaimException + { + _deleteAttribute( m_this, m_jdb.m_this, iAttributeId); + } + + /** + * Looks through the list of attributes for the one specified in iNameId. + * Note that this function's semantics differ from its C++ counterpart. + * @return Returns true if the attribute was found; false otherwise. + * @throws XFlaimException + */ + public boolean hasAttribute( + int iNameId) throws XFlaimException + { + return _hasAttribute( m_this, m_jdb.m_this, iNameId); + } + + /** + * Tests to see if this node as any attributes associated with it. + * @return Returns true if the node has any attributes. + * @throws XFlaimException + */ + public boolean hasAttributes() throws XFlaimException + { + return _hasAttributes( m_this, m_jdb.m_this); + } + + /** + * Tests to see if this node has a next sibling. + * @return Returns true if this node has a next sibling. + * @throws XFlaimException + */ + public boolean hasNextSibling() throws XFlaimException + { + return _hasNextSibling( m_this, m_jdb.m_this); + } + + /** + * Tests to see if this node has a previous sibling. + * @return Returns true if this node has a previous sibling. + * @throws XFlaimException + */ + public boolean hasPreviousSibling() throws XFlaimException + { + return _hasPreviousSibling( m_this, m_jdb.m_this); + } + + /** + * Tests to see if this node has any child nodes. + * @return Returns true if this node has any children. + * @throws XFlaimException + */ + public boolean hasChildren() throws XFlaimException + { + return _hasChildren( m_this, m_jdb.m_this); + } + /** + * Tests to see if this node is an attribute node that defines a namespace. + * @return Returns true if this node is an attribute node that defines a + * namespace and false if this node not an attribute node or it does not + * define a namespace. + * @throws XFlaimException + */ + public boolean isNamespaceDecl() throws XFlaimException + { + return _isNamespaceDecl( m_this, m_jdb.m_this); + } + + /** + * Retrieves the node ID for this node's parent. + * @return Returns the parent node's node ID. + * @throws XFlaimException + */ + public long getParentId() throws XFlaimException + { + return _getParentId( m_this, m_jdb.m_this); + } + + /** + * Retrieves the node ID for this node. + * @return Returns the node ID. + */ + public long getNodeId() + { + return _getNodeId( m_this, m_jdb.m_this); + } + + /** + * Retrieves the node ID for the root node in the document + * @return Returns the root node's node ID. + * @throws XFlaimException + */ + public long getDocumentId() throws XFlaimException + { + return _getDocumentId( m_this, m_jdb.m_this); + } + + /** + * Retrieves the node ID for this node's previous sibling. + * @return Returns the previous sibling node's node ID. + * @throws XFlaimException + */ + public long getPrevSibId() throws XFlaimException + { + return _getPrevSibId( m_this, m_jdb.m_this); + } + + /** + * Retrieves the node ID for this node's next sibling. + * @return Returns the next sibling node's node ID. + * @throws XFlaimException + */ + public long getNextsibId() throws XFlaimException + { + return _getNextSibId( m_this, m_jdb.m_this); + } + + /** + * Retrieves the node ID for this node's first child. + * @return Returns the first child node's node ID. + * @throws XFlaimException + */ + public long getFirstChildId() throws XFlaimException + { + return _getFirstChildId( m_this, m_jdb.m_this); + } + + /** + * Retrieves the node ID for this node's next child. + * @return Returns the next child node's node ID. + * @throws XFlaimException + */ + public long getLastChildId() throws XFlaimException + { + return _getLastChildId( m_this, m_jdb.m_this); + } + + /** + * Retrieves the node ID for this node's first attribute. + * @return Returns the first attribute node's node ID. + * @throws XFlaimException + */ + public long getFirstAttrId() throws XFlaimException + { + return _getFirstAttrId( m_this, m_jdb.m_this); + } + + /** + * Retrieves the node ID for this node's last attribute + * @return Returns the last attribute node's node ID. + * @throws XFlaimException + */ + public long getLastAttrId() throws XFlaimException + { + return _getLastAttrId( m_this, m_jdb.m_this); + } + + /** + * Retrieves this node's name ID. + * @return Returns the name ID for this node. + * @throws XFlaimException + */ + public int getNameId() throws XFlaimException + { + return _getNameId( m_this, m_jdb.m_this); + } + + /** + * Assigns a 64-bit value to this node. + * @param lValue The value to be assigned. + * @throws XFlaimException + */ + public void setLong( + long lValue) throws XFlaimException + { + _setLong( m_this, m_jdb.m_this, lValue); + } + + /** + * Assigns a text string to this node. Existing text is either + * overwritten or has the new text appended to it. See the + * explanation for the bLast parameter. + * @param sValue The text to be assigned + * @param bLast Specifies whether sValue is the last text to be + * appended to this node. If false, then another call to setString + * is expected, and the new text will be appended to the text currently + * stored in this node. If true, then no more text is expected and + * another call to setString will overwrite the what is currently + * stored in this node. + * @throws XFlaimException + */ + public void setString( + String sValue, + boolean bLast) throws XFlaimException + { + _setString( m_this, m_jdb.m_this, sValue, bLast); + } + + /** + * Assigns or appends a text string to this node. This function is + * equivalent to setString( sValue, true). + * @param sValue The text to be assigned. + * @throws XFlaimException + * @see #setString( String, boolean) + */ + public void setString( + String sValue) throws XFlaimException + { + _setString( m_this, m_jdb.m_this, sValue, true); + } + + /** + * Assigns a piece of binary data to this node. + * @param Value An array of bytes to be stored in this node. + * @throws XFlaimException + */ + public void setBinary( + byte[] Value) throws XFlaimException + { + _setBinary( m_this, m_jdb.m_this, Value); + } + + /** + * Retrieves the amount of memory occupied by the value of this node. + * @return Returns the length of the data stored in the node (in bytes). + * @throws XFlaimException + */ + public long getDataLength() throws XFlaimException + { + return _getDataLength( m_this, m_jdb.m_this); + } + + /** + * Retrieves the type of the value stored in this node. The value will + * be one of those listed in + * {@link xflaim.FlmDataType FlmDataType}. + * @return Returns the type of the value stored in this node. + * @throws XFlaimException + */ + public int getDataType() throws XFlaimException + { + return _getDataType( m_this, m_jdb.m_this); + } + + /** + * Retrieves the value stored in this node as a long. + * @return Returns the value stored in the node. + * @throws XFlaimException + */ + public long getLong() throws XFlaimException + { + return _getLong( m_this, m_jdb.m_this); + } + + /** + * Retrieves a string representation of the value stored in this node. + * @return Returns the value stored in the node. + * @throws XFlaimException + */ + public String getString() throws XFlaimException + { + return _getString( m_this, m_jdb.m_this); + } + + /** + * Retrieves the number of unicode characters a string representation of + * the node's value would occupy. + * @return Returns the length of a string representation of this node's + * data. + * @throws XFlaimException + */ + public int getStringLen() throws XFlaimException + { + return _getStringLen( m_this, m_jdb.m_this); + } + + /** + * Retrieves the value of the node as raw data. + * @return Returns a byte array containing the value of this node. + * @throws XFlaimException + */ + public byte[] getBinary() throws XFlaimException + { + return _getBinary( m_this, m_jdb.m_this); + } + + /** + * Retrieves the parent of the current node. + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode + * @throws XFlaimException + */ + public DOMNode getParentNode( + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // call synchronized call + synchronized( m_jdb) + { + lNewNodeRef = _getParentNode( m_this, m_jdb.m_this, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return NewNode; + } + + /** + * Retrieves the first node in the current node's list of child nodes. + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode + * @throws XFlaimException + */ + public DOMNode getFirstChild( + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // call synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _getFirstChild( m_this, m_jdb.m_this, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return NewNode; + } + + /** + * Retrieves the last node in the current node's list of child nodes. + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode; + * @throws XFlaimException + */ + public DOMNode getLastChild( + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _getLastChild( m_this, m_jdb.m_this, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return NewNode; + } + + /** + * Retrieves the first instance of the specified type of node from the + * current node's list of child nodes. + * @param eNodeType The value representing the node type. + * (Use the constants in FlmDomNodeType.) + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode; + * @throws XFlaimException + */ + public DOMNode getChild( + int eNodeType, + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _getChild( m_this, m_jdb.m_this, + eNodeType, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return NewNode; + } + + /** + * Retrieves the specified element node from the current node's + * list of child nodes. + * @param iNameId The name ID for the desired node + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode + * @throws XFlaimException + */ + public DOMNode getChildElement( + int iNameId, + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _getChildElement( m_this, m_jdb.m_this, + iNameId, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return NewNode; + } + + /** + * Retrieves the specified element node from the current node's + * list of sibling nodes. + * @param iNameId The name ID of the desired node. + * @param bNext If true, will search forward following each node's + * "next_sibling" link; if false, will follow each node's "prev_sibling" + * link. + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode + * @throws XFlaimException + */ + public DOMNode getSiblingElement( + int iNameId, + boolean bNext, + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _getSiblingElement( m_this, m_jdb.m_this, iNameId, + bNext, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return NewNode; + } + + /** + * Retrieve's the previous node from the current node's list of + * siblings nodes. + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode + * @throws XFlaimException + */ + public DOMNode getPreviousSibling( + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _getPreviousSibling( m_this, m_jdb.m_this, + lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return NewNode; + } + + /** + * Retrieves the next node from the current node's list of sibling nodes. + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode + * @throws XFlaimException + */ + public DOMNode getNextSibling( + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _getNextSibling( m_this, m_jdb.m_this, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return NewNode; + } + + /** + * Retrieves the previous document node. The current node must be a root + * node or a document node. + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) + * @return Returns an instance of DOMNode + * @throws XFlaimException + */ + public DOMNode getPreviousDocument( + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _getPreviousDocument( m_this, + m_jdb.m_this, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return NewNode; + } + + /** + * Retrieves the next document node. The current node must be a root + * node or a document node. + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) + * @return Returns an instance of DOMNode + * @throws XFlaimException + */ + public DOMNode getNextDocument( + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _getNextDocument( m_this, m_jdb.m_this, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return NewNode; + } + + /** + * Retrieves the namespace prefix for this node + * @return Returns a string containing this node's namespace prefix + * @throws XFlaimException + */ + public String getPrefix () throws XFlaimException + { + return _getPrefix( m_this, m_jdb.m_this); + } + + /** + * Retrieves the namespace URI that this node's name belongs to. + * @return Returns the namespace URI + * @throws XFlaimException + */ + public String getNamespaceURI() throws XFlaimException + { + return _getNamespaceURI( m_this, m_jdb.m_this); + } + + /** + * Retrieves the name of this node, without the namespace prefix. + * @return Returns unprefixed element or attribute name. + * @throws XFlaimException + */ + public String getLocalName() throws XFlaimException + { + return _getLocalName( m_this, m_jdb.m_this); + } + + /** + * Retrieves the fully qualified name (namespace prefix plus local + * name) for this element or attribute. + * @return Returns the fully qualified element or attribute name. + * @throws XFlaimException + */ + public String getQualifiedName() throws XFlaimException + { + return _getQualifiedName( m_this, m_jdb.m_this); + } + + /** + * Retrieves the collection that this node is stored in. + * @return Returns the collection number. + * @throws XFlaimException + */ + public int getCollection() throws XFlaimException + { + return _getCollection( m_this, m_jdb.m_this); + } + + /** + * Creates an annotation node and assignes it to the current node + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return Returns an instance of DOMNode + * @throws XFlaimException + */ + public DOMNode createAnnotation( + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _createAnnotation( m_this, m_jdb.m_this, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return NewNode; + } + + /** + * Retrieves the annotation node assigned to this node. + * @param ReusedNode An instance of DOMNode which is no longer needed and + * can be reassigned to point to different data in the database. (Reusing + * DOMNode objects is encouraged as it saves the system from allocating + * and freeing memory for each object.) Can be null, if no instances are + * available to be reused. + * @return returns the annotation node assigned to this node + * @throws XFlaimException + */ + public DOMNode getAnnotation( + DOMNode ReusedNode) throws XFlaimException + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.m_this; + } + + // See to comments in the finalize function for an explanation of this + // synchronized call + + synchronized( m_jdb) + { + lNewNodeRef = _getAnnotation( m_this, m_jdb.m_this, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, m_jdb); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, m_jdb); + } + + return NewNode; + } + + /** + * Checks to see if this node has an annotation + * @return Returns true if the current node has an annotation + * @throws XFlaimException + */ + public boolean hasAnnotation() throws XFlaimException + { + return _hasAnnotation( m_this, m_jdb.m_this); + } + + /** + * Reassigns the object to "point" to a new F_DOMNode instance and a new + * Db. Called by any of the member functions that take a ReusuedNode + * parameter. Shouldn't be called by outsiders, so it's not public, but + * it must be callable for other instances of this class. (It's also + * called by Db.getNode) + * + * NOTE: This function does not result in a call to F_DOMNode::Release() + * because that is done by the native code when the F_DOMNode object is + * reused. Calling setRef() in any case except after a DOM node has been + * reused will result in a memory leak on the native side! + */ + void setRef( + long lDomNodeRef, + Db jdb) + { + m_this = lDomNodeRef; + m_jdb = jdb; + } + + /** + * Desc: + */ + long getRef() + { + return m_this; + } + + /** + * Desc: + */ + Db getJdb() + { + return m_jdb; + } + + /** + * Desc: + */ + private native long _createNode( + long lThis, + long lpDbRef, + int iNodeType, + int iNameId, + int iInsertLoc, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native void _deleteNode( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native void _deleteChildren( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native int _getNodeType( + long lThis); + + /** + * Desc: + */ + private native boolean _canHaveData( + long lThis); + + /** + * Desc: + */ + private native long _createAttribute( + long lThis, + long lpDbRef, + int iNameId, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getFirstAttribute( + long lThis, + long lpDbRef, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getLastAttribute( + long lThis, + long lpDbRef, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getAttribute( + long lThis, + long lpDbRef, + int iAttributeId, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native void _deleteAttribute( + long lThis, + long lpDbRef, + int iAttributeId) throws XFlaimException; + + /** + * Desc: + */ + private native boolean _hasAttribute( + long lThis, + long lpDbRef, + int iAttributeId) throws XFlaimException; + + /** + * Desc: + */ + private native boolean _hasAttributes( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native boolean _hasChildren( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native boolean _hasNextSibling( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native boolean _hasPreviousSibling( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native boolean _isNamespaceDecl( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getParentNode( + long lThis, + long lpDbRef, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getFirstChild( + long lThis, + long lpDbRef, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getLastChild( + long lThis, + long lpDbRef, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getChild( + long lThis, + long lpDbRef, + int iNodeType, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getPreviousSibling( + long lThis, + long lpDbRef, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getNextSibling + ( + long lThis, + long lpDbRef, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getPreviousDocument + ( + long lThis, + long lpDbRef, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getNextDocument( + long lThis, + long lpDbRef, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native String _getPrefix( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getChildElement( + long lThis, + long lpDbRef, + int iNameId, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getSiblingElement( + long lThis, + long lpDbRef, + int iNameId, + boolean bNext, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getParentId( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getNodeId( + long lThis, + long lpDbRef); + + /** + * Desc: + */ + private native long _getDocumentId( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getPrevSibId( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getNextSibId( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getFirstChildId( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getLastChildId( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getFirstAttrId( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getLastAttrId( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native int _getNameId( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native String _getNamespaceURI( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native String _getLocalName( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native String _getQualifiedName( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native int _getCollection( + long lThis, + long lpDbRef) throws XFlaimException; + + + /** + * Desc: + */ + private native long _getLong( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native String _getString( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native int _getStringLen( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native int _getDataType( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getDataLength( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native byte[] _getBinary( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native void _setLong( + long lThis, + long lpDbRef, + long lValue) throws XFlaimException; + + /** + * Desc: + */ + private native void _setString( + long lThis, + long lpDbRef, + String sValue, + boolean bLast) throws XFlaimException; + + /** + * Desc: + */ + private native void _setBinary( + long lThis, + long lpDbRef, + byte[] Value) throws XFlaimException; + + /** + * Desc: + */ + private native long _createAnnotation( + long lThis, + long lpDbRef, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _getAnnotation( + long lThis, + long lpDbRef, + long lReusedNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native boolean _hasAnnotation( + long lThis, + long lpDbRef) throws XFlaimException; + + /** + * Desc: + */ + private native void _release( + long lThis); + + + private long m_this; + private Db m_jdb; +} diff --git a/xflaim/java/java/xflaim/DataVector.java b/xflaim/java/java/xflaim/DataVector.java new file mode 100644 index 0000000..78c6eeb --- /dev/null +++ b/xflaim/java/java/xflaim/DataVector.java @@ -0,0 +1,683 @@ +//------------------------------------------------------------------------------ +// Desc: Data Vector +// +// 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: DataVector.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * This class implements an interface to the XFlaim IF_DataVector class. + */ +public class DataVector +{ + long m_this; + DbSystem m_dbSystem; + + /** + * Constructor for the DataVector object. This object provides access to + * the XFlaim IF_DataVector interface. All methods defined by the + * IF_DataVector interace are accessible through this Java object. + * + * @param lRef A reference to a C++ IF_DataVector object + * @param dbSystem A reference to a DbSystem object + */ + public DataVector( + long lRef, + DbSystem dbSystem) + { + super(); + m_this = lRef; + m_dbSystem = dbSystem; + } + + /** + * Finalizer method, used to ensure that we release the actual C++ object. + */ + public void finalize() + { + if (m_this != 0) + { + _release( m_this); + m_this = 0; + } + + m_dbSystem = null; + } + + /** + * Method to set the document Id of the search target. + * @param lDocId + */ + public void setDocumentID( + long lDocId) + { + _setDocumentId( m_this, lDocId); + } + + /** + * Method to set the ID of the search target. The ID referred to here is + * the node Id which is actually a 64 bit unsigned value in the XFlaim + * database. + * @param iElementNumber + * @param lID + * @throws XFlaimException + */ + public void setId( + int iElementNumber, + long lID) throws XFlaimException + { + _setID( m_this, iElementNumber, lID); + } + + /** + * Method to set the name ID of the search target. the name Id is a + * numeric value that is used to represent the field or tag of the + * target element. + * @param iElementNumber + * @param iNameId + * @param bIsAttr A boolean flag that indicates whether or not the key + * is an attribute. + * @param bIsData A boolean flag that indicates whether or not the key + * is a data component. + * @throws XFlaimException + */ + public void setNameId( + int iElementNumber, + int iNameId, + boolean bIsAttr, + boolean bIsData) throws XFlaimException + { + _setNameId( m_this, iElementNumber, iNameId, bIsAttr, bIsData); + } + + /** + * Method to set the value of the target key to an integer value. For + * purposes of this interface, an integer is defined to be 32 bits, signed. + * The iNum parameter will be tested to ensure that is falls within range. + * If it is too large, an exception will be thrown. + * @param iElementNumber + * @param iNum The 32 bit signed integer value + * @throws XFlaimException + */ + public void setINT( + int iElementNumber, + int iNum) throws XFlaimException + { + _setINT( m_this, iElementNumber, iNum); + } + + /** + * Special purpose function - NOT for general consumption. + * @param iElementNumber + * @param iUNum + * @throws XFlaimException + */ + public void setUINT( + int iElementNumber, + int iUNum) throws XFlaimException + { + _setUINT( m_this, iElementNumber, iUNum); + } + + /** + * Method to set the value of the target key to a long value. For + * purposes of this interface, a long is defined to be 64 bits, signed. + * @param iElementNumber + * @param lNum The 64 bit signed integer value + * @throws XFlaimException + */ + public void setLong( + int iElementNumber, + long lNum) throws XFlaimException + { + _setLong( m_this, iElementNumber, lNum); + } + + /** + * Method to set the value of the target key to a string value. + * @param iElementNumber + * @param sValue + * @throws XFlaimException + */ + public void setString( + int iElementNumber, + String sValue) throws XFlaimException + { + _setString( m_this, iElementNumber, sValue); + } + + /** + * Method to set the value of the target key to a binary value. + * @param iElementNumber + * @param Value + * @throws XFlaimException + */ + public void setBinary( + int iElementNumber, + byte[] Value) throws XFlaimException + { + _setBinary( m_this, iElementNumber, Value); + } + + /** + * Method to set a flag in the target key that indicates that the key is + * right truncated. + * @param iElementNumber + */ + public void setRightTruncated( + int iElementNumber) + { + _setRightTruncated( m_this, iElementNumber); + } + + /** + * Method to set a flag in the target key that indicates that the key is + * left truncated. + * @param iElementNumber + */ + public void setLeftTruncated( + int iElementNumber) + { + _setLeftTruncated( m_this, iElementNumber); + } + + /** + * Method to clear a flag in the target key that indicates that the key + * is right truncated. + * @param iElementNumber + */ + public void clearRightTruncated( + int iElementNumber) + { + _clearRightTruncated( m_this, iElementNumber); + } + + /** + * Method to clear a flag in the target key that indicates that the key + * is left truncated. + * @param iElementNumber + */ + public void clearLeftTruncated( + int iElementNumber) + { + _clearLeftTruncated( m_this, iElementNumber); + } + + /** + * Method to get the Document ID of the target key. + * @return Document Id + */ + public long getDocumentID() + { + return _getDocumentID( m_this); + } + + /** + * Method to get the node Id of the element specified (iElementNumber) of + * the target key. + * @param iElementNumber + * @return Node Id + */ + public long getID( + int iElementNumber) + { + return _getID( m_this, iElementNumber); + } + + /** + * Method to get the name Id of the element specified (iElementNumber) of + * the target key. + * @param iElementNumber + * @return Name Id + */ + public int getNameId( + int iElementNumber) + { + return _getNameId( m_this, iElementNumber); + } + + /** + * Method to find out if the element specified (iElementNumber) is an + * attribute of the target key. + * @param iElementNumber + * @return boolean true or false + */ + public boolean isAttr( + int iElementNumber) + { + return _isAttr( m_this, iElementNumber); + } + + /** + * Method to find out if the element specified (iElementNumber) is a data + * component of the target key. + * @param iElementNumber + * @return boolean true or false + */ + public boolean isDataComponent( + int iElementNumber) + { + return _isDataComponent( m_this, iElementNumber); + } + + /** + * Method to find out if the element specified (iElementNumber) is a key + * component of the target key. + * @param iElementNumber + * @return boolean true or false + */ + public boolean isKeyComponent( + int iElementNumber) + { + return _isKeyComponent( m_this, iElementNumber); + } + + /** + * Method to get the length of the data value of the element specified + * (iElementNumber) of the target key. + * @param iElementNumber + * @return The data length + */ + public int getDataLength( + int iElementNumber) + { + return _getDataLength( m_this, iElementNumber); + } + + /** + * Desc: + */ + public int getDataType( + int iElementNumber) + { + return _getDataType( m_this, iElementNumber); + } + + /** + * Method to get the value of the element specified (iElementNumber) of the + * target key as an integer. An integer is a 32 bit signed value. + * @param iElementNumber + * @return 32 bit signed integer + * @throws XFlaimException + */ + public int getINT( + int iElementNumber) throws XFlaimException + { + return _getINT( m_this, iElementNumber); + } + + /** + * ** This is a special purpose method and not for general consumption ** + * @param iElementNumber + * @return 32 bit signed integer + * @throws XFlaimException + */ + public int getUINT( + int iElementNumber) throws XFlaimException + { + return _getUINT( m_this, iElementNumber); + } + + /** + * Method to get the value of the element specified (iElementNumber) of the + * target key as a long. An long is a 64 bit signed value. + * @param iElementNumber + * @return 64 bit signed integer + * @throws XFlaimException + */ + public long getLong( + int iElementNumber) throws XFlaimException + { + return _getLong( m_this, iElementNumber); + } + + /** + * Method to get the value of the element specified (iElementNumber) of the + * target key as a String. + * @param iElementNumber + * @return String + * @throws XFlaimException + */ + public String getString( + int iElementNumber) throws XFlaimException + { + return _getString( m_this, iElementNumber); + } + + /** + * Method to get the value of the element specified (iElementNumber) of the + * target key as binary data. + * @param iElementNumber + * @return Returns a byte array containing the value of the specified + * element + * @throws XFlaimException + */ + public byte[] getBinary( + int iElementNumber) throws XFlaimException + { + return _getBinary( m_this, iElementNumber); + } + + /** + * Method to generate a buffer that holds the target key as stored in + * the index. + * @param jDb + * @param iIndexNum + * @param bOutputIds + * @return byte[] key buffer + * @throws XFlaimException + */ + public byte[] outputKey( + Db jDb, + int iIndexNum, + boolean bOutputIds) throws XFlaimException + { + return _outputKey( m_this, jDb.m_this, iIndexNum, bOutputIds); + } + + /** + * Method to generate a buffer that holds only the data of the target key. + * @param jDb + * @param iIndexNum + * @return byte[] + * @throws XFlaimException + */ + public byte[] outputData( + Db jDb, + int iIndexNum) throws XFlaimException + { + return _outputData( m_this, jDb.m_this, iIndexNum); + } + + /** + * Method to populate a DataVector object from an index key. + * @param jDb + * @param iIndexNum + * @param Key + * @param iKeyLen + * @throws XFlaimException + */ + public void inputKey( + Db jDb, + int iIndexNum, + byte[] Key, + int iKeyLen) throws XFlaimException + { + _inputKey( m_this, jDb.m_this, iIndexNum, Key, iKeyLen); + } + + /** + * Method to populate a portion of a DataVector object from the data part of + * an index key. + * @param jDb + * @param iIndexNum + * @throws XFlaimException + */ + public void inputData( + Db jDb, + int iIndexNum, + byte[] Data, + int iDataLen) throws XFlaimException + { + _inputData( m_this, jDb.m_this, iIndexNum, Data, iDataLen); + } + + /** + * Method to reset the contents of the DataVector object. + */ + public void reset() + { + _reset( m_this); + } + + /** + * Desc: + */ + private native void _release( + long lThis); + + /** + * Desc: + */ + private native void _setDocumentId( + long lThis, + long lDocId); + + /** + * Desc: + */ + private native void _setID( + long lThis, + int iElementNumber, + long lID); + + /** + * Desc: + */ + private native void _setNameId( + long lThis, + int iElementNumber, + int iNameId, + boolean bIsAttr, + boolean bIsData); + + /** + * Desc: + */ + private native void _setINT( + long lThis, + int iElementNumber, + int iNum); + + /** + * Desc: + */ + private native void _setUINT( + long lThis, + int iElementNumber, + int iUNum); + + /** + * Desc: + */ + private native void _setLong( + long lThis, + int iElementNumber, + long lNum); + + /** + * Desc: + */ + private native void _setString( + long lThis, + int iElementNumber, + String sValue); + + /** + * Desc: + */ + private native void _setBinary( + long lThis, + int iElementNumber, + byte[] Value); + + /** + * Desc: + */ + private native void _setRightTruncated( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native void _setLeftTruncated( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native void _clearRightTruncated( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native void _clearLeftTruncated( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native long _getDocumentID( + long lThis); + + /** + * Desc: + */ + private native long _getID( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native int _getNameId( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native boolean _isAttr( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native boolean _isDataComponent( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native boolean _isKeyComponent( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native int _getDataLength( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native int _getDataType( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native int _getINT( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native int _getUINT( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native long _getLong( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native String _getString( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native byte[] _getBinary( + long lThis, + int iElementNumber); + + /** + * Desc: + */ + private native byte[] _outputKey( + long lThis, + long ljDbRef, + int iIndexNum, + boolean bOutputIds); + + /** + * Desc: + */ + private native byte[] _outputData( + long lThis, + long ljDbRef, + int iIndexNum); + + /** + * Desc: + */ + private native void _inputKey( + long lThis, + long ljDbRef, + int iIndexNum, + byte[] Key, + int iKeyLen); + + /** + * Desc: + */ + private native void _inputData( + long lThis, + long ljDbRef, + int iIndexNum, + byte[] Data, + int iDataLen); + + /** + * Desc: + */ + private native void _reset( + long lThis); +} diff --git a/xflaim/java/java/xflaim/Db.java b/xflaim/java/java/xflaim/Db.java new file mode 100644 index 0000000..779eba3 --- /dev/null +++ b/xflaim/java/java/xflaim/Db.java @@ -0,0 +1,496 @@ +//------------------------------------------------------------------------------ +// Desc: Db Class +// +// 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: Db.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * The Db class provides a number of methods that allow java applications to + * access the XFlaim native environment, specifically, the IF_Db interface. + */ +public class Db +{ + static + { + System.loadLibrary( "xflaimjni"); + } + + Db( + long ref, + DbSystem dbSystem) throws XFlaimException + { + super(); + + if( ref == 0) + { + throw new XFlaimException( -1, "No legal reference"); + } + + m_this = ref; + + if( dbSystem == null) + { + throw new XFlaimException( -1, "No legal dbSystem reference"); + } + + m_dbSystem = dbSystem; + } + + /** + * Finalize method used to release native resources on garbage collection. + */ + public void finalize() + { + close(); + } + + /** + * Closes the database. + */ + public void close() + { + // Release the native pDb! + + if( m_this != 0) + { + _release( m_this); + m_this = 0; + } + + // Remove our reference to the dbSystem so it can be released. + + m_dbSystem = null; + } + + /** + * Starts a transaction. + * + * @param eTransactionType The type of transaction to start (read or + * write). Should be one of the members of {@link + * xflaim.TransactionType TransactionType}. + * @param iMaxLockWait Maximum lock wait time. Specifies the amount of + * time to wait for lock requests occuring during the transaction to be + * granted. Valid values are 0 through 255 seconds. Zero is used to + * specify no-wait locks. + * @param iFlags Should be a logical OR'd combination of the members of + * the memers of {@link xflaim.TransactionFlags + * TransactionFlags}. + * @throws XFlaimException + */ + public void transBegin( + int eTransactionType, + int iMaxLockWait, + int iFlags) throws XFlaimException + { + _transBegin( m_this, eTransactionType, iMaxLockWait, iFlags); + } + + /** + * Commits an existing transaction. If no transaction is running, or the + * transaction commit fails, an XFlaimException exception will be thrown. + * @throws XFlaimException + */ + public void transCommit() throws XFlaimException + { + _transCommit( m_this); + } + + /** + * Aborts an existing transaction. If no transaction is running, or the + * transaction commit fails, an XFlaimException exception will be thrown. + * + * @throws XFlaimException + */ + public void transAbort() throws XFlaimException + { + _transAbort( m_this); + } + + /** + * Uses the jSearchKey to retrieve the next key from the specified + * index. + * + * @param iIndex The index that is being searched + * @param jSearchKey The DataVector search key + * @param iFlags The search flags that direct how the next key will + * be determined. + * @param jFoundKey This parameter is used during subsequent calls + * to keyRetrieve. The returned DataVector is passed in as this + * parameter so that it may be reused, thus preventing the unnecessary + * accumulation of IF_DataVector objects in the C++ environment. + */ + public void keyRetrieve( + int iIndex, + DataVector jSearchKey, + int iFlags, + DataVector jFoundKey) throws XFlaimException + { + long lKey = jSearchKey.m_this; + long lFoundKey = (jFoundKey == null ? 0 : jFoundKey.m_this); + + _keyRetrieve( m_this, iIndex, lKey, iFlags, lFoundKey); + } + + /** + * Creates a new document node. + * @param iCollection The collection to store the new document in. + * @return Returns the DOMNode representing the new document. + * @throws XFlaimException + */ + + public DOMNode createDocument( + int iCollection) throws XFlaimException + { + long lNewDocRef; + + // See the comments in the DOMNode::finalize() function for an + // explanation of this call synchronized call + + synchronized( this) + { + lNewDocRef = _createDocument( m_this, iCollection); + } + + return (new DOMNode( lNewDocRef, this)); + } + + /** + * Creates a new root element node. This is the root node of a document + * in the XFlaim database. + * @param iCollection + * @param iTag + * @return + * @throws XFlaimException + */ + public DOMNode createRootElement( + int iCollection, + int iTag) throws XFlaimException + { + long lNewDocRef; + + // See the comments in the DOMNode::finalize() function for an + // explanation of this call synchronized call + + synchronized( this) + { + lNewDocRef = _createRootElement( m_this, iCollection, iTag); + } + + return (new DOMNode( lNewDocRef, this)); + } + + /** + * Method to retrieve the first document in a specified collection. + * @param iCollection - The collection from which to retrieve the + * first document + * @param jDOMNode - If this parameter is non-null, it will be assumed + * that it is no longer needed and will be rendered unusable upon + * returning from this method. + * @return - Returns a DOMNode which is the root node of the requested + * document. + * @throws XFlaimException + */ + public DOMNode getFirstDocument( + int iCollection, + DOMNode jDOMNode) throws XFlaimException + { + DOMNode jNode = null; + long lRef = 0; + + // See the comments in the DOMNode::finalize() function for an + // explanation of this call synchronized call + + synchronized( this) + { + lRef = _getFirstDocument( m_this, iCollection, jDOMNode); + } + + // If we got a reference to a native DOMNode back, let's + // create a new DOMNode. + + if (lRef != 0) + { + if (jDOMNode != null) + { + jDOMNode.setRef( lRef, this); + jNode = jDOMNode; + } + else + { + jNode = new DOMNode( lRef, this); + } + } + + return( jNode); + } + + /** + * Creates a new element definition in the dictionary. + * @param sNamespaceURI The namespace URI that this definition should be + * created in. If null, the default namespace will be used. + * @param sElementName The name of the definition. + * @param iDataType The type of node this definition will represent. + * Should be one of the constants listed in + * {@link xflaim.FlmDataType FlmDataType}. + * @param iRequestedId If non-zero, then xflaim will try to use this + * number as the name ID of the new definition. + * @return Returns the name ID of the new definition. + * @throws XFlaimException + */ + public int createElementDef( + String sNamespaceURI, + String sElementName, + int iDataType, + int iRequestedId) throws XFlaimException + + { + int iNewNameId; + + // See the comments in the DOMNode::finalize() function for an + // explanation of this call synchronized call + + synchronized( this) + { + iNewNameId = _createElementDef( m_this, sNamespaceURI, + sElementName, iDataType, + iRequestedId); + } + + return( iNewNameId); + } + + /** + * Retrieves the specified node from the specified collection + * @param iCollection The collection where the node is stored. + * @param lNodeId The ID number of the node to be retrieved + * @param ReusedNode Optional. An existing instance of DOMNode who's + * contents will be replaced with that of the new node. If null, a + * new instance will be allocated. + * @return Returns a DOMNode representing the retrieved node. + * @throws XFlaimException + */ + public DOMNode getNode( + int iCollection, + long lNodeId, + DOMNode ReusedNode) throws XFlaimException + + { + long lReusedNodeRef = 0; + long lNewNodeRef = 0; + DOMNode NewNode; + + if (ReusedNode != null) + { + lReusedNodeRef = ReusedNode.getRef(); + } + + // See the comments in DOMNode::finalize() for an explanation + // of this synchronized call + + synchronized( this) + { + lNewNodeRef = _getNode( m_this, iCollection, lNodeId, lReusedNodeRef); + } + + if (ReusedNode == null) + { + NewNode = new DOMNode(lNewNodeRef, this); + } + else + { + NewNode=ReusedNode; + NewNode.setRef( lNewNodeRef, this); + } + + return( NewNode); + } + + /** + * Sets up XFlaim to perform a backup operation + * @param eBackupType The type of backup to perform. Must be one of the + * members of {@link xflaim.FlmBackupType + * FlmBackupType}. + * @param eTransType The type of transaction in which the backup operation + * will take place. Must be one of the members of + * {@link xflaim.TransactionType TransactionType}. + * @param iMaxLockWait Maximum lock wait time. Specifies the amount of + * time to wait for lock requests occuring during the backup operation to + * be granted. Valid values are 0 through 255 seconds. Zero is used to + * specify no-wait locks. + * @param ReusedBackup Optional. An existing instance of Backup that + * will be reset with the new settings. If null, a new instance will + * be allocated. + * @return Returns an instance of Backup configured to perform the + * requested backup operation + * @throws XFlaimException + */ + public Backup backupBegin( + int eBackupType, + int eTransType, + int iMaxLockWait, + Backup ReusedBackup) throws XFlaimException + { + long lReusedRef = 0; + long lNewRef = 0; + Backup NewBackup; + + if (ReusedBackup != null) + { + lReusedRef = ReusedBackup.getRef(); + } + + // See to comments in the finalize function for an explanation of this + // synchronized call + + synchronized( this) + { + lNewRef = _backupBegin( m_this, eBackupType, eTransType, + iMaxLockWait, lReusedRef); + } + + if (ReusedBackup == null) + { + NewBackup = new Backup(lNewRef, this); + } + else + { + NewBackup = ReusedBackup; + NewBackup.setRef( lNewRef, this); + } + + return( NewBackup); + } + + /** + * Imports an XML document into the XFlaim database. The import requires + * an update transaction (TransactionType.UPDATE_TRANS). If the document + * cannot be imported, an XFlaimEXception exception will be thrown. + * @param jIStream + * @param iCollection + * @throws XFlaimException + */ + public void Import( + PosIStream jIStream, + int iCollection) throws XFlaimException + { + _import( m_this, jIStream, iCollection); + } + + /** + * Desc: + */ + private native void _release( + long lThis); + + /** + * Desc: + */ + private native void _transBegin( + long lThis, + int iTransactionType, + int iMaxlockWait, + int iFlags); + + /** + * Desc: + */ + private native void _transCommit( long lThis); + + /** + * Desc: + */ + private native void _transAbort( long lThis); + + /** + * Desc: + */ + private native void _import( + long lThis, + PosIStream jIStream, + int iCollection); + + /** + * Desc: + */ + private native long _getFirstDocument( + long lThis, + int iCollection, + DOMNode jNode) throws XFlaimException; + + /** + * Desc: + */ + private native long _getNode( + long lThis, + int iCollection, + long lNodeId, + long lpOldNodeRef) throws XFlaimException; + + /** + * Desc: + */ + private native long _createDocument( + long lThis, + int iCollection) throws XFlaimException; + + /** + * Desc: + */ + private native long _createRootElement( + long lThis, + int iCollection, + int iTag) throws XFlaimException; + + /** + * Desc: + */ + private native int _createElementDef( + long lThis, + String sNamespaceURI, + String sElementName, + int iDataType, + int iRequestedId) throws XFlaimException; + + /** + * Desc: + */ + private native long _backupBegin( + long lThis, + int eBackupType, + int eTransType, + int iMaxLockWait, + long lReusedRef) throws XFlaimException; + + /** + * Desc: + */ + private native void _keyRetrieve( + long lThis, + int iIndex, + long lKey, + int iFlags, + long lFoundKey); + + long m_this; + private DbSystem m_dbSystem; +} diff --git a/xflaim/java/java/xflaim/DbCheckFlags.java b/xflaim/java/java/xflaim/DbCheckFlags.java new file mode 100644 index 0000000..062afb0 --- /dev/null +++ b/xflaim/java/java/xflaim/DbCheckFlags.java @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// Desc: Check Flags +// +// Tabs: 3 +// +// Copyright (c) 2004-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: DbCheckFlags.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * The members of this class are used by DbSystem.dbCheck. + * The values of these members must match exactly with the equivalent + * #defines in xflaim.h. + */ +public final class DbCheckFlags +{ + public static final int FO_ONLINE = 0x0020; + public static final int FO_DO_LOGICAL_CHECK = 0x0100; + public static final int FO_SKIP_DOM_LINK_CHECK = 0x0400; +} diff --git a/xflaim/java/java/xflaim/DbCheckStatus.java b/xflaim/java/java/xflaim/DbCheckStatus.java new file mode 100644 index 0000000..dcfecf1 --- /dev/null +++ b/xflaim/java/java/xflaim/DbCheckStatus.java @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// Desc: Db Check Status +// +// Tabs: 3 +// +// Copyright (c) 2004-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: DbCheckStatus.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * This interface alows XFlaim to periodically pass information back to the + * client about the status of an ongoing database check operation. The + * implementor may do anything it wants with the information, such as write + * it to a log file or display it on the screen. Additionally, it allows + * the implementor to chose, on a case-by-case basis, whether to attempt + * to fix problems manually, request XFLaim attempt to fix them or + * ignore them alltogether. + */ +public interface DbCheckStatus +{ + /** + * Called periodically by XFlaim to inform the client of the status + * of an ongoing database check operation. + * @param ProgCheck A class who's public data members contain + * information about what exactly has been checked so far and + * what problems have been found. + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * check operation to abort and an XFLaimException to be thrown. + * @see xflaim.CHECKINFO + */ + int reportProgress( + CHECKINFO ProgCheck); + + /** + * Called by XFlaim when an error has been detected during a database + * check. + * @param CorruptInfo A class who's public data members contain + * information describing the nature of the currption. + * @param bFix This is an array containing a single element. If the + * client writes a true into that element, then XFlaim will attempt + * to fix the corruption. + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * check operation to abort and an XFLaimException to be thrown. + * @see xflaim.CORRUPTINFO + */ + int reportCheckErr( + CORRUPTINFO CorruptInfo, + boolean[] bFix); +} diff --git a/xflaim/java/java/xflaim/DbCopyStatus.java b/xflaim/java/java/xflaim/DbCopyStatus.java new file mode 100644 index 0000000..bca61b8 --- /dev/null +++ b/xflaim/java/java/xflaim/DbCopyStatus.java @@ -0,0 +1,56 @@ +//------------------------------------------------------------------------------ +// Desc: Db Copy Status +// +// Tabs: 3 +// +// Copyright (c) 2004-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: DbCopyStatus.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * This interface alows XFlaim to periodically pass information back to the + * client about the status of an ongoing database copy operation. The + * implementor may do anything it wants with the information, such as write + * it to a log file or display it on the screen. + */ +public interface DbCopyStatus +{ + /** + * Called periodically to inform the client about the status of the copy + * operation. + * @param ui64BytesToCopy The total number of bytes that this operation + * will copy. + * @param ui64BytesCopied The number of bytes that have been copied so far. + * @param bNewSrcFile Set to true if the copy operation has started + * working on a new file. + * @param pszSrcFileName The name of the file that is currently being copied. + * @param pszDestFileName The name of the destination file. + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * copy operation to abort and an XFLaimException to be thrown. + */ + int dbCopyStatus( + long ui64BytesToCopy, + long ui64BytesCopied, + boolean bNewSrcFile, + String pszSrcFileName, + String pszDestFileName); +} diff --git a/xflaim/java/java/xflaim/DbInfo.java b/xflaim/java/java/xflaim/DbInfo.java new file mode 100644 index 0000000..29cb462 --- /dev/null +++ b/xflaim/java/java/xflaim/DbInfo.java @@ -0,0 +1,59 @@ +//------------------------------------------------------------------------------ +// Desc: Db Copy Status +// +// Tabs: 3 +// +// Copyright (c) 2004-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: DbInfo.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class DbInfo +{ + DbInfo( + long lRef) throws XFlaimException + { + if (lRef == 0) + { + throw new XFlaimException( -1, "No legal reference"); + } + + m_this = lRef; + } + + /** + * Desc: + */ + protected void finalize() + { + _release( m_this); + } + + /** + * Desc: + */ + private native void _release( + long lThis); + + private long m_this; +} diff --git a/xflaim/java/java/xflaim/DbRebuildStatus.java b/xflaim/java/java/xflaim/DbRebuildStatus.java new file mode 100644 index 0000000..41422a1 --- /dev/null +++ b/xflaim/java/java/xflaim/DbRebuildStatus.java @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// Desc: Db Rebuild +// +// Tabs: 3 +// +// Copyright (c) 2004-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: DbRebuildStatus.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public interface DbRebuildStatus +{ +} diff --git a/xflaim/java/java/xflaim/DbRenameStatus.java b/xflaim/java/java/xflaim/DbRenameStatus.java new file mode 100644 index 0000000..b802c9e --- /dev/null +++ b/xflaim/java/java/xflaim/DbRenameStatus.java @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// Desc: Db Rename Status +// +// Tabs: 3 +// +// Copyright (c) 2004-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: DbRenameStatus.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * This interface alows XFlaim to periodically pass information back to the + * client about the status of an ongoing database rename operation. The + * implementor may do anything it wants with the information, such as write + * it to a log file or display it on the screen. + */ +public interface DbRenameStatus +{ + + /** + * Called after each file is renamed. + * @param sSrcFileName The old name of the file. + * @param sDstFileName The new name of the file. + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * rename operation to abort and an XFLaimException to be thrown. + */ + public int dbRenameStatus( + String sSrcFileName, + String sDstFileName); +} diff --git a/xflaim/java/java/xflaim/DbSystem.java b/xflaim/java/java/xflaim/DbSystem.java new file mode 100644 index 0000000..0b8e0d2 --- /dev/null +++ b/xflaim/java/java/xflaim/DbSystem.java @@ -0,0 +1,484 @@ +//------------------------------------------------------------------------------ +// Desc: Db System +// +// 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: DbSystem.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * The DbSystem class provides a number of methods that allow java + * applications to access the XFlaim native environment, specifically, the + * IF_DbSystem interface. + */ +public class DbSystem +{ + static + { + System.loadLibrary( "xflaimjni"); + } + + /** + * Loads the appropriate native library (as determined from the system + * properties). + * + * @throws XFlaimException + */ + public DbSystem() + throws XFlaimException + { + super(); + m_this = _createDbSystem(); + _init(m_this); + } + + public void finalize() + { + _exit( m_this); + m_this = 0; + } + + public void dbClose() + { + _exit( m_this); + m_this = 0; + } + + /** + * Creates a new XFlaim database. + * + * @param sDbFileName The name of the database to create. (Should be a + * filename ending in .db) + * @param sDataDir The directory where the database should be created. + * If null, the current directory will be used. + * @param sRflDir The directory where the roll forward log files should be + * stored. If null, then they will be stored in a subdirectory under the + * directory containing the main database file. + * @param sDictFileName - The name of a file which contains dictionary + * definition items. May be null. Ignored if sDictBuf is non-null. + * @param sDictBuf - Contains dictionary definitions. If null, + * sDictFileName is used. If both sDictFileName and sDictBuf are null, + * the database is created with an empty dictionary. + * @param CreateOpts - An object containing several parameters that affect + * the creation of the database. (For advanced users.) + * @return Db reference. + * @throws XFlaimException + */ + public Db dbCreate( + String sDbFileName, + String sDataDir, + String sRflDir, + String sDictFileName, + String sDictBuf, + CREATEOPTS CreateOpts) throws XFlaimException + { + + Db jDb = null; + long jDb_ref; + + + jDb_ref = _dbCreate( m_this, sDbFileName, sDataDir, sRflDir, + sDictFileName, sDictBuf, CreateOpts); + + if( jDb_ref != 0) + { + jDb = new Db( jDb_ref, this); + } + + return( jDb); + } + + /** + * Opens an existing XFlaim database. + * @param sDbFileName The name of the database to open. (Should be a + * filename ending in .db) + * @param sDataDir The directory where the database should be created. + * If null, the current directory will be used. + * @param sRflDir The directory where the roll forward log files should be + * stored. If null, then they will be stored in a subdirectory under the + * directory containing the main database file. + * @return Returns an instance of Db. + * @throws XFlaimException + */ + + public Db dbOpen( + String sDbFileName, + String sDataDir, + String sRflDir, + String sPassword, + boolean bAllowLimited) throws XFlaimException + { + Db jDb = null; + long jDb_ref; + + if( (jDb_ref = _dbOpen( m_this, sDbFileName, sDataDir, + sRflDir, sPassword, bAllowLimited)) != 0) + { + jDb = new Db( jDb_ref, this); + } + + return( jDb); + } + + /** + * Removes (deletes) an XFlaim database. + * @param sDbFileName The name of the database to delete. (Should be a + * filename ending in .db) + * @param sDataDir The directory where the database currently exists. + * If null, the current directory is assumed. + * @param sRflDir The directory where the roll forward log files are + * stored. If null, then they are assumed to be stored in a subdirectory + * under the directory containing the main database file. + * @param bRemoveRflFiles If true, the roll forward log files will be + * deleted. + */ + public void dbRemove( + String sDbFileName, + String sDataDir, + String sRflDir, + boolean bRemoveRflFiles) + { + _dbRemove( m_this, sDbFileName, sDataDir, sRflDir, bRemoveRflFiles); + } + + /** + * Restores a previously backed up database. sBackupPath and + * RestoreClient are mutually exclusive. If + * RestoreClient is null, then an instance of + * DefaultRestoreClient will be created and + * sBackupPath passed into its constructor. If + * RestoreClient is non-null, sBackupPath is ignored. + * @param sDbPath The name of the database to create. (Should be a + * filename ending in .db) + * @param sDataDir Optional. The directory where the new data files will + * be stored. If null, then they will be stored in the same directory as + * the .db file. + * @param sRflDir Optional. The directory where RFL files will be stored. + * If null, then they will be stored in a subdirectory under the directory + * containing the .db file. + * @param sBackupPath Optional. The path to the backup files. + * @param RestoreClient Optional. An object implementing the + * {@link RestoreClient RestoreClient} interface + * @param RestoreStatus Optional. An object implementing the + * {@link RestoreStatus RestoreStatus} interface + * @throws XFlaimException + */ + public void dbRestore( + String sDbPath, + String sDataDir, + String sRflDir, + String sBackupPath, + String sPassword, + RestoreClient RestoreClient, + RestoreStatus RestoreStatus) throws XFlaimException + { + RestoreClient Client; + + if (RestoreClient != null) + { + Client = RestoreClient; + } + else + { + Client = new DefaultRestoreClient( sBackupPath); + } + + _dbRestore( m_this, sDbPath, sDataDir, sRflDir, sBackupPath, + sPassword, Client, RestoreStatus); + } + + + /** + * Opens a buffered input stream. + * @param sBuffer + * @return Returns an instance of PosIStream. + */ + public PosIStream openBufferIStream( + String sBuffer) throws XFlaimException + { + PosIStream jPosIStream = null; + long lRef = 0; + + lRef = _openBufferIStream( m_this, sBuffer); + + if (lRef != 0) + { + jPosIStream = new PosIStream( lRef, sBuffer, this); + } + + return( jPosIStream); + } + + /** + * Opens a file to be used as an input stream. + * @param sPath The pathname of the file to be opened. + * @return Returns an instance of PosIStream. + * @throws XFlaimException + */ + public PosIStream openFileIStream( String sPath) throws XFlaimException + { + PosIStream jIStream = null; + long lRef = 0; + + lRef = _openFileIStream( + m_this, + sPath); + + if (lRef != 0) + { + jIStream = new PosIStream( lRef, this); + } + + return( jIStream); + } + + /** + * Creates and returns a DataVector object to be used when searching + * indexes. + * @return DataVector + */ + public DataVector createJDataVector() throws XFlaimException + { + DataVector jDataVector = null; + long lRef = 0; + + lRef = _createJDataVector(m_this); + + if (lRef != 0) + { + jDataVector = new DataVector(lRef, this); + } + + return jDataVector; + } + + /** + * Peforms an integrity check on the specified database. + * @param sDbFileName The name of the database to be checked. (Should be a + * filename ending in .db) + * @param sDataDir Optional. The directory where the data files are + * stored. If null, then XFlaim will assume that they are stored in the + * same directory as the .db file. + * @param sRflDir Optional. The directory where RFL files are stored. + * If null, then XFlaim will assume that they are stored in a subdirectory + * under the directory containing the .db file. + * @param iFlags Flags that control exactly what the operation checks. + * Should be a logical OR of the members of + * {@link xflaim.DbCheckFlags DbCheckFlags}. + * @param Status Optional. If non-null, then XFlaim will call member + * functions to report progress of the check and report any errors that + * are found. + * @return Returns an instance of DbInfo containing data on the physical + * structure of the database. + * @throws XFlaimException + */ + public DbInfo dbCheck( + String sDbFileName, + String sDataDir, + String sRflDir, + String sPassword, + int iFlags, + DbCheckStatus Status) throws XFlaimException + { + long lRef = _dbCheck( m_this, sDbFileName, sDataDir, sRflDir, + sPassword, iFlags, Status); + return new DbInfo( lRef); + } + + /** + * Makes a copy of an existing database. + * @param sSrcDbName The name of the existing database. (Should be a + * filename ending in .db) + * @param sSrcDataDir Optional. The directory where the data files are + * stored. If null, then XFlaim will assume that they are stored in the + * same directory as the .db file. + * @param sSrcRflDir Optional. The directory where RFL files are stored. + * If null, then XFlaim will assume that they are stored in a subdirectory + * under the directory containing the .db file. + * @param sDestDbName The name for the new database. + * @param sDestDataDir Optional. The directory where the data files for + * the new database will be stored. + * @param sDestRflDir Optional. The directory where the RFL files for the + * new database will be stored. + * @param Status Optional. If non-null, then Status.dbCopyStatus + * will be called periodically. + * @throws XFlaimException + */ + public void dbCopy( + String sSrcDbName, + String sSrcDataDir, + String sSrcRflDir, + String sDestDbName, + String sDestDataDir, + String sDestRflDir, + DbCopyStatus Status) throws XFlaimException + { + _dbCopy( m_this, sSrcDbName, sSrcDataDir, sSrcRflDir, + sDestDbName, sDestDataDir, sDestRflDir, Status); + } + + /** + * Renames a database. + * @param sDbName The name of the database to be renamed. (Should be a + * filename ending in .db) + * @param sDataDir Optional. The directory where the data files are + * stored. If null, then XFlaim will assume that they are stored in the + * same directory as the .db file. + * @param sRflDir Optional. The directory where RFL files are stored. + * If null, then XFlaim will assume that they are stored in a subdirectory + * under the directory containing the .db file. + * @param sNewDbName The new name for the database. + * @param bOverwriteDestOk If true, then if the database specified in + * sNewDbName already exists, it will be overwritten. + * @param Status Optional. If non-null, then Status.dbRenameStatus + * will be called as every file is renamed. + * @throws XFlaimException + */ + public void dbRename( + String sDbName, + String sDataDir, + String sRflDir, + String sNewDbName, + boolean bOverwriteDestOk, + DbRenameStatus Status) throws XFlaimException + { + _dbRename( m_this, sDbName, sDataDir, sRflDir, sNewDbName, + bOverwriteDestOk, Status); + } + + /** + * Desc: + */ + private native long _createDbSystem(); + + /** + * Desc: + */ + private native void _init( long lThis); + + /** + * Desc: + */ + private native void _exit( long lThis); + + /** + * Desc: + */ + private native long _dbCreate( + long lThis, + String DbFileName, + String DataDir, + String RflDir, + String DictFileName, + String DictBuf, + CREATEOPTS CreateOpts); + + private native long _dbOpen( + long lThis, + String DbFileName, + String DataDir, + String RflDir, + String Password, + boolean bAllowLimited); + + /** + * Desc: + */ + private native void _dbRemove( + long lThis, + String DbFileName, + String DataDir, + String RflDir, + boolean bRemoveRflFiles); + + /** + * Desc: + */ + private native long _dbCheck( + long lThis, + String sDbFileName, + String sDataDir, + String sRflDir, + String sPassword, + int iFlags, + DbCheckStatus Status) throws XFlaimException; + + /** + * Desc: + */ + private native void _dbCopy( + long lThis, + String sSrcDbName, + String sSrcDataDir, + String sSrcRflDir, + String sDestDbName, + String sDestDataDir, + String sDestRflDir, + DbCopyStatus Status) throws XFlaimException; + + /** + * Desc: + */ + private native void _dbRestore( + long lThis, + String sDbPath, + String sDataDir, + String sRflDir, + String sBackupPath, + String sPassword, + RestoreClient RestoreClient, + RestoreStatus RestoreStatus) throws XFlaimException; + + /** + * Desc: + */ + private native void _dbRename( + long lThis, + String sDbName, + String sDataDir, + String sRflDir, + String sNewDbName, + boolean bOverwriteDestOk, + DbRenameStatus Status) throws XFlaimException; + + /** + * Desc: + */ + private native long _openBufferIStream( + long lThis, + String sBuffer) throws XFlaimException; + + /** + * Desc: + */ + private native long _openFileIStream( + long lThis, + String sPath); + + /** + * Desc: + */ + private native long _createJDataVector( + long lRef); + + private long m_this; +} diff --git a/xflaim/java/java/xflaim/DefaultBackupClient.java b/xflaim/java/java/xflaim/DefaultBackupClient.java new file mode 100644 index 0000000..ad223b7 --- /dev/null +++ b/xflaim/java/java/xflaim/DefaultBackupClient.java @@ -0,0 +1,81 @@ +//------------------------------------------------------------------------------ +// Desc: Default Backup Client +// +// 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: DefaultBackupClient.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import xflaim.RCODE; + +/** + * This is a simple example of an object that implements the + * BackupClient interface. It writes the backed up data + * to a file. Note that like the C++ default backup, this class can + * only be used for full backups. This class cannot be used for an + * incremental backup. + */ +public class DefaultBackupClient + implements BackupClient +{ + public DefaultBackupClient( + String sBackupPath) throws FileNotFoundException + { + File BackupDir = new File( sBackupPath); + + BackupDir.mkdirs(); + + // Note: This rather odd name comes from the desire to maintain + // compatibility with C++ default backup client + + String sPathName = sBackupPath + + System.getProperty( "file.separator") + + "00000000.64"; + + m_OStream = new FileOutputStream( sPathName); + } + + /** + * Desc: + */ + public int WriteData( + byte[] Buffer) + { + int iRCode = RCODE.NE_XFLM_OK; + + try + { + m_OStream.write( Buffer); + } + catch (IOException e) + { + iRCode = RCODE.NE_XFLM_WRITING_FILE; + } + + return( iRCode); + } + + private FileOutputStream m_OStream; +} diff --git a/xflaim/java/java/xflaim/DefaultRestoreClient.java b/xflaim/java/java/xflaim/DefaultRestoreClient.java new file mode 100644 index 0000000..c2bfbaa --- /dev/null +++ b/xflaim/java/java/xflaim/DefaultRestoreClient.java @@ -0,0 +1,165 @@ +//------------------------------------------------------------------------------ +// Desc: Default Restore Client +// +// Tabs: 3 +// +// Copyright (c) 2004-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: $ +//------------------------------------------------------------------------------ + +package xflaim; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import xflaim.RCODE; + +/** + * This is a simple example of a class that implements the + * {@link RestoreClient RestoreClient} interface. It restores from a + * backup file created with {@link DefaultBackupClient + * DefaultBackupClient}. Note that this class is mostly intended as a + * demonstration. It only restores full backups; it cannot handle incremental + * or hot, continuous backups. + */ +public class DefaultRestoreClient implements RestoreClient +{ + public DefaultRestoreClient( + String sBackupPath) + { + m_sBackupPath = sBackupPath; + } + + /* (non-Javadoc) + * @see xflaim.RestoreClient#openBackupSet() + */ + public int openBackupSet() + { + int iRc = RCODE.NE_XFLM_OK; + + // Note: This rather odd name comes from the desire to maintain + // compatibility with C++ default backup client + + String sPathName = m_sBackupPath + + System.getProperty( "file.separator") + + "00000000.64"; + + try + { + m_IStream = new FileInputStream( sPathName); + } + catch ( FileNotFoundException e) + { + iRc = RCODE.NE_XFLM_IO_PATH_NOT_FOUND; + } + + return( iRc); + } + + /* (non-Javadoc) + * @see xflaim.RestoreClient#openRflFile(int) + */ + public int openRflFile(int iFileNum) + { + // This function is not, and probably never will be, implemented. + // If you really want to restore from a hot, continuous backup, + // you should write your own implementations of RestoreClient + // (and BackupClient). + + return( RCODE.NE_XFLM_FAILURE); + } + + /* (non-Javadoc) + * @see xflaim.RestoreClient#openIncFile(int) + */ + public int openIncFile(int iFileNum) + { + // This function is not, and probably never will be, implemented. + // If you really want to restore from an incremental backup, + // you should write your own implementations of RestoreClient + // (and BackupClient). + // Note that this function will still be called by XFlaim. Returning + // PATH_NOT_FOUND is what tells XFLaim that there are no more incremental + // backups. + + return( RCODE.NE_XFLM_IO_PATH_NOT_FOUND); + } + + /* (non-Javadoc) + * @see xflaim.RestoreClient#read(int, byte[]) + */ + public int read(byte[] Buffer, int[] BytesRead) + { + // Try to read Buffer.length bytes from the file. + // Store the actual bytes read in BytesRead[0]. Note that + // BytesRead will have a length of 1. + + int iBytesRead = 0; + int iRc = RCODE.NE_XFLM_OK; + + try + { + iBytesRead = m_IStream.read( Buffer); + } + catch (IOException e) + { + iRc = RCODE.NE_XFLM_FAILURE; + } + + if( iBytesRead == -1) + { + iBytesRead = 0; + iRc = RCODE.NE_XFLM_IO_END_OF_FILE; + } + + BytesRead[0] = iBytesRead; + + return( iRc); + } + + /* (non-Javadoc) + * @see xflaim.RestoreClient#close() + */ + public int close() + { + int iRc = RCODE.NE_XFLM_OK; + + try + { + m_IStream.close(); + } + catch ( IOException e) + { + iRc = RCODE.NE_XFLM_FAILURE; + } + + m_IStream = null; + return( iRc); + } + + /* (non-Javadoc) + * @see xflaim.RestoreClient#abortFile() + */ + public int abortFile() { + return close(); + } + + private String m_sBackupPath; + private FileInputStream m_IStream; +} diff --git a/xflaim/java/java/xflaim/FlmBackupType.java b/xflaim/java/java/xflaim/FlmBackupType.java new file mode 100644 index 0000000..03f804d --- /dev/null +++ b/xflaim/java/java/xflaim/FlmBackupType.java @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// Desc: Backup +// +// Tabs: 3 +// +// Copyright (c) 2004-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: FlmBackupType.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * Provides enums for all (currently 2) of the possible types of backups. + * NOTE: The values in this class must match *exactly* with the eFBackupType + * enum in xflaim.h + */ +public final class FlmBackupType +{ + public static final int FULL_BACKUP = 0; + public static final int INCREMENTAL_BACKUP = 1; +} diff --git a/xflaim/java/java/xflaim/FlmDataType.java b/xflaim/java/java/xflaim/FlmDataType.java new file mode 100644 index 0000000..54608f0 --- /dev/null +++ b/xflaim/java/java/xflaim/FlmDataType.java @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// Desc: Data Type +// +// Tabs: 3 +// +// Copyright (c) 2003,2005-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: FlmDataType.java 3113 2006-01-19 13:20:35 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * Provides enums for all of the possible data types a DOM node can hold. + * NOTE: The values in this class must match *exactly* with the equivalent + * #defines in xflaim.h + */ +public final class FlmDataType +{ + public static final int FLM_NODATA_TYPE = 0; + public static final int FLM_TEXT_TYPE = 1; + public static final int FLM_NUMBER_TYPE = 2; + public static final int FLM_BINARY_TYPE = 3; + + public static final int FLM_NUM_OF_TYPES = 4; + public static final int FLM_UNKNOWN_TYPE = 0xF; +} diff --git a/xflaim/java/java/xflaim/FlmDictIndex.java b/xflaim/java/java/xflaim/FlmDictIndex.java new file mode 100644 index 0000000..f47d72e --- /dev/null +++ b/xflaim/java/java/xflaim/FlmDictIndex.java @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// Desc: Dictionary Index +// +// Tabs: 3 +// +// Copyright (c) 2003,2005-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: FlmDictIndex.java 3113 2006-01-19 13:20:35 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * To change the template for this generated type comment go to + * Window->Preferences->Java->Code Generation->Code and Comments + */ +public final class FlmDictIndex +{ + public static final int MAX_INDEX_NUM = 65500; + public static final int NUMBER_INDEX = 65534; + public static final int NAME_INDEX = 65535; +} diff --git a/xflaim/java/java/xflaim/FlmDomNodeType.java b/xflaim/java/java/xflaim/FlmDomNodeType.java new file mode 100644 index 0000000..ad3f1ae --- /dev/null +++ b/xflaim/java/java/xflaim/FlmDomNodeType.java @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------------ +// Desc: DOM Node Type +// +// Tabs: 3 +// +// Copyright (c) 2003,2005-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: FlmDomNodeType.java 3113 2006-01-19 13:20:35 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * Provides enums for all of the possible DOM node types. + * NOTE: The values in this class must match *exactly* with the + * eFlmDomNodeType enum defined in xflaim.h + */ +public final class FlmDomNodeType +{ + public final static int INVALID_NODE = 0x00; + public final static int DOCUMENT_NODE = 0x01; + public final static int ELEMENT_NODE = 0x02; + public final static int DATA_NODE = 0x03; + public final static int COMMENT_NODE = 0x04; + public final static int CDATA_SECTION_NODE = 0x05; + public final static int ANNOTATION_NODE = 0x06; + public final static int PROCESSING_INSTRUCTION_NODE = 0x07; + public final static int ATTRIBUTE_NODE = 0x08; + public final static int ANY_NODE_TYPE = 0xFFFF; +} diff --git a/xflaim/java/java/xflaim/FlmInsertLoc.java b/xflaim/java/java/xflaim/FlmInsertLoc.java new file mode 100644 index 0000000..8d44fce --- /dev/null +++ b/xflaim/java/java/xflaim/FlmInsertLoc.java @@ -0,0 +1,40 @@ +//------------------------------------------------------------------------------ +// Desc: Insert Location +// +// Tabs: 3 +// +// Copyright (c) 2003,2005-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: FlmInsertLoc.java 3113 2006-01-19 13:20:35 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * Contains a class that provides enums for the different ways a new DOM node + * can be inserted into an existing document. + * NOTE: The values in this class must match *exactly* with the eFlmInsertLoc + * enum defined in xflaim.h + */ +public final class FlmInsertLoc +{ + public static final int FLM_FIRST_CHILD = 1; + public static final int FLM_LAST_CHILD = 2; + public static final int FLM_PREV_SIB = 3; + public static final int FLM_NEXT_SIB = 4; +} diff --git a/xflaim/java/java/xflaim/KeyRetrieveFlags.java b/xflaim/java/java/xflaim/KeyRetrieveFlags.java new file mode 100644 index 0000000..c70ff43 --- /dev/null +++ b/xflaim/java/java/xflaim/KeyRetrieveFlags.java @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// Desc: Key Retrieve Flags +// +// Tabs: 3 +// +// Copyright (c) 2003,2005-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: KeyRetrieveFlags.java 3113 2006-01-19 13:20:35 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * To change the template for this generated type comment go to + * Window->Preferences->Java->Code Generation->Code and Comments + */ +public final class KeyRetrieveFlags +{ + public static final int FO_INCL = 0x0010; + public static final int FO_EXCL = 0x0020; + public static final int FO_EXACT = 0x0040; + public static final int FO_KEY_EXACT = 0x0080; + public static final int FO_FIRST = 0x0100; + public static final int FO_LAST = 0x0200; + public static final int FO_MATCH_IDS = 0x0400; +} diff --git a/xflaim/java/java/xflaim/PosIStream.java b/xflaim/java/java/xflaim/PosIStream.java new file mode 100644 index 0000000..bf6aaf1 --- /dev/null +++ b/xflaim/java/java/xflaim/PosIStream.java @@ -0,0 +1,118 @@ +//------------------------------------------------------------------------------ +// Desc: Positionable Input Stream +// +// Tabs: 3 +// +// Copyright (c) 2003,2005-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: PosIStream.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * The PosIStream class provides a number of methods that allow java + * applications to access the XFlaim native environment, specifically, the + * IF_PosIStream interface. + */ +public class PosIStream +{ + PosIStream( + long lRef, + String sBuffer, + DbSystem dbSystem) throws XFlaimException + { + if (lRef == 0) + { + throw new XFlaimException( -1, "No legal reference to an F_PosIStream"); + } + + m_this = lRef; + + if (dbSystem==null) + { + throw new XFlaimException( -1, "No legal dbSystem reference"); + } + + m_dbSystem = dbSystem; + + if (sBuffer == null) + { + throw new XFlaimException( -1, "No legal reference to a buffer"); + } + + m_sBuffer = sBuffer; + } + + PosIStream( + long lRef, + DbSystem dbSystem) throws XFlaimException + { + if (lRef == 0) + { + throw new XFlaimException( -1, "No legal reference to an IF_PosIStream"); + } + + m_this = lRef; + + if (dbSystem==null) + { + throw new XFlaimException( -1, "No legal dbSystem reference"); + } + + m_dbSystem = dbSystem; + m_sBuffer = null; + } + + /** + * Finalizer method used to release native resources on garbage collection. + */ + public void finalize() + { + if (m_this != 0) + { + _release( m_this); + m_this = 0; + } + + m_dbSystem = null; + } + + /** + * + */ + public void release() + { + if (m_this != 0) + { + _release( m_this); + m_this = 0; + } + + m_dbSystem = null; + } + + /** + * + */ + private native void _release( long iThis); + + private long m_this; + private DbSystem m_dbSystem; + private String m_sBuffer; +} diff --git a/xflaim/java/java/xflaim/RCODE.java b/xflaim/java/java/xflaim/RCODE.java new file mode 100644 index 0000000..c951a4c --- /dev/null +++ b/xflaim/java/java/xflaim/RCODE.java @@ -0,0 +1,405 @@ +//------------------------------------------------------------------------------ +// Desc: RCODEs +// +// 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: RCODE.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006; dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * Provides enums for some of the error codes that XFlaim might return in an + * {@link xflaim.XFlaimException XFlaimException}. + */ + +public final class RCODE +{ + public static final int NE_XFLM_OK = 0; + + public static final int NE_XFLM_FIRST_COMMON_ERROR = 0x81050000; // NOTE: This is not an error code - do not document it + public static final int NE_XFLM_NOT_IMPLEMENTED = 0x81050001; // NE_NOT_IMPLEMENTED - Attempt was made to use a feature that is not implemented. + public static final int NE_XFLM_MEM = 0x81050002; // NE_INSUFFICIENT_MEMORY - Attempt to allocate memory failed. + public static final int NE_XFLM_INVALID_PARM = 0x81050005; // NE_INVALID_PARAMETER - Invalid parameter passed into a function. + public static final int NE_XFLM_TIMEOUT = 0x81050009; // NE_WAIT_TIMEOUT - Database operation timed out (usually a query operation;. + public static final int NE_XFLM_NOT_FOUND = 0x8105000A; // NE_OBJECT_NOT_FOUND - An object was not found. + public static final int NE_XFLM_EXISTS = 0x8105000C; // NE_OBJECT_ALREADY_EXISTS - Object already exists. + public static final int NE_XFLM_USER_ABORT = 0x81050010; // NE_CALLBACK_CANCELLED - User or application aborted (canceled; the operation + public static final int NE_XFLM_FAILURE = 0x81050011; // NE_RECOVERABLE_FAILURE - Internal failure. + public static final int NE_XFLM_LAST_COMMON_ERROR = 0x81050012; // NOTE: This is not an error code - do not document. + + public static final int NE_XFLM_FIRST_GENERAL_ERROR = 0x81050100; // NOTE: This is not an error code - do not document + public static final int NE_XFLM_BOF_HIT = 0x81050101; // Beginning of results encountered. This error is may be returned when reading query results in reverse order (from last to first;. + public static final int NE_XFLM_EOF_HIT = 0x81050102; // End of results encountered. This error may be returned when reading query results in forward order (first to last;. + public static final int NE_XFLM_END = 0x81050103; // End of roll-forward log packets encountered. NOTE: This error code should never be returned to an application. + public static final int NE_XFLM_BAD_PREFIX = 0x81050104; // Invalid XLM namespace prefix specified. Either a prefix name or number that was specified was not defined. + public static final int NE_XFLM_ATTRIBUTE_PURGED = 0x81050105; // XML attribute cannot be used - it is being deleted from the database. + public static final int NE_XFLM_BAD_COLLECTION = 0x81050106; // Invalid collection number specified. Collection is not defined. + public static final int NE_XFLM_DATABASE_LOCK_REQ_TIMEOUT = 0x81050107; // Request to lock the database timed out. + public static final int NE_XFLM_ILLEGAL_DATA_COMPONENT = 0x81050108; // Cannot use ELM_ROOT_TAG as a data component in an index. + public static final int NE_XFLM_BAD_DATA_TYPE = 0x81050109; // Attempt to set/get data on an XML element or attribute using a data type that is incompatible with the data type specified in the dictionary. + public static final int NE_XFLM_MUST_INDEX_ON_PRESENCE = 0x8105010A; // When using ELM_ROOT_TAG in an index component, must specify PRESENCE indexing only. + public static final int NE_XFLM_BAD_IX = 0x8105010B; // Invalid index number specified. Index is not defined. + public static final int NE_XFLM_BACKUP_ACTIVE = 0x8105010C; // Operation could not be performed because a backup is currently in progress. + public static final int NE_XFLM_SERIAL_NUM_MISMATCH = 0x8105010D; // Serial number on backup file does not match the serial number that is expected. + public static final int NE_XFLM_BAD_RFL_DB_SERIAL_NUM = 0x8105010E; // Bad database serial number in roll-forward log file header. + public static final int NE_XFLM_BTREE_ERROR = 0x8105010F; // A B-Tree in the database is bad. + public static final int NE_XFLM_BTREE_FULL = 0x81050110; // A B-tree in the database is full, or a b-tree being used for a temporary result set is full. + public static final int NE_XFLM_BAD_RFL_FILE_NUMBER = 0x81050111; // Bad roll-forward log file number in roll-forward log file header. + public static final int NE_XFLM_CANNOT_DEL_ELEMENT = 0x81050112; // Cannot delete an XML element definition in the dictionary because it is in use. + public static final int NE_XFLM_CANNOT_MOD_DATA_TYPE = 0x81050113; // Cannot modify the data type for an XML element or attribute definition in the dictionary. + public static final int NE_XFLM_CANNOT_INDEX_DATA_TYPE = 0x81050114; // Data type of XML element or attribute is not one that can be indexed. + public static final int NE_XFLM_CONV_BAD_DIGIT = 0x81050115; // Non-numeric digit found in text to numeric conversion. + public static final int NE_XFLM_CONV_DEST_OVERFLOW = 0x81050116; // Destination buffer not large enough to hold data. + public static final int NE_XFLM_CONV_ILLEGAL = 0x81050117; // Attempt to convert between data types is an unsupported conversion. + public static final int NE_XFLM_CONV_NULL_SRC = 0x81050118; // Data source cannot be NULL when doing data conversion. + public static final int NE_XFLM_CONV_NUM_OVERFLOW = 0x81050119; // Numeric overflow (> upper bound; converting to numeric type. + public static final int NE_XFLM_CONV_NUM_UNDERFLOW = 0x8105011A; // Numeric underflow (< lower bound; converting to numeric type. + public static final int NE_XFLM_BAD_ELEMENT_NUM = 0x8105011B; // Bad element number specified - element not defined in dictionary. + public static final int NE_XFLM_BAD_ATTRIBUTE_NUM = 0x8105011C; // Bad attribute number specified - attribute not defined in dictionary. + public static final int NE_XFLM_BAD_ENCDEF_NUM = 0x8105011D; // Bad encryption number specified - encryption definition not defined in dictionary. + public static final int NE_XFLM_DATA_ERROR = 0x8105011E; // Encountered data in the database that was corrupted. + public static final int NE_XFLM_INVALID_FILE_SEQUENCE = 0x8105011F; // Incremental backup file number provided during a restore is invalid. + public static final int NE_XFLM_ILLEGAL_OP = 0x81050120; // Attempt to perform an illegal operation. + public static final int NE_XFLM_DUPLICATE_ELEMENT_NUM = 0x81050121; // Element number specified in element definition is already in use. + public static final int NE_XFLM_ILLEGAL_TRANS_TYPE = 0x81050122; // Illegal transaction type specified for transaction begin operation. + public static final int NE_XFLM_UNSUPPORTED_VERSION = 0x81050123; // Version of database found in database header is not supported. + public static final int NE_XFLM_ILLEGAL_TRANS_OP = 0x81050124; // Illegal operation for transaction type. + public static final int NE_XFLM_INCOMPLETE_LOG = 0x81050125; // Incomplete rollback log. + public static final int NE_XFLM_ILLEGAL_INDEX_DEF = 0x81050126; // Index definition document is illegal - does not conform to the expected form of an index definition document. + public static final int NE_XFLM_ILLEGAL_INDEX_ON = 0x81050127; // The "IndexOn" attribute of an index definition has an illegal value. + public static final int NE_XFLM_ILLEGAL_STATE_CHANGE = 0x81050128; // Attempted an illegal state change on an element or attribute definition. + public static final int NE_XFLM_BAD_RFL_SERIAL_NUM = 0x81050129; // Serial number in roll-forward log file header does not match expected serial number. + public static final int NE_XFLM_NEWER_FLAIM = 0x8105012A; // Running old code on a newer version of database. Newer code must be used. + public static final int NE_XFLM_CANNOT_MOD_ELEMENT_STATE = 0x8105012B; // Attempted to change state of a predefined element definition. + public static final int NE_XFLM_CANNOT_MOD_ATTRIBUTE_STATE = 0x8105012C; // Attempted to change state of a predefined attribute definition. + public static final int NE_XFLM_NO_MORE_ELEMENT_NUMS = 0x8105012D; // The highest element number has already been used, cannot create more element definitions. + public static final int NE_XFLM_NO_TRANS_ACTIVE = 0x8105012E; // Operation must be performed inside a database transaction. + public static final int NE_XFLM_NOT_UNIQUE = 0x8105012F; // Attempt was made to insert a key into a b-tree that was already in the b-tree. + public static final int NE_XFLM_NOT_FLAIM = 0x81050130; // The file specified is not a FLAIM database. + public static final int NE_XFLM_OLD_VIEW = 0x81050131; // Unable to maintain read transaction's view of the database. + public static final int NE_XFLM_SHARED_LOCK = 0x81050132; // Attempted to perform an operation on the database that requires exclusive access, but cannot because there is a shared lock. + public static final int NE_XFLM_SYNTAX = 0x81050133; // Syntax error while parsing XML or query. + public static final int NE_XFLM_TRANS_ACTIVE = 0x81050134; // Operation cannot be performed while a transaction is active. + public static final int NE_XFLM_RFL_TRANS_GAP = 0x81050135; // A gap was found in the transaction sequence in the roll-forward log. + public static final int NE_XFLM_BAD_COLLATED_KEY = 0x81050136; // Something in collated key is bad. + public static final int NE_XFLM_UNSUPPORTED_FEATURE = 0x81050137; // Attempting to use a feature for which full support has been disabled. + public static final int NE_XFLM_MUST_DELETE_INDEXES = 0x81050138; // Attempting to delete a collection that has indexes defined for it. Associated indexes must be deleted before the collection can be deleted. + public static final int NE_XFLM_RFL_INCOMPLETE = 0x81050139; // Roll-forward log file is incomplete. + public static final int NE_XFLM_CANNOT_RESTORE_RFL_FILES = 0x8105013A; // Cannot restore roll-forward log files - not using multiple roll-forward log files. + public static final int NE_XFLM_INCONSISTENT_BACKUP = 0x8105013B; // A problem (corruption, etc.; was detected in a backup set. + public static final int NE_XFLM_BLOCK_CRC = 0x8105013C; // CRC for database block was invalid. May indicate problems in reading from or writing to disk. + public static final int NE_XFLM_ABORT_TRANS = 0x8105013D; // Attempted operation after a critical error - transaction should be aborted. + public static final int NE_XFLM_NOT_RFL = 0x8105013E; // File was not a roll-forward log file as expected. + public static final int NE_XFLM_BAD_RFL_PACKET = 0x8105013F; // Roll-forward log file packet was bad. + public static final int NE_XFLM_DATA_PATH_MISMATCH = 0x81050140; // Bad data path specified to open database. Does not match data path specified for prior opens of the database. + public static final int NE_XFLM_STREAM_EXISTS = 0x81050141; // Attempt to create stream, but the file(s; already exists. + public static final int NE_XFLM_FILE_EXISTS = 0x81050142; // Attempt to create a database, but the file already exists. + public static final int NE_XFLM_COULD_NOT_CREATE_SEMAPHORE = 0x81050143; // Could not create a semaphore. + public static final int NE_XFLM_MUST_CLOSE_DATABASE = 0x81050144; // Database must be closed due to a critical error. + public static final int NE_XFLM_INVALID_ENCKEY_CRC = 0x81050145; // Encryption key CRC could not be verified. + public static final int NE_XFLM_BAD_UTF8 = 0x81050146; // An invalid byte sequence was found in a UTF-8 string + public static final int NE_XFLM_COULD_NOT_CREATE_MUTEX = 0x81050147; // Could not create a mutex. + public static final int NE_XFLM_ERROR_WAITING_ON_SEMPAHORE = 0x81050148; // Error occurred while waiting on a sempahore. + public static final int NE_XFLM_BAD_PLATFORM_FORMAT = 0x81050149; // Cannot support platform format. NOTE: No need to document this one, it is strictly internal. + public static final int NE_XFLM_HDR_CRC = 0x8105014A; // Database header has a bad CRC. + public static final int NE_XFLM_NO_NAME_TABLE = 0x8105014B; // No name table was set up for the database. + public static final int NE_XFLM_MULTIPLE_MATCHES = 0x8105014C; // Multiple entries match the name in the name table. Need to pass a namespace to disambiguate. + public static final int NE_XFLM_UNALLOWED_UPGRADE = 0x8105014D; // Cannot upgrade database from one version to another. + public static final int NE_XFLM_BTREE_BAD_STATE = 0x8105014E; // Btree function called before proper setup steps taken. + public static final int NE_XFLM_DUPLICATE_ATTRIBUTE_NUM = 0x8105014F; // Attribute number specified in attribute definition is already in use. + public static final int NE_XFLM_DUPLICATE_INDEX_NUM = 0x81050150; // Index number specified in index definition is already in use. + public static final int NE_XFLM_DUPLICATE_COLLECTION_NUM = 0x81050151; // Collection number specified in collection definition is already in use. + public static final int NE_XFLM_DUPLICATE_ELEMENT_NAME = 0x81050152; // Element name+namespace specified in element definition is already in use. + public static final int NE_XFLM_DUPLICATE_ATTRIBUTE_NAME = 0x81050153; // Attribute name+namespace specified in attribute definition is already in use. + public static final int NE_XFLM_DUPLICATE_INDEX_NAME = 0x81050154; // Index name specified in index definition is already in use. + public static final int NE_XFLM_DUPLICATE_COLLECTION_NAME = 0x81050155; // Collection name specified in collection definition is already in use. + public static final int NE_XFLM_ELEMENT_PURGED = 0x81050156; // XML element cannot be used - it is deleted from the database. + public static final int NE_XFLM_TOO_MANY_OPEN_DATABASES = 0x81050157; // Too many open databases, cannot open another one. + public static final int NE_XFLM_DATABASE_OPEN = 0x81050158; // Operation cannot be performed because the database is currently open. + public static final int NE_XFLM_CACHE_ERROR = 0x81050159; // Cached database block has been compromised while in cache. + public static final int NE_XFLM_BTREE_KEY_SIZE = 0x8105015A; // Key too large to insert/lookup in a b-tree. + public static final int NE_XFLM_DB_FULL = 0x8105015B; // Database is full, cannot create more blocks. + public static final int NE_XFLM_QUERY_SYNTAX = 0x8105015C; // Query expression had improper syntax. + public static final int NE_XFLM_COULD_NOT_START_THREAD = 0x8105015D; // Error occurred while attempting to start a thread. + public static final int NE_XFLM_INDEX_OFFLINE = 0x8105015E; // Index is offline, cannot be used in a query. + public static final int NE_XFLM_RFL_DISK_FULL = 0x8105015F; // Disk which contains roll-forward log is full. + public static final int NE_XFLM_MUST_WAIT_CHECKPOINT = 0x81050160; // Must wait for a checkpoint before starting transaction - due to disk problems - usually in disk containing roll-forward log files. + public static final int NE_XFLM_MISSING_ENC_ALGORITHM = 0x81050161; // Encryption definition is missing an encryption algorithm. + public static final int NE_XFLM_INVALID_ENC_ALGORITHM = 0x81050162; // Invalid encryption algorithm specified in encryption definition. + public static final int NE_XFLM_INVALID_ENC_KEY_SIZE = 0x81050163; // Invalid key size specified in encryption definition. + public static final int NE_XFLM_ILLEGAL_DATA_TYPE = 0x81050164; // Data type specified for XML element or attribute definition is illegal. + public static final int NE_XFLM_ILLEGAL_STATE = 0x81050165; // State specified for index definition or XML element or attribute definition is illegal. + public static final int NE_XFLM_ILLEGAL_ELEMENT_NAME = 0x81050166; // XML element name specified in element definition is illegal. + public static final int NE_XFLM_ILLEGAL_ATTRIBUTE_NAME = 0x81050167; // XML attribute name specified in attribute definition is illegal. + public static final int NE_XFLM_ILLEGAL_COLLECTION_NAME = 0x81050168; // Collection name specified in collection definition is illegal. + public static final int NE_XFLM_ILLEGAL_INDEX_NAME = 0x81050169; // Index name specified is illegal + public static final int NE_XFLM_ILLEGAL_ELEMENT_NUMBER = 0x8105016A; // Element number specified in element definition or index definition is illegal. + public static final int NE_XFLM_ILLEGAL_ATTRIBUTE_NUMBER = 0x8105016B; // Attribute number specified in attribute definition or index definition is illegal. + public static final int NE_XFLM_ILLEGAL_COLLECTION_NUMBER = 0x8105016C; // Collection number specified in collection definition or index definition is illegal. + public static final int NE_XFLM_ILLEGAL_INDEX_NUMBER = 0x8105016D; // Index number specified in index definition is illegal. + public static final int NE_XFLM_ILLEGAL_ENCDEF_NUMBER = 0x8105016E; // Encryption definition number specified in encryption definition is illegal. + public static final int NE_XFLM_COLLECTION_NAME_MISMATCH = 0x8105016F; // Collection name and number specified in index definition do not correspond to each other. + public static final int NE_XFLM_ELEMENT_NAME_MISMATCH = 0x81050170; // Element name+namespace and number specified in index definition do not correspond to each other. + public static final int NE_XFLM_ATTRIBUTE_NAME_MISMATCH = 0x81050171; // Attribute name+namespace and number specified in index definition do not correspond to each other. + public static final int NE_XFLM_INVALID_COMPARE_RULE = 0x81050172; // Invalid comparison rule specified in index definition. + public static final int NE_XFLM_DUPLICATE_KEY_COMPONENT = 0x81050173; // Duplicate key component number specified in index definition. + public static final int NE_XFLM_DUPLICATE_DATA_COMPONENT = 0x81050174; // Duplicate data component number specified in index definition. + public static final int NE_XFLM_MISSING_KEY_COMPONENT = 0x81050175; // Index definition is missing a key component. + public static final int NE_XFLM_MISSING_DATA_COMPONENT = 0x81050176; // Index definition is missing a data component. + public static final int NE_XFLM_INVALID_INDEX_OPTION = 0x81050177; // Invalid index option specified on index definition. + public static final int NE_XFLM_NO_MORE_ATTRIBUTE_NUMS = 0x81050178; // The highest attribute number has already been used, cannot create more. + public static final int NE_XFLM_MISSING_ELEMENT_NAME = 0x81050179; // Missing element name in XML element definition. + public static final int NE_XFLM_MISSING_ATTRIBUTE_NAME = 0x8105017A; // Missing attribute name in XML attribute definition. + public static final int NE_XFLM_MISSING_ELEMENT_NUMBER = 0x8105017B; // Missing element number in XML element definition. + public static final int NE_XFLM_MISSING_ATTRIBUTE_NUMBER = 0x8105017C; // Missing attribute number from XML attribute definition. + public static final int NE_XFLM_MISSING_INDEX_NAME = 0x8105017D; // Missing index name in index definition. + public static final int NE_XFLM_MISSING_INDEX_NUMBER = 0x8105017E; // Missing index number in index definition. + public static final int NE_XFLM_MISSING_COLLECTION_NAME = 0x8105017F; // Missing collection name in collection definition. + public static final int NE_XFLM_MISSING_COLLECTION_NUMBER = 0x81050180; // Missing collection number in collection definition. + public static final int NE_XFLM_BAD_SEN = 0x81050181; // Invalid simple encoded number. + public static final int NE_XFLM_MISSING_ENCDEF_NAME = 0x81050182; // Missing encryption definition name in encryption definition. + public static final int NE_XFLM_MISSING_ENCDEF_NUMBER = 0x81050183; // Missing encryption definition number in encryption definition. + public static final int NE_XFLM_NO_MORE_INDEX_NUMS = 0x81050184; // The highest index number has already been used, cannot create more. + public static final int NE_XFLM_NO_MORE_COLLECTION_NUMS = 0x81050185; // The highest collection number has already been used, cannot create more. + public static final int NE_XFLM_CANNOT_DEL_ATTRIBUTE = 0x81050186; // Cannot delete an XML attribute definition because it is in use. + public static final int NE_XFLM_TOO_MANY_PENDING_NODES = 0x81050187; // Too many documents in the pending document list. + public static final int NE_XFLM_UNSUPPORTED_INTERFACE = 0x81050188; // Requested COM interface is not supported. + public static final int NE_XFLM_BAD_USE_OF_ELM_ROOT_TAG = 0x81050189; // ELM_ROOT_TAG, if used, must be the sole root component of an index definition. + public static final int NE_XFLM_DUP_SIBLING_IX_COMPONENTS = 0x8105018A; // Sibling components in an index definition cannot have the same XML element or attribute number. + public static final int NE_XFLM_RFL_FILE_NOT_FOUND = 0x8105018B; // Could not open a roll-forward log file - was not found in the roll-forward log directory. + public static final int NE_XFLM_BAD_RCODE_TABLE = 0x8105018C; // The error code tables are incorrect. NOTE: This is an internal error that does not need to be documented. + public static final int NE_XFLM_ILLEGAL_KEY_COMPONENT_NUM = 0x8105018D; // Key component of zero in index definition is not allowed. + public static final int NE_XFLM_ILLEGAL_DATA_COMPONENT_NUM = 0x8105018E; // Data component of zero in index definition is not allowed. + public static final int NE_XFLM_CLASS_NOT_AVAILABLE = 0x8105018F; // Requested COM class is not available. + public static final int NE_XFLM_BUFFER_OVERFLOW = 0x81050190; // Buffer overflow. + public static final int NE_XFLM_ILLEGAL_PREFIX_NUMBER = 0x81050191; // Prefix number specified in prefix definition is illegal. + public static final int NE_XFLM_MISSING_PREFIX_NAME = 0x81050192; // Missing prefix name in prefix definition. + public static final int NE_XFLM_MISSING_PREFIX_NUMBER = 0x81050193; // Missing prefix number in prefix definition. + public static final int NE_XFLM_UNDEFINED_ELEMENT_NAME = 0x81050194; // XML element name+namespace that was specified in index definition or XML document is not defined in dictionary. + public static final int NE_XFLM_UNDEFINED_ATTRIBUTE_NAME = 0x81050195; // XML attribute name+namespace that was specified in index definition or XML document is not defined in dictionary. + public static final int NE_XFLM_DUPLICATE_PREFIX_NAME = 0x81050196; // Prefix name specified in prefix definition is already in use. + public static final int NE_XFLM_KEY_OVERFLOW = 0x81050197; // Generated index key too large. + public static final int NE_XFLM_UNESCAPED_METACHAR = 0x81050198; // Unescaped metacharacter in regular expression. + public static final int NE_XFLM_ILLEGAL_QUANTIFIER = 0x81050199; // Illegal quantifier in regular expression. + public static final int NE_XFLM_UNEXPECTED_END_OF_EXPR = 0x8105019A; // Unexpected end of regular expression. + public static final int NE_XFLM_ILLEGAL_MIN_COUNT = 0x8105019B; // Illegal minimum count in regular expression quantifier. + public static final int NE_XFLM_ILLEGAL_MAX_COUNT = 0x8105019C; // Illegal maximum count in regular expression quantifier. + public static final int NE_XFLM_EMPTY_BRANCH_IN_EXPR = 0x8105019D; // Illegal empty branch in a regular expression. + public static final int NE_XFLM_ILLEGAL_RPAREN_IN_EXPR = 0x8105019E; // Illegal right paren in a regular expression. + public static final int NE_XFLM_ILLEGAL_CLASS_SUBTRACTION = 0x8105019F; // Illegal class subtraction in regular expression. + public static final int NE_XFLM_ILLEGAL_CHAR_RANGE_IN_EXPR = 0x810501A0; // Illegal character range in regular expression. + public static final int NE_XFLM_BAD_BASE64_ENCODING = 0x810501A1; // Illegal character(s; found in a base64 stream. + public static final int NE_XFLM_NAMESPACE_NOT_ALLOWED = 0x810501A2; // Cannot define a namespace for XML attributes whose name begins with "xmlns:" or that is equal to "xmlns" + public static final int NE_XFLM_INVALID_NAMESPACE_DECL = 0x810501A3; // Name for namespace declaration attribute must be "xmlns" or begin with "xmlns:" + public static final int NE_XFLM_ILLEGAL_NAMESPACE_DECL_DATATYPE= 0x810501A4; // Data type for XML attributes that are namespace declarations must be text. + public static final int NE_XFLM_UNEXPECTED_END_OF_INPUT = 0x810501A5; // Encountered unexpected end of input when parsing XPATH expression. + public static final int NE_XFLM_NO_MORE_PREFIX_NUMS = 0x810501A6; // The highest prefix number has already been used, cannot create more. + public static final int NE_XFLM_NO_MORE_ENCDEF_NUMS = 0x810501A7; // The highest encryption definition number has already been used, cannot create more. + public static final int NE_XFLM_COLLECTION_OFFLINE = 0x810501A8; // Collection is encrypted, cannot be accessed while in operating in limited mode. + public static final int NE_XFLM_INVALID_XML = 0x810501A9; // Invalid XML encountered while parsing document. + public static final int NE_XFLM_READ_ONLY = 0x810501AA; // Item is read-only and cannot be updated. + public static final int NE_XFLM_DELETE_NOT_ALLOWED = 0x810501AB; // Item cannot be deleted. + public static final int NE_XFLM_RESET_NEEDED = 0x810501AC; // Used during check operations to indicate we need to reset the view. NOTE: This is an internal error code and should not be documented. + public static final int NE_XFLM_ILLEGAL_REQUIRED_VALUE = 0x810501AD; // An illegal value was specified for the "Required" attribute in an index definition. + public static final int NE_XFLM_ILLEGAL_INDEX_COMPONENT = 0x810501AE; // A leaf index component in an index definition was not marked as a data component or key component. + public static final int NE_XFLM_ILLEGAL_UNIQUE_SUB_ELEMENT_VALUE = 0x810501AF; // Illegal value for the "UniqueSubElements" attribute in an element definition. + public static final int NE_XFLM_DATA_TYPE_MUST_BE_NO_DATA = 0x810501B0; // Data type for an element definition with UniqueSubElements="yes" must be nodata. + public static final int NE_XFLM_ILLEGAL_FLAG = 0x810501B1; // Illegal flag passed to getChildElement method. Must be zero for elements that can have non-unique child elements. + public static final int NE_XFLM_CANNOT_SET_REQUIRED = 0x810501B2; // Cannot set the "Required" attribute on a non-key index component in index definition. + public static final int NE_XFLM_CANNOT_SET_LIMIT = 0x810501B3; // Cannot set the "Limit" attribute on a non-key index component in index definition. + public static final int NE_XFLM_CANNOT_SET_INDEX_ON = 0x810501B4; // Cannot set the "IndexOn" attribute on a non-key index component in index definition. + public static final int NE_XFLM_CANNOT_SET_COMPARE_RULES = 0x810501B5; // Cannot set the "CompareRules" on a non-key index component in index definition. + public static final int NE_XFLM_INPUT_PENDING = 0x810501B6; // Attempt to set a value while an input stream is still open. + public static final int NE_XFLM_INVALID_NODE_TYPE = 0x810501B7; // Bad node type + public static final int NE_XFLM_INVALID_CHILD_ELM_NODE_ID = 0x810501B8; // Attempt to insert a unique child element that has a lower node ID than the parent element + public static final int NE_XFLM_LAST_GENERAL_ERROR = 0x810501B9; // NOTE: This is not an error code - do not document + + /**************************************************************************** + Desc: DOM Errors + ****************************************************************************/ + + public static final int NE_XFLM_FIRST_DOM_ERROR = 0x81051100; // NOTE: This is not an error code - do not document + public static final int NE_XFLM_DOM_HIERARCHY_REQUEST_ERR = 0x81051101; // Attempt to insert a DOM node somewhere it doesn't belong. + public static final int NE_XFLM_DOM_WRONG_DOCUMENT_ERR = 0x81051102; // A DOM node is being used in a different document than the one that created it. + public static final int NE_XFLM_DOM_DATA_ERROR = 0x81051103; // Links between DOM nodes in a document are corrupt. + public static final int NE_XFLM_DOM_NODE_NOT_FOUND = 0x81051104; // The requested DOM node does not exist. + public static final int NE_XFLM_DOM_INVALID_CHILD_TYPE = 0x81051105; // Attempting to insert a child DOM node whose type cannot be inserted as a child node. + public static final int NE_XFLM_DOM_NODE_DELETED = 0x81051106; // DOM node being accessed has been deleted. + public static final int NE_XFLM_DOM_DUPLICATE_ELEMENT = 0x81051107; // Node already has a child element with the given name id - this node's child nodes must all be unique. + public static final int NE_XFLM_LAST_DOM_ERROR = 0x81051108; // NOTE: This is not an error code - do not document + + /**************************************************************************** + Desc: I/O Errors + ****************************************************************************/ + + public static final int NE_XFLM_FIRST_IO_ERROR = 0x81052100; // NOTE: This is not an error code - do not document + public static final int NE_XFLM_IO_ACCESS_DENIED = 0x81052101; // Access to file is denied. Caller is not allowed access to a file. + public static final int NE_XFLM_IO_BAD_FILE_HANDLE = 0x81052102; // Bad file handle or file descriptor. + public static final int NE_XFLM_IO_COPY_ERR = 0x81052103; // Error occurred while copying a file. + public static final int NE_XFLM_IO_DISK_FULL = 0x81052104; // Disk full. + public static final int NE_XFLM_IO_END_OF_FILE = 0x81052105; // End of file reached while reading from the file. + public static final int NE_XFLM_IO_OPEN_ERR = 0x81052106; // Error while opening the file. + public static final int NE_XFLM_IO_SEEK_ERR = 0x81052107; // Error occurred while positioning (seeking; within a file. + public static final int NE_XFLM_IO_DIRECTORY_ERR = 0x81052108; // Error occurred while accessing or deleting a directory. + public static final int NE_XFLM_IO_PATH_NOT_FOUND = 0x81052109; // File not found. + public static final int NE_XFLM_IO_TOO_MANY_OPEN_FILES = 0x8105210A; // Too many files open. + public static final int NE_XFLM_IO_PATH_TOO_LONG = 0x8105210B; // File name too long. + public static final int NE_XFLM_IO_NO_MORE_FILES = 0x8105210C; // No more files in directory. + public static final int NE_XFLM_IO_DELETING_FILE = 0x8105210D; // Error occurred while deleting a file. + public static final int NE_XFLM_IO_FILE_LOCK_ERR = 0x8105210E; // Error attempting to acquire a byte-range lock on a file. + public static final int NE_XFLM_IO_FILE_UNLOCK_ERR = 0x8105210F; // Error attempting to release a byte-range lock on a file. + public static final int NE_XFLM_IO_PATH_CREATE_FAILURE = 0x81052110; // Error occurred while attempting to create a directory or sub-directory. + public static final int NE_XFLM_IO_RENAME_FAILURE = 0x81052111; // Error occurred while renaming a file. + public static final int NE_XFLM_IO_INVALID_PASSWORD = 0x81052112; // Invalid file password. + public static final int NE_XFLM_SETTING_UP_FOR_READ = 0x81052113; // Error occurred while setting up to perform a file read operation. + public static final int NE_XFLM_SETTING_UP_FOR_WRITE = 0x81052114; // Error occurred while setting up to perform a file write operation. + public static final int NE_XFLM_IO_CANNOT_REDUCE_PATH = 0x81052115; // Cannot reduce file name into more components. + public static final int NE_XFLM_INITIALIZING_IO_SYSTEM = 0x81052116; // Error occurred while setting up to access the file system. + public static final int NE_XFLM_FLUSHING_FILE = 0x81052117; // Error occurred while flushing file data buffers to disk. + public static final int NE_XFLM_IO_INVALID_FILENAME = 0x81052118; // Invalid file name. + public static final int NE_XFLM_IO_CONNECT_ERROR = 0x81052119; // Error connecting to a remote network resource. + public static final int NE_XFLM_OPENING_FILE = 0x8105211A; // Unexpected error occurred while opening a file. + public static final int NE_XFLM_DIRECT_OPENING_FILE = 0x8105211B; // Unexpected error occurred while opening a file in direct access mode. + public static final int NE_XFLM_CREATING_FILE = 0x8105211C; // Unexpected error occurred while creating a file. + public static final int NE_XFLM_DIRECT_CREATING_FILE = 0x8105211D; // Unexpected error occurred while creating a file in direct access mode. + public static final int NE_XFLM_READING_FILE = 0x8105211E; // Unexpected error occurred while reading a file. + public static final int NE_XFLM_DIRECT_READING_FILE = 0x8105211F; // Unexpected error occurred while reading a file in direct access mode. + public static final int NE_XFLM_WRITING_FILE = 0x81052120; // Unexpected error occurred while writing to a file. + public static final int NE_XFLM_DIRECT_WRITING_FILE = 0x81052121; // Unexpected error occurred while writing a file in direct access mode. + public static final int NE_XFLM_POSITIONING_IN_FILE = 0x81052122; // Unexpected error occurred while positioning within a file. + public static final int NE_XFLM_GETTING_FILE_SIZE = 0x81052123; // Unexpected error occurred while getting a file's size. + public static final int NE_XFLM_TRUNCATING_FILE = 0x81052124; // Unexpected error occurred while truncating a file. + public static final int NE_XFLM_PARSING_FILE_NAME = 0x81052125; // Unexpected error occurred while parsing a file's name. + public static final int NE_XFLM_CLOSING_FILE = 0x81052126; // Unexpected error occurred while closing a file. + public static final int NE_XFLM_GETTING_FILE_INFO = 0x81052127; // Unexpected error occurred while getting information about a file. + public static final int NE_XFLM_EXPANDING_FILE = 0x81052128; // Unexpected error occurred while expanding a file. + public static final int NE_XFLM_CHECKING_FILE_EXISTENCE = 0x81052129; // Unexpected error occurred while checking to see if a file exists. + public static final int NE_XFLM_RENAMING_FILE = 0x8105212A; // Unexpected error occurred while renaming a file. + public static final int NE_XFLM_SETTING_FILE_INFO = 0x8105212B; // Unexpected error occurred while setting a file's information. + public static final int NE_XFLM_LAST_IO_ERROR = 0x8105212C; // NOTE: This is not an error code - do not document + + /**************************************************************************** + Desc: Network Errors + ****************************************************************************/ + + public static final int NE_XFLM_FIRST_NET_ERROR = 0x81053100; // NOTE: This is not an error code - do not document + public static final int NE_XFLM_SVR_NOIP_ADDR = 0x81053101; // IP address not found + public static final int NE_XFLM_SVR_SOCK_FAIL = 0x81053102; // IP socket failure + public static final int NE_XFLM_SVR_CONNECT_FAIL = 0x81053103; // TCP/IP connection failure + public static final int NE_XFLM_SVR_BIND_FAIL = 0x81053104; // The TCP/IP services on your system may not be configured or installed. If this POA is not to run Client/Server, use the /notcpip startup switch or disable TCP/IP through the NWADMIN snapin + public static final int NE_XFLM_SVR_LISTEN_FAIL = 0x81053105; // TCP/IP listen failed + public static final int NE_XFLM_SVR_ACCEPT_FAIL = 0x81053106; // TCP/IP accept failed + public static final int NE_XFLM_SVR_SELECT_ERR = 0x81053107; // TCP/IP select failed + public static final int NE_XFLM_SVR_SOCKOPT_FAIL = 0x81053108; // TCP/IP socket operation failed + public static final int NE_XFLM_SVR_DISCONNECT = 0x81053109; // TCP/IP disconnected + public static final int NE_XFLM_SVR_READ_FAIL = 0x8105310A; // TCP/IP read failed + public static final int NE_XFLM_SVR_WRT_FAIL = 0x8105310B; // TCP/IP write failed + public static final int NE_XFLM_SVR_READ_TIMEOUT = 0x8105310C; // TCP/IP read timeout + public static final int NE_XFLM_SVR_WRT_TIMEOUT = 0x8105310D; // TCP/IP write timeout + public static final int NE_XFLM_SVR_ALREADY_CLOSED = 0x8105310E; // Connection already closed + public static final int NE_XFLM_LAST_NET_ERROR = 0x8105310F; // NOTE: This is not an error code - do not document + + /**************************************************************************** + Desc: Query Errors + ****************************************************************************/ + + public static final int NE_XFLM_FIRST_QUERY_ERROR = 0x81054100; // NOTE: This is not an error code - do not document + public static final int NE_XFLM_Q_UNMATCHED_RPAREN = 0x81054101; // Query setup error: Unmatched right paren. + public static final int NE_XFLM_Q_UNEXPECTED_LPAREN = 0x81054102; // Query setup error: Unexpected left paren. + public static final int NE_XFLM_Q_UNEXPECTED_RPAREN = 0x81054103; // Query setup error: Unexpected right paren. + public static final int NE_XFLM_Q_EXPECTING_OPERAND = 0x81054104; // Query setup error: Expecting an operand. + public static final int NE_XFLM_Q_EXPECTING_OPERATOR = 0x81054105; // Query setup error: Expecting an operator. + public static final int NE_XFLM_Q_UNEXPECTED_COMMA = 0x81054106; // Query setup error: Unexpected comma. + public static final int NE_XFLM_Q_EXPECTING_LPAREN = 0x81054107; // Query setup error: Expecting a left paren. + public static final int NE_XFLM_Q_UNEXPECTED_VALUE = 0x81054108; // Query setup error: Unexpected value. + public static final int NE_XFLM_Q_INVALID_NUM_FUNC_ARGS = 0x81054109; // Query setup error: Invalid number of arguments for a function. + public static final int NE_XFLM_Q_UNEXPECTED_XPATH_COMPONENT = 0x8105410A; // Query setup error: Unexpected XPATH componenent. + public static final int NE_XFLM_Q_ILLEGAL_LBRACKET = 0x8105410B; // Query setup error: Illegal left bracket ([;. + public static final int NE_XFLM_Q_ILLEGAL_RBRACKET = 0x8105410C; // Query setup error: Illegal right bracket (];. + public static final int NE_XFLM_Q_ILLEGAL_OPERAND = 0x8105410D; // Query setup error: Operand for some operator is not valid for that operator type. + public static final int NE_XFLM_Q_ALREADY_OPTIMIZED = 0x8105410E; // Operation is illegal, cannot change certain things after query has been optimized. + public static final int NE_XFLM_Q_MISMATCHED_DB = 0x8105410F; // Database handle passed in does not match database associated with query. + public static final int NE_XFLM_Q_ILLEGAL_OPERATOR = 0x81054110; // Illegal operator - cannot pass this operator into the addOperator method. + public static final int NE_XFLM_Q_ILLEGAL_COMPARE_RULES = 0x81054111; // Illegal combination of comparison rules passed to addOperator method. + public static final int NE_XFLM_Q_INCOMPLETE_QUERY_EXPR = 0x81054112; // Query setup error: Query expression is incomplete. + public static final int NE_XFLM_Q_NOT_POSITIONED = 0x81054113; // Query not positioned due to previous error, cannot call getNext, getPrev, or getCurrent + public static final int NE_XFLM_Q_INVALID_NODE_ID_VALUE = 0x81054114; // Query setup error: Invalid type of value constant used for node id value comparison. + public static final int NE_XFLM_Q_INVALID_META_DATA_TYPE = 0x81054115; // Query setup error: Invalid meta data type specified. + public static final int NE_XFLM_Q_NEW_EXPR_NOT_ALLOWED = 0x81054116; // Query setup error: Cannot add an expression to an XPATH component after having added an expression that tests context position. + public static final int NE_XFLM_Q_INVALID_CONTEXT_POS = 0x81054117; // Invalid context position value encountered - must be a positive number. + public static final int NE_XFLM_Q_INVALID_FUNC_ARG = 0x81054118; // Query setup error: Parameter to user-defined functions must be a single XPATH only. + public static final int NE_XFLM_Q_EXPECTING_RPAREN = 0x81054119; // Query setup error: Expecting right paren. + public static final int NE_XFLM_Q_TOO_LATE_TO_ADD_SORT_KEYS = 0x8105411A; // Query setup error: Cannot add sort keys after having called getFirst, getLast, getNext, or getPrev. + public static final int NE_XFLM_Q_INVALID_SORT_KEY_COMPONENT = 0x8105411B; // Query setup error: Invalid sort key component number specified in query. + public static final int NE_XFLM_Q_DUPLICATE_SORT_KEY_COMPONENT = 0x8105411C; // Query setup error: Duplicate sort key component number specified in query. + public static final int NE_XFLM_Q_MISSING_SORT_KEY_COMPONENT = 0x8105411D; // Query setup error: Missing sort key component number in sort keys that were specified for query. + public static final int NE_XFLM_Q_NO_SORT_KEY_COMPONENTS_SPECIFIED = 0x8105411E; // Query setup error: addSortKeys was called, but no sort key components were specified. + public static final int NE_XFLM_Q_SORT_KEY_CONTEXT_MUST_BE_ELEMENT = 0x8105411F; // Query setup error: A sort key context cannot be an XML attribute. + public static final int NE_XFLM_Q_INVALID_ELEMENT_NUM_IN_SORT_KEYS = 0x81054120; // Query setup error: The XML element number specified for a sort key in a query is invalid - no element definition in the dictionary. + public static final int NE_XFLM_Q_INVALID_ATTR_NUM_IN_SORT_KEYS = 0x81054121; // Query setup error: The XML attribute number specified for a sort key in a query is invalid - no attribute definition in the dictionary. + public static final int NE_XFLM_Q_NON_POSITIONABLE_QUERY = 0x81054122; // Attempt is being made to position in a query that is not positionable. + public static final int NE_XFLM_Q_INVALID_POSITION = 0x81054123; // Attempt is being made to position to an invalid position in the result set. + public static final int NE_XFLM_LAST_QUERY_ERROR = 0x81054124; // NOTE: This is not an error code - do not document + + /**************************************************************************** + Desc: Stream Errors + ****************************************************************************/ + + public static final int NE_XFLM_FIRST_STREAM_ERROR = 0x81056100; // NOTE: This is not an error code - do not document + public static final int NE_XFLM_STREAM_DECOMPRESS_ERROR = 0x81056101; // Error decompressing data stream. + public static final int NE_XFLM_STREAM_NOT_COMPRESSED = 0x81056102; // Attempting to decompress a data stream that is not compressed. + public static final int NE_XFLM_STREAM_TOO_MANY_FILES = 0x81056103; // Too many files in input stream. + public static final int NE_XFLM_LAST_STREAM_ERROR = 0x81056104; // NOTE: This is not an error code - do not document + + /**************************************************************************** + Desc: NICI / Encryption Errors + ****************************************************************************/ + + public static final int NE_XFLM_FIRST_NICI_ERROR = 0x81057100; // NOTE: This is not an error code - do not document + public static final int NE_XFLM_NICI_CONTEXT = 0x81057101; // Error occurred while creating NICI context for encryption/decryption. + public static final int NE_XFLM_NICI_ATTRIBUTE_VALUE = 0x81057102; // Error occurred while accessing an attribute on a NICI encryption key. + public static final int NE_XFLM_NICI_BAD_ATTRIBUTE = 0x81057103; // Value retrieved from an attribute on a NICI encryption key was bad. + public static final int NE_XFLM_NICI_WRAPKEY_FAILED = 0x81057104; // Error occurred while wrapping a NICI encryption key in another NICI encryption key. + public static final int NE_XFLM_NICI_UNWRAPKEY_FAILED = 0x81057105; // Error occurred while unwrapping a NICI encryption key that is wrapped in another NICI encryption key. + public static final int NE_XFLM_NICI_INVALID_ALGORITHM = 0x81057106; // Attempt to use invalid NICI encryption algorithm. + public static final int NE_XFLM_NICI_GENKEY_FAILED = 0x81057107; // Error occurred while attempting to generate a NICI encryption key. + public static final int NE_XFLM_NICI_BAD_RANDOM = 0x81057108; // Error occurred while generating random data using NICI. + public static final int NE_XFLM_PBE_ENCRYPT_FAILED = 0x81057109; // Error occurred while attempting to wrap a NICI encryption key in a password. + public static final int NE_XFLM_PBE_DECRYPT_FAILED = 0x8105710A; // Error occurred while attempting to unwrap a NICI encryption key that was previously wrapped in a password. + public static final int NE_XFLM_DIGEST_INIT_FAILED = 0x8105710B; // Error occurred while attempting to initialize the NICI digest functionality. + public static final int NE_XFLM_DIGEST_FAILED = 0x8105710C; // Error occurred while attempting to create a NICI digest. + public static final int NE_XFLM_INJECT_KEY_FAILED = 0x8105710D; // Error occurred while attempting to inject an encryption key into NICI. + public static final int NE_XFLM_NICI_FIND_INIT = 0x8105710E; // Error occurred while attempting to initialize NICI to find information on a NICI encryption key. + public static final int NE_XFLM_NICI_FIND_OBJECT = 0x8105710F; // Error occurred while attempting to find information on a NICI encryption key. + public static final int NE_XFLM_NICI_KEY_NOT_FOUND = 0x81057110; // Could not find the NICI encryption key or information on the NICI encryption key. + public static final int NE_XFLM_NICI_ENC_INIT_FAILED = 0x81057111; // Error occurred while initializing NICI to encrypt data. + public static final int NE_XFLM_NICI_ENCRYPT_FAILED = 0x81057112; // Error occurred while encrypting data. + public static final int NE_XFLM_NICI_DECRYPT_INIT_FAILED = 0x81057113; // Error occurred while initializing NICI to decrypt data. + public static final int NE_XFLM_NICI_DECRYPT_FAILED = 0x81057114; // Error occurred while decrypting data. + public static final int NE_XFLM_NICI_WRAPKEY_NOT_FOUND = 0x81057115; // Could not find the NICI encryption key used to wrap another NICI encryption key. + public static final int NE_XFLM_NOT_EXPECTING_PASSWORD = 0x81057116; // Password supplied when none was expected. + public static final int NE_XFLM_EXPECTING_PASSWORD = 0x81057117; // No password supplied when one was required. + public static final int NE_XFLM_EXTRACT_KEY_FAILED = 0x81057118; // Error occurred while attempting to extract a NICI encryption key. + public static final int NE_XFLM_NICI_INIT_FAILED = 0x81057119; // Error occurred while initializing NICI. + public static final int NE_XFLM_BAD_ENCKEY_SIZE = 0x8105711A; // Bad encryption key size found in roll-forward log packet. + public static final int NE_XFLM_ENCRYPTION_UNAVAILABLE = 0x8105711B; // Attempt was made to encrypt data when NICI is unavailable. + public static final int NE_XFLM_LAST_NICI_ERROR = 0x8105711C; // NOTE: This is not an error code - do not document +} diff --git a/xflaim/java/java/xflaim/ReserveID.java b/xflaim/java/java/xflaim/ReserveID.java new file mode 100644 index 0000000..a3ad9d8 --- /dev/null +++ b/xflaim/java/java/xflaim/ReserveID.java @@ -0,0 +1,174 @@ +//------------------------------------------------------------------------------ +// Desc: Reserve ID +// +// Tabs: 3 +// +// Copyright (c) 2003,2005-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: ReserveID.java 3113 2006-01-19 13:20:35 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * This class provides enums for all of the reserved dictionay tags in XFlaim. + */ +public final class ReserveID +{ + public static final int ELM_ELEMENT_TAG = 0xFFFFFE00; + public static final String ELM_ELEMENT_TAG_NAME = "element"; + public static final int ELM_ATTRIBUTE_TAG = 0xFFFFFE01; + public static final String ELM_ATTRIBUTE_TAG_NAME = "attribute"; + public static final int ELM_INDEX_TAG = 0xFFFFFE02; + public static final String ELM_INDEX_TAG_NAME = "Index"; + public static final int ELM_ELEMENT_COMPONENT_TAG = 0xFFFFFE04; + public static final String ELM_ELEMENT_COMPONENT_TAG_NAME = "ElementComponent"; + public static final int ELM_ATTRIBUTE_COMPONENT_TAG = 0xFFFFFE05; + public static final String ELM_ATTRIBUTE_COMPONENT_TAG_NAME = "AttributeComponent"; + public static final int ELM_COLLECTION_TAG = 0xFFFFFE06; + public static final String ELM_COLLECTION_TAG_NAME = "Collection"; + public static final int ELM_PREFIX_TAG = 0xFFFFFE07; + public static final String ELM_PREFIX_TAG_NAME = "Prefix"; + public static final int ELM_NEXT_DICT_NUMS_TAG = 0xFFFFFE08; + public static final String ELM_NEXT_DICT_NUMS_TAG_NAME = "NextDictNums"; + public static final int ELM_DOCUMENT_TITLE_TAG = 0xFFFFFE09; + public static final String ELM_DOCUMENT_TITLE_TAG_NAME = "DocumentTitle"; + public static final int ELM_INVALID_TAG = 0xFFFFFE0A; + public static final String ELM_INVALID_TAG_NAME = "Invalid"; + public static final int ELM_QUARANTINED_TAG = 0xFFFFFE0B; + public static final String ELM_QUARANTINED_TAG_NAME = "Quarantined"; + public static final int ELM_ALL_TAG = 0xFFFFFE0C; + public static final String ELM_ALL_TAG_NAME = "All"; + public static final int ELM_ANNOTATION_TAG = 0xFFFFFE0D; + public static final String ELM_ANNOTATION_TAG_NAME = "Annotation"; + public static final int ELM_ANY_TAG = 0xFFFFFE0E; + public static final String ELM_ANY_TAG_NAME = "Any"; + public static final int ELM_ATTRIBUTE_GROUP_TAG = 0xFFFFFE0F; + public static final String ELM_ATTRIBUTE_GROUP_TAG_NAME = "AttributeGroup"; + public static final int ELM_CHOICE_TAG = 0xFFFFFE10; + public static final String ELM_CHOICE_TAG_NAME = "Choice"; + public static final int ELM_COMPLEX_CONTENT_TAG = 0xFFFFFE11; + public static final String ELM_COMPLEX_CONTENT_TAG_NAME = "ComplexContent"; + public static final int ELM_COMPLEX_TYPE_TAG = 0xFFFFFE12; + public static final String ELM_COMPLEX_TYPE_TAG_NAME = "ComplexType"; + public static final int ELM_DOCUMENTATION_TAG = 0xFFFFFE13; + public static final String ELM_DOCUMENTATION_TAG_NAME = "Documentation"; + public static final int ELM_ENUMERATION_TAG = 0xFFFFFE14; + public static final String ELM_ENUMERATION_TAG_NAME = "Enumeration"; + public static final int ELM_EXTENSION_TAG = 0xFFFFFE15; + public static final String ELM_EXTENSION_TAG_NAME = "Extension"; + public static final int ELM_GROUP_TAG = 0xFFFFFE16; + public static final String ELM_GROUP_TAG_NAME = "Group"; + public static final int ELM_MAX_OCCURS_TAG = 0xFFFFFE17; + public static final String ELM_MAX_OCCURS_TAG_NAME = "MaxOccurs"; + public static final int ELM_MIN_OCCURS_TAG = 0xFFFFFE18; + public static final String ELM_MIN_OCCURS_TAG_NAME = "MinOccurs"; + public static final int ELM_RESTRICTION_TAG = 0xFFFFFE19; + public static final String ELM_RESTRICTION_TAG_NAME = "Restriction"; + public static final int ELM_SEQUENCE_TAG = 0xFFFFFE1A; + public static final String ELM_SEQUENCE_TAG_NAME = "Sequence"; + public static final int ELM_SIMPLE_CONTENT_TAG = 0xFFFFFE1B; + public static final String ELM_SIMPLE_TYPE_NAME = "SimpleType"; + public static final int ELM_ROOT_TAG = 0xFFFFFE01; + + public static final int ATTR_DICT_NUMBER_TAG = 0xFFFFFE00; + public static final String ATTR_DICT_NUMBER_TAG_NAME = "DictNumber"; + public static final int ATTR_COLLECTION_NUMBER_TAG = 0xFFFFFE01; + public static final String ATTR_COLLECTION_NUMBER_TAG_NAME = "CollectionNumber"; + public static final int ATTR_COLLECTION_NAME_TAG = 0xFFFFFE02; + public static final String ATTR_COLLECTION_NAME_TAG_NAME = "CollectionName"; + public static final int ATTR_NAME_TAG = 0xFFFFFE03; + public static final String ATTR_NAME_TAG_NAME = "name"; + public static final int ATTR_TARGET_NAMESPACE_TAG = 0xFFFFFE04; + public static final String ATTR_TARGET_NAMESPACE_TAG_NAME = "targetNameSpace"; + public static final int ATTR_TYPE_TAG = 0xFFFFFE05; + public static final String ATTR_TYPE_TAG_NAME = "type"; + public static final int ATTR_STATE_TAG = 0xFFFFFE06; + public static final String ATTR_STATE_TAG_NAME = "State"; + public static final int ATTR_LANGUAGE_TAG = 0xFFFFFE07; + public static final String ATTR_LANGUAGE_TAG_NAME = "Language"; + public static final int ATTR_INDEX_OPTIONS_TAG = 0xFFFFFE08; + public static final String ATTR_INDEX_OPTIONS_TAG_NAME = "IndexOptions"; + public static final int ATTR_INDEX_ON_TAG = 0xFFFFFE09; + public static final String ATTR_INDEX_ON_TAG_NAME = "IndexOn"; + public static final int ATTR_REQUIRED_TAG = 0xFFFFFE0A; + public static final String ATTR_REQUIRED_TAG_NAME = "Required"; + public static final int ATTR_LIMIT_TAG = 0xFFFFFE0B; + public static final String ATTR_LIMIT_TAG_NAME = "Limit"; + public static final int ATTR_COMPARE_RULES_TAG = 0xFFFFFE0C; + public static final String ATTR_COMPARE_RULES_TAG_NAME = "CompareRules"; + public static final int ATTR_KEY_COMPONENT_TAG = 0xFFFFFE0D; + public static final String ATTR_KEY_COMPONENT_TAG_NAME = "KeyComponent"; + public static final int ATTR_DATA_COMPONENT_TAG = 0xFFFFFE0E; + public static final String ATTR_DATA_COMPONENT_TAG_NAME = "DataComponent"; + public static final int ATTR_LAST_DOC_INDEXED_TAG = 0xFFFFFE0F; + public static final String ATTR_LAST_DOC_INDEXED_TAG_NAME = "LastDocumentIndexed"; + public static final int ATTR_NEXT_ELEMENT_NUM_TAG = 0xFFFFFE10; + public static final String ATTR_NEXT_ELEMENT_NUM_TAG_NAME = "NextElementNum"; + public static final int ATTR_NEXT_ATTRIBUTE_NUM_TAG = 0xFFFFFE11; + public static final String ATTR_NEXT_ATTRIBUTE_NUM_TAG_NAME = "NextAttributeNum"; + public static final int ATTR_NEXT_INDEX_NUM_TAG = 0xFFFFFE12; + public static final String ATTR_NEXT_INDEX_NUM_TAG_NAME = "NextIndexNum"; + public static final int ATTR_NEXT_COLLECTION_NUM_TAG = 0xFFFFFE13; + public static final String ATTR_NEXT_COLLECTION_NUM_TAG_NAME = "NextCollectionNum"; + public static final int ATTR_NEXT_PREFIX_NUM_TAG = 0xFFFFFE14; + public static final String ATTR_NEXT_PREFIX_NUM_TAG_NAME = "NextPrefixNum"; + public static final int ATTR_DEFAULT_PREFIX_TAG = 0xFFFFFE15; + public static final String ATTR_DEFAULT_PREFIX_TAG_NAME = "DefaultPrefix"; + public static final int ATTR_SOURCE_TAG = 0xFFFFFE16; + public static final String ATTR_SOURCE_TAG_NAME = "Source"; + public static final int ATTR_STATE_CHANGE_COUNT_TAG = 0xFFFFFE17; + public static final String ATTR_STATE_CHANGE_COUNT_TAG_NAME = "StateChangeCount"; + public static final int ATTR_XMLNS_TAG = 0xFFFFFE18; + public static final String ATTR_XMLNS_TAG_NAME = "xmlns"; + public static final int ATTR_ABSTRACT_TAG = 0xFFFFFE19; + public static final String ATTR_ABSTRACT_TAG_NAME = "abstract"; + public static final int ATTR_BASE_TAG = 0xFFFFFE1A; + public static final String ATTR_BASE_TAG_NAME = "base"; + public static final int ATTR_BLOCK_TAG = 0xFFFFFE1B; + public static final String ATTR_BLOCK_TAG_NAME = "block"; + public static final int ATTR_DEFAULT_TAG = 0xFFFFFE1C; + public static final String ATTR_DEFAULT_TAG_NAME = "default"; + public static final int ATTR_FINAL_TAG = 0xFFFFFE1D; + public static final String ATTR_FINAL_TAG_NAME = "final"; + public static final int ATTR_FIXED_TAG = 0xFFFFFE1E; + public static final String ATTR_FIXED_TAG_NAME = "fixed"; + public static final int ATTR_ITEM_TYPE_TAG = 0xFFFFFE1F; + public static final String ATTR_ITEM_TYPE_TAG_NAME = "itemtype"; + public static final int ATTR_MAX_OCCURS_TAG = 0xFFFFFE20; + public static final String ATTR_MAX_OCCURS_TAG_NAME = "maxoccurs"; + public static final int ATTR_MEMBER_TYPES_TAG = 0xFFFFFE21; + public static final String ATTR_MEMBER_TYPES_TAG_NAME = "membertypes"; + public static final int ATTR_MIN_OCCURS_TAG = 0xFFFFFE22; + public static final String ATTR_MIN_OCCURS_TAG_NAME = "minoccurs"; + public static final int ATTR_MIXED_TAG = 0xFFFFFE23; + public static final String ATTR_MIXED_TAG_NAME = "mixed"; + public static final int ATTR_NILLABLE_TAG = 0xFFFFFE24; + public static final String ATTR_NILLABLE_TAG_NAME = "nillable"; + public static final int ATTR_REF_TAG = 0xFFFFFE25; + public static final String ATTR_REF_TAG_NAME = "ref"; + public static final int ATTR_USE_TAG = 0xFFFFFE26; + public static final String ATTR_USE_TAG_NAME = "use"; + public static final int ATTR_VALUE_TAG = 0xFFFFFE27; + public static final String ATTR_VALUE_TAG_NAME = "value"; + + public static final int XS_PREFIX_ID = 0xFFFFFE00; + public static final int XSI_PREFIX_ID = 0xFFFFFE01; + public static final int XFLAIM_PREFIX_ID = 0xFFFFFE02; + public static final int XMLNS_PREFIX_ID = 0xFFFFFE03; +} diff --git a/xflaim/java/java/xflaim/RestoreAction.java b/xflaim/java/java/xflaim/RestoreAction.java new file mode 100644 index 0000000..3463dda --- /dev/null +++ b/xflaim/java/java/xflaim/RestoreAction.java @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// Desc: Restore Actions +// +// Tabs: 3 +// +// Copyright (c) 2003,2005-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: RestoreAction.java 3113 2006-01-19 13:20:35 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * Provides enums for all of the possible return codes for the members of the + * {@link xflaim.RestoreStatus RestoreStatus} interface. + * NOTE: The values in this class must match *exactly* with the equivalent + * enum defined in xflaim.h + */ + +public final class RestoreAction +{ + public static final int CONTINUE = 0; // Continue recovery + public static final int STOP = 1; // Stop recovery + public static final int SKIP = 2; // Skip operation (future) + public static final int RETRY = 3; // Retry the operation +} diff --git a/xflaim/java/java/xflaim/RestoreClient.java b/xflaim/java/java/xflaim/RestoreClient.java new file mode 100644 index 0000000..203729a --- /dev/null +++ b/xflaim/java/java/xflaim/RestoreClient.java @@ -0,0 +1,100 @@ +//------------------------------------------------------------------------------ +// Desc: Restore Client +// +// Tabs: 3 +// +// Copyright (c) 2004-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: RestoreClient.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * This interface defines the client side interface to XFlaim's restore + * subsystem. Clients must pass an object that implements this interface + * into the call to {@link DbSystem#dbRestore DbSystem::dbRestore} + * See the documentation regarding Backup/Restore operations for more details. + * @see DefaultRestoreClient + */ +public interface RestoreClient +{ + /** + * + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort an XFLaimException to be thrown. + */ + public int openBackupSet(); + + /** + * + * @param iFileNum + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort an XFLaimException to be thrown. + */ + public int openRflFile( + int iFileNum); + + /** + * + * @param iFileNum + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort an XFLaimException to be thrown. + */ + public int openIncFile( + int iFileNum); + + /** + * + * @param Buffer + * @param BytesRead NOTE: Will have a length of 1 Function + * must store the number of valid bytes in Buffer into BytesRead[0]. + * (This allows us to pass that value back to the calling function.) + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort an XFLaimException to be thrown. + */ + public int read( + byte[] Buffer, + int[] BytesRead); + + /** + * + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort an XFLaimException to be thrown. + */ + public int close(); + + /** + * + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort an XFLaimException to be thrown. + */ + public int abortFile(); +} diff --git a/xflaim/java/java/xflaim/RestoreStatus.java b/xflaim/java/java/xflaim/RestoreStatus.java new file mode 100644 index 0000000..3c3a3c8 --- /dev/null +++ b/xflaim/java/java/xflaim/RestoreStatus.java @@ -0,0 +1,405 @@ +//------------------------------------------------------------------------------ +// Desc: Restore Status +// +// Tabs: 3 +// +// Copyright (c) 2004-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: RestoreStatus.java 3110 2006-01-19 13:09:08 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ +package xflaim; + +/** + * This interface allows XFlaim's backup subsystem to periodicly pass + * information about the status of a restore operation (bytes completed and + * bytes remaining) while the operation is running. The implementor may do + * anything it wants with the information, such as using it to update a + * progress bar or simply ignoring it. + */ +public interface RestoreStatus +{ + /** + * + * @param lBytesToDo + * @param lBytesDone + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportProgress( + long lBytesToDo, + long lBytesDone); + + /** + * + * @param eErrCode + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportError( + int eErrCode); + + /** + * + * @param lTransId + * @param iStartTime + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportBeginTrans( + long lTransId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportCommitTrans( + long lTransId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportAbortTrans( + long lTransId); + + /** + * + * @param lTransId + * @param iMaintDocNum + * @param iStartBlkAddr + * @param iEndBlkAddr + * @param iCount + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportBlockChainFree( + long lTransId, + int iMaintDocNum, + int iStartBlkAddr, + int iEndBlkAddr, + int iCount); + + /** + * + * @param lTransId + * @param iIndexNum + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportIndexSuspend( + long lTransId, + int iIndexNum); + + /** + * + * @param lTransId + * @param iIndexNum + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportIndexResume( + long lTransId, + int iIndexNum); + + /** + * + * @param lTransId + * @param iCount + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportReduce( + long lTransId, + int iCount); + + /** + * + * @param lTransId + * @param iOldDbVersion + * @param iNewDbVersion + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportUpgrade( + long lTransId, + int iOldDbVersion, + int iNewDbVersion); + + /** + * + * @param iFileNum + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportOpenRflFile( + int iFileNum); + + /** + * + * @param iFileNum + * @param iBytesRead + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportRflRead( + int iFileNum, + int iBytesRead); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportEnableEncryption( + long lTransId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportWrapKey( + long lTransId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportSetNextNodeId( + long lTransId, + int iCollection, + long lNextNodeId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportNodeSetMetaValue( + long lTransId, + int iCollection, + long lNodeId, + long lMetaValue); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportNodeSetPrefixId( + long lTransId, + int iCollection, + long lNodeId, + int iAttrNameId, + int iPrefixId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportNodeFlagsUpdate( + long lTransId, + int iCollection, + long lNodeId, + int iFlags, + boolean bAdd); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportAttributeSetValue( + long lTransId, + int iCollection, + long lElementNodeId, + int iAttrNameId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportNodeSetValue( + long lTransId, + int iCollection, + long lNodeId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportNodeUpdate( + long lTransId, + int iCollection, + long lNodeId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportInsertBefore( + long lTransId, + int iCollection, + long lParentId, + long lNewChildId, + long lRefChildId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportNodeCreate( + long lTransId, + int iCollection, + long lRefNodeId, + int eNodeType, + int iNameId, + int eLocation); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportNodeChildrenDelete( + long lTransId, + int iCollection, + long lNodeId, + int iNameId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportAttributeDelete( + long lTransId, + int iCollection, + long lElementId, + int iAttrNameId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportNodeDelete( + long lTransId, + int iCollection, + long lNodeId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportDocumentDone( + long lTransId, + int iCollection, + long lNodeId); + + /** + * + * @param lTransId + * @return Returns a status code. The integer should one of the constants + * found in {@link xflaim.RCODE xflaim.RCODE}. + * Note that returning anything other than NE_XFLM_OK will cause the + * restore operation to abort and an XFLaimException to be thrown. + */ + int reportRollOverDbKey( + long lTransId); +} diff --git a/xflaim/java/java/xflaim/TransactionFlags.java b/xflaim/java/java/xflaim/TransactionFlags.java new file mode 100644 index 0000000..30919fa --- /dev/null +++ b/xflaim/java/java/xflaim/TransactionFlags.java @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// Desc: Transaction Flags +// +// Tabs: 3 +// +// Copyright (c) 2003,2005-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: TransactionFlags.java 3113 2006-01-19 13:20:35 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * Class to represent the posible transaction flags. + */ +public class TransactionFlags +{ + public static final int DONT_KILL_TRANS = 1; + public static final int DONT_POISON_CACHE = 2; +} diff --git a/xflaim/java/java/xflaim/TransactionType.java b/xflaim/java/java/xflaim/TransactionType.java new file mode 100644 index 0000000..d28ed55 --- /dev/null +++ b/xflaim/java/java/xflaim/TransactionType.java @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// Desc: Transaction Types +// +// Tabs: 3 +// +// Copyright (c) 2003,2005-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: TransactionType.java 3113 2006-01-19 13:20:35 -0700 (Thu, 19 Jan 2006) dsanders $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * Static class representing the transaction types. + */ +public class TransactionType +{ + public static final int NO_TRANS = 0; + public static final int READ_TRANS = 1; + public static final int UPDATE_TRANS = 2; +} diff --git a/xflaim/java/java/xflaim/XFlaimException.java b/xflaim/java/java/xflaim/XFlaimException.java new file mode 100644 index 0000000..2664bd1 --- /dev/null +++ b/xflaim/java/java/xflaim/XFlaimException.java @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// Desc: XFLAIM Exceptions +// +// Tabs: 3 +// +// Copyright (c) 2003,2005-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: $ +//------------------------------------------------------------------------------ + +package xflaim; + +/** + * This is the XFlaim exception class. + */ +public class XFlaimException extends Exception +{ + XFlaimException( + int iRcode, + String message) + { + super( message); + m_rc = iRcode; + } + + public int getRCode() + { + return m_rc; + } + + private int m_rc; +} diff --git a/xflaim/java/native/src/jbackup.cpp b/xflaim/java/native/src/jbackup.cpp new file mode 100644 index 0000000..199f96e --- /dev/null +++ b/xflaim/java/native/src/jbackup.cpp @@ -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(); +} diff --git a/xflaim/java/native/src/jdatavector.cpp b/xflaim/java/native/src/jdatavector.cpp new file mode 100644 index 0000000..c00103e --- /dev/null +++ b/xflaim/java/native/src/jdatavector.cpp @@ -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(); +} diff --git a/xflaim/java/native/src/jdb.cpp b/xflaim/java/native/src/jdb.cpp new file mode 100644 index 0000000..27f6fbf --- /dev/null +++ b/xflaim/java/native/src/jdb.cpp @@ -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; +} diff --git a/xflaim/java/native/src/jdbsystem.cpp b/xflaim/java/native/src/jdbsystem.cpp new file mode 100644 index 0000000..b7b889f --- /dev/null +++ b/xflaim/java/native/src/jdbsystem.cpp @@ -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); +} diff --git a/xflaim/java/native/src/jdomnode.cpp b/xflaim/java/native/src/jdomnode.cpp new file mode 100644 index 0000000..00830cf --- /dev/null +++ b/xflaim/java/native/src/jdomnode.cpp @@ -0,0 +1,1573 @@ +//------------------------------------------------------------------------------ +// 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_DOMNode.h" +#include "jniftk.h" + +#define THIS_NODE() \ + ((IF_DOMNode *)(FLMUINT)lThis) + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1createNode( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jint iNodeType, + jint iNameId, + jint iInsertLoc, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if( RC_BAD( rc = pThisNode->createNode( ifpDb, (eDomNodeType)iNodeType, + (FLMUINT)iNameId, (eNodeInsertLoc)iInsertLoc, &ifpNewNode, NULL))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)((FLMUINT)ifpNewNode)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT void JNICALL Java_xflaim_DOMNode__1deleteNode( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + + if (RC_BAD( rc = pNode->deleteNode( ifpDb))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return; +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT void JNICALL Java_xflaim_DOMNode__1deleteChildren( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + + if (RC_BAD( rc = pNode->deleteChildren( ifpDb))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return; +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jint JNICALL Java_xflaim_DOMNode__1getNodeType( + JNIEnv *, // pEnv, + jobject, // obj, + jlong lThis) +{ + return( THIS_NODE()->getNodeType()); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1createAttribute( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jint iNameId, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if( RC_BAD( rc = pThisNode->createAttribute( ifpDb, + (FLMUINT)iNameId, &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)((FLMUINT)ifpNewNode)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getFirstAttribute( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if ( RC_BAD( rc = pThisNode->getFirstAttribute( ifpDb, &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)((FLMUINT)ifpNewNode)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getLastAttribute( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if ( RC_BAD( rc = pThisNode->getLastAttribute( ifpDb, &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)((FLMUINT)ifpNewNode)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getAttribute( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jint iAttributeId, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if( RC_BAD( rc = pThisNode->getAttribute( ifpDb, (FLMUINT)iAttributeId, + &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)((FLMUINT)ifpNewNode)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT void JNICALL Java_xflaim_DOMNode__1deleteAttribute( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jint iAttributeId) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + + if (RC_BAD( rc = pThisNode->deleteAttribute( ifpDb, (FLMUINT)iAttributeId))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return; +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jboolean JNICALL Java_xflaim_DOMNode__1hasAttribute( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jint iAttributeId) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + jboolean bRv = false; + + rc = pThisNode->hasAttribute( ifpDb, (FLMUINT)iAttributeId, NULL); + + if (RC_OK( rc)) + { + bRv = true; + } + else if (rc != NE_XFLM_DOM_NODE_NOT_FOUND) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( bRv); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jboolean JNICALL Java_xflaim_DOMNode__1hasAttributes( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMBOOL bHasAttr = FALSE; + + if( RC_BAD( rc = pThisNode->hasAttributes( ifpDb, &bHasAttr))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( bHasAttr ? true : false); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jboolean JNICALL Java_xflaim_DOMNode__1hasNextSibling( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMBOOL bHasNextSib = FALSE; + + if (RC_BAD( rc = pThisNode->hasNextSibling( ifpDb, &bHasNextSib))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( bHasNextSib ? true : false); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jboolean JNICALL Java_xflaim_DOMNode__1hasPreviousSibling( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMBOOL bHasPreviousSib = FALSE; + + if (RC_BAD( rc = pThisNode->hasPreviousSibling( ifpDb, &bHasPreviousSib))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( bHasPreviousSib ? true : false); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jboolean JNICALL Java_xflaim_DOMNode__1hasChildren( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMBOOL bHasChild = FALSE; + + if (RC_BAD( rc = pThisNode->hasChildren( ifpDb, &bHasChild))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( bHasChild ? true : false); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jboolean JNICALL Java_xflaim_DOMNode__1isNamespaceDecl( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMBOOL bIsDecl = FALSE; + + if (RC_BAD( rc = pThisNode->isNamespaceDecl( ifpDb, &bIsDecl))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( bIsDecl ? true : false); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getParentNode( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if (RC_BAD( rc = pThisNode->getParentNode( ifpDb, &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)(FLMUINT)ifpNewNode); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getFirstChild( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if (RC_BAD( rc = pThisNode->getFirstChild( ifpDb, &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)(FLMUINT)ifpNewNode); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getLastChild( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if (RC_BAD( rc = pThisNode->getLastChild( ifpDb, &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)(FLMUINT)ifpNewNode); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getPreviousSibling( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = (IF_DOMNode *)(FLMUINT)lThis; + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if (RC_BAD( rc = pThisNode->getPreviousSibling( ifpDb, &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)(FLMUINT)ifpNewNode); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getNextSibling( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if (RC_BAD( rc = pThisNode->getNextSibling( ifpDb, &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)(FLMUINT)ifpNewNode); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getPreviousDocument( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if (RC_BAD( rc = pThisNode->getPreviousDocument( ifpDb, &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)(FLMUINT)ifpNewNode); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getNextDocument( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if (RC_BAD( rc = pThisNode->getNextDocument( ifpDb, &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)(FLMUINT)ifpNewNode); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jstring JNICALL Java_xflaim_DOMNode__1getPrefix( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUNICODE uzPrefix[ 128]; + FLMUNICODE * puzPrefix = uzPrefix; + FLMUINT uiBufSize = sizeof( uzPrefix); + FLMUINT uiNumChars; + jstring sPrefix = NULL; + + if (RC_BAD( rc = pThisNode->getPrefix( ifpDb, + (FLMUNICODE *)NULL, 0, &uiNumChars))) + { + ThrowError( rc, pEnv); + goto Exit; + } + + if (uiNumChars * sizeof( FLMUNICODE) >= uiBufSize) + { + uiBufSize = (uiNumChars + 1) * sizeof( FLMUNICODE); + + if (RC_BAD( rc = f_alloc( uiBufSize, puzPrefix))) + { + ThrowError( rc, pEnv); + goto Exit; + } + } + + if (RC_BAD( rc = pThisNode->getPrefix( ifpDb, puzPrefix, uiBufSize, NULL))) + { + ThrowError( rc, pEnv); + goto Exit; + } + + sPrefix = pEnv->NewString( puzPrefix, uiNumChars); + +Exit: + + if (puzPrefix != uzPrefix) + { + f_free( &puzPrefix); + } + + return( sPrefix); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getChildElement( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jint iNameId, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if (RC_BAD( rc = pThisNode->getChildElement( ifpDb, + (FLMUINT)iNameId, &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)(FLMUINT)ifpNewNode); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getSiblingElement( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jint iNameId, + jboolean bNext, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if (lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if (RC_BAD( rc = pThisNode->getSiblingElement( ifpDb, + (FLMUINT)iNameId, bNext ? TRUE : FALSE, &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)(FLMUINT)ifpNewNode); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getParentId( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT64 ui64Id; + + if (RC_BAD( rc = pThisNode->getParentId( ifpDb, &ui64Id))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)ui64Id); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getNodeId( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT64 ui64Id; + + if (RC_BAD( rc = pThisNode->getNodeId( ifpDb, &ui64Id))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)ui64Id); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getDocumentId( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT64 ui64Id; + + if (RC_BAD( rc = pThisNode->getDocumentId( ifpDb, &ui64Id))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)ui64Id); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getPrevSibId( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT64 ui64Id; + + if (RC_BAD( rc = pThisNode->getPrevSibId( ifpDb, &ui64Id))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)ui64Id); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getNextSibId( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT64 ui64Id; + + if (RC_BAD( rc = pThisNode->getNextSibId( ifpDb, &ui64Id))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)ui64Id); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getFirstChildId( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT64 ui64Id; + + if (RC_BAD( rc = pThisNode->getFirstChildId( ifpDb, &ui64Id))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)ui64Id); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getLastChildId( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT64 ui64Id; + + if (RC_BAD( rc = pThisNode->getLastChildId( ifpDb, &ui64Id))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)ui64Id); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jint JNICALL Java_xflaim_DOMNode__1getNameId( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT uiId; + + if (RC_BAD( rc = pThisNode->getNameId( ifpDb, &uiId))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jint)uiId); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jstring JNICALL Java_xflaim_DOMNode__1getNamespaceURI( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUNICODE uzNamespaceURI[ 128]; + FLMUNICODE * puzNamespaceURI = uzNamespaceURI; + FLMUINT uiBufSize = sizeof( uzNamespaceURI); + FLMUINT uiNumChars; + jstring sNamespaceURI = NULL; + + if (RC_BAD( rc = pThisNode->getNamespaceURI( ifpDb, + (FLMUNICODE *)NULL, 0, &uiNumChars))) + { + ThrowError( rc, pEnv); + goto Exit; + } + + if (uiNumChars * sizeof( FLMUNICODE) >= uiBufSize) + { + uiBufSize = (uiNumChars + 1) * sizeof(FLMUNICODE); + + if (RC_BAD( rc = f_alloc( uiBufSize, puzNamespaceURI))) + { + ThrowError( rc, pEnv); + goto Exit; + } + } + + if (RC_BAD( rc = pThisNode->getNamespaceURI( ifpDb, puzNamespaceURI, + uiBufSize, NULL))) + { + ThrowError( rc, pEnv); + goto Exit; + } + + sNamespaceURI = pEnv->NewString( puzNamespaceURI, uiNumChars); + +Exit: + + if (puzNamespaceURI != uzNamespaceURI) + { + f_free( &puzNamespaceURI); + } + + return( sNamespaceURI); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jstring JNICALL Java_xflaim_DOMNode__1getLocalName( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = (IF_DOMNode *)(FLMUINT)lThis; + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUNICODE uzLocalName[ 128]; + FLMUNICODE * puzLocalName = uzLocalName; + FLMUINT uiBufSize = sizeof(uzLocalName); + FLMUINT uiNumChars; + jstring sLocalName = NULL; + + if (RC_BAD( rc = pThisNode->getLocalName( ifpDb, (FLMUNICODE *)NULL, + 0, &uiNumChars))) + { + ThrowError( rc, pEnv); + goto Exit; + } + + if (uiNumChars * sizeof( FLMUNICODE) >= uiBufSize) + { + uiBufSize = (uiNumChars + 1) * sizeof(FLMUNICODE); + + if (RC_BAD( rc = f_alloc( uiBufSize, puzLocalName))) + { + ThrowError( rc, pEnv); + goto Exit; + } + } + + if (RC_BAD( rc = pThisNode->getLocalName( ifpDb, puzLocalName, + uiBufSize, NULL))) + { + ThrowError( rc, pEnv); + goto Exit; + } + + sLocalName = pEnv->NewString( puzLocalName, uiNumChars); + +Exit: + + if (puzLocalName != uzLocalName) + { + f_free( &puzLocalName); + } + + return( sLocalName); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jstring JNICALL Java_xflaim_DOMNode__1getQualifiedName( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = (IF_DOMNode *)(FLMUINT)lThis; + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUNICODE uzQualName[ 128]; + FLMUNICODE * puzQualName = uzQualName; + FLMUINT uiNumChars; + FLMUINT uiBufSize = sizeof( uzQualName); + jstring sLocalName = NULL; + + if (RC_BAD( rc = pThisNode->getQualifiedName( ifpDb, (FLMUNICODE *)NULL, + 0, &uiNumChars))) + { + ThrowError( rc, pEnv); + goto Exit; + } + + if (uiNumChars * sizeof( FLMUNICODE) >= uiBufSize) + { + uiBufSize = (uiNumChars + 1)* sizeof(FLMUNICODE); + + if (RC_BAD( rc = f_alloc( uiBufSize, puzQualName))) + { + ThrowError( rc, pEnv); + goto Exit; + } + } + + if (RC_BAD( rc = pThisNode->getQualifiedName( ifpDb, puzQualName, + uiBufSize, NULL))) + { + ThrowError( rc, pEnv); + goto Exit; + } + + sLocalName = pEnv->NewString( puzQualName, uiNumChars); + +Exit: + + if (puzQualName != uzQualName) + { + f_free( &puzQualName); + } + + return( sLocalName); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jint JNICALL Java_xflaim_DOMNode__1getCollection( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT uiColNum; + + if (RC_BAD( rc = pThisNode->getCollection( ifpDb, &uiColNum))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jint)uiColNum); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getLong( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMINT64 i64Val; + + if (RC_BAD( rc = pThisNode->getINT64( ifpDb, &i64Val))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)i64Val); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jstring JNICALL Java_xflaim_DOMNode__1getString( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUNICODE uzBuffer[ 128]; + FLMUNICODE * puzBuf = uzBuffer; + FLMUINT uiBufSize = sizeof(uzBuffer); + FLMUINT uiNumChars; + jstring sBuf = NULL; + + if (RC_BAD( rc = pThisNode->getUnicodeChars( ifpDb, &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 = pThisNode->getUnicode( ifpDb, puzBuf, uiBufSize, 0, + uiNumChars, NULL))) + { + ThrowError( rc, pEnv); + goto Exit; + } + + sBuf = pEnv->NewString( puzBuf, uiNumChars); + +Exit: + + if (puzBuf != uzBuffer) + { + f_free( &puzBuf); + } + + return( sBuf); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jint JNICALL Java_xflaim_DOMNode__1getStringLen( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT uiVal; + + if (RC_BAD(rc = pThisNode->getUnicodeChars( ifpDb, &uiVal))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jint)uiVal); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jint JNICALL Java_xflaim_DOMNode__1getDataType( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT uiType; + + if (RC_BAD( rc = pThisNode->getDataType( ifpDb, &uiType))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( uiType); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getDataLength( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT uiLength; + + if (RC_BAD( rc = pThisNode->getDataLength( ifpDb, &uiLength))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)uiLength); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jbyteArray JNICALL Java_xflaim_DOMNode__1getBinary( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT uiLength; + jbyteArray Data = NULL; + void * pvData = NULL; + jboolean bIsCopy = false; + + if (RC_BAD(rc = pThisNode->getDataLength( ifpDb, &uiLength))) + { + ThrowError( rc, pEnv); + goto Exit; + } + + Data = pEnv->NewByteArray( uiLength); + + if ( (pvData = pEnv->GetPrimitiveArrayCritical( Data, &bIsCopy)) == NULL) + { + rc = RC_SET( NE_XFLM_MEM); + ThrowError( rc, pEnv); + goto Exit; + } + + if (RC_BAD( rc = pThisNode->getBinary(ifpDb, pvData, 0, uiLength, NULL))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + if (pvData) + { + 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_DOMNode__1setLong( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jlong lValue) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + + if (RC_BAD( rc = pThisNode->setINT64( ifpDb, (FLMINT64)lValue))) + { + ThrowError( rc, pEnv); + } +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT void JNICALL Java_xflaim_DOMNode__1setString( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jstring sValue, + jboolean bLast) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + jchar * pszValue = NULL; + FLMUINT uiLength = 0; + + if (sValue) + { + pszValue = (jchar *)pEnv->GetStringCritical( sValue, NULL); + uiLength = (FLMUINT)pEnv->GetStringLength( sValue); + } + + if (RC_BAD( rc = pThisNode->setUnicode( ifpDb, pszValue, uiLength, + bLast ? TRUE : FALSE))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + if (pszValue) + { + pEnv->ReleaseStringCritical( sValue, pszValue); + } +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT void JNICALL Java_xflaim_DOMNode__1setBinary( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jbyteArray Value) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMUINT uiLength = pEnv->GetArrayLength( Value); + void * pvValue = NULL; + jboolean bIsCopy = false; + + if( (pvValue = pEnv->GetPrimitiveArrayCritical( Value, &bIsCopy)) == NULL) + { + rc = RC_SET( NE_XFLM_MEM); + ThrowError( rc, pEnv); + goto Exit; + } + + if( RC_BAD( rc = pThisNode->setBinary(ifpDb, pvValue, uiLength))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + if (pvValue) + { + pEnv->ReleasePrimitiveArrayCritical( Value, pvValue, JNI_ABORT); + } +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT void JNICALL Java_xflaim_DOMNode__1release( + JNIEnv *, // pEnv, + jobject, // obj, + jlong lThis) +{ + IF_DOMNode * pNode = THIS_NODE(); + + if( pNode) + { + pNode->Release(); + } +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1createAnnotation( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if( lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if( RC_BAD( rc = pThisNode->createAnnotation( ifpDb, &ifpNewNode, NULL))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)((FLMUINT)ifpNewNode)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jlong JNICALL Java_xflaim_DOMNode__1getAnnotation( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef, + jlong lReusedNodeRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + IF_DOMNode * ifpNewNode = NULL; + + if( lReusedNodeRef) + { + ifpNewNode = (IF_DOMNode *)(FLMUINT)lReusedNodeRef; + } + + if( RC_BAD( rc = pThisNode->getAnnotation( ifpDb, &ifpNewNode))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (jlong)((FLMUINT)ifpNewNode)); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +JNIEXPORT jboolean JNICALL Java_xflaim_DOMNode__1hasAnnotation( + JNIEnv * pEnv, + jobject, // obj, + jlong lThis, + jlong lpDbRef) +{ + RCODE rc = NE_XFLM_OK; + IF_DOMNode * pThisNode = THIS_NODE(); + IF_Db * ifpDb = (IF_Db *)(FLMUINT)lpDbRef; + FLMBOOL bHasAnnotation; + + if( RC_BAD( rc = pThisNode->hasAnnotation( ifpDb, &bHasAnnotation))) + { + ThrowError( rc, pEnv); + goto Exit; + } + +Exit: + + return( (bHasAnnotation ? true : false)); +} diff --git a/xflaim/java/native/src/jniftk.cpp b/xflaim/java/native/src/jniftk.cpp new file mode 100644 index 0000000..5786f58 --- /dev/null +++ b/xflaim/java/native/src/jniftk.cpp @@ -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, + "", "(ILjava/lang/String;)V"); + + Exception = pEnv->NewObject( class_XFlaimException, id_Constructor, + (jint)rc, pEnv->NewStringUTF( szMsg)); + + pEnv->Throw( reinterpret_cast(Exception)); +} diff --git a/xflaim/java/native/src/jniftk.h b/xflaim/java/native/src/jniftk.h new file mode 100644 index 0000000..92e48eb --- /dev/null +++ b/xflaim/java/native/src/jniftk.h @@ -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 diff --git a/xflaim/java/native/src/jnirestore.cpp b/xflaim/java/native/src/jnirestore.cpp new file mode 100644 index 0000000..40db54b --- /dev/null +++ b/xflaim/java/native/src/jnirestore.cpp @@ -0,0 +1,1638 @@ +//------------------------------------------------------------------------------ +// 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 "jnirestore.h" + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreClient::openBackupSet( void) +{ + 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_jClient); + MId = pEnv->GetMethodID( Cls, "openBackupSet", "()I"); + flmAssert( MId); + + if( RC_BAD( rc = (RCODE)pEnv->CallIntMethod( m_jClient, MId))) + { + goto Exit; + } + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreClient::openRflFile( + FLMUINT uiFileNum) +{ + 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_jClient); + MId = pEnv->GetMethodID( Cls, "opeRflFile", "(I)I"); + flmAssert( MId); + + if( RC_BAD( rc = (RCODE)pEnv->CallIntMethod( + m_jClient, MId, (jint)uiFileNum))) + { + goto Exit; + } + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreClient::openIncFile( + FLMUINT uiFileNum) +{ + 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_jClient); + MId = pEnv->GetMethodID( Cls, "openIncFile", "(I)I"); + flmAssert( MId); + + if( RC_BAD( rc = (RCODE)pEnv->CallIntMethod( + m_jClient, MId, (jint)uiFileNum))) + { + goto Exit; + } + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreClient::read( + FLMUINT uiLength, + void * pvBuffer, + FLMUINT * puiBytesRead) +{ + RCODE rc = NE_XFLM_OK; + JNIEnv * pEnv; + jclass Cls; + jmethodID MId; + jbyteArray ByteBuffer; + jintArray IntBuffer; + jint iBytesRead; + void * pvTemp; + 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, "read", "([B[I)I"); + flmAssert( MId); + + ByteBuffer = pEnv->NewByteArray( (jsize)uiLength); + IntBuffer = pEnv->NewIntArray( 1); + + rc = (RCODE)pEnv->CallIntMethod( m_jClient, MId, + ByteBuffer, IntBuffer); + + // Get the value out of IntBuffer + + pEnv->GetIntArrayRegion( IntBuffer, 0, 1, &iBytesRead); + flmAssert( iBytesRead > 0); + *puiBytesRead = (FLMUINT)iBytesRead; + + // Get the data out of ByteBuffer + + pvTemp = pEnv->GetPrimitiveArrayCritical( ByteBuffer, NULL); + f_memcpy( pvBuffer, pvTemp, (FLMUINT)iBytesRead); + pEnv->ReleasePrimitiveArrayCritical( ByteBuffer, pvTemp, JNI_ABORT); + +Exit: + + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreClient::close( void) +{ + 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_jClient); + MId = pEnv->GetMethodID( Cls, "close", "()I"); + flmAssert( MId); + + if( RC_BAD( rc = (RCODE)pEnv->CallIntMethod( m_jClient, MId))) + { + goto Exit; + } + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreClient::abortFile( void) +{ + 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_jClient); + MId = pEnv->GetMethodID( Cls, "abortFile", "()I"); + flmAssert( MId); + + if( RC_BAD( rc = (RCODE)pEnv->CallIntMethod( m_jClient, MId))) + { + goto Exit; + } + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportProgress( + eRestoreAction * peAction, + 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, "reportProgress", "(JJ)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)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: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportError( + eRestoreAction * peAction, + RCODE rcErr) +{ + 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, "reportError", "(I)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jint)rcErr); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportBeginTrans( + eRestoreAction * peAction, + FLMUINT64 ui64TransId) +{ + 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, "reportBeginTrans", "(J)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportCommitTrans( + eRestoreAction * peAction, + FLMUINT64 ui64TransId) +{ + 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, "reportCommitTrans", "(J)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportAbortTrans( + eRestoreAction * peAction, + FLMUINT64 ui64TransId) +{ + 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, "reportAbortTrans", "(J)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportBlockChainFree( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT64 ui64MaintDocNum, + FLMUINT uiStartBlkAddr, + FLMUINT uiEndBlkAddr, + FLMUINT uiCount) +{ + 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, "reportBlockChainFree", "(JJIII)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jlong)ui64MaintDocNum, + (jint)uiStartBlkAddr, (jint)uiEndBlkAddr, (jint)uiCount); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportIndexSuspend( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiIndexNum) +{ + 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, "reportIndexSuspend", "(JI)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiIndexNum); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportIndexResume( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiIndexNum) +{ + 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, "reportIndexResume", "(JI)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiIndexNum); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportReduce( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCount) +{ + 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, "reportReduce", "(JI)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCount); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportUpgrade( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiOldDbVersion, + FLMUINT uiNewDbVersion) +{ + 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, "reportUpgrade", "(JII)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiOldDbVersion, + (jint)uiNewDbVersion); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportOpenRflFile( + eRestoreAction * peAction, + FLMUINT uiFileNum) +{ + 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, "reportOpenRflFile", "(I)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jint)uiFileNum); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportRflRead( + eRestoreAction * peAction, + FLMUINT uiFileNum, + FLMUINT uiBytesRead) +{ + 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, "reportRflRead", "(II)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jint)uiFileNum, (jint)uiBytesRead); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportEnableEncryption( + eRestoreAction * peAction, + FLMUINT64 ui64TransId) +{ + 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, "reportEnableEncryption", "(J)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportWrapKey( + eRestoreAction * peAction, + FLMUINT64 ui64TransId) +{ + 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, "reportWrapKey", "(J)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportSetNextNodeId( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCollection, + FLMUINT64 ui64NextNodeId) +{ + 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, "reportSetNextNodeId", "(JIJ)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCollection, + (jlong)ui64NextNodeId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportNodeSetMetaValue( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCollection, + FLMUINT64 ui64NodeId, + FLMUINT64 ui64MetaValue) +{ + 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, "reportNodeSetMetaValue", "(JIJJ)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCollection, (jlong)ui64NodeId, + (jlong)ui64MetaValue); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportNodeSetPrefixId( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCollection, + FLMUINT64 ui64NodeId, + FLMUINT uiAttrNameId, + FLMUINT uiPrefixId) +{ + 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, "reportNodeSetPrefixId", "(JIJII)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCollection, (jlong)ui64NodeId, + (jint)uiAttrNameId, (jint)uiPrefixId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportNodeFlagsUpdate( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCollection, + FLMUINT64 ui64NodeId, + FLMUINT uiFlags, + FLMBOOL bAdd) +{ + 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, "reportNodeFlagsUpdate", "(JIJIZ)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCollection, (jlong)ui64NodeId, + (jint)uiFlags, (jboolean)bAdd); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportAttributeSetValue( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCollection, + FLMUINT64 ui64ElementNodeId, + FLMUINT uiAttrNameId) +{ + 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, "reportAttributeSetValue", "(JIJI)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCollection, + (jlong)ui64ElementNodeId, (jint)uiAttrNameId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportNodeSetValue( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCollection, + FLMUINT64 ui64NodeId) +{ + 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, "reportNodeSetValue", "(JIJ)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCollection, (jlong)ui64NodeId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportNodeUpdate( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCollection, + FLMUINT64 ui64NodeId) +{ + 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, "reportNodeUpdate", "(JIJ)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCollection, (jlong)ui64NodeId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportInsertBefore( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCollection, + FLMUINT64 ui64ParentId, + FLMUINT64 ui64NewChildId, + FLMUINT64 ui64RefChildId) +{ + 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, "reportInsertBefore", "(JIJJJ)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCollection, (jlong)ui64ParentId, + (jlong)ui64NewChildId, (jlong)ui64RefChildId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportNodeCreate( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCollection, + FLMUINT64 ui64RefNodeId, + eDomNodeType eNodeType, + FLMUINT uiNameId, + eNodeInsertLoc eLocation) +{ + 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, "reportNodeCreate", "(JIJIII)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCollection, (jlong)ui64RefNodeId, + (jint)eNodeType, (jint)uiNameId, (jint)eLocation); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportNodeChildrenDelete( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCollection, + FLMUINT64 ui64NodeId, + FLMUINT uiNameId) +{ + 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, "reportNodeChildrenDelete", "(JIJI)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCollection, (jlong)ui64NodeId, + (jint)uiNameId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportAttributeDelete( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCollection, + FLMUINT64 ui64ElementId, + FLMUINT uiAttrNameId) +{ + 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, "reportAttributeDelete", "(JIJI)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCollection, (jlong)ui64ElementId, + (jint)uiAttrNameId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportNodeDelete( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCollection, + FLMUINT64 ui64NodeId) +{ + 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, "reportNodeDelete", "(JIJ)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCollection, (jlong)ui64NodeId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportDocumentDone( + eRestoreAction * peAction, + FLMUINT64 ui64TransId, + FLMUINT uiCollection, + FLMUINT64 ui64NodeId) +{ + 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, "reportDocumentDone", "(JIJ)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId, (jint)uiCollection, (jlong)ui64NodeId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} + +/**************************************************************************** +Desc: +****************************************************************************/ +RCODE XFLMAPI JNIRestoreStatus::reportRollOverDbKey( + eRestoreAction * peAction, + FLMUINT64 ui64TransId) +{ + 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, "reportRollOverDbKey", "(J)I"); + flmAssert( MId); + + *peAction = (eRestoreAction)pEnv->CallIntMethod( m_jStatus, MId, + (jlong)ui64TransId); + +Exit: + + if (bMustDetach) + { + if (m_pJvm->DetachCurrentThread() != 0) + { + flmAssert( 0); + rc = RC_SET( NE_XFLM_FAILURE); + } + } + + return( rc); +} diff --git a/xflaim/java/native/src/jnirestore.h b/xflaim/java/native/src/jnirestore.h new file mode 100644 index 0000000..c3258f3 --- /dev/null +++ b/xflaim/java/native/src/jnirestore.h @@ -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; +}; diff --git a/xflaim/java/native/src/jnistatus.cpp b/xflaim/java/native/src/jnistatus.cpp new file mode 100644 index 0000000..2eb38fe --- /dev/null +++ b/xflaim/java/native/src/jnistatus.cpp @@ -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, "", "()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); +} diff --git a/xflaim/java/native/src/jnistatus.h b/xflaim/java/native/src/jnistatus.h new file mode 100644 index 0000000..d328109 --- /dev/null +++ b/xflaim/java/native/src/jnistatus.h @@ -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 + +/**************************************************************************** +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; +}; diff --git a/xflaim/java/native/src/jposistream.cpp b/xflaim/java/native/src/jposistream.cpp new file mode 100644 index 0000000..a84daf0 --- /dev/null +++ b/xflaim/java/native/src/jposistream.cpp @@ -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(); +}