diff options
author | unknown <ram@mysql.r18.ru> | 2003-01-22 15:29:31 +0400 |
---|---|---|
committer | unknown <ram@mysql.r18.ru> | 2003-01-22 15:29:31 +0400 |
commit | c917330a0285ddb1e4b279872325658e815c4a4f (patch) | |
tree | a06e470af27c0d1183c9fbe32544e0b2ccb31000 /bdb/java/src | |
parent | 8823fa22f16acca6e540074fdcd2491183a38707 (diff) | |
download | mariadb-git-c917330a0285ddb1e4b279872325658e815c4a4f.tar.gz |
bdb/ cleanup (SCRUM)
BitKeeper/deleted/.del-README~281c91deea8d9cf7:
Delete: bdb/examples_c/README
BitKeeper/deleted/.del-bench_001.c~2fa9b35498dae603:
Delete: bdb/examples_c/bench_001.c
BitKeeper/deleted/.del-ex_access.c~75506e56e42fa9d4:
Delete: bdb/examples_c/ex_access.c
BitKeeper/deleted/.del-ex_btrec.c~1dd4f24b6baa62a5:
Delete: bdb/examples_c/ex_btrec.c
BitKeeper/deleted/.del-ex_dbclient.c~9560845efc4dcf01:
Delete: bdb/examples_c/ex_dbclient.c
BitKeeper/deleted/.del-ex_env.c~b2fbf8debefbb955:
Delete: bdb/examples_c/ex_env.c
BitKeeper/deleted/.del-ex_lock.c~6b6f72e8b19da0b1:
Delete: bdb/examples_c/ex_lock.c
BitKeeper/deleted/.del-ex_mpool.c~b51c929ad09f2cb8:
Delete: bdb/examples_c/ex_mpool.c
BitKeeper/deleted/.del-auto_rebuild~79f363fad0302f23:
Delete: bdb/examples_c/ex_apprec/auto_rebuild
BitKeeper/deleted/.del-ex_apprec.c~d76cd5b13fd7f9e:
Delete: bdb/examples_c/ex_apprec/ex_apprec.c
BitKeeper/deleted/.del-ex_apprec.h~fbc4e37c9936bed8:
Delete: bdb/examples_c/ex_apprec/ex_apprec.h
BitKeeper/deleted/.del-ex_apprec.src~3cb70069cd818a9c:
Delete: bdb/examples_c/ex_apprec/ex_apprec.src
BitKeeper/deleted/.del-ex_apprec_rec.c~5cc676001646b782:
Delete: bdb/examples_c/ex_apprec/ex_apprec_rec.c
BitKeeper/deleted/.del-ex_repquote.h~4d3695fe78cc55bf:
Delete: bdb/examples_c/ex_repquote/ex_repquote.h
BitKeeper/deleted/.del-ex_rq_client.c~d7044f23b55b359:
Delete: bdb/examples_c/ex_repquote/ex_rq_client.c
BitKeeper/deleted/.del-ex_rq_main.c~da00595d16b60cf0:
Delete: bdb/examples_c/ex_repquote/ex_rq_main.c
BitKeeper/deleted/.del-ex_rq_master.c~85dbde9ad8245ecb:
Delete: bdb/examples_c/ex_repquote/ex_rq_master.c
BitKeeper/deleted/.del-ex_rq_net.c~a54052285595ec00:
Delete: bdb/examples_c/ex_repquote/ex_rq_net.c
BitKeeper/deleted/.del-ex_rq_util.c~fa9d3ac1141a075c:
Delete: bdb/examples_c/ex_repquote/ex_rq_util.c
BitKeeper/deleted/.del-ex_thread.c~cff8e0283bd52c4c:
Delete: bdb/examples_c/ex_thread.c
BitKeeper/deleted/.del-ex_tpcb.c~438b76c1166f4c05:
Delete: bdb/examples_c/ex_tpcb.c
BitKeeper/deleted/.del-ex_tpcb.h~1f578e0fb4fb78d3:
Delete: bdb/examples_c/ex_tpcb.h
BitKeeper/deleted/.del-AccessExample.cpp~1016122e96eac900:
Delete: bdb/examples_cxx/AccessExample.cpp
BitKeeper/deleted/.del-BtRecExample.cpp~f79114b5ee4d7c99:
Delete: bdb/examples_cxx/BtRecExample.cpp
BitKeeper/deleted/.del-EnvExample.cpp~ef23df0013fbadfb:
Delete: bdb/examples_cxx/EnvExample.cpp
BitKeeper/deleted/.del-LockExample.cpp~7ef6698c1a6364c6:
Delete: bdb/examples_cxx/LockExample.cpp
BitKeeper/deleted/.del-MpoolExample.cpp~45a8c0095f7149a3:
Delete: bdb/examples_cxx/MpoolExample.cpp
BitKeeper/deleted/.del-TpcbExample.cpp~a3fab717eccade1a:
Delete: bdb/examples_cxx/TpcbExample.cpp
BitKeeper/deleted/.del-Db.java.in~e887e6168818e1fe:
Delete: bdb/java/src/com/sleepycat/db/Db.java.in
BitKeeper/deleted/.del-DbAppDispatch.java~b6c6964ddeceb451:
Delete: bdb/java/src/com/sleepycat/db/DbAppDispatch.java
BitKeeper/deleted/.del-DbAppendRecno.java~20e7d8affe21bda4:
Delete: bdb/java/src/com/sleepycat/db/DbAppendRecno.java
BitKeeper/deleted/.del-DbBtreeCompare.java~2def264d9d57c5d4:
Delete: bdb/java/src/com/sleepycat/db/DbBtreeCompare.java
BitKeeper/deleted/.del-DbBtreePrefix.java~781bcc5275fd02a7:
Delete: bdb/java/src/com/sleepycat/db/DbBtreePrefix.java
BitKeeper/deleted/.del-DbClient.java~526df4e74349d6d6:
Delete: bdb/java/src/com/sleepycat/db/DbClient.java
BitKeeper/deleted/.del-DbDeadlockException.java~568c96bffced5abf:
Delete: bdb/java/src/com/sleepycat/db/DbDeadlockException.java
BitKeeper/deleted/.del-DbDupCompare.java~905735b85e180ae2:
Delete: bdb/java/src/com/sleepycat/db/DbDupCompare.java
BitKeeper/deleted/.del-DbEnv.java~79f045af656bde5c:
Delete: bdb/java/src/com/sleepycat/db/DbEnv.java
BitKeeper/deleted/.del-DbEnvFeedback.java~5d68defe7f5b72ac:
Delete: bdb/java/src/com/sleepycat/db/DbEnvFeedback.java
BitKeeper/deleted/.del-DbErrcall.java~ae4f822b75a145a9:
Delete: bdb/java/src/com/sleepycat/db/DbErrcall.java
BitKeeper/deleted/.del-DbException.java~c1ea24cdb4bd795f:
Delete: bdb/java/src/com/sleepycat/db/DbException.java
BitKeeper/deleted/.del-DbFeedback.java~7e7c1fc71f4ceee5:
Delete: bdb/java/src/com/sleepycat/db/DbFeedback.java
BitKeeper/deleted/.del-DbHash.java~658cdd90ec5197b2:
Delete: bdb/java/src/com/sleepycat/db/DbHash.java
BitKeeper/deleted/.del-DbKeyRange.java~28b6b373a22ec489:
Delete: bdb/java/src/com/sleepycat/db/DbKeyRange.java
BitKeeper/deleted/.del-DbLock.java~23eaf3e4a1ccadc1:
Delete: bdb/java/src/com/sleepycat/db/DbLock.java
BitKeeper/deleted/.del-DbLockNotGrantedException.java~4981a6c1878659ec:
Delete: bdb/java/src/com/sleepycat/db/DbLockNotGrantedException.java
BitKeeper/deleted/.del-DbLockRequest.java~b6751a2bbac273de:
Delete: bdb/java/src/com/sleepycat/db/DbLockRequest.java
BitKeeper/deleted/.del-DbLogc.java~cf88740f650599c3:
Delete: bdb/java/src/com/sleepycat/db/DbLogc.java
BitKeeper/deleted/.del-DbLsn.java~813ddabdb6098c13:
Delete: bdb/java/src/com/sleepycat/db/DbLsn.java
BitKeeper/deleted/.del-DbMemoryException.java~459fea825d4835a:
Delete: bdb/java/src/com/sleepycat/db/DbMemoryException.java
BitKeeper/deleted/.del-DbMpoolStat.java~d868c0c27966efd8:
Delete: bdb/java/src/com/sleepycat/db/DbMpoolStat.java
BitKeeper/deleted/.del-DbMultipleDataIterator.java~38348934676e4a64:
Delete: bdb/java/src/com/sleepycat/db/DbMultipleDataIterator.java
BitKeeper/deleted/.del-DbMultipleIterator.java~587d1f79b3783ec0:
Delete: bdb/java/src/com/sleepycat/db/DbMultipleIterator.java
BitKeeper/deleted/.del-DbMultipleKeyDataIterator.java~e8d9948c3bb3b408:
Delete: bdb/java/src/com/sleepycat/db/DbMultipleKeyDataIterator.java
BitKeeper/deleted/.del-DbMultipleRecnoDataIterator.java~7243ef5ba89fbaa0:
Delete: bdb/java/src/com/sleepycat/db/DbMultipleRecnoDataIterator.java
BitKeeper/deleted/.del-DbOutputStreamErrcall.java~7b2c1e221fcaf5a:
Delete: bdb/java/src/com/sleepycat/db/DbOutputStreamErrcall.java
BitKeeper/deleted/.del-DbPreplist.java~520488d9ab8efca8:
Delete: bdb/java/src/com/sleepycat/db/DbPreplist.java
BitKeeper/deleted/.del-DbRepTransport.java~ce17e09c2a29ef96:
Delete: bdb/java/src/com/sleepycat/db/DbRepTransport.java
BitKeeper/deleted/.del-DbRunRecoveryException.java~6c02e5ffd95ec7d:
Delete: bdb/java/src/com/sleepycat/db/DbRunRecoveryException.java
BitKeeper/deleted/.del-DbSecondaryKeyCreate.java~a154ad043120c3:
Delete: bdb/java/src/com/sleepycat/db/DbSecondaryKeyCreate.java
BitKeeper/deleted/.del-DbTxn.java~da61406e8af5d725:
Delete: bdb/java/src/com/sleepycat/db/DbTxn.java
BitKeeper/deleted/.del-DbUtil.java~7c40dfa8a06a1a50:
Delete: bdb/java/src/com/sleepycat/db/DbUtil.java
BitKeeper/deleted/.del-Dbc.java~1cb27c86611ea9b0:
Delete: bdb/java/src/com/sleepycat/db/Dbc.java
BitKeeper/deleted/.del-AccessExample.java~219ec1dab0b67a6c:
Delete: bdb/java/src/com/sleepycat/examples/AccessExample.java
BitKeeper/deleted/.del-BtRecExample.java~642b5d36f9df6088:
Delete: bdb/java/src/com/sleepycat/examples/BtRecExample.java
BitKeeper/deleted/.del-BulkAccessExample.java~293cb1f4c373e0cb:
Delete: bdb/java/src/com/sleepycat/examples/BulkAccessExample.java
BitKeeper/deleted/.del-DbXAResource.java~874c6f2697b602db:
Delete: bdb/java/src/com/sleepycat/db/xa/DbXAResource.java
BitKeeper/deleted/.del-DbXid.java~77ee0f96aa4eb4e:
Delete: bdb/java/src/com/sleepycat/db/xa/DbXid.java
BitKeeper/deleted/.del-Dbt.java~ea175c8ddc0efd2c:
Delete: bdb/java/src/com/sleepycat/db/Dbt.java
BitKeeper/deleted/.del-EnvExample.java~a44d38fba5efa4ef:
Delete: bdb/java/src/com/sleepycat/examples/EnvExample.java
BitKeeper/deleted/.del-LockExample.java~adc9265cb3d68019:
Delete: bdb/java/src/com/sleepycat/examples/LockExample.java
BitKeeper/deleted/.del-TpcbExample.java~5d4818c4e5e7320a:
Delete: bdb/java/src/com/sleepycat/examples/TpcbExample.java
bdb/dist/s_include:
removed 'crypto'
bdb/dist/s_recover:
bdb/ cleanup
bdb/dist/s_symlink:
bdb/ cleanup
Diffstat (limited to 'bdb/java/src')
43 files changed, 0 insertions, 4823 deletions
diff --git a/bdb/java/src/com/sleepycat/db/Db.java.in b/bdb/java/src/com/sleepycat/db/Db.java.in deleted file mode 100644 index df311795f54..00000000000 --- a/bdb/java/src/com/sleepycat/db/Db.java.in +++ /dev/null @@ -1,761 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: Db.java,v 11.110 2002/09/09 20:47:31 bostic Exp $ - */ - -package com.sleepycat.db; - -import java.io.OutputStream; -import java.io.FileNotFoundException; - -/** - * - * @author Donald D. Anderson - */ -public class Db -{ - // BEGIN-JAVA-SPECIAL-CONSTANTS - /* DO NOT EDIT: automatically built by dist/s_java. */ - public static final int DB_BTREE = 1; - public static final int DB_DONOTINDEX = -30999; - public static final int DB_HASH = 2; - public static final int DB_KEYEMPTY = -30998; - public static final int DB_KEYEXIST = -30997; - public static final int DB_LOCK_DEADLOCK = -30996; - public static final int DB_LOCK_NOTGRANTED = -30995; - public static final int DB_NOSERVER = -30994; - public static final int DB_NOSERVER_HOME = -30993; - public static final int DB_NOSERVER_ID = -30992; - public static final int DB_NOTFOUND = -30991; - public static final int DB_OLD_VERSION = -30990; - public static final int DB_PAGE_NOTFOUND = -30989; - public static final int DB_QUEUE = 4; - public static final int DB_RECNO = 3; - public static final int DB_REP_DUPMASTER = -30988; - public static final int DB_REP_HOLDELECTION = -30987; - public static final int DB_REP_NEWMASTER = -30986; - public static final int DB_REP_NEWSITE = -30985; - public static final int DB_REP_OUTDATED = -30984; - public static final int DB_RUNRECOVERY = -30982; - public static final int DB_SECONDARY_BAD = -30981; - public static final int DB_TXN_ABORT = 0; - public static final int DB_TXN_APPLY = 1; - public static final int DB_TXN_BACKWARD_ROLL = 3; - public static final int DB_TXN_FORWARD_ROLL = 4; - public static final int DB_TXN_PRINT = 8; - public static final int DB_UNKNOWN = 5; - public static final int DB_VERIFY_BAD = -30980; - public static final int DB_AFTER; - public static final int DB_AGGRESSIVE; - public static final int DB_APPEND; - public static final int DB_ARCH_ABS; - public static final int DB_ARCH_DATA; - public static final int DB_ARCH_LOG; - public static final int DB_AUTO_COMMIT; - public static final int DB_BEFORE; - public static final int DB_CACHED_COUNTS; - public static final int DB_CDB_ALLDB; - public static final int DB_CHKSUM_SHA1; - public static final int DB_CLIENT; - public static final int DB_CONSUME; - public static final int DB_CONSUME_WAIT; - public static final int DB_CREATE; - public static final int DB_CURRENT; - public static final int DB_CXX_NO_EXCEPTIONS; - public static final int DB_DBT_MALLOC; - public static final int DB_DBT_PARTIAL; - public static final int DB_DBT_REALLOC; - public static final int DB_DBT_USERMEM; - public static final int DB_DIRECT; - public static final int DB_DIRECT_DB; - public static final int DB_DIRECT_LOG; - public static final int DB_DIRTY_READ; - public static final int DB_DUP; - public static final int DB_DUPSORT; - public static final int DB_EID_BROADCAST; - public static final int DB_EID_INVALID; - public static final int DB_ENCRYPT; - public static final int DB_ENCRYPT_AES; - public static final int DB_EXCL; - public static final int DB_FAST_STAT; - public static final int DB_FIRST; - public static final int DB_FLUSH; - public static final int DB_FORCE; - public static final int DB_GET_BOTH; - public static final int DB_GET_BOTH_RANGE; - public static final int DB_GET_RECNO; - public static final int DB_INIT_CDB; - public static final int DB_INIT_LOCK; - public static final int DB_INIT_LOG; - public static final int DB_INIT_MPOOL; - public static final int DB_INIT_TXN; - public static final int DB_JOINENV; - public static final int DB_JOIN_ITEM; - public static final int DB_JOIN_NOSORT; - public static final int DB_KEYFIRST; - public static final int DB_KEYLAST; - public static final int DB_LAST; - public static final int DB_LOCKDOWN; - public static final int DB_LOCK_DEFAULT; - public static final int DB_LOCK_EXPIRE; - public static final int DB_LOCK_GET; - public static final int DB_LOCK_GET_TIMEOUT; - public static final int DB_LOCK_IREAD; - public static final int DB_LOCK_IWR; - public static final int DB_LOCK_IWRITE; - public static final int DB_LOCK_MAXLOCKS; - public static final int DB_LOCK_MINLOCKS; - public static final int DB_LOCK_MINWRITE; - public static final int DB_LOCK_NOWAIT; - public static final int DB_LOCK_OLDEST; - public static final int DB_LOCK_PUT; - public static final int DB_LOCK_PUT_ALL; - public static final int DB_LOCK_PUT_OBJ; - public static final int DB_LOCK_RANDOM; - public static final int DB_LOCK_READ; - public static final int DB_LOCK_TIMEOUT; - public static final int DB_LOCK_WRITE; - public static final int DB_LOCK_YOUNGEST; - public static final int DB_MULTIPLE; - public static final int DB_MULTIPLE_KEY; - public static final int DB_NEXT; - public static final int DB_NEXT_DUP; - public static final int DB_NEXT_NODUP; - public static final int DB_NODUPDATA; - public static final int DB_NOLOCKING; - public static final int DB_NOMMAP; - public static final int DB_NOORDERCHK; - public static final int DB_NOOVERWRITE; - public static final int DB_NOPANIC; - public static final int DB_NOSYNC; - public static final int DB_ODDFILESIZE; - public static final int DB_ORDERCHKONLY; - public static final int DB_OVERWRITE; - public static final int DB_PANIC_ENVIRONMENT; - public static final int DB_POSITION; - public static final int DB_PREV; - public static final int DB_PREV_NODUP; - public static final int DB_PRINTABLE; - public static final int DB_PRIORITY_DEFAULT; - public static final int DB_PRIORITY_HIGH; - public static final int DB_PRIORITY_LOW; - public static final int DB_PRIORITY_VERY_HIGH; - public static final int DB_PRIORITY_VERY_LOW; - public static final int DB_PRIVATE; - public static final int DB_RDONLY; - public static final int DB_RECNUM; - public static final int DB_RECORDCOUNT; - public static final int DB_RECOVER; - public static final int DB_RECOVER_FATAL; - public static final int DB_REGION_INIT; - public static final int DB_RENUMBER; - public static final int DB_REP_CLIENT; - public static final int DB_REP_LOGSONLY; - public static final int DB_REP_MASTER; - public static final int DB_REP_PERMANENT; - public static final int DB_REP_UNAVAIL; - public static final int DB_REVSPLITOFF; - public static final int DB_RMW; - public static final int DB_SALVAGE; - public static final int DB_SET; - public static final int DB_SET_LOCK_TIMEOUT; - public static final int DB_SET_RANGE; - public static final int DB_SET_RECNO; - public static final int DB_SET_TXN_TIMEOUT; - public static final int DB_SNAPSHOT; - public static final int DB_STAT_CLEAR; - public static final int DB_SYSTEM_MEM; - public static final int DB_THREAD; - public static final int DB_TRUNCATE; - public static final int DB_TXN_NOSYNC; - public static final int DB_TXN_NOWAIT; - public static final int DB_TXN_SYNC; - public static final int DB_TXN_WRITE_NOSYNC; - public static final int DB_UPGRADE; - public static final int DB_USE_ENVIRON; - public static final int DB_USE_ENVIRON_ROOT; - public static final int DB_VERB_CHKPOINT; - public static final int DB_VERB_DEADLOCK; - public static final int DB_VERB_RECOVERY; - public static final int DB_VERB_REPLICATION; - public static final int DB_VERB_WAITSFOR; - public static final int DB_VERIFY; - public static final int DB_VERSION_MAJOR; - public static final int DB_VERSION_MINOR; - public static final int DB_VERSION_PATCH; - public static final int DB_WRITECURSOR; - public static final int DB_XA_CREATE; - public static final int DB_XIDDATASIZE; - public static final int DB_YIELDCPU; - // END-JAVA-SPECIAL-CONSTANTS - - // Note: the env can be null - // - public Db(DbEnv env, int flags) - throws DbException - { - constructor_env_ = env; - _init(env, flags); - if (env == null) { - dbenv_ = new DbEnv(this); - } - else { - dbenv_ = env; - } - dbenv_._add_db(this); - } - - // - // Our parent DbEnv is notifying us that the environment is closing. - // - /*package*/ void _notify_dbenv_close() - { - dbenv_ = null; - _notify_internal(); - } - - private native void _init(DbEnv env, int flags) - throws DbException; - - private native void _notify_internal(); - - // methods - // - - public synchronized void associate(DbTxn txn, Db secondary, - DbSecondaryKeyCreate key_creator, - int flags) - throws DbException - { - secondary.secondary_key_create_ = key_creator; - _associate(txn, secondary, key_creator, flags); - } - - public native void _associate(DbTxn txn, Db secondary, - DbSecondaryKeyCreate key_creator, int flags) - throws DbException; - - public synchronized int close(int flags) - throws DbException - { - try { - dbenv_._remove_db(this); - return _close(flags); - } - finally { - if (constructor_env_ == null) { - dbenv_._notify_db_close(); - } - dbenv_ = null; - } - } - - public native int _close(int flags) - throws DbException; - - public native Dbc cursor(DbTxn txnid, int flags) - throws DbException; - - public native int del(DbTxn txnid, Dbt key, int flags) - throws DbException; - - public native void err(int errcode, String message); - - public native void errx(String message); - - public native int fd() - throws DbException; - - // overrides Object.finalize - protected void finalize() - throws Throwable - { - if (dbenv_ == null) - _finalize(null, null); - else - _finalize(dbenv_.errcall_, dbenv_.errpfx_); - } - - protected native void _finalize(DbErrcall errcall, String errpfx) - throws Throwable; - - // returns: 0, DB_NOTFOUND, or throws error - public native int get(DbTxn txnid, Dbt key, Dbt data, int flags) - throws DbException; - - public native boolean get_byteswapped(); - - public native /*DBTYPE*/ int get_type(); - - public native Dbc join(Dbc curslist[], int flags) - throws DbException; - - public native void key_range(DbTxn txnid, Dbt key, - DbKeyRange range, int flags) - throws DbException; - - public synchronized void open(DbTxn txnid, String file, - String database, /*DBTYPE*/ int type, - int flags, int mode) - throws DbException, FileNotFoundException - { - _open(txnid, file, database, type, flags, mode); - } - - // (Internal) - public native void _open(DbTxn txnid, String file, - String database, /*DBTYPE*/ int type, - int flags, int mode) - throws DbException, FileNotFoundException; - - - // returns: 0, DB_NOTFOUND, or throws error - public native int pget(DbTxn txnid, Dbt key, Dbt pkey, Dbt data, int flags) - throws DbException; - - // returns: 0, DB_KEYEXIST, or throws error - public native int put(DbTxn txnid, Dbt key, Dbt data, int flags) - throws DbException; - - public synchronized void rename(String file, String database, - String newname, int flags) - throws DbException, FileNotFoundException - { - try { - _rename(file, database, newname, flags); - } - finally { - if (constructor_env_ == null) { - dbenv_._notify_db_close(); - } - dbenv_ = null; - } - } - - public native void _rename(String file, String database, - String newname, int flags) - throws DbException, FileNotFoundException; - - - public synchronized void remove(String file, - String database, int flags) - throws DbException, FileNotFoundException - { - try { - _remove(file, database, flags); - } - finally { - if (constructor_env_ == null) { - dbenv_._notify_db_close(); - } - dbenv_ = null; - } - } - - public native void _remove(String file, String database, - int flags) - throws DbException, FileNotFoundException; - - // Comparison function. - public void set_append_recno(DbAppendRecno append_recno) - throws DbException - { - append_recno_ = append_recno; - append_recno_changed(append_recno); - } - - // (Internal) - private native void append_recno_changed(DbAppendRecno append_recno) - throws DbException; - - // Comparison function. - public void set_bt_compare(DbBtreeCompare bt_compare) - throws DbException - { - bt_compare_ = bt_compare; - bt_compare_changed(bt_compare); - } - - // (Internal) - private native void bt_compare_changed(DbBtreeCompare bt_compare) - throws DbException; - - // Maximum keys per page. - public native void set_bt_maxkey(int maxkey) - throws DbException; - - // Minimum keys per page. - public native void set_bt_minkey(int minkey) - throws DbException; - - // Prefix function. - public void set_bt_prefix(DbBtreePrefix bt_prefix) - throws DbException - { - bt_prefix_ = bt_prefix; - bt_prefix_changed(bt_prefix); - } - - // (Internal) - private native void bt_prefix_changed(DbBtreePrefix bt_prefix) - throws DbException; - - // Set cache size - public native void set_cachesize(int gbytes, int bytes, int ncaches) - throws DbException; - - // Set cache priority - public native void set_cache_priority(/* DB_CACHE_PRIORITY */ int priority) - throws DbException; - - // Duplication resolution - public void set_dup_compare(DbDupCompare dup_compare) - throws DbException - { - dup_compare_ = dup_compare; - dup_compare_changed(dup_compare); - } - - // (Internal) - private native void dup_compare_changed(DbDupCompare dup_compare) - throws DbException; - - // Encryption - public native void set_encrypt(String passwd, /*u_int32_t*/ int flags) - throws DbException; - - // Error message callback. - public void set_errcall(DbErrcall errcall) - { - if (dbenv_ != null) - dbenv_.set_errcall(errcall); - } - - // Error stream. - public void set_error_stream(OutputStream s) - { - DbOutputStreamErrcall errcall = new DbOutputStreamErrcall(s); - set_errcall(errcall); - } - - // Error message prefix. - public void set_errpfx(String errpfx) - { - if (dbenv_ != null) - dbenv_.set_errpfx(errpfx); - } - - - // Feedback - public void set_feedback(DbFeedback feedback) - throws DbException - { - feedback_ = feedback; - feedback_changed(feedback); - } - - // (Internal) - private native void feedback_changed(DbFeedback feedback) - throws DbException; - - // Flags. - public native void set_flags(/*u_int32_t*/ int flags) - throws DbException; - - // Internal - only intended for testing purposes in the Java RPC server - public native int get_flags_raw() - throws DbException; - - // Fill factor. - public native void set_h_ffactor(/*unsigned*/ int h_ffactor) - throws DbException; - - // Hash function. - public void set_h_hash(DbHash h_hash) - throws DbException - { - h_hash_ = h_hash; - hash_changed(h_hash); - } - - // (Internal) - private native void hash_changed(DbHash hash) - throws DbException; - - // Number of elements. - public native void set_h_nelem(/*unsigned*/ int h_nelem) - throws DbException; - - // Byte order. - public native void set_lorder(int lorder) - throws DbException; - - // Underlying page size. - public native void set_pagesize(/*size_t*/ long pagesize) - throws DbException; - - // Variable-length delimiting byte. - public native void set_re_delim(int re_delim) - throws DbException; - - // Length for fixed-length records. - public native void set_re_len(/*u_int32_t*/ int re_len) - throws DbException; - - // Fixed-length padding byte. - public native void set_re_pad(int re_pad) - throws DbException; - - // Source file name. - public native void set_re_source(String re_source) - throws DbException; - - // Extent size of Queue - public native void set_q_extentsize(/*u_int32_t*/ int extent_size) - throws DbException; - - // returns a DbBtreeStat or DbHashStat - public native Object stat(int flags) - throws DbException; - - public native void sync(int flags) - throws DbException; - - public native int truncate(DbTxn txnid, int flags) - throws DbException; - - public native void upgrade(String name, int flags) - throws DbException; - - public native void verify(String name, String subdb, - OutputStream outstr, int flags) - throws DbException; - - //////////////////////////////////////////////////////////////// - // - // private data - // - private long private_dbobj_ = 0; - private long private_info_ = 0; - private DbEnv dbenv_ = null; - private DbEnv constructor_env_ = null; - private DbFeedback feedback_ = null; - private DbAppendRecno append_recno_ = null; - private DbBtreeCompare bt_compare_ = null; - private DbBtreePrefix bt_prefix_ = null; - private DbDupCompare dup_compare_ = null; - private DbHash h_hash_ = null; - private DbSecondaryKeyCreate secondary_key_create_ = null; - - //////////////////////////////////////////////////////////////// - // - // static methods and data that implement - // loading the native library and doing any - // extra sanity checks on startup. - // - private static boolean already_loaded_ = false; - - public static void load_db() - { - if (already_loaded_) - return; - - // An alternate library name can be specified via a property. - // - String override; - - if ((override = System.getProperty("sleepycat.db.libfile")) != null) { - System.load(override); - } - else if ((override = System.getProperty("sleepycat.db.libname")) != null) { - System.loadLibrary(override); - } - else { - String os = System.getProperty("os.name"); - if (os != null && os.startsWith("Windows")) { - // library name is "libdb_java30.dll" (for example) on Win/* - System.loadLibrary("libdb_java" + - DbConstants.DB_VERSION_MAJOR + - DbConstants.DB_VERSION_MINOR); - } - else { - // library name is "libdb_java-3.0.so" (for example) on UNIX - // Note: "db_java" isn't good enough; - // some Unixes require us to use the explicit SONAME. - System.loadLibrary("db_java-" + - DbConstants.DB_VERSION_MAJOR + "." + - DbConstants.DB_VERSION_MINOR); - } - } - - already_loaded_ = true; - } - - static private native void one_time_init(); - - static private void check_constant(int c1, int c2) - { - if (c1 != c2) { - System.err.println("Db: constant mismatch"); - Thread.dumpStack(); - System.exit(1); - } - } - - static { - Db.load_db(); - - // BEGIN-JAVA-CONSTANT-INITIALIZATION - /* DO NOT EDIT: automatically built by dist/s_java. */ - DB_AFTER = DbConstants.DB_AFTER; - DB_AGGRESSIVE = DbConstants.DB_AGGRESSIVE; - DB_APPEND = DbConstants.DB_APPEND; - DB_ARCH_ABS = DbConstants.DB_ARCH_ABS; - DB_ARCH_DATA = DbConstants.DB_ARCH_DATA; - DB_ARCH_LOG = DbConstants.DB_ARCH_LOG; - DB_AUTO_COMMIT = DbConstants.DB_AUTO_COMMIT; - DB_BEFORE = DbConstants.DB_BEFORE; - DB_CACHED_COUNTS = DbConstants.DB_CACHED_COUNTS; - DB_CDB_ALLDB = DbConstants.DB_CDB_ALLDB; - DB_CHKSUM_SHA1 = DbConstants.DB_CHKSUM_SHA1; - DB_CLIENT = DbConstants.DB_CLIENT; - DB_CONSUME = DbConstants.DB_CONSUME; - DB_CONSUME_WAIT = DbConstants.DB_CONSUME_WAIT; - DB_CREATE = DbConstants.DB_CREATE; - DB_CURRENT = DbConstants.DB_CURRENT; - DB_CXX_NO_EXCEPTIONS = DbConstants.DB_CXX_NO_EXCEPTIONS; - DB_DBT_MALLOC = DbConstants.DB_DBT_MALLOC; - DB_DBT_PARTIAL = DbConstants.DB_DBT_PARTIAL; - DB_DBT_REALLOC = DbConstants.DB_DBT_REALLOC; - DB_DBT_USERMEM = DbConstants.DB_DBT_USERMEM; - DB_DIRECT = DbConstants.DB_DIRECT; - DB_DIRECT_DB = DbConstants.DB_DIRECT_DB; - DB_DIRECT_LOG = DbConstants.DB_DIRECT_LOG; - DB_DIRTY_READ = DbConstants.DB_DIRTY_READ; - DB_DUP = DbConstants.DB_DUP; - DB_DUPSORT = DbConstants.DB_DUPSORT; - DB_EID_BROADCAST = DbConstants.DB_EID_BROADCAST; - DB_EID_INVALID = DbConstants.DB_EID_INVALID; - DB_ENCRYPT = DbConstants.DB_ENCRYPT; - DB_ENCRYPT_AES = DbConstants.DB_ENCRYPT_AES; - DB_EXCL = DbConstants.DB_EXCL; - DB_FAST_STAT = DbConstants.DB_FAST_STAT; - DB_FIRST = DbConstants.DB_FIRST; - DB_FLUSH = DbConstants.DB_FLUSH; - DB_FORCE = DbConstants.DB_FORCE; - DB_GET_BOTH = DbConstants.DB_GET_BOTH; - DB_GET_BOTH_RANGE = DbConstants.DB_GET_BOTH_RANGE; - DB_GET_RECNO = DbConstants.DB_GET_RECNO; - DB_INIT_CDB = DbConstants.DB_INIT_CDB; - DB_INIT_LOCK = DbConstants.DB_INIT_LOCK; - DB_INIT_LOG = DbConstants.DB_INIT_LOG; - DB_INIT_MPOOL = DbConstants.DB_INIT_MPOOL; - DB_INIT_TXN = DbConstants.DB_INIT_TXN; - DB_JOINENV = DbConstants.DB_JOINENV; - DB_JOIN_ITEM = DbConstants.DB_JOIN_ITEM; - DB_JOIN_NOSORT = DbConstants.DB_JOIN_NOSORT; - DB_KEYFIRST = DbConstants.DB_KEYFIRST; - DB_KEYLAST = DbConstants.DB_KEYLAST; - DB_LAST = DbConstants.DB_LAST; - DB_LOCKDOWN = DbConstants.DB_LOCKDOWN; - DB_LOCK_DEFAULT = DbConstants.DB_LOCK_DEFAULT; - DB_LOCK_EXPIRE = DbConstants.DB_LOCK_EXPIRE; - DB_LOCK_GET = DbConstants.DB_LOCK_GET; - DB_LOCK_GET_TIMEOUT = DbConstants.DB_LOCK_GET_TIMEOUT; - DB_LOCK_IREAD = DbConstants.DB_LOCK_IREAD; - DB_LOCK_IWR = DbConstants.DB_LOCK_IWR; - DB_LOCK_IWRITE = DbConstants.DB_LOCK_IWRITE; - DB_LOCK_MAXLOCKS = DbConstants.DB_LOCK_MAXLOCKS; - DB_LOCK_MINLOCKS = DbConstants.DB_LOCK_MINLOCKS; - DB_LOCK_MINWRITE = DbConstants.DB_LOCK_MINWRITE; - DB_LOCK_NOWAIT = DbConstants.DB_LOCK_NOWAIT; - DB_LOCK_OLDEST = DbConstants.DB_LOCK_OLDEST; - DB_LOCK_PUT = DbConstants.DB_LOCK_PUT; - DB_LOCK_PUT_ALL = DbConstants.DB_LOCK_PUT_ALL; - DB_LOCK_PUT_OBJ = DbConstants.DB_LOCK_PUT_OBJ; - DB_LOCK_RANDOM = DbConstants.DB_LOCK_RANDOM; - DB_LOCK_READ = DbConstants.DB_LOCK_READ; - DB_LOCK_TIMEOUT = DbConstants.DB_LOCK_TIMEOUT; - DB_LOCK_WRITE = DbConstants.DB_LOCK_WRITE; - DB_LOCK_YOUNGEST = DbConstants.DB_LOCK_YOUNGEST; - DB_MULTIPLE = DbConstants.DB_MULTIPLE; - DB_MULTIPLE_KEY = DbConstants.DB_MULTIPLE_KEY; - DB_NEXT = DbConstants.DB_NEXT; - DB_NEXT_DUP = DbConstants.DB_NEXT_DUP; - DB_NEXT_NODUP = DbConstants.DB_NEXT_NODUP; - DB_NODUPDATA = DbConstants.DB_NODUPDATA; - DB_NOLOCKING = DbConstants.DB_NOLOCKING; - DB_NOMMAP = DbConstants.DB_NOMMAP; - DB_NOORDERCHK = DbConstants.DB_NOORDERCHK; - DB_NOOVERWRITE = DbConstants.DB_NOOVERWRITE; - DB_NOPANIC = DbConstants.DB_NOPANIC; - DB_NOSYNC = DbConstants.DB_NOSYNC; - DB_ODDFILESIZE = DbConstants.DB_ODDFILESIZE; - DB_ORDERCHKONLY = DbConstants.DB_ORDERCHKONLY; - DB_OVERWRITE = DbConstants.DB_OVERWRITE; - DB_PANIC_ENVIRONMENT = DbConstants.DB_PANIC_ENVIRONMENT; - DB_POSITION = DbConstants.DB_POSITION; - DB_PREV = DbConstants.DB_PREV; - DB_PREV_NODUP = DbConstants.DB_PREV_NODUP; - DB_PRINTABLE = DbConstants.DB_PRINTABLE; - DB_PRIORITY_DEFAULT = DbConstants.DB_PRIORITY_DEFAULT; - DB_PRIORITY_HIGH = DbConstants.DB_PRIORITY_HIGH; - DB_PRIORITY_LOW = DbConstants.DB_PRIORITY_LOW; - DB_PRIORITY_VERY_HIGH = DbConstants.DB_PRIORITY_VERY_HIGH; - DB_PRIORITY_VERY_LOW = DbConstants.DB_PRIORITY_VERY_LOW; - DB_PRIVATE = DbConstants.DB_PRIVATE; - DB_RDONLY = DbConstants.DB_RDONLY; - DB_RECNUM = DbConstants.DB_RECNUM; - DB_RECORDCOUNT = DbConstants.DB_RECORDCOUNT; - DB_RECOVER = DbConstants.DB_RECOVER; - DB_RECOVER_FATAL = DbConstants.DB_RECOVER_FATAL; - DB_REGION_INIT = DbConstants.DB_REGION_INIT; - DB_RENUMBER = DbConstants.DB_RENUMBER; - DB_REP_CLIENT = DbConstants.DB_REP_CLIENT; - DB_REP_LOGSONLY = DbConstants.DB_REP_LOGSONLY; - DB_REP_MASTER = DbConstants.DB_REP_MASTER; - DB_REP_PERMANENT = DbConstants.DB_REP_PERMANENT; - DB_REP_UNAVAIL = DbConstants.DB_REP_UNAVAIL; - DB_REVSPLITOFF = DbConstants.DB_REVSPLITOFF; - DB_RMW = DbConstants.DB_RMW; - DB_SALVAGE = DbConstants.DB_SALVAGE; - DB_SET = DbConstants.DB_SET; - DB_SET_LOCK_TIMEOUT = DbConstants.DB_SET_LOCK_TIMEOUT; - DB_SET_RANGE = DbConstants.DB_SET_RANGE; - DB_SET_RECNO = DbConstants.DB_SET_RECNO; - DB_SET_TXN_TIMEOUT = DbConstants.DB_SET_TXN_TIMEOUT; - DB_SNAPSHOT = DbConstants.DB_SNAPSHOT; - DB_STAT_CLEAR = DbConstants.DB_STAT_CLEAR; - DB_SYSTEM_MEM = DbConstants.DB_SYSTEM_MEM; - DB_THREAD = DbConstants.DB_THREAD; - DB_TRUNCATE = DbConstants.DB_TRUNCATE; - DB_TXN_NOSYNC = DbConstants.DB_TXN_NOSYNC; - DB_TXN_NOWAIT = DbConstants.DB_TXN_NOWAIT; - DB_TXN_SYNC = DbConstants.DB_TXN_SYNC; - DB_TXN_WRITE_NOSYNC = DbConstants.DB_TXN_WRITE_NOSYNC; - DB_UPGRADE = DbConstants.DB_UPGRADE; - DB_USE_ENVIRON = DbConstants.DB_USE_ENVIRON; - DB_USE_ENVIRON_ROOT = DbConstants.DB_USE_ENVIRON_ROOT; - DB_VERB_CHKPOINT = DbConstants.DB_VERB_CHKPOINT; - DB_VERB_DEADLOCK = DbConstants.DB_VERB_DEADLOCK; - DB_VERB_RECOVERY = DbConstants.DB_VERB_RECOVERY; - DB_VERB_REPLICATION = DbConstants.DB_VERB_REPLICATION; - DB_VERB_WAITSFOR = DbConstants.DB_VERB_WAITSFOR; - DB_VERIFY = DbConstants.DB_VERIFY; - DB_VERSION_MAJOR = DbConstants.DB_VERSION_MAJOR; - DB_VERSION_MINOR = DbConstants.DB_VERSION_MINOR; - DB_VERSION_PATCH = DbConstants.DB_VERSION_PATCH; - DB_WRITECURSOR = DbConstants.DB_WRITECURSOR; - DB_XA_CREATE = DbConstants.DB_XA_CREATE; - DB_XIDDATASIZE = DbConstants.DB_XIDDATASIZE; - DB_YIELDCPU = DbConstants.DB_YIELDCPU; - // END-JAVA-CONSTANT-INITIALIZATION - - one_time_init(); - } -} -// end of Db.java diff --git a/bdb/java/src/com/sleepycat/db/DbAppDispatch.java b/bdb/java/src/com/sleepycat/db/DbAppDispatch.java deleted file mode 100644 index de72771f3e9..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbAppDispatch.java +++ /dev/null @@ -1,22 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2000-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbAppDispatch.java,v 11.6 2002/02/26 16:23:02 krinsky Exp $ - */ - -package com.sleepycat.db; - -/* - * This interface is used by DbEnv.set_app_dispatch() - * - */ -public interface DbAppDispatch -{ - // The value of recops is one of the Db.DB_TXN_* constants - public abstract int app_dispatch(DbEnv env, Dbt dbt, DbLsn lsn, int recops); -} - -// end of DbAppDispatch.java diff --git a/bdb/java/src/com/sleepycat/db/DbAppendRecno.java b/bdb/java/src/com/sleepycat/db/DbAppendRecno.java deleted file mode 100644 index c9d205ec74d..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbAppendRecno.java +++ /dev/null @@ -1,22 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2000-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbAppendRecno.java,v 11.5 2002/01/11 15:52:33 bostic Exp $ - */ - -package com.sleepycat.db; - -/* - * This interface is used by Db.set_append_recno() - * - */ -public interface DbAppendRecno -{ - public abstract void db_append_recno(Db db, Dbt data, int recno) - throws DbException; -} - -// end of DbAppendRecno.java diff --git a/bdb/java/src/com/sleepycat/db/DbBtreeCompare.java b/bdb/java/src/com/sleepycat/db/DbBtreeCompare.java deleted file mode 100644 index d738998cfb5..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbBtreeCompare.java +++ /dev/null @@ -1,21 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2000-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbBtreeCompare.java,v 11.6 2002/01/11 15:52:33 bostic Exp $ - */ - -package com.sleepycat.db; - -/* - * This interface is used by DbEnv.set_bt_compare() - * - */ -public interface DbBtreeCompare -{ - public abstract int bt_compare(Db db, Dbt dbt1, Dbt dbt2); -} - -// end of DbBtreeCompare.java diff --git a/bdb/java/src/com/sleepycat/db/DbBtreePrefix.java b/bdb/java/src/com/sleepycat/db/DbBtreePrefix.java deleted file mode 100644 index 4f18d8feb11..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbBtreePrefix.java +++ /dev/null @@ -1,21 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2000-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbBtreePrefix.java,v 11.6 2002/01/11 15:52:33 bostic Exp $ - */ - -package com.sleepycat.db; - -/* - * This interface is used by DbEnv.set_bt_prefix() - * - */ -public interface DbBtreePrefix -{ - public abstract int bt_prefix(Db db, Dbt dbt1, Dbt dbt2); -} - -// end of DbBtreePrefix.java diff --git a/bdb/java/src/com/sleepycat/db/DbClient.java b/bdb/java/src/com/sleepycat/db/DbClient.java deleted file mode 100644 index 3b9b349c841..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbClient.java +++ /dev/null @@ -1,21 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2000-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbClient.java,v 11.4 2002/01/11 15:52:33 bostic Exp $ - */ - -package com.sleepycat.db; - -/* - * This interface is used by DbEnv.set_rpc_server(). - * It is a placeholder for a future capability. - * - */ -public interface DbClient -{ -} - -// end of DbClient.java diff --git a/bdb/java/src/com/sleepycat/db/DbDeadlockException.java b/bdb/java/src/com/sleepycat/db/DbDeadlockException.java deleted file mode 100644 index 2540e22a782..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbDeadlockException.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1999-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbDeadlockException.java,v 11.6 2002/01/11 15:52:33 bostic Exp $ - */ - -package com.sleepycat.db; - -public class DbDeadlockException extends DbException -{ - // methods - // - - public DbDeadlockException(String s) - { - super(s); - } - - public DbDeadlockException(String s, int errno) - { - super(s, errno); - } -} - -// end of DbDeadlockException.java diff --git a/bdb/java/src/com/sleepycat/db/DbDupCompare.java b/bdb/java/src/com/sleepycat/db/DbDupCompare.java deleted file mode 100644 index b014c76594c..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbDupCompare.java +++ /dev/null @@ -1,21 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2000-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbDupCompare.java,v 11.6 2002/01/11 15:52:34 bostic Exp $ - */ - -package com.sleepycat.db; - -/* - * This interface is used by DbEnv.set_dup_compare() - * - */ -public interface DbDupCompare -{ - public abstract int dup_compare(Db db, Dbt dbt1, Dbt dbt2); -} - -// end of DbDupCompare.java diff --git a/bdb/java/src/com/sleepycat/db/DbEnv.java b/bdb/java/src/com/sleepycat/db/DbEnv.java deleted file mode 100644 index f5a2e25f61b..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbEnv.java +++ /dev/null @@ -1,430 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbEnv.java,v 11.58 2002/08/29 14:22:22 margo Exp $ - */ - -package com.sleepycat.db; - -import java.io.OutputStream; -import java.io.FileNotFoundException; -import java.util.Date; -import java.util.Enumeration; -import java.util.Vector; - -/** - * - * @author Donald D. Anderson - */ -public class DbEnv -{ - // methods - // - - // - // After using this constructor, set any parameters via - // the set_* access methods below, and finally open - // the environment by calling open(). - // - public DbEnv(int flags) throws DbException - { - constructor_flags_ = flags; - _init(errstream_, constructor_flags_); - } - - // - // This constructor is purposely not public. - // It is used internally to create a DbEnv wrapper - // when an underlying environment already exists. - // - /*package*/ DbEnv(Db db) - { - _init_using_db(errstream_, db); - } - - // - // When a Db is created, it is kept in a private list, - // so that Db's can be notified when the environment - // is closed. This allows us to detect and guard - // against the following situation: - // DbEnv env = new DbEnv(0); - // Db db = new Db(0); - // env.close(); - // db.close(); - // - // This *is* a programming error, but not protecting - // against it will crash the VM. - // - /*package*/ void _add_db(Db db) - { - dblist_.addElement(db); - } - - // - // Remove from the private list of Db's. - // - /*package*/ void _remove_db(Db db) - { - dblist_.removeElement(db); - } - - // - // Iterate all the Db's in the list, and - // notify them that the environment is closing, - // so they can clean up. - // - /*package*/ void _notify_dbs() - { - Enumeration enum = dblist_.elements(); - while (enum.hasMoreElements()) { - Db db = (Db)enum.nextElement(); - db._notify_dbenv_close(); - } - dblist_.removeAllElements(); - } - - // close discards any internal memory. - // After using close, the DbEnv can be reopened. - // - public synchronized void close(int flags) - throws DbException - { - _notify_dbs(); - _close(flags); - } - - // (Internal) - private native void _close(int flags) - throws DbException; - - public native void dbremove(DbTxn txn, String name, String subdb, - int flags) - throws DbException; - - public native void dbrename(DbTxn txn, String name, String subdb, - String newname, int flags) - throws DbException; - - public native void err(int errcode, String message); - - public native void errx(String message); - - // overrides Object.finalize - protected void finalize() - throws Throwable - { - _notify_dbs(); - _finalize(errcall_, errpfx_); - } - - // (Internal) - protected native void _finalize(DbErrcall errcall, String errpfx) - throws Throwable; - - // (Internal) - // called during constructor - private native void _init(DbErrcall errcall, int flags) throws DbException; - - // (Internal) - // called when DbEnv is constructed as part of Db constructor. - private native void _init_using_db(DbErrcall errcall, Db db); - - /*package*/ native void _notify_db_close(); - - public native void open(String db_home, int flags, int mode) - throws DbException, FileNotFoundException; - - // remove removes any files and discards any internal memory. - // (i.e. implicitly it does a close, if the environment is open). - // After using close, the DbEnv can no longer be used; - // create another one if needed. - // - public native synchronized void remove(String db_home, int flags) - throws DbException, FileNotFoundException; - - //////////////////////////////////////////////////////////////// - // simple get/set access methods - // - // If you are calling set_ methods, you need to - // use the constructor with one argument along with open(). - - public native void set_cachesize(int gbytes, int bytes, int ncaches) - throws DbException; - - // Encryption - public native void set_encrypt(String passwd, /*u_int32_t*/ int flags) - throws DbException; - - // Error message callback. - public void set_errcall(DbErrcall errcall) - { - errcall_ = errcall; - _set_errcall(errcall); - } - - public native void _set_errcall(DbErrcall errcall); - - // Error stream. - public void set_error_stream(OutputStream s) - { - DbOutputStreamErrcall errcall = new DbOutputStreamErrcall(s); - set_errcall(errcall); - } - - // Error message prefix. - public void set_errpfx(String errpfx) - { - errpfx_ = errpfx; - _set_errpfx(errpfx); - } - - private native void _set_errpfx(String errpfx); - - // Feedback - public void set_feedback(DbEnvFeedback feedback) - throws DbException - { - feedback_ = feedback; - feedback_changed(feedback); - } - - // (Internal) - private native void feedback_changed(DbEnvFeedback feedback) - throws DbException; - - // Generate debugging messages. - public native void set_verbose(int which, boolean onoff) - throws DbException; - - public native void set_data_dir(String data_dir) - throws DbException; - - // Log buffer size. - public native void set_lg_bsize(/*u_int32_t*/ int lg_bsize) - throws DbException; - - // Log directory. - public native void set_lg_dir(String lg_dir) - throws DbException; - - // Maximum log file size. - public native void set_lg_max(/*u_int32_t*/ int lg_max) - throws DbException; - - // Log region size. - public native void set_lg_regionmax(/*u_int32_t*/ int lg_regionmax) - throws DbException; - - // Two dimensional conflict matrix. - public native void set_lk_conflicts(byte[][] lk_conflicts) - throws DbException; - - // Deadlock detect on every conflict. - public native void set_lk_detect(/*u_int32_t*/ int lk_detect) - throws DbException; - - /** - * @deprecated DB 3.2.6, see the online documentation. - */ - // Maximum number of locks. - public native void set_lk_max(/*unsigned*/ int lk_max) - throws DbException; - - // Maximum number of lockers. - public native void set_lk_max_lockers(/*unsigned*/ int lk_max_lockers) - throws DbException; - - // Maximum number of locks. - public native void set_lk_max_locks(/*unsigned*/ int lk_max_locks) - throws DbException; - - // Maximum number of locked objects. - public native void set_lk_max_objects(/*unsigned*/ int lk_max_objects) - throws DbException; - - // Maximum file size for mmap. - public native void set_mp_mmapsize(/*size_t*/ long mmapsize) - throws DbException; - - public native void set_flags(int flags, boolean onoff) - throws DbException; - - public native void set_rep_limit(int gbytes, int bytes) throws DbException; - - public void set_rep_transport(int envid, DbRepTransport transport) - throws DbException - { - rep_transport_ = transport; - rep_transport_changed(envid, transport); - } - - // (Internal) - private native void rep_transport_changed(int envid, - DbRepTransport transport) - throws DbException; - - public native void set_rpc_server(DbClient client, String host, - long cl_timeout, long sv_timeout, - int flags) - throws DbException; - - public native void set_shm_key(long shm_key) - throws DbException; - - public native void set_tas_spins(int tas_spins) - throws DbException; - - public native void set_timeout(/*db_timeout_t*/ long timeout, - /*u_int32_t*/ int flags) - throws DbException; - - public native void set_tmp_dir(String tmp_dir) - throws DbException; - - // Feedback - public void set_app_dispatch(DbAppDispatch app_dispatch) - throws DbException - { - app_dispatch_ = app_dispatch; - app_dispatch_changed(app_dispatch); - } - - // (Internal) - private native void app_dispatch_changed(DbAppDispatch app_dispatch) - throws DbException; - - // Maximum number of transactions. - public native void set_tx_max(/*unsigned*/ int tx_max) - throws DbException; - - // Note: only the seconds (not milliseconds) of the timestamp - // are used in this API. - public void set_tx_timestamp(Date timestamp) - throws DbException - { - _set_tx_timestamp(timestamp.getTime()/1000); - } - - // (Internal) - private native void _set_tx_timestamp(long seconds) - throws DbException; - - // Versioning information - public native static int get_version_major(); - public native static int get_version_minor(); - public native static int get_version_patch(); - public native static String get_version_string(); - - // Convert DB error codes to strings - public native static String strerror(int errcode); - - public native int lock_detect(int flags, int atype) - throws DbException; - - public native DbLock lock_get(/*u_int32_t*/ int locker, - int flags, - Dbt obj, - /*db_lockmode_t*/ int lock_mode) - throws DbException; - - public native void lock_put(DbLock lock) - throws DbException; - - public native /*u_int32_t*/ int lock_id() - throws DbException; - - public native void lock_id_free(/*u_int32_t*/ int id) - throws DbException; - - public native DbLockStat lock_stat(/*u_int32_t*/ int flags) - throws DbException; - - public native void lock_vec(/*u_int32_t*/ int locker, - int flags, - DbLockRequest[] list, - int offset, - int count) - throws DbException; - - public native String[] log_archive(int flags) - throws DbException; - - public native static int log_compare(DbLsn lsn0, DbLsn lsn1); - - public native DbLogc log_cursor(int flags) - throws DbException; - - public native String log_file(DbLsn lsn) - throws DbException; - - public native void log_flush(DbLsn lsn) - throws DbException; - - public native void log_put(DbLsn lsn, Dbt data, int flags) - throws DbException; - - public native DbLogStat log_stat(/*u_int32_t*/ int flags) - throws DbException; - - public native DbMpoolStat memp_stat(/*u_int32_t*/ int flags) - throws DbException; - - public native DbMpoolFStat[] memp_fstat(/*u_int32_t*/ int flags) - throws DbException; - - public native int memp_trickle(int pct) - throws DbException; - - public native int rep_elect(int nsites, int pri, int timeout) - throws DbException; - - public static class RepProcessMessage { - public int envid; - } - public native int rep_process_message(Dbt control, Dbt rec, - RepProcessMessage result) - throws DbException; - - public native void rep_start(Dbt cookie, int flags) - throws DbException; - - public native DbRepStat rep_stat(/*u_int32_t*/ int flags) - throws DbException; - - public native DbTxn txn_begin(DbTxn pid, int flags) - throws DbException; - - public native void txn_checkpoint(int kbyte, int min, int flags) - throws DbException; - - public native DbPreplist[] txn_recover(int count, int flags) - throws DbException; - - public native DbTxnStat txn_stat(/*u_int32_t*/ int flags) - throws DbException; - - //////////////////////////////////////////////////////////////// - // - // private data - // - private long private_dbobj_ = 0; - private long private_info_ = 0; - private int constructor_flags_ = 0; - private Vector dblist_ = new Vector(); // Db's that are open - private DbEnvFeedback feedback_ = null; - private DbRepTransport rep_transport_ = null; - private DbAppDispatch app_dispatch_ = null; - private DbOutputStreamErrcall errstream_ = - new DbOutputStreamErrcall(System.err); - /*package*/ DbErrcall errcall_ = errstream_; - /*package*/ String errpfx_; - - static { - Db.load_db(); - } -} - -// end of DbEnv.java diff --git a/bdb/java/src/com/sleepycat/db/DbEnvFeedback.java b/bdb/java/src/com/sleepycat/db/DbEnvFeedback.java deleted file mode 100644 index feef750f186..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbEnvFeedback.java +++ /dev/null @@ -1,19 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1999-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbEnvFeedback.java,v 11.6 2002/01/11 15:52:34 bostic Exp $ - */ - -package com.sleepycat.db; - -public interface DbEnvFeedback -{ - // methods - // - public abstract void feedback(DbEnv env, int opcode, int pct); -} - -// end of DbFeedback.java diff --git a/bdb/java/src/com/sleepycat/db/DbErrcall.java b/bdb/java/src/com/sleepycat/db/DbErrcall.java deleted file mode 100644 index 4db12772ccd..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbErrcall.java +++ /dev/null @@ -1,23 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbErrcall.java,v 11.6 2002/01/11 15:52:35 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author Donald D. Anderson - */ -public interface DbErrcall -{ - // methods - // - public abstract void errcall(String prefix, String buffer); -} - -// end of DbErrcall.java diff --git a/bdb/java/src/com/sleepycat/db/DbException.java b/bdb/java/src/com/sleepycat/db/DbException.java deleted file mode 100644 index 132ea868f14..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbException.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbException.java,v 11.7 2002/01/11 15:52:35 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author Donald D. Anderson - */ -public class DbException extends Exception -{ - // methods - // - - public DbException(String s) - { - super(s); - } - - public DbException(String s, int errno) - { - super(s); - this.errno_ = errno; - } - - public String toString() - { - String s = super.toString(); - if (errno_ == 0) - return s; - else - return s + ": " + DbEnv.strerror(errno_); - - } - - // get/set methods - // - - public int get_errno() - { - return errno_; - } - - // private data - // - - private int errno_ = 0; -} - -// end of DbException.java diff --git a/bdb/java/src/com/sleepycat/db/DbFeedback.java b/bdb/java/src/com/sleepycat/db/DbFeedback.java deleted file mode 100644 index 38d7346e03e..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbFeedback.java +++ /dev/null @@ -1,23 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbFeedback.java,v 11.7 2002/01/11 15:52:35 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author Donald D. Anderson - */ -public interface DbFeedback -{ - // methods - // - public abstract void feedback(Db db, int opcode, int pct); -} - -// end of DbFeedback.java diff --git a/bdb/java/src/com/sleepycat/db/DbHash.java b/bdb/java/src/com/sleepycat/db/DbHash.java deleted file mode 100644 index 22781a11929..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbHash.java +++ /dev/null @@ -1,21 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2000-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbHash.java,v 11.5 2002/01/11 15:52:36 bostic Exp $ - */ - -package com.sleepycat.db; - -/* - * This interface is used by DbEnv.set_bt_compare() - * - */ -public interface DbHash -{ - public abstract int hash(Db db, byte[] data, int len); -} - -// end of DbHash.java diff --git a/bdb/java/src/com/sleepycat/db/DbKeyRange.java b/bdb/java/src/com/sleepycat/db/DbKeyRange.java deleted file mode 100644 index aa5dc16eeda..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbKeyRange.java +++ /dev/null @@ -1,23 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbKeyRange.java,v 1.4 2002/01/11 15:52:36 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author Donald D. Anderson - */ -public class DbKeyRange -{ - public double less; - public double equal; - public double greater; -} - -// end of DbKeyRange.java diff --git a/bdb/java/src/com/sleepycat/db/DbLock.java b/bdb/java/src/com/sleepycat/db/DbLock.java deleted file mode 100644 index ee021a856b8..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbLock.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbLock.java,v 11.8 2002/01/11 15:52:36 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author Donald D. Anderson - */ -public class DbLock -{ - protected native void finalize() - throws Throwable; - - // get/set methods - // - - // private data - // - private long private_dbobj_ = 0; - - static { - Db.load_db(); - } -} - -// end of DbLock.java diff --git a/bdb/java/src/com/sleepycat/db/DbLockNotGrantedException.java b/bdb/java/src/com/sleepycat/db/DbLockNotGrantedException.java deleted file mode 100644 index 0fa434c72ee..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbLockNotGrantedException.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbLockNotGrantedException.java,v 11.3 2002/01/11 15:52:36 bostic Exp $ - */ - -package com.sleepycat.db; - -public class DbLockNotGrantedException extends DbException { - public DbLockNotGrantedException(String message, - int op, int mode, Dbt obj, - DbLock lock, int index) - { - super(message, Db.DB_LOCK_NOTGRANTED); - this.op = op; - this.mode = mode; - this.obj = obj; - this.lock = lock; - this.index = index; - } - - public int get_op() - { - return op; - } - - public int get_mode() - { - return mode; - } - - public Dbt get_obj() - { - return obj; - } - - public DbLock get_lock() - { - return lock; - } - - public int get_index() - { - return index; - } - - private int op; - private int mode; - private Dbt obj; - private DbLock lock; - private int index; - -} - diff --git a/bdb/java/src/com/sleepycat/db/DbLockRequest.java b/bdb/java/src/com/sleepycat/db/DbLockRequest.java deleted file mode 100644 index 2ea2fe148ea..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbLockRequest.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbLockRequest.java,v 11.4 2002/01/16 07:45:24 mjc Exp $ - */ - -package com.sleepycat.db; - -public class DbLockRequest -{ - public DbLockRequest(int op, int mode, Dbt obj, DbLock lock) - { - this.op = op; - this.mode = mode; - this.obj = obj; - this.lock = lock; - } - - public int get_op() - { - return op; - } - - public void set_op(int op) - { - this.op = op; - } - - public int get_mode() - { - return mode; - } - - public void set_mode(int mode) - { - this.mode = mode; - } - - public Dbt get_obj() - { - return obj; - } - - public void set_obj(Dbt obj) - { - this.obj = obj; - } - - public DbLock get_lock() - { - return lock; - } - - public void set_lock(DbLock lock) - { - this.lock = lock; - } - - private /* db_lockop_t */ int op; - private /* db_lockmode_t */ int mode; - private /* db_timeout_t */ int timeout; - private Dbt obj; - private DbLock lock; -} diff --git a/bdb/java/src/com/sleepycat/db/DbLogc.java b/bdb/java/src/com/sleepycat/db/DbLogc.java deleted file mode 100644 index 34368199d5e..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbLogc.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbLogc.java,v 11.3 2002/01/11 15:52:37 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author Donald D. Anderson - */ -public class DbLogc -{ - // methods - // - public native void close(int flags) - throws DbException; - - // returns: 0, DB_NOTFOUND, or throws error - public native int get(DbLsn lsn, Dbt data, int flags) - throws DbException; - - protected native void finalize() - throws Throwable; - - // private data - // - private long private_dbobj_ = 0; - - static { - Db.load_db(); - } -} - -// end of DbLogc.java diff --git a/bdb/java/src/com/sleepycat/db/DbLsn.java b/bdb/java/src/com/sleepycat/db/DbLsn.java deleted file mode 100644 index c9e01225e3f..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbLsn.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbLsn.java,v 11.8 2002/01/11 15:52:37 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author Donald D. Anderson - */ -public class DbLsn -{ - // methods - // - public DbLsn() - { - init_lsn(); - } - - protected native void finalize() - throws Throwable; - - private native void init_lsn(); - - // get/set methods - // - - // private data - // - private long private_dbobj_ = 0; - - static { - Db.load_db(); - } -} - -// end of DbLsn.java diff --git a/bdb/java/src/com/sleepycat/db/DbMemoryException.java b/bdb/java/src/com/sleepycat/db/DbMemoryException.java deleted file mode 100644 index a5f66674c89..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbMemoryException.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1999-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbMemoryException.java,v 11.7 2002/01/11 15:52:37 bostic Exp $ - */ - -package com.sleepycat.db; - -public class DbMemoryException extends DbException -{ - // methods - // - - public DbMemoryException(String s) - { - super(s); - } - - public DbMemoryException(String s, int errno) - { - super(s, errno); - } - - public void set_dbt(Dbt dbt) - { - this.dbt = dbt; - } - - public Dbt get_dbt() - { - return dbt; - } - - /* Override of DbException.toString(): - * the extra verbage that comes from DbEnv.strerror(ENOMEM) - * is not helpful. - */ - public String toString() - { - return getMessage(); - } - - Dbt dbt = null; -} - -// end of DbMemoryException.java diff --git a/bdb/java/src/com/sleepycat/db/DbMpoolStat.java b/bdb/java/src/com/sleepycat/db/DbMpoolStat.java deleted file mode 100644 index d2d854a8b8d..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbMpoolStat.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbMpoolStat.java,v 11.7 2002/01/11 15:52:38 bostic Exp $ - */ - -package com.sleepycat.db; - -/* - * This is filled in and returned by the - * DbMpool.stat() method. - */ -public class DbMpoolStat -{ - public int st_cache_hit; // Pages found in the cache. - public int st_cache_miss; // Pages not found in the cache. - public int st_map; // Pages from mapped files. - public int st_page_create; // Pages created in the cache. - public int st_page_in; // Pages read in. - public int st_page_out; // Pages written out. - public int st_ro_evict; // Clean pages forced from the cache. - public int st_rw_evict; // Dirty pages forced from the cache. - public int st_hash_buckets; // Number of hash buckets. - public int st_hash_searches; // Total hash chain searches. - public int st_hash_longest; // Longest hash chain searched. - public int st_hash_examined; // Total hash entries searched. - public int st_page_clean; // Clean pages. - public int st_page_dirty; // Dirty pages. - public int st_page_trickle; // Pages written by memp_trickle. - public int st_region_wait; // Region lock granted after wait. - public int st_region_nowait; // Region lock granted without wait. - public int st_regsize; // Region size. -} - -// end of DbMpoolStat.java diff --git a/bdb/java/src/com/sleepycat/db/DbMultipleDataIterator.java b/bdb/java/src/com/sleepycat/db/DbMultipleDataIterator.java deleted file mode 100644 index 3c948ad37cd..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbMultipleDataIterator.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2001-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbMultipleDataIterator.java,v 1.5 2002/01/11 15:52:38 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author David M. Krinsky - */ -public class DbMultipleDataIterator extends DbMultipleIterator -{ - // public methods - public DbMultipleDataIterator(Dbt data) - { - super(data); - } - - public boolean next(Dbt data) - { - int dataoff = DbUtil.array2int(buf, pos); - - // crack out the data offset and length. - if (dataoff < 0) { - return (false); - } - - pos -= int32sz; - int datasz = DbUtil.array2int(buf, pos); - - pos -= int32sz; - - data.set_data(buf); - data.set_size(datasz); - data.set_offset(dataoff); - - return (true); - } -} - -// end of DbMultipleDataIterator.java diff --git a/bdb/java/src/com/sleepycat/db/DbMultipleIterator.java b/bdb/java/src/com/sleepycat/db/DbMultipleIterator.java deleted file mode 100644 index 0a28d9507a1..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbMultipleIterator.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2001-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbMultipleIterator.java,v 1.5 2002/01/11 15:52:38 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author David M. Krinsky - */ -// DbMultipleIterator is a shared package-private base class for the three -// types of bulk-return Iterator; it should never be instantiated directly, -// but it handles the functionality shared by its subclasses. -class DbMultipleIterator -{ - // Package-private methods and members: used by our subclasses. - - // Called implicitly by the subclass - DbMultipleIterator(Dbt data) - { - buf = data.get_data(); - size = data.get_ulen(); - // The offset will always be zero from the front of the buffer - // DB returns, and the buffer is opaque, so don't bother - // handling an offset. - - // The initial position is pointing at the last u_int32_t - // in the buffer. - pos = size - int32sz; - } - - // The C macros use sizeof(u_int32_t). Fortunately, java ints - // are always four bytes. Make this a constant just for form's sake. - static final int int32sz = 4; - - // Current position within the buffer; equivalent to "pointer" - // in the DB_MULTIPLE macros. - int pos; - - // A reference to the encoded buffer returned from the original - // Db/Dbc.get call on the data Dbt, and its size. - byte[] buf; - int size; -} - -// end of DbMultipleIterator.java diff --git a/bdb/java/src/com/sleepycat/db/DbMultipleKeyDataIterator.java b/bdb/java/src/com/sleepycat/db/DbMultipleKeyDataIterator.java deleted file mode 100644 index 0edae5801d4..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbMultipleKeyDataIterator.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2001-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbMultipleKeyDataIterator.java,v 1.5 2002/01/11 15:52:39 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author David M. Krinsky - */ -public class DbMultipleKeyDataIterator extends DbMultipleIterator -{ - // public methods - public DbMultipleKeyDataIterator(Dbt data) - { - super(data); - } - - public boolean next(Dbt key, Dbt data) - { - int keyoff = DbUtil.array2int(buf, pos); - - // crack out the key and data offsets and lengths. - if (keyoff < 0) { - return (false); - } - - pos -= int32sz; - int keysz = DbUtil.array2int(buf, pos); - - pos -= int32sz; - int dataoff = DbUtil.array2int(buf, pos); - - pos -= int32sz; - int datasz = DbUtil.array2int(buf, pos); - - pos -= int32sz; - - key.set_data(buf); - key.set_size(keysz); - key.set_offset(keyoff); - - data.set_data(buf); - data.set_size(datasz); - data.set_offset(dataoff); - - return (true); - } -} - -// end of DbMultipleKeyDataIterator.java diff --git a/bdb/java/src/com/sleepycat/db/DbMultipleRecnoDataIterator.java b/bdb/java/src/com/sleepycat/db/DbMultipleRecnoDataIterator.java deleted file mode 100644 index a4a578ed170..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbMultipleRecnoDataIterator.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2001-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbMultipleRecnoDataIterator.java,v 1.5 2002/01/11 15:52:39 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author David M. Krinsky - */ -public class DbMultipleRecnoDataIterator extends DbMultipleIterator -{ - // public methods - public DbMultipleRecnoDataIterator(Dbt data) - { - super(data); - } - - public boolean next(Dbt key, Dbt data) - { - int keyoff = DbUtil.array2int(buf, pos); - - // crack out the key offset and the data offset and length. - if (keyoff < 0) { - return (false); - } - - pos -= int32sz; - int dataoff = DbUtil.array2int(buf, pos); - - pos -= int32sz; - int datasz = DbUtil.array2int(buf, pos); - - pos -= int32sz; - - key.set_recno_key_from_buffer(buf, keyoff); - - data.set_data(buf); - data.set_size(datasz); - data.set_offset(dataoff); - - return (true); - } -} - -// end of DbMultipleRecnoDataIterator.java diff --git a/bdb/java/src/com/sleepycat/db/DbOutputStreamErrcall.java b/bdb/java/src/com/sleepycat/db/DbOutputStreamErrcall.java deleted file mode 100644 index 7343caa8238..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbOutputStreamErrcall.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbOutputStreamErrcall.java,v 11.6 2002/01/11 15:52:39 bostic Exp $ - */ - -package com.sleepycat.db; -import java.io.OutputStream; -import java.io.IOException; - -/** - * - * @author Donald D. Anderson - * - * This class is not public, as it is only used internally - * by Db to implement a default error handler. - */ - -/*package*/ class DbOutputStreamErrcall implements DbErrcall -{ - DbOutputStreamErrcall(OutputStream stream) - { - this.stream_ = stream; - } - - // errcall implements DbErrcall - // - public void errcall(String prefix, String buffer) - { - try { - if (prefix != null) { - stream_.write(prefix.getBytes()); - stream_.write((new String(": ")).getBytes()); - } - stream_.write(buffer.getBytes()); - stream_.write((new String("\n")).getBytes()); - } - catch (IOException e) { - - // well, we tried. - // Do our best to report the problem by other means. - // - System.err.println("DbOutputStreamErrcall Exception: " + e); - if (prefix != null) - System.err.print(prefix + ": "); - System.err.println(buffer + "\n"); - } - } - - // private data - // - private OutputStream stream_; -} - -// end of DbOutputStreamErrcall.java diff --git a/bdb/java/src/com/sleepycat/db/DbPreplist.java b/bdb/java/src/com/sleepycat/db/DbPreplist.java deleted file mode 100644 index e5fffa77e1e..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbPreplist.java +++ /dev/null @@ -1,22 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1999-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbPreplist.java,v 11.3 2002/01/11 15:52:40 bostic Exp $ - */ - -package com.sleepycat.db; - -/* - * This is filled in and returned by the - * DbEnv.txn_recover() method. - */ -public class DbPreplist -{ - public DbTxn txn; - public byte gid[]; -} - -// end of DbPreplist.java diff --git a/bdb/java/src/com/sleepycat/db/DbRepTransport.java b/bdb/java/src/com/sleepycat/db/DbRepTransport.java deleted file mode 100644 index 441c783b890..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbRepTransport.java +++ /dev/null @@ -1,19 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2001-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbRepTransport.java,v 11.2 2002/01/11 15:52:40 bostic Exp $ - */ - -package com.sleepycat.db; - -/* - * This is used as a callback by DbEnv.set_rep_transport. - */ -public interface DbRepTransport -{ - public int send(DbEnv env, Dbt control, Dbt rec, int flags, int envid) - throws DbException; -} diff --git a/bdb/java/src/com/sleepycat/db/DbRunRecoveryException.java b/bdb/java/src/com/sleepycat/db/DbRunRecoveryException.java deleted file mode 100644 index 32f2727a78b..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbRunRecoveryException.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbRunRecoveryException.java,v 11.6 2002/01/11 15:52:40 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author Donald D. Anderson - */ -public class DbRunRecoveryException extends DbException -{ - // methods - // - - public DbRunRecoveryException(String s) - { - super(s); - } - - public DbRunRecoveryException(String s, int errno) - { - super(s, errno); - } -} - -// end of DbRunRecoveryException.java diff --git a/bdb/java/src/com/sleepycat/db/DbSecondaryKeyCreate.java b/bdb/java/src/com/sleepycat/db/DbSecondaryKeyCreate.java deleted file mode 100644 index ca2acde1b03..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbSecondaryKeyCreate.java +++ /dev/null @@ -1,22 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1999-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbSecondaryKeyCreate.java,v 11.3 2002/01/11 15:52:40 bostic Exp $ - */ - -package com.sleepycat.db; - -/* - * This is used as a callback by Db.associate. - */ -public interface DbSecondaryKeyCreate -{ - public int secondary_key_create(Db secondary, Dbt key, - Dbt data, Dbt result) - throws DbException; -} - -// end of DbSecondaryKeyCreate.java diff --git a/bdb/java/src/com/sleepycat/db/DbTxn.java b/bdb/java/src/com/sleepycat/db/DbTxn.java deleted file mode 100644 index d3906d112c0..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbTxn.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbTxn.java,v 11.17 2002/08/29 14:22:22 margo Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author Donald D. Anderson - */ -public class DbTxn -{ - // methods - // - public native void abort() - throws DbException; - - public native void commit(int flags) - throws DbException; - - public native void discard(int flags) - throws DbException; - - public native /*u_int32_t*/ int id() - throws DbException; - - public native void prepare(byte[] gid) - throws DbException; - - public native void set_timeout(/*db_timeout_t*/ long timeout, - /*u_int32_t*/ int flags) - throws DbException; - - // We override Object.equals because it is possible for - // the Java API to create multiple DbTxns that reference - // the same underlying object. This can happen for example - // during DbEnv.txn_recover(). - // - public boolean equals(Object obj) - { - if (this == obj) - return true; - - if (obj != null && (obj instanceof DbTxn)) { - DbTxn that = (DbTxn)obj; - return (this.private_dbobj_ == that.private_dbobj_); - } - return false; - } - - // We must override Object.hashCode whenever we override - // Object.equals() to enforce the maxim that equal objects - // have the same hashcode. - // - public int hashCode() - { - return ((int)private_dbobj_ ^ (int)(private_dbobj_ >> 32)); - } - - // get/set methods - // - - // private data - // - private long private_dbobj_ = 0; - - static { - Db.load_db(); - } -} - -// end of DbTxn.java diff --git a/bdb/java/src/com/sleepycat/db/DbUtil.java b/bdb/java/src/com/sleepycat/db/DbUtil.java deleted file mode 100644 index 30ca93d03cc..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbUtil.java +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2001-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbUtil.java,v 11.5 2002/01/11 15:52:41 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author David M. Krinsky - */ - -// DbUtil is a simple, package-private wrapper class that holds a few -// static utility functions other parts of the package share and that don't -// have a good home elsewhere. (For now, that's limited to byte-array-to-int -// conversion and back.) - -class DbUtil -{ - // Get the u_int32_t stored beginning at offset "offset" into - // array "arr". We have to do the conversion manually since it's - // a C-native int, and we're not really supposed to make this kind of - // cast in Java. - static int array2int(byte[] arr, int offset) - { - int b1, b2, b3, b4; - int pos = offset; - - // Get the component bytes; b4 is most significant, b1 least. - if (big_endian) { - b4 = arr[pos++]; - b3 = arr[pos++]; - b2 = arr[pos++]; - b1 = arr[pos]; - } else { - b1 = arr[pos++]; - b2 = arr[pos++]; - b3 = arr[pos++]; - b4 = arr[pos]; - } - - // Bytes are signed. Convert [-128, -1] to [128, 255]. - if (b1 < 0) { b1 += 256; } - if (b2 < 0) { b2 += 256; } - if (b3 < 0) { b3 += 256; } - if (b4 < 0) { b4 += 256; } - - // Put the bytes in their proper places in an int. - b2 <<= 8; - b3 <<= 16; - b4 <<= 24; - - // Return their sum. - return (b1 + b2 + b3 + b4); - } - - // Store the specified u_int32_t, with endianness appropriate - // to the platform we're running on, into four consecutive bytes of - // the specified byte array, starting from the specified offset. - static void int2array(int n, byte[] arr, int offset) - { - int b1, b2, b3, b4; - int pos = offset; - - b1 = n & 0xff; - b2 = (n >> 8) & 0xff; - b3 = (n >> 16) & 0xff; - b4 = (n >> 24) & 0xff; - - // Bytes are signed. Convert [128, 255] to [-128, -1]. - if (b1 >= 128) { b1 -= 256; } - if (b2 >= 128) { b2 -= 256; } - if (b3 >= 128) { b3 -= 256; } - if (b4 >= 128) { b4 -= 256; } - - // Put the bytes in the appropriate place in the array. - if (big_endian) { - arr[pos++] = (byte)b4; - arr[pos++] = (byte)b3; - arr[pos++] = (byte)b2; - arr[pos] = (byte)b1; - } else { - arr[pos++] = (byte)b1; - arr[pos++] = (byte)b2; - arr[pos++] = (byte)b3; - arr[pos] = (byte)b4; - } - } - - private static final boolean big_endian = is_big_endian(); - private static native boolean is_big_endian(); -} - -// end of DbUtil.java diff --git a/bdb/java/src/com/sleepycat/db/Dbc.java b/bdb/java/src/com/sleepycat/db/Dbc.java deleted file mode 100644 index 60c00b1deb7..00000000000 --- a/bdb/java/src/com/sleepycat/db/Dbc.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: Dbc.java,v 11.9 2002/01/11 15:52:41 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author Donald D. Anderson - */ -public class Dbc -{ - // methods - // - public native void close() - throws DbException; - - public native int count(int flags) - throws DbException; - - // returns: 0, DB_KEYEMPTY, or throws error - public native int del(int flags) - throws DbException; - - public native Dbc dup(int flags) - throws DbException; - - // returns: 0, DB_NOTFOUND, or throws error - public native int get(Dbt key, Dbt data, int flags) - throws DbException; - - // returns: 0, DB_NOTFOUND, or throws error - public native int pget(Dbt key, Dbt pkey, Dbt data, int flags) - throws DbException; - - // returns: 0, DB_KEYEXIST, or throws error - public native int put(Dbt key, Dbt data, int flags) - throws DbException; - - protected native void finalize() - throws Throwable; - - // get/set methods - // - - // private data - // - private long private_dbobj_ = 0; - - static { - Db.load_db(); - } -} - -// end of Dbc.java diff --git a/bdb/java/src/com/sleepycat/db/Dbt.java b/bdb/java/src/com/sleepycat/db/Dbt.java deleted file mode 100644 index f51d0419963..00000000000 --- a/bdb/java/src/com/sleepycat/db/Dbt.java +++ /dev/null @@ -1,230 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: Dbt.java,v 11.15 2002/09/04 00:37:25 mjc Exp $ - */ - -package com.sleepycat.db; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -/** - * - * @author Donald D. Anderson - */ -public class Dbt -{ - // methods - // - - public Dbt(byte[] data) - { - init(); - this.data = data; - if (data != null) { - this.size = data.length; - } - } - - public Dbt(byte[] data, int off, int len) - { - init(); - this.data = data; - this.offset = off; - this.size = len; - } - - public Dbt() - { - init(); - } - - public Dbt(Object serialobj) throws java.io.IOException - { - init(); - this.set_object(serialobj); - } - - protected native void finalize() - throws Throwable; - - // get/set methods - // - - // key/data - public byte[] get_data() - { - // In certain circumstances, like callbacks to - // user code that have Dbt args, we do not create - // data arrays until the user explicitly does a get_data. - // This saves us from needlessly creating objects - // (potentially large arrays) that may never be accessed. - // - if (must_create_data) { - data = create_data(); - must_create_data = false; - } - return data; - } - - public void set_data(byte[] data) - { - this.data = data; - this.must_create_data = false; - } - - - // get_offset/set_offset is unique to the Java portion - // of the DB APIs. They can be used to get/set the offset - // into the attached byte array. - // - public int get_offset() - { - return offset; - } - - public void set_offset(int offset) - { - this.offset = offset; - } - - // key/data length - public /*u_int32_t*/ int get_size() - { - return size; - } - - public void set_size(/*u_int32_t*/ int size) - { - this.size = size; - } - - // RO: length of user buffer. - public /*u_int32_t*/ int get_ulen() - { - return ulen; - } - - public void set_ulen(/*u_int32_t*/ int ulen) - { - this.ulen = ulen; - } - - - // RO: get/put record length. - public /*u_int32_t*/ int get_dlen() - { - return dlen; - } - - public void set_dlen(/*u_int32_t*/ int dlen) - { - this.dlen = dlen; - } - - // RO: get/put record offset. - public /*u_int32_t*/ int get_doff() - { - return doff; - } - - public void set_doff(/*u_int32_t*/ int doff) - { - this.doff = doff; - } - - // flags - public /*u_int32_t*/ int get_flags() - { - return flags; - } - - public void set_flags(/*u_int32_t*/ int flags) - { - this.flags = flags; - } - - // Helper methods to get/set a Dbt from a serializable object. - public Object get_object() throws java.io.IOException, - java.lang.ClassNotFoundException - { - ByteArrayInputStream bytestream = new ByteArrayInputStream(get_data()); - ObjectInputStream ois = new ObjectInputStream(bytestream); - Object serialobj = ois.readObject(); - ois.close(); - bytestream.close(); - return (serialobj); - } - - public void set_object(Object serialobj) throws java.io.IOException - { - ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(bytestream); - oos.writeObject(serialobj); - oos.close(); - byte[] buf = bytestream.toByteArray(); - bytestream.close(); - set_data(buf); - set_offset(0); - set_size(buf.length); - } - - // These are not in the original DB interface. - // They can be used to set the recno key for a Dbt. - // Note: if data is less than (offset + 4) bytes, these - // methods may throw an ArrayIndexException. get_recno_key_data() - // will additionally throw a NullPointerException if data is null. - public void set_recno_key_data(int recno) - { - if (data == null) { - data = new byte[4]; - size = 4; - offset = 0; - } - DbUtil.int2array(recno, data, offset); - } - - public int get_recno_key_data() - { - return (DbUtil.array2int(data, offset)); - } - - // Used internally by DbMultipleRecnoIterator - // - /*package*/ void set_recno_key_from_buffer(byte[] data, int offset) - { - this.data = data; - this.offset = offset; - this.size = 4; - } - - static { - Db.load_db(); - } - - // private methods - // - private native void init(); - private native byte[] create_data(); - - // private data - // - private long private_dbobj_ = 0; - - private byte[] data = null; - private int offset = 0; - private int size = 0; - private int ulen = 0; - private int dlen = 0; - private int doff = 0; - private int flags = 0; - private boolean must_create_data = false; -} - -// end of Dbt.java diff --git a/bdb/java/src/com/sleepycat/db/xa/DbXAResource.java b/bdb/java/src/com/sleepycat/db/xa/DbXAResource.java deleted file mode 100644 index 3a996c0d045..00000000000 --- a/bdb/java/src/com/sleepycat/db/xa/DbXAResource.java +++ /dev/null @@ -1,190 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbXAResource.java,v 1.2 2002/08/09 01:54:57 bostic Exp $ - */ - -package com.sleepycat.db.xa; - -import com.sleepycat.db.Db; -import com.sleepycat.db.DbEnv; -import com.sleepycat.db.DbTxn; -import javax.transaction.xa.XAResource; -import javax.transaction.xa.XAException; -import javax.transaction.xa.Xid; - -public class DbXAResource implements XAResource -{ - public DbXAResource(String home, int rmid, int flags) - throws XAException - { - this.home = home; - this.rmid = rmid; - - // We force single-threading for calls to _init/_close. - // This makes our internal code much easier, and - // should not be a performance burden. - synchronized (DbXAResource.class) { - _init(home, rmid, flags); - } - } - - // - // Alternate constructor for convenience. - // Uses an rmid that is unique within this JVM, - // numbered started at 0. - // - public DbXAResource(String home) - throws XAException - { - this(home, get_unique_rmid(), 0); - } - - private native void _init(String home, int rmid, int flags); - - public void close(int flags) - throws XAException - { - // We force single-threading for calls to _init/_close. - // This makes our internal code much easier, and - // should not be a performance burden. - synchronized (DbXAResource.class) { - _close(home, rmid, flags); - } - } - - private native void _close(String home, int rmid, int flags); - - public void commit(Xid xid, boolean onePhase) - throws XAException - { - _commit(xid, rmid, onePhase); - } - - private native void _commit(Xid xid, int rmid, boolean onePhase); - - public void end(Xid xid, int flags) - throws XAException - { - _end(xid, rmid, flags); - } - - private native void _end(Xid xid, int rmid, int flags); - - public void forget(Xid xid) - throws XAException - { - _forget(xid, rmid); - } - - private native void _forget(Xid xid, int rmid); - - public int getTransactionTimeout() - throws XAException - { - return transactionTimeout; - } - - public boolean isSameRM(XAResource xares) - throws XAException - { - if (!(xares instanceof DbXAResource)) - return false; - return (this.rmid == ((DbXAResource)xares).rmid); - } - - public int prepare(Xid xid) - throws XAException - { - return _prepare(xid, rmid); - } - - private native int _prepare(Xid xid, int rmid); - - public Xid [] recover(int flag) - throws XAException - { - return _recover(rmid, flag); - } - - private native Xid[] _recover(int rmid, int flags); - - public void rollback(Xid xid) - throws XAException - { - _rollback(xid, rmid); - System.err.println("DbXAResource.rollback returned"); - } - - private native void _rollback(Xid xid, int rmid); - - public boolean setTransactionTimeout(int seconds) - throws XAException - { - // XXX we are not using the transaction timeout. - transactionTimeout = seconds; - return true; - } - - public void start(Xid xid, int flags) - throws XAException - { - _start(xid, rmid, flags); - } - - private native void _start(Xid xid, int rmid, int flags); - - private static synchronized int get_unique_rmid() - { - return unique_rmid++; - } - - public interface DbAttach - { - public DbEnv get_env(); - public DbTxn get_txn(); - } - - protected static class DbAttachImpl implements DbAttach - { - private DbEnv env; - private DbTxn txn; - - DbAttachImpl(DbEnv env, DbTxn txn) - { - this.env = env; - this.txn = txn; - } - - public DbTxn get_txn() - { - return txn; - } - - public DbEnv get_env() - { - return env; - } - } - - public static native DbAttach xa_attach(Xid xid, Integer rmid); - - //////////////////////////////////////////////////////////////// - // - // private data - // - private long private_dbobj_ = 0; - private int transactionTimeout = 0; - private String home; - private int rmid; - - private static int unique_rmid = 0; - - static - { - Db.load_db(); - } -} diff --git a/bdb/java/src/com/sleepycat/db/xa/DbXid.java b/bdb/java/src/com/sleepycat/db/xa/DbXid.java deleted file mode 100644 index ba03d3ebf3e..00000000000 --- a/bdb/java/src/com/sleepycat/db/xa/DbXid.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: DbXid.java,v 1.2 2002/08/09 01:54:58 bostic Exp $ - */ - -package com.sleepycat.db.xa; - -import com.sleepycat.db.DbException; -import com.sleepycat.db.DbTxn; -import javax.transaction.xa.XAException; -import javax.transaction.xa.Xid; - -public class DbXid implements Xid -{ - public DbXid(int formatId, byte[] gtrid, byte[] bqual) - throws XAException - { - this.formatId = formatId; - this.gtrid = gtrid; - this.bqual = bqual; - } - - public int getFormatId() - { - return formatId; - } - - public byte[] getGlobalTransactionId() - { - return gtrid; - } - - public byte[] getBranchQualifier() - { - return bqual; - } - - //////////////////////////////////////////////////////////////// - // - // private data - // - private byte[] gtrid; - private byte[] bqual; - private int formatId; -} diff --git a/bdb/java/src/com/sleepycat/examples/AccessExample.java b/bdb/java/src/com/sleepycat/examples/AccessExample.java deleted file mode 100644 index ea3d5f342ed..00000000000 --- a/bdb/java/src/com/sleepycat/examples/AccessExample.java +++ /dev/null @@ -1,181 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: AccessExample.java,v 11.12 2002/02/05 22:27:13 mjc Exp $ - */ - -package com.sleepycat.examples; - -import com.sleepycat.db.*; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.InputStreamReader; -import java.io.IOException; -import java.io.PrintStream; - -class AccessExample -{ - private static final String FileName = "access.db"; - - public AccessExample() - { - } - - public static void main(String argv[]) - { - try - { - AccessExample app = new AccessExample(); - app.run(); - } - catch (DbException dbe) - { - System.err.println("AccessExample: " + dbe.toString()); - System.exit(1); - } - catch (FileNotFoundException fnfe) - { - System.err.println("AccessExample: " + fnfe.toString()); - System.exit(1); - } - System.exit(0); - } - - // Prompts for a line, and keeps prompting until a non blank - // line is returned. Returns null on error. - // - static public String askForLine(InputStreamReader reader, - PrintStream out, String prompt) - { - String result = ""; - while (result != null && result.length() == 0) { - out.print(prompt); - out.flush(); - result = getLine(reader); - } - return result; - } - - // Not terribly efficient, but does the job. - // Works for reading a line from stdin or a file. - // Returns null on EOF. If EOF appears in the middle - // of a line, returns that line, then null on next call. - // - static public String getLine(InputStreamReader reader) - { - StringBuffer b = new StringBuffer(); - int c; - try { - while ((c = reader.read()) != -1 && c != '\n') { - if (c != '\r') - b.append((char)c); - } - } - catch (IOException ioe) { - c = -1; - } - - if (c == -1 && b.length() == 0) - return null; - else - return b.toString(); - } - - public void run() - throws DbException, FileNotFoundException - { - // Remove the previous database. - new File(FileName).delete(); - - // Create the database object. - // There is no environment for this simple example. - Db table = new Db(null, 0); - table.set_error_stream(System.err); - table.set_errpfx("AccessExample"); - table.open(null, FileName, null, Db.DB_BTREE, Db.DB_CREATE, 0644); - - // - // Insert records into the database, where the key is the user - // input and the data is the user input in reverse order. - // - InputStreamReader reader = new InputStreamReader(System.in); - - for (;;) { - String line = askForLine(reader, System.out, "input> "); - if (line == null) - break; - - String reversed = (new StringBuffer(line)).reverse().toString(); - - // See definition of StringDbt below - // - StringDbt key = new StringDbt(line); - StringDbt data = new StringDbt(reversed); - - try - { - int err; - if ((err = table.put(null, - key, data, Db.DB_NOOVERWRITE)) == Db.DB_KEYEXIST) { - System.out.println("Key " + line + " already exists."); - } - } - catch (DbException dbe) - { - System.out.println(dbe.toString()); - } - System.out.println(""); - } - - // Acquire an iterator for the table. - Dbc iterator; - iterator = table.cursor(null, 0); - - // Walk through the table, printing the key/data pairs. - // See class StringDbt defined below. - // - StringDbt key = new StringDbt(); - StringDbt data = new StringDbt(); - while (iterator.get(key, data, Db.DB_NEXT) == 0) - { - System.out.println(key.getString() + " : " + data.getString()); - } - iterator.close(); - table.close(0); - } - - // Here's an example of how you can extend a Dbt in a straightforward - // way to allow easy storage/retrieval of strings, or whatever - // kind of data you wish. We've declared it as a static inner - // class, but it need not be. - // - static /*inner*/ - class StringDbt extends Dbt - { - StringDbt() - { - set_flags(Db.DB_DBT_MALLOC); // tell Db to allocate on retrieval - } - - StringDbt(String value) - { - setString(value); - set_flags(Db.DB_DBT_MALLOC); // tell Db to allocate on retrieval - } - - void setString(String value) - { - byte[] data = value.getBytes(); - set_data(data); - set_size(data.length); - } - - String getString() - { - return new String(get_data(), 0, get_size()); - } - } -} diff --git a/bdb/java/src/com/sleepycat/examples/BtRecExample.java b/bdb/java/src/com/sleepycat/examples/BtRecExample.java deleted file mode 100644 index 68365600748..00000000000 --- a/bdb/java/src/com/sleepycat/examples/BtRecExample.java +++ /dev/null @@ -1,340 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: BtRecExample.java,v 11.11 2002/02/05 22:27:13 mjc Exp $ - */ - -package com.sleepycat.examples; - -import com.sleepycat.db.*; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.InputStreamReader; -import java.io.IOException; -import java.io.PrintStream; - -public class BtRecExample -{ - static final String progname = "BtRecExample"; // Program name. - static final String database = "access.db"; - static final String wordlist = "../test/wordlist"; - - BtRecExample(BufferedReader reader) - throws DbException, IOException, FileNotFoundException - { - int ret; - - // Remove the previous database. - File f = new File(database); - f.delete(); - - dbp = new Db(null, 0); - - dbp.set_error_stream(System.err); - dbp.set_errpfx(progname); - dbp.set_pagesize(1024); // 1K page sizes. - - dbp.set_flags(Db.DB_RECNUM); // Record numbers. - dbp.open(null, database, null, Db.DB_BTREE, Db.DB_CREATE, 0664); - - // - // Insert records into the database, where the key is the word - // preceded by its record number, and the data is the same, but - // in reverse order. - // - - for (int cnt = 1; cnt <= 1000; ++cnt) { - String numstr = String.valueOf(cnt); - while (numstr.length() < 4) - numstr = "0" + numstr; - String buf = numstr + '_' + reader.readLine(); - StringBuffer rbuf = new StringBuffer(buf).reverse(); - - StringDbt key = new StringDbt(buf); - StringDbt data = new StringDbt(rbuf.toString()); - - if ((ret = dbp.put(null, key, data, Db.DB_NOOVERWRITE)) != 0) { - if (ret != Db.DB_KEYEXIST) - throw new DbException("Db.put failed" + ret); - } - } - } - - void run() - throws DbException - { - int recno; - int ret; - - // Acquire a cursor for the database. - dbcp = dbp.cursor(null, 0); - - // - // Prompt the user for a record number, then retrieve and display - // that record. - // - InputStreamReader reader = new InputStreamReader(System.in); - - for (;;) { - // Get a record number. - String line = askForLine(reader, System.out, "recno #> "); - if (line == null) - break; - - try { - recno = Integer.parseInt(line); - } - catch (NumberFormatException nfe) { - System.err.println("Bad record number: " + nfe); - continue; - } - - // - // Start with a fresh key each time, the dbp.get() routine returns - // the key and data pair, not just the key! - // - RecnoStringDbt key = new RecnoStringDbt(recno, 100); - RecnoStringDbt data = new RecnoStringDbt(100); - - if ((ret = dbcp.get(key, data, Db.DB_SET_RECNO)) != 0) { - throw new DbException("Dbc.get failed", ret); - } - - // Display the key and data. - show("k/d\t", key, data); - - // Move the cursor a record forward. - if ((ret = dbcp.get(key, data, Db.DB_NEXT)) != 0) { - throw new DbException("Dbc.get failed", ret); - } - - // Display the key and data. - show("next\t", key, data); - - RecnoStringDbt datano = new RecnoStringDbt(100); - - // - // Retrieve the record number for the following record into - // local memory. - // - if ((ret = dbcp.get(key, datano, Db.DB_GET_RECNO)) != 0) { - if (ret != Db.DB_NOTFOUND && ret != Db.DB_KEYEMPTY) { - throw new DbException("Dbc.get failed", ret); - } - } - else { - recno = datano.getRecno(); - System.out.println("retrieved recno: " + recno); - } - } - - dbcp.close(); - dbcp = null; - } - - // - // Print out the number of records in the database. - // - void stats() - throws DbException - { - DbBtreeStat statp; - - statp = (DbBtreeStat)dbp.stat(0); - System.out.println(progname + ": database contains " + - statp.bt_ndata + " records"); - } - - void show(String msg, RecnoStringDbt key, RecnoStringDbt data) - throws DbException - { - System.out.println(msg + key.getString() + ": " + data.getString()); - } - - public void shutdown() - throws DbException - { - if (dbcp != null) { - dbcp.close(); - dbcp = null; - } - if (dbp != null) { - dbp.close(0); - dbp = null; - } - } - - public static void main(String argv[]) - { - - try { - // Open the word database. - FileReader freader = new FileReader(wordlist); - - BtRecExample app = new BtRecExample(new BufferedReader(freader)); - - // Close the word database. - freader.close(); - freader = null; - - app.stats(); - app.run(); - } catch (FileNotFoundException fnfe) { - System.err.println(progname + ": unexpected open error " + fnfe); - System.exit (1); - } catch (IOException ioe) { - System.err.println(progname + ": open " + wordlist + ": " + ioe); - System.exit (1); - } catch (DbException dbe) { - System.err.println("Exception: " + dbe); - System.exit(dbe.get_errno()); - } - - System.exit(0); - } - - // Prompts for a line, and keeps prompting until a non blank - // line is returned. Returns null on error. - // - static public String askForLine(InputStreamReader reader, - PrintStream out, String prompt) - { - String result = ""; - while (result != null && result.length() == 0) { - out.print(prompt); - out.flush(); - result = getLine(reader); - } - return result; - } - - // Not terribly efficient, but does the job. - // Works for reading a line from stdin or a file. - // Returns null on EOF. If EOF appears in the middle - // of a line, returns that line, then null on next call. - // - static public String getLine(InputStreamReader reader) - { - StringBuffer b = new StringBuffer(); - int c; - try { - while ((c = reader.read()) != -1 && c != '\n') { - if (c != '\r') - b.append((char)c); - } - } - catch (IOException ioe) { - c = -1; - } - - if (c == -1 && b.length() == 0) - return null; - else - return b.toString(); - } - - private Dbc dbcp; - private Db dbp; - - // Here's an example of how you can extend a Dbt in a straightforward - // way to allow easy storage/retrieval of strings. - // We've declared it as a static inner class, but it need not be. - // - static /*inner*/ - class StringDbt extends Dbt - { - StringDbt(byte[] arr) - { - set_flags(Db.DB_DBT_USERMEM); - set_data(arr); - set_size(arr.length); - } - - StringDbt() - { - set_flags(Db.DB_DBT_MALLOC); // tell Db to allocate on retrieval - } - - StringDbt(String value) - { - setString(value); - set_flags(Db.DB_DBT_MALLOC); // tell Db to allocate on retrieval - } - - void setString(String value) - { - byte[] data = value.getBytes(); - set_data(data); - set_size(data.length); - // must set ulen because sometimes a string is returned - set_ulen(data.length); - } - - String getString() - { - return new String(get_data(), 0, get_size()); - } - } - - // Here's an example of how you can extend a Dbt to store - // (potentially) both recno's and strings in the same - // structure. - // - static /*inner*/ - class RecnoStringDbt extends Dbt - { - RecnoStringDbt(int maxsize) - { - this(0, maxsize); // let other constructor do most of the work - } - - RecnoStringDbt(int value, int maxsize) - { - set_flags(Db.DB_DBT_USERMEM); // do not allocate on retrieval - arr = new byte[maxsize]; - set_data(arr); // use our local array for data - set_ulen(maxsize); // size of return storage - setRecno(value); - } - - RecnoStringDbt(String value, int maxsize) - { - set_flags(Db.DB_DBT_USERMEM); // do not allocate on retrieval - arr = new byte[maxsize]; - set_data(arr); // use our local array for data - set_ulen(maxsize); // size of return storage - setString(value); - } - - void setRecno(int value) - { - set_recno_key_data(value); - set_size(arr.length); - } - - void setString(String value) - { - byte[] data = value.getBytes(); - set_data(data); - set_size(data.length); - } - - int getRecno() - { - return get_recno_key_data(); - } - - String getString() - { - return new String(get_data(), 0, get_size()); - } - - byte arr[]; - } -} diff --git a/bdb/java/src/com/sleepycat/examples/BulkAccessExample.java b/bdb/java/src/com/sleepycat/examples/BulkAccessExample.java deleted file mode 100644 index e6690197105..00000000000 --- a/bdb/java/src/com/sleepycat/examples/BulkAccessExample.java +++ /dev/null @@ -1,198 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: BulkAccessExample.java,v 1.6 2002/02/05 22:27:13 mjc Exp $ - */ - -package com.sleepycat.examples; - -import com.sleepycat.db.*; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.InputStreamReader; -import java.io.IOException; -import java.io.PrintStream; - -class BulkAccessExample -{ - private static final String FileName = "access.db"; - - public BulkAccessExample() - { - } - - public static void main(String argv[]) - { - try - { - BulkAccessExample app = new BulkAccessExample(); - app.run(); - } - catch (DbException dbe) - { - System.err.println("BulkAccessExample: " + dbe.toString()); - System.exit(1); - } - catch (FileNotFoundException fnfe) - { - System.err.println("BulkAccessExample: " + fnfe.toString()); - System.exit(1); - } - System.exit(0); - } - - // Prompts for a line, and keeps prompting until a non blank - // line is returned. Returns null on error. - // - static public String askForLine(InputStreamReader reader, - PrintStream out, String prompt) - { - String result = ""; - while (result != null && result.length() == 0) { - out.print(prompt); - out.flush(); - result = getLine(reader); - } - return result; - } - - // Not terribly efficient, but does the job. - // Works for reading a line from stdin or a file. - // Returns null on EOF. If EOF appears in the middle - // of a line, returns that line, then null on next call. - // - static public String getLine(InputStreamReader reader) - { - StringBuffer b = new StringBuffer(); - int c; - try { - while ((c = reader.read()) != -1 && c != '\n') { - if (c != '\r') - b.append((char)c); - } - } - catch (IOException ioe) { - c = -1; - } - - if (c == -1 && b.length() == 0) - return null; - else - return b.toString(); - } - - public void run() - throws DbException, FileNotFoundException - { - // Remove the previous database. - new File(FileName).delete(); - - // Create the database object. - // There is no environment for this simple example. - Db table = new Db(null, 0); - table.set_error_stream(System.err); - table.set_errpfx("BulkAccessExample"); - table.open(null, FileName, null, Db.DB_BTREE, Db.DB_CREATE, 0644); - - // - // Insert records into the database, where the key is the user - // input and the data is the user input in reverse order. - // - InputStreamReader reader = new InputStreamReader(System.in); - - for (;;) { - String line = askForLine(reader, System.out, "input> "); - if (line == null) - break; - - String reversed = (new StringBuffer(line)).reverse().toString(); - - // See definition of StringDbt below - // - StringDbt key = new StringDbt(line); - StringDbt data = new StringDbt(reversed); - - try - { - int err; - if ((err = table.put(null, - key, data, Db.DB_NOOVERWRITE)) == Db.DB_KEYEXIST) { - System.out.println("Key " + line + " already exists."); - } - } - catch (DbException dbe) - { - System.out.println(dbe.toString()); - } - System.out.println(""); - } - - // Acquire a cursor for the table and two Dbts. - Dbc dbc = table.cursor(null, 0); - Dbt foo = new Dbt(); - foo.set_flags(Db.DB_DBT_MALLOC); - - Dbt bulk_data = new Dbt(); - - // Set Db.DB_DBT_USERMEM on the data Dbt; Db.DB_MULTIPLE_KEY requires - // it. Then allocate a byte array of a reasonable size; we'll - // go through the database in chunks this big. - bulk_data.set_flags(Db.DB_DBT_USERMEM); - bulk_data.set_data(new byte[1000000]); - bulk_data.set_ulen(1000000); - - - // Walk through the table, printing the key/data pairs. - // - while (dbc.get(foo, bulk_data, Db.DB_NEXT | Db.DB_MULTIPLE_KEY) == 0) - { - DbMultipleKeyDataIterator iterator; - iterator = new DbMultipleKeyDataIterator(bulk_data); - - StringDbt key, data; - key = new StringDbt(); - data = new StringDbt(); - - while (iterator.next(key, data)) { - System.out.println(key.getString() + " : " + data.getString()); - } - } - dbc.close(); - table.close(0); - } - - // Here's an example of how you can extend a Dbt in a straightforward - // way to allow easy storage/retrieval of strings, or whatever - // kind of data you wish. We've declared it as a static inner - // class, but it need not be. - // - static /*inner*/ - class StringDbt extends Dbt - { - StringDbt() - { - set_flags(Db.DB_DBT_MALLOC); // tell Db to allocate on retrieval - } - - StringDbt(String value) - { - setString(value); - set_flags(Db.DB_DBT_MALLOC); // tell Db to allocate on retrieval - } - - void setString(String value) - { - byte[] data = value.getBytes(); - set_data(data); - set_size(data.length); - } - - String getString() - { - return new String(get_data(), get_offset(), get_size()); - } - } -} diff --git a/bdb/java/src/com/sleepycat/examples/EnvExample.java b/bdb/java/src/com/sleepycat/examples/EnvExample.java deleted file mode 100644 index acbd9f59621..00000000000 --- a/bdb/java/src/com/sleepycat/examples/EnvExample.java +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: EnvExample.java,v 11.9 2002/01/11 15:52:42 bostic Exp $ - */ - -package com.sleepycat.examples; - -import com.sleepycat.db.*; -import java.io.FileNotFoundException; -import java.io.OutputStream; - -/* - * An example of a program using DbEnv to configure its DB - * environment. - * - * For comparison purposes, this example uses a similar structure - * as examples/ex_env.c and examples_cxx/EnvExample.cpp. - */ -public class EnvExample -{ - private static final String progname = "EnvExample"; - private static final String DATABASE_HOME = "/tmp/database"; - - private static void db_application() - throws DbException - { - // Do something interesting... - // Your application goes here. - } - - private static void db_setup(String home, String data_dir, - OutputStream errs) - throws DbException, FileNotFoundException - { - // - // Create an environment object and initialize it for error - // reporting. - // - DbEnv dbenv = new DbEnv(0); - dbenv.set_error_stream(errs); - dbenv.set_errpfx(progname); - - // - // We want to specify the shared memory buffer pool cachesize, - // but everything else is the default. - // - dbenv.set_cachesize(0, 64 * 1024, 0); - - // Databases are in a subdirectory. - dbenv.set_data_dir(data_dir); - - // Open the environment with full transactional support. - // - // open() will throw a DbException if there is an error. - // - // open is declared to throw a FileNotFoundException, which normally - // shouldn't occur with the DB_CREATE option. - // - dbenv.open(DATABASE_HOME, - Db.DB_CREATE | Db.DB_INIT_LOCK | Db.DB_INIT_LOG | - Db.DB_INIT_MPOOL | Db.DB_INIT_TXN, 0); - - try { - - // Start your application. - db_application(); - - } - finally { - - // Close the environment. Doing this in the - // finally block ensures it is done, even if - // an error is thrown. - // - dbenv.close(0); - } - } - - private static void db_teardown(String home, String data_dir, - OutputStream errs) - throws DbException, FileNotFoundException - { - // Remove the shared database regions. - - DbEnv dbenv = new DbEnv(0); - - dbenv.set_error_stream(errs); - dbenv.set_errpfx(progname); - dbenv.set_data_dir(data_dir); - dbenv.remove(home, 0); - } - - public static void main(String[] args) - { - // - // All of the shared database files live in /tmp/database, - // but data files live in /database. - // - // Using Berkeley DB in C/C++, we need to allocate two elements - // in the array and set config[1] to NULL. This is not - // necessary in Java. - // - String home = DATABASE_HOME; - String config = "/database/files"; - - try { - System.out.println("Setup env"); - db_setup(home, config, System.err); - - System.out.println("Teardown env"); - db_teardown(home, config, System.err); - } - catch (DbException dbe) { - System.err.println(progname + ": environment open: " + dbe.toString()); - System.exit (1); - } - catch (FileNotFoundException fnfe) { - System.err.println(progname + - ": unexpected open environment error " + fnfe); - System.exit (1); - } - } - -} diff --git a/bdb/java/src/com/sleepycat/examples/LockExample.java b/bdb/java/src/com/sleepycat/examples/LockExample.java deleted file mode 100644 index d450193146a..00000000000 --- a/bdb/java/src/com/sleepycat/examples/LockExample.java +++ /dev/null @@ -1,235 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: LockExample.java,v 11.8 2002/01/11 15:52:43 bostic Exp $ - */ - -package com.sleepycat.examples; - -import com.sleepycat.db.*; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.IOException; -import java.io.PrintStream; -import java.util.Vector; - -// -// An example of a program using DbLock and related classes. -// -class LockExample extends DbEnv -{ - private static final String progname = "LockExample"; - private static final String LOCK_HOME = "TESTDIR"; - - public LockExample(String home, int maxlocks, boolean do_unlink) - throws DbException, FileNotFoundException - { - super(0); - if (do_unlink) { - remove(home, Db.DB_FORCE); - } - else { - set_error_stream(System.err); - set_errpfx("LockExample"); - if (maxlocks != 0) - set_lk_max_locks(maxlocks); - open(home, Db.DB_CREATE|Db.DB_INIT_LOCK, 0); - } - } - - // Prompts for a line, and keeps prompting until a non blank - // line is returned. Returns null on error. - // - static public String askForLine(InputStreamReader reader, - PrintStream out, String prompt) - { - String result = ""; - while (result != null && result.length() == 0) { - out.print(prompt); - out.flush(); - result = getLine(reader); - } - return result; - } - - // Not terribly efficient, but does the job. - // Works for reading a line from stdin or a file. - // Returns null on EOF. If EOF appears in the middle - // of a line, returns that line, then null on next call. - // - static public String getLine(InputStreamReader reader) - { - StringBuffer b = new StringBuffer(); - int c; - try { - while ((c = reader.read()) != -1 && c != '\n') { - if (c != '\r') - b.append((char)c); - } - } - catch (IOException ioe) { - c = -1; - } - - if (c == -1 && b.length() == 0) - return null; - else - return b.toString(); - } - - public void run() - throws DbException - { - long held; - int len = 0, locker; - int ret; - boolean did_get = false; - int lockid = 0; - InputStreamReader in = new InputStreamReader(System.in); - Vector locks = new Vector(); - - // - // Accept lock requests. - // - locker = lock_id(); - for (held = 0;;) { - String opbuf = askForLine(in, System.out, - "Operation get/release [get]> "); - if (opbuf == null) - break; - - try { - if (opbuf.equals("get")) { - // Acquire a lock. - String objbuf = askForLine(in, System.out, - "input object (text string) to lock> "); - if (objbuf == null) - break; - - String lockbuf; - do { - lockbuf = askForLine(in, System.out, - "lock type read/write [read]> "); - if (lockbuf == null) - break; - len = lockbuf.length(); - } while (len >= 1 && - !lockbuf.equals("read") && - !lockbuf.equals("write")); - - int lock_type; - if (len <= 1 || lockbuf.equals("read")) - lock_type = Db.DB_LOCK_READ; - else - lock_type = Db.DB_LOCK_WRITE; - - Dbt dbt = new Dbt(objbuf.getBytes()); - - DbLock lock; - did_get = true; - lock = lock_get(locker, Db.DB_LOCK_NOWAIT, - dbt, lock_type); - lockid = locks.size(); - locks.addElement(lock); - } else { - // Release a lock. - String objbuf; - objbuf = askForLine(in, System.out, - "input lock to release> "); - if (objbuf == null) - break; - - lockid = Integer.parseInt(objbuf, 16); - if (lockid < 0 || lockid >= locks.size()) { - System.out.println("Lock #" + lockid + " out of range"); - continue; - } - did_get = false; - DbLock lock = (DbLock)locks.elementAt(lockid); - lock_put(lock); - } - System.out.println("Lock #" + lockid + " " + - (did_get ? "granted" : "released")); - held += did_get ? 1 : -1; - } - catch (DbException dbe) { - switch (dbe.get_errno()) { - case Db.DB_LOCK_NOTGRANTED: - System.out.println("Lock not granted"); - break; - case Db.DB_LOCK_DEADLOCK: - System.err.println("LockExample: lock_" + - (did_get ? "get" : "put") + - ": returned DEADLOCK"); - break; - default: - System.err.println("LockExample: lock_get: " + dbe.toString()); - } - } - } - System.out.println(); - System.out.println("Closing lock region " + String.valueOf(held) + - " locks held"); - } - - private static void usage() - { - System.err.println("usage: LockExample [-u] [-h home] [-m maxlocks]"); - System.exit(1); - } - - public static void main(String argv[]) - { - String home = LOCK_HOME; - boolean do_unlink = false; - int maxlocks = 0; - - for (int i = 0; i < argv.length; ++i) { - if (argv[i].equals("-h")) { - if (++i >= argv.length) - usage(); - home = argv[i]; - } - else if (argv[i].equals("-m")) { - if (++i >= argv.length) - usage(); - - try { - maxlocks = Integer.parseInt(argv[i]); - } - catch (NumberFormatException nfe) { - usage(); - } - } - else if (argv[i].equals("-u")) { - do_unlink = true; - } - else { - usage(); - } - } - - try { - if (do_unlink) { - // Create an environment that immediately - // removes all files. - LockExample tmp = new LockExample(home, maxlocks, do_unlink); - } - - LockExample app = new LockExample(home, maxlocks, do_unlink); - app.run(); - app.close(0); - } - catch (DbException dbe) { - System.err.println(progname + ": " + dbe.toString()); - } - catch (Throwable t) { - System.err.println(progname + ": " + t.toString()); - } - System.out.println("LockExample completed"); - } -} diff --git a/bdb/java/src/com/sleepycat/examples/TpcbExample.java b/bdb/java/src/com/sleepycat/examples/TpcbExample.java deleted file mode 100644 index aa9d10b37bc..00000000000 --- a/bdb/java/src/com/sleepycat/examples/TpcbExample.java +++ /dev/null @@ -1,843 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997-2002 - * Sleepycat Software. All rights reserved. - * - * $Id: TpcbExample.java,v 11.16 2002/02/13 06:08:35 mjc Exp $ - */ - -package com.sleepycat.examples; - -import com.sleepycat.db.*; -import java.io.FileNotFoundException; -import java.util.Calendar; -import java.util.Date; -import java.util.Random; -import java.util.GregorianCalendar; -import java.math.BigDecimal; - -// -// This program implements a basic TPC/B driver program. To create the -// TPC/B database, run with the -i (init) flag. The number of records -// with which to populate the account, history, branch, and teller tables -// is specified by the a, s, b, and t flags respectively. To run a TPC/B -// test, use the n flag to indicate a number of transactions to run (note -// that you can run many of these processes in parallel to simulate a -// multiuser test run). -// -class TpcbExample extends DbEnv -{ - public static final int TELLERS_PER_BRANCH = 10; - public static final int ACCOUNTS_PER_TELLER = 10000; - public static final int HISTORY_PER_BRANCH = 2592000; - - // - // The default configuration that adheres to TPCB scaling rules requires - // nearly 3 GB of space. To avoid requiring that much space for testing, - // we set the parameters much lower. If you want to run a valid 10 TPS - // configuration, uncomment the VALID_SCALING configuration - // - - // VALID_SCALING configuration - /* - public static final int ACCOUNTS = 1000000; - public static final int BRANCHES = 10; - public static final int TELLERS = 100; - public static final int HISTORY = 25920000; - */ - - // TINY configuration - /* - public static final int ACCOUNTS = 1000; - public static final int BRANCHES = 10; - public static final int TELLERS = 100; - public static final int HISTORY = 10000; - */ - - // Default configuration - public static final int ACCOUNTS = 100000; - public static final int BRANCHES = 10; - public static final int TELLERS = 100; - public static final int HISTORY = 259200; - - public static final int HISTORY_LEN = 100; - public static final int RECLEN = 100; - public static final int BEGID = 1000000; - - // used by random_id() - public static final int ACCOUNT = 0; - public static final int BRANCH = 1; - public static final int TELLER = 2; - - private static boolean verbose = false; - private static final String progname = "TpcbExample"; // Program name. - - public TpcbExample(String home, int cachesize, - boolean initializing, int flags) - throws DbException, FileNotFoundException - { - super(0); - set_error_stream(System.err); - set_errpfx(progname); - set_cachesize(0, cachesize == 0 ? 4 * 1024 * 1024 : cachesize, 0); - - if ((flags & (Db.DB_TXN_NOSYNC)) != 0) - set_flags(Db.DB_TXN_NOSYNC, true); - flags &= ~(Db.DB_TXN_NOSYNC); - - int local_flags = flags | Db.DB_CREATE; - if (initializing) - local_flags |= Db.DB_INIT_MPOOL; - else - local_flags |= Db.DB_INIT_TXN | Db.DB_INIT_LOCK | - Db.DB_INIT_LOG | Db.DB_INIT_MPOOL; - - open(home, local_flags, 0); // may throw DbException - } - - // - // Initialize the database to the specified number of accounts, branches, - // history records, and tellers. - // - // Note: num_h was unused in the original ex_tpcb.c example. - // - public void - populate(int num_a, int num_b, int num_h, int num_t) - { - Db dbp = null; - - int err; - int balance, idnum; - int end_anum, end_bnum, end_tnum; - int start_anum, start_bnum, start_tnum; - int h_nelem; - - idnum = BEGID; - balance = 500000; - - h_nelem = num_a; - - try { - dbp = new Db(this, 0); - dbp.set_h_nelem(h_nelem); - dbp.open(null, "account", null, Db.DB_HASH, - Db.DB_CREATE | Db.DB_TRUNCATE, 0644); - } - // can be DbException or FileNotFoundException - catch (Exception e1) { - errExit(e1, "Open of account file failed"); - } - - start_anum = idnum; - populateTable(dbp, idnum, balance, h_nelem, "account"); - idnum += h_nelem; - end_anum = idnum - 1; - try { - dbp.close(0); - } - catch (DbException e2) { - errExit(e2, "Account file close failed"); - } - - if (verbose) - System.out.println("Populated accounts: " - + String.valueOf(start_anum) + " - " + String.valueOf(end_anum)); - - // - // Since the number of branches is very small, we want to use very - // small pages and only 1 key per page. This is the poor-man's way - // of getting key locking instead of page locking. - // - h_nelem = (int)num_b; - - try { - dbp = new Db(this, 0); - - dbp.set_h_nelem(h_nelem); - dbp.set_h_ffactor(1); - dbp.set_pagesize(512); - - dbp.open(null, "branch", null, Db.DB_HASH, - Db.DB_CREATE | Db.DB_TRUNCATE, 0644); - } - // can be DbException or FileNotFoundException - catch (Exception e3) { - errExit(e3, "Branch file create failed"); - } - start_bnum = idnum; - populateTable(dbp, idnum, balance, h_nelem, "branch"); - idnum += h_nelem; - end_bnum = idnum - 1; - - try { - dbp.close(0); - } - catch (DbException dbe4) { - errExit(dbe4, "Close of branch file failed"); - } - - if (verbose) - System.out.println("Populated branches: " - + String.valueOf(start_bnum) + " - " + String.valueOf(end_bnum)); - - // - // In the case of tellers, we also want small pages, but we'll let - // the fill factor dynamically adjust itself. - // - h_nelem = (int)num_t; - - try { - - dbp = new Db(this, 0); - - dbp.set_h_nelem(h_nelem); - dbp.set_h_ffactor(0); - dbp.set_pagesize(512); - - dbp.open(null, "teller", null, Db.DB_HASH, - Db.DB_CREATE | Db.DB_TRUNCATE, 0644); - } - // can be DbException or FileNotFoundException - catch (Exception e5) { - errExit(e5, "Teller file create failed"); - } - - start_tnum = idnum; - populateTable(dbp, idnum, balance, h_nelem, "teller"); - idnum += h_nelem; - end_tnum = idnum - 1; - - try { - dbp.close(0); - } - catch (DbException e6) { - errExit(e6, "Close of teller file failed"); - } - - if (verbose) - System.out.println("Populated tellers: " - + String.valueOf(start_tnum) + " - " + String.valueOf(end_tnum)); - - try { - dbp = new Db(this, 0); - dbp.set_re_len(HISTORY_LEN); - dbp.open(null, "history", null, Db.DB_RECNO, - Db.DB_CREATE | Db.DB_TRUNCATE, 0644); - } - // can be DbException or FileNotFoundException - catch (Exception e7) { - errExit(e7, "Create of history file failed"); - } - - populateHistory(dbp, num_h, num_a, num_b, num_t); - - try { - dbp.close(0); - } - catch (DbException e8) { - errExit(e8, "Close of history file failed"); - } - } - - public void - populateTable(Db dbp, - int start_id, int balance, - int nrecs, String msg) - { - Defrec drec = new Defrec(); - - Dbt kdbt = new Dbt(drec.data); - kdbt.set_size(4); // sizeof(int) - Dbt ddbt = new Dbt(drec.data); - ddbt.set_size(drec.data.length); // uses whole array - - try { - for (int i = 0; i < nrecs; i++) { - kdbt.set_recno_key_data(start_id + (int)i); - drec.set_balance(balance); - dbp.put(null, kdbt, ddbt, Db.DB_NOOVERWRITE); - } - } - catch (DbException dbe) { - System.err.println("Failure initializing " + msg + " file: " + - dbe.toString()); - System.exit(1); - } - } - - public void - populateHistory(Db dbp, int nrecs, - int anum, int bnum, int tnum) - { - Histrec hrec = new Histrec(); - hrec.set_amount(10); - - byte arr[] = new byte[4]; // sizeof(int) - int i; - Dbt kdbt = new Dbt(arr); - kdbt.set_size(arr.length); - Dbt ddbt = new Dbt(hrec.data); - ddbt.set_size(hrec.data.length); - - try { - for (i = 1; i <= nrecs; i++) { - kdbt.set_recno_key_data(i); - - hrec.set_aid(random_id(ACCOUNT, anum, bnum, tnum)); - hrec.set_bid(random_id(BRANCH, anum, bnum, tnum)); - hrec.set_tid(random_id(TELLER, anum, bnum, tnum)); - - dbp.put(null, kdbt, ddbt, Db.DB_APPEND); - } - } - catch (DbException dbe) { - errExit(dbe, "Failure initializing history file"); - } - } - - static Random rand = new Random(); - - public static int - random_int(int lo, int hi) - { - int ret; - int t; - - t = rand.nextInt(); - if (t < 0) - t = -t; - ret = (int)(((double)t / ((double)(Integer.MAX_VALUE) + 1)) * - (hi - lo + 1)); - ret += lo; - return (ret); - } - - public static int - random_id(int type, int accounts, int branches, int tellers) - { - int min, max, num; - - max = min = BEGID; - num = accounts; - switch(type) { - case TELLER: - min += branches; - num = tellers; - // Fallthrough - case BRANCH: - if (type == BRANCH) - num = branches; - min += accounts; - // Fallthrough - case ACCOUNT: - max = min + num - 1; - } - return (random_int(min, max)); - } - - public void - run(int n, int accounts, int branches, int tellers) - { - Db adb = null; - Db bdb = null; - Db hdb = null; - Db tdb = null; - double gtps, itps; - int failed, ifailed, ret, txns; - long starttime, curtime, lasttime; - - // - // Open the database files. - // - int err; - try { - adb = new Db(this, 0); - adb.open(null, "account", null, Db.DB_UNKNOWN, - Db.DB_AUTO_COMMIT, 0); - bdb = new Db(this, 0); - bdb.open(null, "branch", null, Db.DB_UNKNOWN, - Db.DB_AUTO_COMMIT, 0); - tdb = new Db(this, 0); - tdb.open(null, "teller", null, Db.DB_UNKNOWN, - Db.DB_AUTO_COMMIT, 0); - hdb = new Db(this, 0); - hdb.open(null, "history", null, Db.DB_UNKNOWN, - Db.DB_AUTO_COMMIT, 0); - } - catch (DbException dbe) { - errExit(dbe, "Open of db files failed"); - } - catch (FileNotFoundException fnfe) { - errExit(fnfe, "Open of db files failed, missing file"); - } - - txns = failed = ifailed = 0; - starttime = (new Date()).getTime(); - lasttime = starttime; - while (n-- > 0) { - txns++; - ret = txn(adb, bdb, tdb, hdb, accounts, branches, tellers); - if (ret != 0) { - failed++; - ifailed++; - } - if (n % 5000 == 0) { - curtime = (new Date()).getTime(); - gtps = (double)(txns - failed) / - ((curtime - starttime) / 1000.0); - itps = (double)(5000 - ifailed) / - ((curtime - lasttime) / 1000.0); - System.out.print(String.valueOf(txns) + " txns " + - String.valueOf(failed) + " failed "); - System.out.println(showRounded(gtps, 2) + " TPS (gross) " + - showRounded(itps, 2) + " TPS (interval)"); - lasttime = curtime; - ifailed = 0; - } - } - - try { - adb.close(0); - bdb.close(0); - tdb.close(0); - hdb.close(0); - } - catch (DbException dbe2) { - errExit(dbe2, "Close of db files failed"); - } - - System.out.println((long)txns + " transactions begun " - + String.valueOf(failed) + " failed"); - - } - - // - // XXX Figure out the appropriate way to pick out IDs. - // - public int - txn(Db adb, Db bdb, Db tdb, Db hdb, - int anum, int bnum, int tnum) - { - Dbc acurs = null; - Dbc bcurs = null; - Dbc hcurs = null; - Dbc tcurs = null; - DbTxn t = null; - - Defrec rec = new Defrec(); - Histrec hrec = new Histrec(); - int account, branch, teller; - - Dbt d_dbt = new Dbt(); - Dbt d_histdbt = new Dbt(); - Dbt k_dbt = new Dbt(); - Dbt k_histdbt = new Dbt(); - - account = random_id(ACCOUNT, anum, bnum, tnum); - branch = random_id(BRANCH, anum, bnum, tnum); - teller = random_id(TELLER, anum, bnum, tnum); - - // The history key will not actually be retrieved, - // but it does need to be set to something. - byte hist_key[] = new byte[4]; - k_histdbt.set_data(hist_key); - k_histdbt.set_size(4 /* == sizeof(int)*/); - - byte key_bytes[] = new byte[4]; - k_dbt.set_data(key_bytes); - k_dbt.set_size(4 /* == sizeof(int)*/); - - d_dbt.set_flags(Db.DB_DBT_USERMEM); - d_dbt.set_data(rec.data); - d_dbt.set_ulen(rec.length()); - - hrec.set_aid(account); - hrec.set_bid(branch); - hrec.set_tid(teller); - hrec.set_amount(10); - // Request 0 bytes since we're just positioning. - d_histdbt.set_flags(Db.DB_DBT_PARTIAL); - - // START TIMING - - try { - t = txn_begin(null, 0); - - acurs = adb.cursor(t, 0); - bcurs = bdb.cursor(t, 0); - tcurs = tdb.cursor(t, 0); - hcurs = hdb.cursor(t, 0); - - // Account record - k_dbt.set_recno_key_data(account); - if (acurs.get(k_dbt, d_dbt, Db.DB_SET) != 0) - throw new TpcbException("acurs get failed"); - rec.set_balance(rec.get_balance() + 10); - acurs.put(k_dbt, d_dbt, Db.DB_CURRENT); - - // Branch record - k_dbt.set_recno_key_data(branch); - if (bcurs.get(k_dbt, d_dbt, Db.DB_SET) != 0) - throw new TpcbException("bcurs get failed"); - rec.set_balance(rec.get_balance() + 10); - bcurs.put(k_dbt, d_dbt, Db.DB_CURRENT); - - // Teller record - k_dbt.set_recno_key_data(teller); - if (tcurs.get(k_dbt, d_dbt, Db.DB_SET) != 0) - throw new TpcbException("ccurs get failed"); - rec.set_balance(rec.get_balance() + 10); - tcurs.put(k_dbt, d_dbt, Db.DB_CURRENT); - - // History record - d_histdbt.set_flags(0); - d_histdbt.set_data(hrec.data); - d_histdbt.set_ulen(hrec.length()); - if (hdb.put(t, k_histdbt, d_histdbt, Db.DB_APPEND) != 0) - throw(new DbException("put failed")); - - acurs.close(); - bcurs.close(); - tcurs.close(); - hcurs.close(); - - // null out t in advance; if the commit fails, - // we don't want to abort it in the catch clause. - DbTxn tmptxn = t; - t = null; - tmptxn.commit(0); - - // END TIMING - return (0); - - } - catch (Exception e) { - try { - if (acurs != null) - acurs.close(); - if (bcurs != null) - bcurs.close(); - if (tcurs != null) - tcurs.close(); - if (hcurs != null) - hcurs.close(); - if (t != null) - t.abort(); - } - catch (DbException dbe) { - // not much we can do here. - } - - if (verbose) { - System.out.println("Transaction A=" + String.valueOf(account) - + " B=" + String.valueOf(branch) - + " T=" + String.valueOf(teller) + " failed"); - System.out.println("Reason: " + e.toString()); - } - return (-1); - } - } - - static void errExit(Exception err, String s) - { - System.err.print(progname + ": "); - if (s != null) { - System.err.print(s + ": "); - } - System.err.println(err.toString()); - System.exit(1); - } - - public static void main(String argv[]) - { - long seed; - int accounts, branches, tellers, history; - boolean iflag, txn_no_sync; - int mpool, ntxns; - String home, endarg; - - home = "TESTDIR"; - accounts = branches = history = tellers = 0; - txn_no_sync = false; - mpool = ntxns = 0; - verbose = false; - iflag = false; - seed = (new GregorianCalendar()).get(Calendar.SECOND); - - for (int i = 0; i < argv.length; ++i) - { - if (argv[i].equals("-a")) { - // Number of account records - if ((accounts = Integer.parseInt(argv[++i])) <= 0) - invarg(argv[i]); - } - else if (argv[i].equals("-b")) { - // Number of branch records - if ((branches = Integer.parseInt(argv[++i])) <= 0) - invarg(argv[i]); - } - else if (argv[i].equals("-c")) { - // Cachesize in bytes - if ((mpool = Integer.parseInt(argv[++i])) <= 0) - invarg(argv[i]); - } - else if (argv[i].equals("-f")) { - // Fast mode: no txn sync. - txn_no_sync = true; - } - else if (argv[i].equals("-h")) { - // DB home. - home = argv[++i]; - } - else if (argv[i].equals("-i")) { - // Initialize the test. - iflag = true; - } - else if (argv[i].equals("-n")) { - // Number of transactions - if ((ntxns = Integer.parseInt(argv[++i])) <= 0) - invarg(argv[i]); - } - else if (argv[i].equals("-S")) { - // Random number seed. - seed = Long.parseLong(argv[++i]); - if (seed <= 0) - invarg(argv[i]); - } - else if (argv[i].equals("-s")) { - // Number of history records - if ((history = Integer.parseInt(argv[++i])) <= 0) - invarg(argv[i]); - } - else if (argv[i].equals("-t")) { - // Number of teller records - if ((tellers = Integer.parseInt(argv[++i])) <= 0) - invarg(argv[i]); - } - else if (argv[i].equals("-v")) { - // Verbose option. - verbose = true; - } - else - { - usage(); - } - } - - rand.setSeed((int)seed); - - TpcbExample app = null; - - // Initialize the database environment. - // Must be done in within a try block. - // - try { - app = new TpcbExample(home, mpool, iflag, - txn_no_sync ? Db.DB_TXN_NOSYNC : 0); - } - catch (Exception e1) { - errExit(e1, "initializing environment failed"); - } - - accounts = accounts == 0 ? ACCOUNTS : accounts; - branches = branches == 0 ? BRANCHES : branches; - tellers = tellers == 0 ? TELLERS : tellers; - history = history == 0 ? HISTORY : history; - - if (verbose) - System.out.println((long)accounts + " Accounts, " - + String.valueOf(branches) + " Branches, " - + String.valueOf(tellers) + " Tellers, " - + String.valueOf(history) + " History"); - - if (iflag) { - if (ntxns != 0) - usage(); - app.populate(accounts, branches, history, tellers); - } - else { - if (ntxns == 0) - usage(); - app.run(ntxns, accounts, branches, tellers); - } - - // Shut down the application. - - try { - app.close(0); - } - catch (DbException dbe2) { - errExit(dbe2, "appexit failed"); - } - - System.exit(0); - } - - private static void invarg(String str) - { - System.err.println("TpcbExample: invalid argument: " + str); - System.exit(1); - } - - private static void usage() - { - System.err.println( - "usage: TpcbExample [-fiv] [-a accounts] [-b branches]\n" + - " [-c cachesize] [-h home] [-n transactions ]\n" + - " [-S seed] [-s history] [-t tellers]"); - System.exit(1); - } - - // round 'd' to 'scale' digits, and return result as string - private String showRounded(double d, int scale) - { - return new BigDecimal(d). - setScale(scale, BigDecimal.ROUND_HALF_DOWN).toString(); - } - - // The byte order is our choice. - // - static long get_int_in_array(byte[] array, int offset) - { - return - ((0xff & array[offset+0]) << 0) | - ((0xff & array[offset+1]) << 8) | - ((0xff & array[offset+2]) << 16) | - ((0xff & array[offset+3]) << 24); - } - - // Note: Value needs to be long to avoid sign extension - static void set_int_in_array(byte[] array, int offset, long value) - { - array[offset+0] = (byte)((value >> 0) & 0x0ff); - array[offset+1] = (byte)((value >> 8) & 0x0ff); - array[offset+2] = (byte)((value >> 16) & 0x0ff); - array[offset+3] = (byte)((value >> 24) & 0x0ff); - } - -}; - -// Simulate the following C struct: -// struct Defrec { -// u_int32_t id; -// u_int32_t balance; -// u_int8_t pad[RECLEN - sizeof(int) - sizeof(int)]; -// }; - -class Defrec -{ - public Defrec() - { - data = new byte[TpcbExample.RECLEN]; - } - - public int length() - { - return TpcbExample.RECLEN; - } - - public long get_id() - { - return TpcbExample.get_int_in_array(data, 0); - } - - public void set_id(long value) - { - TpcbExample.set_int_in_array(data, 0, value); - } - - public long get_balance() - { - return TpcbExample.get_int_in_array(data, 4); - } - - public void set_balance(long value) - { - TpcbExample.set_int_in_array(data, 4, value); - } - - static { - Defrec d = new Defrec(); - d.set_balance(500000); - } - - public byte[] data; -} - -// Simulate the following C struct: -// struct Histrec { -// u_int32_t aid; -// u_int32_t bid; -// u_int32_t tid; -// u_int32_t amount; -// u_int8_t pad[RECLEN - 4 * sizeof(u_int32_t)]; -// }; - -class Histrec -{ - public Histrec() - { - data = new byte[TpcbExample.RECLEN]; - } - - public int length() - { - return TpcbExample.RECLEN; - } - - public long get_aid() - { - return TpcbExample.get_int_in_array(data, 0); - } - - public void set_aid(long value) - { - TpcbExample.set_int_in_array(data, 0, value); - } - - public long get_bid() - { - return TpcbExample.get_int_in_array(data, 4); - } - - public void set_bid(long value) - { - TpcbExample.set_int_in_array(data, 4, value); - } - - public long get_tid() - { - return TpcbExample.get_int_in_array(data, 8); - } - - public void set_tid(long value) - { - TpcbExample.set_int_in_array(data, 8, value); - } - - public long get_amount() - { - return TpcbExample.get_int_in_array(data, 12); - } - - public void set_amount(long value) - { - TpcbExample.set_int_in_array(data, 12, value); - } - - public byte[] data; -} - -class TpcbException extends Exception -{ - TpcbException() - { - super(); - } - - TpcbException(String s) - { - super(s); - } -} |