diff options
author | unknown <ram@mysql.r18.ru> | 2002-10-30 15:57:05 +0400 |
---|---|---|
committer | unknown <ram@mysql.r18.ru> | 2002-10-30 15:57:05 +0400 |
commit | 155e78f014de1a2e259ae5119f4621fbb210a784 (patch) | |
tree | 6881a3cca88bea0bb9eeffd5aae34be437152786 /bdb/java/src | |
parent | b8798d25ab71436bf690ee8ae48285a655c5487e (diff) | |
download | mariadb-git-155e78f014de1a2e259ae5119f4621fbb210a784.tar.gz |
BDB 4.1.24
BitKeeper/deleted/.del-ex_access.wpj~3df6ae8c99bf7c5f:
Delete: bdb/build_vxworks/ex_access/ex_access.wpj
BitKeeper/deleted/.del-ex_btrec.wpj~a7622f1c6f432dc6:
Delete: bdb/build_vxworks/ex_btrec/ex_btrec.wpj
BitKeeper/deleted/.del-ex_dbclient.wpj~7345440f3b204cdd:
Delete: bdb/build_vxworks/ex_dbclient/ex_dbclient.wpj
BitKeeper/deleted/.del-ex_env.wpj~fbe1ab10b04e8b74:
Delete: bdb/build_vxworks/ex_env/ex_env.wpj
BitKeeper/deleted/.del-ex_mpool.wpj~4479cfd5c45f327d:
Delete: bdb/build_vxworks/ex_mpool/ex_mpool.wpj
BitKeeper/deleted/.del-ex_tpcb.wpj~f78093006e14bf41:
Delete: bdb/build_vxworks/ex_tpcb/ex_tpcb.wpj
BitKeeper/deleted/.del-db_buildall.dsp~bd749ff6da11682:
Delete: bdb/build_win32/db_buildall.dsp
BitKeeper/deleted/.del-cxx_app.cpp~ad8df8e0791011ed:
Delete: bdb/cxx/cxx_app.cpp
BitKeeper/deleted/.del-cxx_log.cpp~a50ff3118fe06952:
Delete: bdb/cxx/cxx_log.cpp
BitKeeper/deleted/.del-cxx_table.cpp~ecd751e79b055556:
Delete: bdb/cxx/cxx_table.cpp
BitKeeper/deleted/.del-namemap.txt~796a3acd3885d8fd:
Delete: bdb/cxx/namemap.txt
BitKeeper/deleted/.del-Design.fileop~3ca4da68f1727373:
Delete: bdb/db/Design.fileop
BitKeeper/deleted/.del-db185_int.h~61bee3736e7959ef:
Delete: bdb/db185/db185_int.h
BitKeeper/deleted/.del-acconfig.h~411e8854d67ad8b5:
Delete: bdb/dist/acconfig.h
BitKeeper/deleted/.del-mutex.m4~a13383cde18a64e1:
Delete: bdb/dist/aclocal/mutex.m4
BitKeeper/deleted/.del-options.m4~b9d0ca637213750a:
Delete: bdb/dist/aclocal/options.m4
BitKeeper/deleted/.del-programs.m4~3ce7890b47732b30:
Delete: bdb/dist/aclocal/programs.m4
BitKeeper/deleted/.del-tcl.m4~f944e2db93c3b6db:
Delete: bdb/dist/aclocal/tcl.m4
BitKeeper/deleted/.del-types.m4~59cae158c9a32cff:
Delete: bdb/dist/aclocal/types.m4
BitKeeper/deleted/.del-script~d38f6d3a4f159cb4:
Delete: bdb/dist/build/script
BitKeeper/deleted/.del-configure.in~ac795a92c8fe049c:
Delete: bdb/dist/configure.in
BitKeeper/deleted/.del-ltconfig~66bbd007d8024af:
Delete: bdb/dist/ltconfig
BitKeeper/deleted/.del-rec_ctemp~a28554362534f00a:
Delete: bdb/dist/rec_ctemp
BitKeeper/deleted/.del-s_tcl~2ffe4326459fcd9f:
Delete: bdb/dist/s_tcl
BitKeeper/deleted/.del-.IGNORE_ME~d8148b08fa7d5d15:
Delete: bdb/dist/template/.IGNORE_ME
BitKeeper/deleted/.del-btree.h~179f2aefec1753d:
Delete: bdb/include/btree.h
BitKeeper/deleted/.del-cxx_int.h~6b649c04766508f8:
Delete: bdb/include/cxx_int.h
BitKeeper/deleted/.del-db.src~6b433ae615b16a8d:
Delete: bdb/include/db.src
BitKeeper/deleted/.del-db_185.h~ad8b373d9391d35c:
Delete: bdb/include/db_185.h
BitKeeper/deleted/.del-db_am.h~a714912b6b75932f:
Delete: bdb/include/db_am.h
BitKeeper/deleted/.del-db_cxx.h~fcafadf45f5d19e9:
Delete: bdb/include/db_cxx.h
BitKeeper/deleted/.del-db_dispatch.h~6844f20f7eb46904:
Delete: bdb/include/db_dispatch.h
BitKeeper/deleted/.del-db_int.src~419a3f48b6a01da7:
Delete: bdb/include/db_int.src
BitKeeper/deleted/.del-db_join.h~76f9747a42c3399a:
Delete: bdb/include/db_join.h
BitKeeper/deleted/.del-db_page.h~e302ca3a4db3abdc:
Delete: bdb/include/db_page.h
BitKeeper/deleted/.del-db_server_int.h~e1d20b6ba3bca1ab:
Delete: bdb/include/db_server_int.h
BitKeeper/deleted/.del-db_shash.h~5fbf2d696fac90f3:
Delete: bdb/include/db_shash.h
BitKeeper/deleted/.del-db_swap.h~1e60887550864a59:
Delete: bdb/include/db_swap.h
BitKeeper/deleted/.del-db_upgrade.h~c644eee73701fc8d:
Delete: bdb/include/db_upgrade.h
BitKeeper/deleted/.del-db_verify.h~b8d6c297c61f342e:
Delete: bdb/include/db_verify.h
BitKeeper/deleted/.del-debug.h~dc2b4f2cf27ccebc:
Delete: bdb/include/debug.h
BitKeeper/deleted/.del-hash.h~2aaa548b28882dfb:
Delete: bdb/include/hash.h
BitKeeper/deleted/.del-lock.h~a761c1b7de57b77f:
Delete: bdb/include/lock.h
BitKeeper/deleted/.del-log.h~ff20184238e35e4d:
Delete: bdb/include/log.h
BitKeeper/deleted/.del-mp.h~7e317597622f3411:
Delete: bdb/include/mp.h
BitKeeper/deleted/.del-mutex.h~d3ae7a2977a68137:
Delete: bdb/include/mutex.h
BitKeeper/deleted/.del-os.h~91867cc8757cd0e3:
Delete: bdb/include/os.h
BitKeeper/deleted/.del-os_jump.h~e1b939fa5151d4be:
Delete: bdb/include/os_jump.h
BitKeeper/deleted/.del-qam.h~6fad0c1b5723d597:
Delete: bdb/include/qam.h
BitKeeper/deleted/.del-queue.h~4c72c0826c123d5:
Delete: bdb/include/queue.h
BitKeeper/deleted/.del-region.h~513fe04d977ca0fc:
Delete: bdb/include/region.h
BitKeeper/deleted/.del-shqueue.h~525fc3e6c2025c36:
Delete: bdb/include/shqueue.h
BitKeeper/deleted/.del-tcl_db.h~c536fd61a844f23f:
Delete: bdb/include/tcl_db.h
BitKeeper/deleted/.del-txn.h~c8d94b221ec147e4:
Delete: bdb/include/txn.h
BitKeeper/deleted/.del-xa.h~ecc466493aae9d9a:
Delete: bdb/include/xa.h
BitKeeper/deleted/.del-DbRecoveryInit.java~756b52601a0b9023:
Delete: bdb/java/src/com/sleepycat/db/DbRecoveryInit.java
BitKeeper/deleted/.del-DbTxnRecover.java~74607cba7ab89d6d:
Delete: bdb/java/src/com/sleepycat/db/DbTxnRecover.java
BitKeeper/deleted/.del-lock_conflict.c~fc5e0f14cf597a2b:
Delete: bdb/lock/lock_conflict.c
BitKeeper/deleted/.del-log.src~53ac9e7b5cb023f2:
Delete: bdb/log/log.src
BitKeeper/deleted/.del-log_findckp.c~24287f008916e81f:
Delete: bdb/log/log_findckp.c
BitKeeper/deleted/.del-log_rec.c~d51711f2cac09297:
Delete: bdb/log/log_rec.c
BitKeeper/deleted/.del-log_register.c~b40bb4efac75ca15:
Delete: bdb/log/log_register.c
BitKeeper/deleted/.del-Design~b3d0f179f2767b:
Delete: bdb/mp/Design
BitKeeper/deleted/.del-os_finit.c~95dbefc6fe79b26c:
Delete: bdb/os/os_finit.c
BitKeeper/deleted/.del-os_abs.c~df95d1e7db81924:
Delete: bdb/os_vxworks/os_abs.c
BitKeeper/deleted/.del-os_finit.c~803b484bdb9d0122:
Delete: bdb/os_vxworks/os_finit.c
BitKeeper/deleted/.del-os_map.c~3a6d7926398b76d3:
Delete: bdb/os_vxworks/os_map.c
BitKeeper/deleted/.del-os_finit.c~19a227c6d3c78ad:
Delete: bdb/os_win32/os_finit.c
BitKeeper/deleted/.del-log-corruption.patch~1cf2ecc7c6408d5d:
Delete: bdb/patches/log-corruption.patch
BitKeeper/deleted/.del-Btree.pm~af6d0c5eaed4a98e:
Delete: bdb/perl.BerkeleyDB/BerkeleyDB/Btree.pm
BitKeeper/deleted/.del-BerkeleyDB.pm~7244036d4482643:
Delete: bdb/perl.BerkeleyDB/BerkeleyDB.pm
BitKeeper/deleted/.del-BerkeleyDB.pod~e7b18fd6132448e3:
Delete: bdb/perl.BerkeleyDB/BerkeleyDB.pod
BitKeeper/deleted/.del-Hash.pm~10292a26c06a5c95:
Delete: bdb/perl.BerkeleyDB/BerkeleyDB/Hash.pm
BitKeeper/deleted/.del-BerkeleyDB.pod.P~79f76a1495eda203:
Delete: bdb/perl.BerkeleyDB/BerkeleyDB.pod.P
BitKeeper/deleted/.del-BerkeleyDB.xs~80c99afbd98e392c:
Delete: bdb/perl.BerkeleyDB/BerkeleyDB.xs
BitKeeper/deleted/.del-Changes~729c1891efa60de9:
Delete: bdb/perl.BerkeleyDB/Changes
BitKeeper/deleted/.del-MANIFEST~63a1e34aecf157a0:
Delete: bdb/perl.BerkeleyDB/MANIFEST
BitKeeper/deleted/.del-Makefile.PL~c68797707d8df87a:
Delete: bdb/perl.BerkeleyDB/Makefile.PL
BitKeeper/deleted/.del-README~5f2f579b1a241407:
Delete: bdb/perl.BerkeleyDB/README
BitKeeper/deleted/.del-Todo~dca3c66c193adda9:
Delete: bdb/perl.BerkeleyDB/Todo
BitKeeper/deleted/.del-config.in~ae81681e450e0999:
Delete: bdb/perl.BerkeleyDB/config.in
BitKeeper/deleted/.del-dbinfo~28ad67d83be4f68e:
Delete: bdb/perl.BerkeleyDB/dbinfo
BitKeeper/deleted/.del-mkconsts~543ab60669c7a04e:
Delete: bdb/perl.BerkeleyDB/mkconsts
BitKeeper/deleted/.del-mkpod~182c0ca54e439afb:
Delete: bdb/perl.BerkeleyDB/mkpod
BitKeeper/deleted/.del-5.004~e008cb5a48805543:
Delete: bdb/perl.BerkeleyDB/patches/5.004
BitKeeper/deleted/.del-irix_6_5.pl~61662bb08afcdec8:
Delete: bdb/perl.BerkeleyDB/hints/irix_6_5.pl
BitKeeper/deleted/.del-solaris.pl~6771e7182394e152:
Delete: bdb/perl.BerkeleyDB/hints/solaris.pl
BitKeeper/deleted/.del-typemap~783b8f5295b05f3d:
Delete: bdb/perl.BerkeleyDB/typemap
BitKeeper/deleted/.del-5.004_01~6081ce2fff7b0bc:
Delete: bdb/perl.BerkeleyDB/patches/5.004_01
BitKeeper/deleted/.del-5.004_02~87214eac35ad9e6:
Delete: bdb/perl.BerkeleyDB/patches/5.004_02
BitKeeper/deleted/.del-5.004_03~9a672becec7cb40f:
Delete: bdb/perl.BerkeleyDB/patches/5.004_03
BitKeeper/deleted/.del-5.004_04~e326cb51af09d154:
Delete: bdb/perl.BerkeleyDB/patches/5.004_04
BitKeeper/deleted/.del-5.004_05~7ab457a1e41a92fe:
Delete: bdb/perl.BerkeleyDB/patches/5.004_05
BitKeeper/deleted/.del-5.005~f9e2d59b5964cd4b:
Delete: bdb/perl.BerkeleyDB/patches/5.005
BitKeeper/deleted/.del-5.005_01~3eb9fb7b5842ea8e:
Delete: bdb/perl.BerkeleyDB/patches/5.005_01
BitKeeper/deleted/.del-5.005_02~67477ce0bef717cb:
Delete: bdb/perl.BerkeleyDB/patches/5.005_02
BitKeeper/deleted/.del-5.005_03~c4c29a1fb21e290a:
Delete: bdb/perl.BerkeleyDB/patches/5.005_03
BitKeeper/deleted/.del-5.6.0~e1fb9897d124ee22:
Delete: bdb/perl.BerkeleyDB/patches/5.6.0
BitKeeper/deleted/.del-btree.t~e4a1a3c675ddc406:
Delete: bdb/perl.BerkeleyDB/t/btree.t
BitKeeper/deleted/.del-db-3.0.t~d2c60991d84558f2:
Delete: bdb/perl.BerkeleyDB/t/db-3.0.t
BitKeeper/deleted/.del-db-3.1.t~6ee88cd13f55e018:
Delete: bdb/perl.BerkeleyDB/t/db-3.1.t
BitKeeper/deleted/.del-db-3.2.t~f73b6461f98fd1cf:
Delete: bdb/perl.BerkeleyDB/t/db-3.2.t
BitKeeper/deleted/.del-destroy.t~cc6a2ae1980a2ecd:
Delete: bdb/perl.BerkeleyDB/t/destroy.t
BitKeeper/deleted/.del-env.t~a8604a4499c4bd07:
Delete: bdb/perl.BerkeleyDB/t/env.t
BitKeeper/deleted/.del-examples.t~2571b77c3cc75574:
Delete: bdb/perl.BerkeleyDB/t/examples.t
BitKeeper/deleted/.del-examples.t.T~8228bdd75ac78b88:
Delete: bdb/perl.BerkeleyDB/t/examples.t.T
BitKeeper/deleted/.del-examples3.t.T~66a186897a87026d:
Delete: bdb/perl.BerkeleyDB/t/examples3.t.T
BitKeeper/deleted/.del-examples3.t~fe3822ba2f2d7f83:
Delete: bdb/perl.BerkeleyDB/t/examples3.t
BitKeeper/deleted/.del-filter.t~f87b045c1b708637:
Delete: bdb/perl.BerkeleyDB/t/filter.t
BitKeeper/deleted/.del-hash.t~616bfb4d644de3a3:
Delete: bdb/perl.BerkeleyDB/t/hash.t
BitKeeper/deleted/.del-join.t~29fc39f74a83ca22:
Delete: bdb/perl.BerkeleyDB/t/join.t
BitKeeper/deleted/.del-mldbm.t~31f5015341eea040:
Delete: bdb/perl.BerkeleyDB/t/mldbm.t
BitKeeper/deleted/.del-queue.t~8f338034ce44a641:
Delete: bdb/perl.BerkeleyDB/t/queue.t
BitKeeper/deleted/.del-recno.t~d4ddbd3743add63e:
Delete: bdb/perl.BerkeleyDB/t/recno.t
BitKeeper/deleted/.del-strict.t~6885cdd2ea71ca2d:
Delete: bdb/perl.BerkeleyDB/t/strict.t
BitKeeper/deleted/.del-subdb.t~aab62a5d5864c603:
Delete: bdb/perl.BerkeleyDB/t/subdb.t
BitKeeper/deleted/.del-txn.t~65033b8558ae1216:
Delete: bdb/perl.BerkeleyDB/t/txn.t
BitKeeper/deleted/.del-unknown.t~f3710458682665e1:
Delete: bdb/perl.BerkeleyDB/t/unknown.t
BitKeeper/deleted/.del-Changes~436f74a5c414c65b:
Delete: bdb/perl.DB_File/Changes
BitKeeper/deleted/.del-DB_File.pm~ae0951c6c7665a82:
Delete: bdb/perl.DB_File/DB_File.pm
BitKeeper/deleted/.del-DB_File.xs~89e49a0b5556f1d8:
Delete: bdb/perl.DB_File/DB_File.xs
BitKeeper/deleted/.del-DB_File_BS~290fad5dbbb87069:
Delete: bdb/perl.DB_File/DB_File_BS
BitKeeper/deleted/.del-MANIFEST~90ee581572bdd4ac:
Delete: bdb/perl.DB_File/MANIFEST
BitKeeper/deleted/.del-Makefile.PL~ac0567bb5a377e38:
Delete: bdb/perl.DB_File/Makefile.PL
BitKeeper/deleted/.del-README~77e924a5a9bae6b3:
Delete: bdb/perl.DB_File/README
BitKeeper/deleted/.del-config.in~ab4c2792b86a810b:
Delete: bdb/perl.DB_File/config.in
BitKeeper/deleted/.del-dbinfo~461c43b30fab2cb:
Delete: bdb/perl.DB_File/dbinfo
BitKeeper/deleted/.del-dynixptx.pl~50dcddfae25d17e9:
Delete: bdb/perl.DB_File/hints/dynixptx.pl
BitKeeper/deleted/.del-typemap~55cffb3288a9e587:
Delete: bdb/perl.DB_File/typemap
BitKeeper/deleted/.del-version.c~a4df0e646f8b3975:
Delete: bdb/perl.DB_File/version.c
BitKeeper/deleted/.del-5.004_01~d6830d0082702af7:
Delete: bdb/perl.DB_File/patches/5.004_01
BitKeeper/deleted/.del-5.004_02~78b082dc80c91031:
Delete: bdb/perl.DB_File/patches/5.004_02
BitKeeper/deleted/.del-5.004~4411ec2e3c9e008b:
Delete: bdb/perl.DB_File/patches/5.004
BitKeeper/deleted/.del-sco.pl~1e795fe14fe4dcfe:
Delete: bdb/perl.DB_File/hints/sco.pl
BitKeeper/deleted/.del-5.004_03~33f274648b160d95:
Delete: bdb/perl.DB_File/patches/5.004_03
BitKeeper/deleted/.del-5.004_04~8f3d1b3cf18bb20a:
Delete: bdb/perl.DB_File/patches/5.004_04
BitKeeper/deleted/.del-5.004_05~9c0f02e7331e142:
Delete: bdb/perl.DB_File/patches/5.004_05
BitKeeper/deleted/.del-5.005~c2108cb2e3c8d951:
Delete: bdb/perl.DB_File/patches/5.005
BitKeeper/deleted/.del-5.005_01~3b45e9673afc4cfa:
Delete: bdb/perl.DB_File/patches/5.005_01
BitKeeper/deleted/.del-5.005_02~9fe5766bb02a4522:
Delete: bdb/perl.DB_File/patches/5.005_02
BitKeeper/deleted/.del-5.005_03~ffa1c38c19ae72ea:
Delete: bdb/perl.DB_File/patches/5.005_03
BitKeeper/deleted/.del-5.6.0~373be3a5ce47be85:
Delete: bdb/perl.DB_File/patches/5.6.0
BitKeeper/deleted/.del-db-btree.t~3231595a1c241eb3:
Delete: bdb/perl.DB_File/t/db-btree.t
BitKeeper/deleted/.del-db-hash.t~7c4ad0c795c7fad2:
Delete: bdb/perl.DB_File/t/db-hash.t
BitKeeper/deleted/.del-db-recno.t~6c2d3d80b9ba4a50:
Delete: bdb/perl.DB_File/t/db-recno.t
BitKeeper/deleted/.del-db_server.sed~cdb00ebcd48a64e2:
Delete: bdb/rpc_server/db_server.sed
BitKeeper/deleted/.del-db_server_proc.c~d46c8f409c3747f4:
Delete: bdb/rpc_server/db_server_proc.c
BitKeeper/deleted/.del-db_server_svc.sed~3f5e59f334fa4607:
Delete: bdb/rpc_server/db_server_svc.sed
BitKeeper/deleted/.del-db_server_util.c~a809f3a4629acda:
Delete: bdb/rpc_server/db_server_util.c
BitKeeper/deleted/.del-log.tcl~ff1b41f1355b97d7:
Delete: bdb/test/log.tcl
BitKeeper/deleted/.del-mpool.tcl~b0df4dc1b04db26c:
Delete: bdb/test/mpool.tcl
BitKeeper/deleted/.del-mutex.tcl~52fd5c73a150565:
Delete: bdb/test/mutex.tcl
BitKeeper/deleted/.del-txn.tcl~c4ff071550b5446e:
Delete: bdb/test/txn.tcl
BitKeeper/deleted/.del-README~e800a12a5392010a:
Delete: bdb/test/upgrade/README
BitKeeper/deleted/.del-pack-2.6.6.pl~89d5076d758d3e98:
Delete: bdb/test/upgrade/generate-2.X/pack-2.6.6.pl
BitKeeper/deleted/.del-test-2.6.patch~4a52dc83d447547b:
Delete: bdb/test/upgrade/generate-2.X/test-2.6.patch
Diffstat (limited to 'bdb/java/src')
53 files changed, 2020 insertions, 825 deletions
diff --git a/bdb/java/src/com/sleepycat/db/Db.java b/bdb/java/src/com/sleepycat/db/Db.java index de11e28414a..df311795f54 100644 --- a/bdb/java/src/com/sleepycat/db/Db.java +++ b/bdb/java/src/com/sleepycat/db/Db.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: Db.java,v 11.38 2000/12/31 19:26:22 bostic Exp $ + * $Id: Db.java,v 11.110 2002/09/09 20:47:31 bostic Exp $ */ package com.sleepycat.db; @@ -18,228 +18,180 @@ import java.io.FileNotFoundException; */ public class Db { - // All constant and flag values used with Db* classes are defined here. - - // Collectively, these constants are known by the name - // "DBTYPE" in the documentation. - // - public static final int DB_BTREE = 1; // B+tree - public static final int DB_HASH = 2; // Extended Linear Hashing. - public static final int DB_RECNO = 3; // Fixed and variable-length records. - public static final int DB_QUEUE = 4; // Queue - public static final int DB_UNKNOWN = 5; // Figure it out on open. - - // Flags understood by DbEnv() - // - // Note: DB_CXX_NO_EXCEPTIONS will have no effect in Java. - // - public static final int DB_CXX_NO_EXCEPTIONS; // C++: return error values - public static final int DB_CLIENT; // Open for a client environment. - - // Flags understood by Db() - // - public static final int DB_XA_CREATE; // Open in an XA environment. - - // Flags understood by Db.open(), DbEnv.open(). - // - public static final int DB_CREATE; // O_CREAT: create file as necessary. - public static final int DB_NOMMAP; // Don't mmap underlying file. - public static final int DB_THREAD; // Free-thread DB package handles. - - // Flags understood by only DbEnv.open(). - // - public static final int DB_LOCKDOWN; // Lock memory into physical core. - public static final int DB_PRIVATE; // DB_ENV is process local. - - // - // Flags understood by DbEnv.txn_begin(). - // - public static final int DB_TXN_NOWAIT; // Do not wait for locks in this TXN. - public static final int DB_TXN_SYNC; // Always sync log on commit. - - // Flags understood by DbEnv.set_flags(). - // - public static final int DB_CDB_ALLDB; // In CDB, lock across environment. - - // - // Flags understood by Db.open(). - // - public static final int DB_EXCL; // Exclusive open (O_EXCL). - public static final int DB_RDONLY; // Read-only (O_RDONLY). - public static final int DB_TRUNCATE; // Discard existing DB. - public static final int DB_UPGRADE; // Upgrade if necessary. - - // - // DB (user visible) error return codes. - // - public static final int DB_INCOMPLETE = -30999; // Sync didn't finish. - public static final int DB_KEYEMPTY = -30998; // The key/data pair was deleted or - // was never created by the user. - public static final int DB_KEYEXIST = -30997; // The key/data pair already exists. - public static final int DB_LOCK_DEADLOCK = -30996; // Locker killed to resolve deadlock. - public static final int DB_LOCK_NOTGRANTED = -30995; // Lock unavailable, no-wait set. - public static final int DB_NOSERVER = -30994; // Server panic return. - public static final int DB_NOSERVER_HOME = -30993; // Bad home sent to server. - public static final int DB_NOSERVER_ID = -30992; // Bad ID sent to server. - public static final int DB_NOTFOUND = -30991; // Key/data pair not found (EOF). - public static final int DB_OLD_VERSION = -30990; // Out-of-date version. - public static final int DB_RUNRECOVERY = -30989; // Panic return. - public static final int DB_VERIFY_BAD = -30988; // Verify failed; bad format. - - // - // Flags used by DbEnv.open and DbEnv.remove. - // - public static final int DB_FORCE; // Force (anything). - public static final int DB_INIT_CDB; // Concurrent Access Methods. - public static final int DB_INIT_LOCK; // Initialize locking. - public static final int DB_INIT_LOG; // Initialize logging. - public static final int DB_INIT_MPOOL; // Initialize mpool. - public static final int DB_INIT_TXN; // Initialize transactions. - public static final int DB_JOINENV; // Initialize all subsystems present. - public static final int DB_RECOVER; // Run normal recovery. - public static final int DB_RECOVER_FATAL; // Run catastrophic recovery. - public static final int DB_SYSTEM_MEM; // Use system-backed memory. - public static final int DB_TXN_NOSYNC; // Do not sync log on commit. - public static final int DB_USE_ENVIRON; // Use the environment. - public static final int DB_USE_ENVIRON_ROOT; // Use the environment if root. - - // - // Operations values to the tx_recover() function. - // - public static final int DB_TXN_BACKWARD_ROLL = 1; - public static final int DB_TXN_FORWARD_ROLL = 2; - public static final int DB_TXN_OPENFILES = 3; - public static final int DB_TXN_REDO = 4; - public static final int DB_TXN_UNDO = 5; - - // - // Verbose flags; used for DbEnv.set_verbose - // - public static final int DB_VERB_CHKPOINT; // List checkpoints. - public static final int DB_VERB_DEADLOCK; // Deadlock detection information. - public static final int DB_VERB_RECOVERY; // Recovery information. - public static final int DB_VERB_WAITSFOR; // Dump waits-for table. - - // - // Deadlock detector modes; used in the DBENV structure to configure the - // locking subsystem. - // - public static final int DB_LOCK_NORUN; - public static final int DB_LOCK_DEFAULT; - public static final int DB_LOCK_OLDEST; - public static final int DB_LOCK_RANDOM; - public static final int DB_LOCK_YOUNGEST; - - // - // Flags understood by only Db.set_flags. - // - public static final int DB_DUP; // Btree, Hash: duplicate keys. - public static final int DB_DUPSORT; // Btree, Hash: duplicate keys. - public static final int DB_RECNUM; // Btree: record numbers. - public static final int DB_RENUMBER; // Recno: renumber on insert/delete. - public static final int DB_REVSPLITOFF;// Btree: turn off reverse splits. - public static final int DB_SNAPSHOT; // Recno: snapshot the input. - - // - // Flags understood by only Db.join - // - public static final int DB_JOIN_NOSORT;// Don't try to optimize join. - - // - // Flags understood by only Db.verify - // - public static final int DB_NOORDERCHK; // Skip order check; subdb w/ user func - public static final int DB_ORDERCHKONLY;// Only perform an order check on subdb - public static final int DB_SALVAGE; // Salvage what looks like data. - public static final int DB_AGGRESSIVE; // Salvage anything which might be data. - - // Collectively, these constants are known by the name - // "db_lockmode_t" in the documentation. - // - public static final int DB_LOCK_NG = 0; // Not granted. - public static final int DB_LOCK_READ = 1; // Shared/read. - public static final int DB_LOCK_WRITE = 2; // Exclusive/write. - public static final int DB_LOCK_IWRITE = 3; // Intent exclusive/write. - public static final int DB_LOCK_IREAD = 4; // Intent to share/read. - public static final int DB_LOCK_IWR = 5; // Intent to read and write. - - // Collectively, these constants are known by the name - // "db_lockop_t" in the documentation. - // - public static final int DB_LOCK_DUMP = 0; // Display held locks. - public static final int DB_LOCK_GET = 1; // Get the lock. - /* Not visible to API: DB_LOCK_INHERIT = 2 // Pass locks to parent. */ - public static final int DB_LOCK_PUT = 3; // Release the lock. - public static final int DB_LOCK_PUT_ALL = 4;// Release locker's locks. - public static final int DB_LOCK_PUT_OBJ = 5;// Release locker's locks on obj. - - // Flag values for DbLock.vec() - public static final int DB_LOCK_NOWAIT; // Don't wait on unavailable lock. - - // Flag values for DbLock.detect() - public static final int DB_LOCK_CONFLICT; // Run on any conflict. - - // - // Flag values for DbLog.archive() - // - public static final int DB_ARCH_ABS; // Absolute pathnames. - public static final int DB_ARCH_DATA; // Data files. - public static final int DB_ARCH_LOG; // Log files. - - // - // DB access method and cursor operation values. - // Each value is an operation code to which - // additional bit flags are added. - // - public static final int DB_AFTER; // Dbc.put() - public static final int DB_APPEND; // Db.put() - public static final int DB_BEFORE; // Dbc.put() - public static final int DB_CACHED_COUNTS; // Db.stat() - public static final int DB_CHECKPOINT; // DbLog.put(), DbLog.get() - public static final int DB_CONSUME; // Db.get() - public static final int DB_CONSUME_WAIT; // Db.get() - public static final int DB_CURLSN; // DbLog.put() - public static final int DB_CURRENT; // Dbc.get(), Dbc.put(), DbLog.get() - public static final int DB_FIRST; // Dbc.get(), DbLog.get() - public static final int DB_FLUSH; // DbLog.put() - public static final int DB_GET_BOTH; // Db.get(), Dbc.get() - public static final int DB_GET_RECNO; // Dbc.get() - public static final int DB_JOIN_ITEM; // Dbc.get() - public static final int DB_KEYFIRST; // Dbc.put() - public static final int DB_KEYLAST; // Dbc.put() - public static final int DB_LAST; // Dbc.get(), DbLog.get() - public static final int DB_NEXT; // Dbc.get(), DbLog.get() - public static final int DB_NEXT_DUP; // Dbc.get() - public static final int DB_NEXT_NODUP; // Dbc.get() - public static final int DB_NODUPDATA; // Don't permit duplicated data - public static final int DB_NOOVERWRITE;// Db.put() - public static final int DB_NOSYNC; // Db.close() - public static final int DB_POSITION; // Dbc.dup() - public static final int DB_PREV; // Dbc.get(), DbLog.get() - public static final int DB_PREV_NODUP; // Dbc.get() - public static final int DB_RECORDCOUNT;// Db.stat() - public static final int DB_SET; // Dbc.get(), DbLog.get() - public static final int DB_SET_RANGE; // Dbc.get() - public static final int DB_SET_RECNO; // Dbc.get() - public static final int DB_WRITECURSOR;// Db.cursor() - - // Other flags that can be added to an operation codes above. - // - public static final int DB_RMW; // Acquire write flag immediately. - - // Collectively, these values are used for Dbt flags - // - // Return in allocated memory. + // 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; - - // Partial put/get. public static final int DB_DBT_PARTIAL; - - // Return in realloc'd memory. public static final int DB_DBT_REALLOC; - - // Return in user's memory. 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 // @@ -265,7 +217,7 @@ public class Db dbenv_ = null; _notify_internal(); } - + private native void _init(DbEnv env, int flags) throws DbException; @@ -274,17 +226,32 @@ public class Db // 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 { - int err; - - dbenv_._remove_db(this); - err = _close(flags); - if (constructor_env_ == null) { - dbenv_._notify_db_close(); + try { + dbenv_._remove_db(this); + return _close(flags); + } + finally { + if (constructor_env_ == null) { + dbenv_._notify_db_close(); + } + dbenv_ = null; } - return err; } public native int _close(int flags) @@ -307,7 +274,10 @@ public class Db protected void finalize() throws Throwable { - _finalize(dbenv_.errcall_, dbenv_.errpfx_); + if (dbenv_ == null) + _finalize(null, null); + else + _finalize(dbenv_.errcall_, dbenv_.errpfx_); } protected native void _finalize(DbErrcall errcall, String errpfx) @@ -324,36 +294,71 @@ public class Db public native Dbc join(Dbc curslist[], int flags) throws DbException; - public native void key_range(DbTxn txn, Dbt key, + public native void key_range(DbTxn txnid, Dbt key, DbKeyRange range, int flags) throws DbException; - public synchronized void open(String file, String database, - /*DBTYPE*/ int type, + public synchronized void open(DbTxn txnid, String file, + String database, /*DBTYPE*/ int type, int flags, int mode) throws DbException, FileNotFoundException { - _open(file, database, type, flags, mode); + _open(txnid, file, database, type, flags, mode); } - + // (Internal) - public native void _open(String file, String database, - /*DBTYPE*/ int type, + 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 native void rename(String file, String database, - String newname, int flags) - throws DbException, FileNotFoundException; + 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 synchronized native void remove(String file, String database, - int flags) - throws DbException, FileNotFoundException; + 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) @@ -394,7 +399,7 @@ public class Db bt_prefix_ = bt_prefix; bt_prefix_changed(bt_prefix); } - + // (Internal) private native void bt_prefix_changed(DbBtreePrefix bt_prefix) throws DbException; @@ -403,6 +408,10 @@ public class Db 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 @@ -415,6 +424,10 @@ public class Db 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) { @@ -435,7 +448,7 @@ public class Db if (dbenv_ != null) dbenv_.set_errpfx(errpfx); } - + // Feedback public void set_feedback(DbFeedback feedback) @@ -450,10 +463,16 @@ public class Db throws DbException; // Flags. - public native void set_flags(/*u_int32_t*/ int 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); + public native void set_h_ffactor(/*unsigned*/ int h_ffactor) + throws DbException; // Hash function. public void set_h_hash(DbHash h_hash) @@ -464,38 +483,49 @@ public class Db } // (Internal) - private native void hash_changed(DbHash hash) + private native void hash_changed(DbHash hash) throws DbException; // Number of elements. - public native void set_h_nelem(/*unsigned*/ int h_nelem); + public native void set_h_nelem(/*unsigned*/ int h_nelem) + throws DbException; // Byte order. - public native void set_lorder(int lorder); + public native void set_lorder(int lorder) + throws DbException; // Underlying page size. - public native void set_pagesize(/*size_t*/ long pagesize); + public native void set_pagesize(/*size_t*/ long pagesize) + throws DbException; // Variable-length delimiting byte. - public native void set_re_delim(int re_delim); + 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); + 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); + public native void set_re_pad(int re_pad) + throws DbException; // Source file name. - public native void set_re_source(String re_source); + 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); + 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 int sync(int flags) + 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) @@ -519,6 +549,7 @@ public class Db private DbBtreePrefix bt_prefix_ = null; private DbDupCompare dup_compare_ = null; private DbHash h_hash_ = null; + private DbSecondaryKeyCreate secondary_key_create_ = null; //////////////////////////////////////////////////////////////// // @@ -535,9 +566,13 @@ public class Db // An alternate library name can be specified via a property. // - String overrideLibname = System.getProperty("sleepycat.db.libname"); - if (overrideLibname != null) { - System.loadLibrary(overrideLibname); + 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"); @@ -566,6 +601,7 @@ public class Db { if (c1 != c2) { System.err.println("Db: constant mismatch"); + Thread.dumpStack(); System.exit(1); } } @@ -573,138 +609,153 @@ public class Db static { Db.load_db(); - // Note: constant values are stored in DbConstants, which - // is automatically generated. Initializing constants in - // static code insulates users from the possibility of - // changing constants. - // - DB_CXX_NO_EXCEPTIONS = DbConstants.DB_CXX_NO_EXCEPTIONS; - DB_CLIENT = DbConstants.DB_CLIENT; - DB_XA_CREATE = DbConstants.DB_XA_CREATE; - - DB_CREATE = DbConstants.DB_CREATE; - DB_NOMMAP = DbConstants.DB_NOMMAP; - DB_THREAD = DbConstants.DB_THREAD; - - DB_LOCKDOWN = DbConstants.DB_LOCKDOWN; - DB_PRIVATE = DbConstants.DB_PRIVATE; - DB_TXN_NOWAIT = DbConstants.DB_TXN_NOWAIT; - DB_TXN_SYNC = DbConstants.DB_TXN_SYNC; - DB_CDB_ALLDB = DbConstants.DB_CDB_ALLDB; - - DB_EXCL = DbConstants.DB_EXCL; - DB_RDONLY = DbConstants.DB_RDONLY; - DB_TRUNCATE = DbConstants.DB_TRUNCATE; - DB_UPGRADE = DbConstants.DB_UPGRADE; - - // These constants are not assigned, but rather checked. - // Having initialized constants for these values allows - // them to be used as case values in switch statements. - // - check_constant(DB_INCOMPLETE, DbConstants.DB_INCOMPLETE); - check_constant(DB_KEYEMPTY, DbConstants.DB_KEYEMPTY); - check_constant(DB_KEYEXIST, DbConstants.DB_KEYEXIST); - check_constant(DB_LOCK_DEADLOCK, DbConstants.DB_LOCK_DEADLOCK); - check_constant(DB_LOCK_NOTGRANTED, DbConstants.DB_LOCK_NOTGRANTED); - check_constant(DB_NOSERVER, DbConstants.DB_NOSERVER); - check_constant(DB_NOSERVER_HOME, DbConstants.DB_NOSERVER_HOME); - check_constant(DB_NOSERVER_ID, DbConstants.DB_NOSERVER_ID); - check_constant(DB_NOTFOUND, DbConstants.DB_NOTFOUND); - check_constant(DB_OLD_VERSION, DbConstants.DB_OLD_VERSION); - check_constant(DB_RUNRECOVERY, DbConstants.DB_RUNRECOVERY); - check_constant(DB_VERIFY_BAD, DbConstants.DB_VERIFY_BAD); - check_constant(DB_TXN_BACKWARD_ROLL, DbConstants.DB_TXN_BACKWARD_ROLL); - check_constant(DB_TXN_FORWARD_ROLL, DbConstants.DB_TXN_FORWARD_ROLL); - check_constant(DB_TXN_OPENFILES, DbConstants.DB_TXN_OPENFILES); - check_constant(DB_TXN_REDO, DbConstants.DB_TXN_REDO); - check_constant(DB_TXN_UNDO, DbConstants.DB_TXN_UNDO); - - DB_FORCE = DbConstants.DB_FORCE; - 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_RECOVER = DbConstants.DB_RECOVER; - DB_RECOVER_FATAL = DbConstants.DB_RECOVER_FATAL; - DB_SYSTEM_MEM = DbConstants.DB_SYSTEM_MEM; - DB_TXN_NOSYNC = DbConstants.DB_TXN_NOSYNC; - 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_WAITSFOR = DbConstants.DB_VERB_WAITSFOR; - - DB_LOCK_NORUN = DbConstants.DB_LOCK_NORUN; - DB_LOCK_DEFAULT = DbConstants.DB_LOCK_DEFAULT; - DB_LOCK_OLDEST = DbConstants.DB_LOCK_OLDEST; - DB_LOCK_RANDOM = DbConstants.DB_LOCK_RANDOM; - DB_LOCK_YOUNGEST = DbConstants.DB_LOCK_YOUNGEST; - - DB_DUP = DbConstants.DB_DUP; - DB_DUPSORT = DbConstants.DB_DUPSORT; - DB_RECNUM = DbConstants.DB_RECNUM; - DB_RENUMBER = DbConstants.DB_RENUMBER; - DB_REVSPLITOFF = DbConstants.DB_REVSPLITOFF; - DB_SNAPSHOT = DbConstants.DB_SNAPSHOT; - - DB_JOIN_NOSORT = DbConstants.DB_JOIN_NOSORT; - - DB_NOORDERCHK = DbConstants.DB_NOORDERCHK; - DB_ORDERCHKONLY = DbConstants.DB_ORDERCHKONLY; - DB_SALVAGE = DbConstants.DB_SALVAGE; + // BEGIN-JAVA-CONSTANT-INITIALIZATION + /* DO NOT EDIT: automatically built by dist/s_java. */ + DB_AFTER = DbConstants.DB_AFTER; DB_AGGRESSIVE = DbConstants.DB_AGGRESSIVE; - - DB_LOCK_NOWAIT = DbConstants.DB_LOCK_NOWAIT; - DB_LOCK_CONFLICT = DbConstants.DB_LOCK_CONFLICT; - + 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_AFTER = DbConstants.DB_AFTER; - DB_APPEND = DbConstants.DB_APPEND; + DB_AUTO_COMMIT = DbConstants.DB_AUTO_COMMIT; DB_BEFORE = DbConstants.DB_BEFORE; DB_CACHED_COUNTS = DbConstants.DB_CACHED_COUNTS; - DB_CHECKPOINT = DbConstants.DB_CHECKPOINT; + 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_CURLSN = DbConstants.DB_CURLSN; + 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_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_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 new file mode 100644 index 00000000000..de72771f3e9 --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbAppDispatch.java @@ -0,0 +1,22 @@ +/*- + * 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 index ffe40e95f9e..c9d205ec74d 100644 --- a/bdb/java/src/com/sleepycat/db/DbAppendRecno.java +++ b/bdb/java/src/com/sleepycat/db/DbAppendRecno.java @@ -1,17 +1,17 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbAppendRecno.java,v 11.1 2000/07/31 20:28:30 dda Exp $ + * $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 { diff --git a/bdb/java/src/com/sleepycat/db/DbBtreeCompare.java b/bdb/java/src/com/sleepycat/db/DbBtreeCompare.java index 2e5306af232..d738998cfb5 100644 --- a/bdb/java/src/com/sleepycat/db/DbBtreeCompare.java +++ b/bdb/java/src/com/sleepycat/db/DbBtreeCompare.java @@ -1,17 +1,17 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbBtreeCompare.java,v 11.2 2000/07/04 20:53:19 dda Exp $ + * $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 { diff --git a/bdb/java/src/com/sleepycat/db/DbBtreePrefix.java b/bdb/java/src/com/sleepycat/db/DbBtreePrefix.java index 27e63054339..4f18d8feb11 100644 --- a/bdb/java/src/com/sleepycat/db/DbBtreePrefix.java +++ b/bdb/java/src/com/sleepycat/db/DbBtreePrefix.java @@ -1,17 +1,17 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbBtreePrefix.java,v 11.2 2000/07/04 20:53:19 dda Exp $ + * $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 { diff --git a/bdb/java/src/com/sleepycat/db/DbBtreeStat.java b/bdb/java/src/com/sleepycat/db/DbBtreeStat.java index 8dea8da107c..669afcffc88 100644 --- a/bdb/java/src/com/sleepycat/db/DbBtreeStat.java +++ b/bdb/java/src/com/sleepycat/db/DbBtreeStat.java @@ -1,40 +1,28 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. - * - * $Id: DbBtreeStat.java,v 11.5 2000/05/04 02:54:55 dda Exp $ - */ +/* DO NOT EDIT: automatically built by dist/s_java. */ package com.sleepycat.db; -/* - * This is filled in and returned by the - * Db.stat() method. - */ public class DbBtreeStat { - public int bt_magic; // Magic number. - public int bt_version; // Version number. - public int bt_metaflags; // Meta-data flags. - public int bt_nkeys; // Number of unique keys. - public int bt_ndata; // Number of data items. - public int bt_pagesize; // Page size. - public int bt_maxkey; // Maxkey value. - public int bt_minkey; // Minkey value. - public int bt_re_len; // Fixed-length record length. - public int bt_re_pad; // Fixed-length record pad. - public int bt_levels; // Tree levels. - public int bt_int_pg; // Internal pages. - public int bt_leaf_pg; // Leaf pages. - public int bt_dup_pg; // Duplicate pages. - public int bt_over_pg; // Overflow pages. - public int bt_free; // Pages on the free list. - public int bt_int_pgfree; // Bytes free in internal pages. - public int bt_leaf_pgfree; // Bytes free in leaf pages. - public int bt_dup_pgfree; // Bytes free in duplicate pages. - public int bt_over_pgfree; // Bytes free in overflow pages. + public int bt_magic; + public int bt_version; + public int bt_metaflags; + public int bt_nkeys; + public int bt_ndata; + public int bt_pagesize; + public int bt_maxkey; + public int bt_minkey; + public int bt_re_len; + public int bt_re_pad; + public int bt_levels; + public int bt_int_pg; + public int bt_leaf_pg; + public int bt_dup_pg; + public int bt_over_pg; + public int bt_free; + public int bt_int_pgfree; + public int bt_leaf_pgfree; + public int bt_dup_pgfree; + public int bt_over_pgfree; } - // end of DbBtreeStat.java diff --git a/bdb/java/src/com/sleepycat/db/DbClient.java b/bdb/java/src/com/sleepycat/db/DbClient.java new file mode 100644 index 00000000000..3b9b349c841 --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbClient.java @@ -0,0 +1,21 @@ +/*- + * 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 index beab2ad62fa..2540e22a782 100644 --- a/bdb/java/src/com/sleepycat/db/DbDeadlockException.java +++ b/bdb/java/src/com/sleepycat/db/DbDeadlockException.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1999-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbDeadlockException.java,v 11.3 2000/02/14 02:59:56 bostic Exp $ + * $Id: DbDeadlockException.java,v 11.6 2002/01/11 15:52:33 bostic Exp $ */ package com.sleepycat.db; diff --git a/bdb/java/src/com/sleepycat/db/DbDupCompare.java b/bdb/java/src/com/sleepycat/db/DbDupCompare.java index 3d4b5a736f8..b014c76594c 100644 --- a/bdb/java/src/com/sleepycat/db/DbDupCompare.java +++ b/bdb/java/src/com/sleepycat/db/DbDupCompare.java @@ -1,17 +1,17 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbDupCompare.java,v 11.2 2000/07/04 20:53:19 dda Exp $ + * $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 { diff --git a/bdb/java/src/com/sleepycat/db/DbEnv.java b/bdb/java/src/com/sleepycat/db/DbEnv.java index 6e9ce7ae337..f5a2e25f61b 100644 --- a/bdb/java/src/com/sleepycat/db/DbEnv.java +++ b/bdb/java/src/com/sleepycat/db/DbEnv.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbEnv.java,v 11.25 2001/01/04 14:23:30 dda Exp $ + * $Id: DbEnv.java,v 11.58 2002/08/29 14:22:22 margo Exp $ */ package com.sleepycat.db; @@ -29,7 +29,7 @@ public class DbEnv // the set_* access methods below, and finally open // the environment by calling open(). // - public DbEnv(int flags) + public DbEnv(int flags) throws DbException { constructor_flags_ = flags; _init(errstream_, constructor_flags_); @@ -62,7 +62,7 @@ public class DbEnv { dblist_.addElement(db); } - + // // Remove from the private list of Db's. // @@ -70,7 +70,7 @@ public class DbEnv { dblist_.removeElement(db); } - + // // Iterate all the Db's in the list, and // notify them that the environment is closing, @@ -85,7 +85,7 @@ public class DbEnv } dblist_.removeAllElements(); } - + // close discards any internal memory. // After using close, the DbEnv can be reopened. // @@ -100,6 +100,14 @@ public class DbEnv 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); @@ -117,9 +125,11 @@ public class DbEnv throws Throwable; // (Internal) - private native void _init(DbErrcall errcall, int flags); + // 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(); @@ -144,6 +154,10 @@ public class DbEnv 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) { @@ -170,7 +184,7 @@ public class DbEnv private native void _set_errpfx(String errpfx); // Feedback - public void set_feedback(DbFeedback feedback) + public void set_feedback(DbEnvFeedback feedback) throws DbException { feedback_ = feedback; @@ -178,18 +192,18 @@ public class DbEnv } // (Internal) - private native void feedback_changed(DbFeedback feedback) + private native void feedback_changed(DbEnvFeedback feedback) throws DbException; // Generate debugging messages. - public native void set_verbose(int which, int onoff) + 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_max) + public native void set_lg_bsize(/*u_int32_t*/ int lg_bsize) throws DbException; // Log directory. @@ -200,6 +214,10 @@ public class DbEnv 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; @@ -231,55 +249,51 @@ public class DbEnv public native void set_mp_mmapsize(/*size_t*/ long mmapsize) throws DbException; - public native void set_mutexlocks(int mutexlocks) + public native void set_flags(int flags, boolean onoff) throws DbException; - public native static void set_pageyield(int pageyield) - throws DbException; + public native void set_rep_limit(int gbytes, int bytes) throws DbException; - public native static void set_panicstate(int panicstate) - throws DbException; - - public void set_recovery_init(DbRecoveryInit recovery_init) + public void set_rep_transport(int envid, DbRepTransport transport) throws DbException { - recovery_init_ = recovery_init; - recovery_init_changed(recovery_init); + rep_transport_ = transport; + rep_transport_changed(envid, transport); } // (Internal) - private native void recovery_init_changed(DbRecoveryInit recovery_init) + private native void rep_transport_changed(int envid, + DbRepTransport transport) throws DbException; - public native static void set_region_init(int region_init) - throws DbException; - - public native void set_flags(int flags, int onoff) - throws DbException; - - public native void set_server(String host, long cl_timeout, - long sv_timeout, int flags) + 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 static void set_tas_spins(int tas_spins) + 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_tx_recover(DbTxnRecover tx_recover) + public void set_app_dispatch(DbAppDispatch app_dispatch) throws DbException { - tx_recover_ = tx_recover; - tx_recover_changed(tx_recover); + app_dispatch_ = app_dispatch; + app_dispatch_changed(app_dispatch); } // (Internal) - private native void tx_recover_changed(DbTxnRecover tx_recover) + private native void app_dispatch_changed(DbAppDispatch app_dispatch) throws DbException; // Maximum number of transactions. @@ -316,55 +330,80 @@ public class DbEnv /*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 DbLockStat lock_stat() + 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_get(DbLsn lsn, Dbt data, int flags) + public native void log_put(DbLsn lsn, Dbt data, int flags) throws DbException; - public native void log_put(DbLsn lsn, Dbt data, int flags) + public native DbLogStat log_stat(/*u_int32_t*/ int flags) throws DbException; - public native DbLogStat log_stat() + public native DbMpoolStat memp_stat(/*u_int32_t*/ int flags) throws DbException; - public native void log_register(Db dbp, String name) + public native DbMpoolFStat[] memp_fstat(/*u_int32_t*/ int flags) throws DbException; - public native void log_unregister(Db dbp) + public native int memp_trickle(int pct) throws DbException; - public native DbMpoolStat memp_stat() + public native int rep_elect(int nsites, int pri, int timeout) throws DbException; - public native DbMpoolFStat[] memp_fstat() + public static class RepProcessMessage { + public int envid; + } + public native int rep_process_message(Dbt control, Dbt rec, + RepProcessMessage result) throws DbException; - public native int memp_trickle(int pct) + 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 int txn_checkpoint(int kbyte, int min, int flags) + 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() + public native DbTxnStat txn_stat(/*u_int32_t*/ int flags) throws DbException; //////////////////////////////////////////////////////////////// @@ -375,9 +414,9 @@ public class DbEnv private long private_info_ = 0; private int constructor_flags_ = 0; private Vector dblist_ = new Vector(); // Db's that are open - private DbFeedback feedback_ = null; - private DbRecoveryInit recovery_init_ = null; - private DbTxnRecover tx_recover_ = null; + 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_; @@ -386,7 +425,6 @@ public class DbEnv 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 index 9eec2b819f6..feef750f186 100644 --- a/bdb/java/src/com/sleepycat/db/DbEnvFeedback.java +++ b/bdb/java/src/com/sleepycat/db/DbEnvFeedback.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1999-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbEnvFeedback.java,v 11.3 2000/02/14 02:59:56 bostic Exp $ + * $Id: DbEnvFeedback.java,v 11.6 2002/01/11 15:52:34 bostic Exp $ */ package com.sleepycat.db; diff --git a/bdb/java/src/com/sleepycat/db/DbErrcall.java b/bdb/java/src/com/sleepycat/db/DbErrcall.java index 62d3a3e08b3..4db12772ccd 100644 --- a/bdb/java/src/com/sleepycat/db/DbErrcall.java +++ b/bdb/java/src/com/sleepycat/db/DbErrcall.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbErrcall.java,v 11.3 2000/02/14 02:59:56 bostic Exp $ + * $Id: DbErrcall.java,v 11.6 2002/01/11 15:52:35 bostic Exp $ */ package com.sleepycat.db; diff --git a/bdb/java/src/com/sleepycat/db/DbException.java b/bdb/java/src/com/sleepycat/db/DbException.java index ed4d020b677..132ea868f14 100644 --- a/bdb/java/src/com/sleepycat/db/DbException.java +++ b/bdb/java/src/com/sleepycat/db/DbException.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbException.java,v 11.4 2000/02/14 02:59:56 bostic Exp $ + * $Id: DbException.java,v 11.7 2002/01/11 15:52:35 bostic Exp $ */ package com.sleepycat.db; diff --git a/bdb/java/src/com/sleepycat/db/DbFeedback.java b/bdb/java/src/com/sleepycat/db/DbFeedback.java index d932d951a6f..38d7346e03e 100644 --- a/bdb/java/src/com/sleepycat/db/DbFeedback.java +++ b/bdb/java/src/com/sleepycat/db/DbFeedback.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbFeedback.java,v 11.4 2000/02/14 02:59:56 bostic Exp $ + * $Id: DbFeedback.java,v 11.7 2002/01/11 15:52:35 bostic Exp $ */ package com.sleepycat.db; diff --git a/bdb/java/src/com/sleepycat/db/DbHash.java b/bdb/java/src/com/sleepycat/db/DbHash.java index a72c2070b59..22781a11929 100644 --- a/bdb/java/src/com/sleepycat/db/DbHash.java +++ b/bdb/java/src/com/sleepycat/db/DbHash.java @@ -1,17 +1,17 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbHash.java,v 11.1 2000/07/04 20:53:19 dda Exp $ + * $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 { diff --git a/bdb/java/src/com/sleepycat/db/DbHashStat.java b/bdb/java/src/com/sleepycat/db/DbHashStat.java index 62154344732..97de6127af6 100644 --- a/bdb/java/src/com/sleepycat/db/DbHashStat.java +++ b/bdb/java/src/com/sleepycat/db/DbHashStat.java @@ -1,37 +1,24 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1999, 2000 - * Sleepycat Software. All rights reserved. - * - * $Id: DbHashStat.java,v 11.6 2000/05/04 02:54:55 dda Exp $ - */ +/* DO NOT EDIT: automatically built by dist/s_java. */ package com.sleepycat.db; -/* - * This is filled in and returned by the - * Db.stat() method. - */ public class DbHashStat { - public int hash_magic; // Magic number. - public int hash_version; // Version number. - public int hash_metaflags; // Metadata flags. - public int hash_nkeys; // Number of unique keys. - public int hash_ndata; // Number of data items. - public int hash_pagesize; // Page size. - public int hash_nelem; // Original nelem specified. - public int hash_ffactor; // Fill factor specified at create. - public int hash_buckets; // Number of hash buckets. - public int hash_free; // Pages on the free list. - public int hash_bfree; // Bytes free on bucket pages. - public int hash_bigpages; // Number of big key/data pages. - public int hash_big_bfree; // Bytes free on big item pages. - public int hash_overflows; // Number of overflow pages. - public int hash_ovfl_free; // Bytes free on ovfl pages. - public int hash_dup; // Number of dup pages. - public int hash_dup_free; // Bytes free on duplicate pages. + public int hash_magic; + public int hash_version; + public int hash_metaflags; + public int hash_nkeys; + public int hash_ndata; + public int hash_pagesize; + public int hash_ffactor; + public int hash_buckets; + public int hash_free; + public int hash_bfree; + public int hash_bigpages; + public int hash_big_bfree; + public int hash_overflows; + public int hash_ovfl_free; + public int hash_dup; + public int hash_dup_free; } - // end of DbHashStat.java diff --git a/bdb/java/src/com/sleepycat/db/DbKeyRange.java b/bdb/java/src/com/sleepycat/db/DbKeyRange.java index 6a86afd9109..aa5dc16eeda 100644 --- a/bdb/java/src/com/sleepycat/db/DbKeyRange.java +++ b/bdb/java/src/com/sleepycat/db/DbKeyRange.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbKeyRange.java,v 1.1 2000/04/12 15:07:02 dda Exp $ + * $Id: DbKeyRange.java,v 1.4 2002/01/11 15:52:36 bostic Exp $ */ package com.sleepycat.db; diff --git a/bdb/java/src/com/sleepycat/db/DbLock.java b/bdb/java/src/com/sleepycat/db/DbLock.java index bc467913e92..ee021a856b8 100644 --- a/bdb/java/src/com/sleepycat/db/DbLock.java +++ b/bdb/java/src/com/sleepycat/db/DbLock.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbLock.java,v 11.4 2000/05/25 04:18:13 dda Exp $ + * $Id: DbLock.java,v 11.8 2002/01/11 15:52:36 bostic Exp $ */ package com.sleepycat.db; @@ -18,11 +18,6 @@ public class DbLock protected native void finalize() throws Throwable; - // methods - // - public native void put(DbEnv env) - throws DbException; - // get/set methods // diff --git a/bdb/java/src/com/sleepycat/db/DbLockNotGrantedException.java b/bdb/java/src/com/sleepycat/db/DbLockNotGrantedException.java new file mode 100644 index 00000000000..0fa434c72ee --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbLockNotGrantedException.java @@ -0,0 +1,57 @@ +/*- + * 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 new file mode 100644 index 00000000000..2ea2fe148ea --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbLockRequest.java @@ -0,0 +1,67 @@ +/*- + * 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/DbLockStat.java b/bdb/java/src/com/sleepycat/db/DbLockStat.java index f23f2ad5d49..f0903f061d2 100644 --- a/bdb/java/src/com/sleepycat/db/DbLockStat.java +++ b/bdb/java/src/com/sleepycat/db/DbLockStat.java @@ -1,30 +1,32 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. - * - * $Id: DbLockStat.java,v 11.3 2000/02/14 02:59:56 bostic Exp $ - */ +/* DO NOT EDIT: automatically built by dist/s_java. */ package com.sleepycat.db; -/* - * This is filled in and returned by the - * DbLockTab.stat() method. - */ public class DbLockStat { - public int st_maxlocks; // Maximum number of locks in table. - public int st_nmodes; // Number of lock modes. - public int st_nlockers; // Number of lockers. - public int st_nconflicts; // Number of lock conflicts. - public int st_nrequests; // Number of lock gets. - public int st_nreleases; // Number of lock puts. - public int st_ndeadlocks; // Number of lock deadlocks. - 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. + public int st_id; + public int st_cur_maxid; + public int st_maxlocks; + public int st_maxlockers; + public int st_maxobjects; + public int st_nmodes; + public int st_nlocks; + public int st_maxnlocks; + public int st_nlockers; + public int st_maxnlockers; + public int st_nobjects; + public int st_maxnobjects; + public int st_nconflicts; + public int st_nrequests; + public int st_nreleases; + public int st_nnowaits; + public int st_ndeadlocks; + public int st_locktimeout; + public int st_nlocktimeouts; + public int st_txntimeout; + public int st_ntxntimeouts; + public int st_region_wait; + public int st_region_nowait; + public int st_regsize; } - // end of DbLockStat.java diff --git a/bdb/java/src/com/sleepycat/db/DbLogStat.java b/bdb/java/src/com/sleepycat/db/DbLogStat.java index d708f1c4148..19e5be25ce3 100644 --- a/bdb/java/src/com/sleepycat/db/DbLogStat.java +++ b/bdb/java/src/com/sleepycat/db/DbLogStat.java @@ -1,35 +1,29 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. - * - * $Id: DbLogStat.java,v 11.3 2000/02/14 02:59:56 bostic Exp $ - */ +/* DO NOT EDIT: automatically built by dist/s_java. */ package com.sleepycat.db; -/* - * This is filled in and returned by the - * DbLog.stat() method. - */ public class DbLogStat { - public int st_magic; // Log file magic number. - public int st_version; // Log file version number. - public int st_mode; // Log file mode. - public int st_lg_max; // Maximum log file size. - public int st_w_bytes; // Bytes to log. - public int st_w_mbytes; // Megabytes to log. - public int st_wc_bytes; // Bytes to log since checkpoint. - public int st_wc_mbytes; // Megabytes to log since checkpoint. - public int st_wcount; // Total syncs to the log. - public int st_scount; // Total writes to the log. - public int st_region_wait; // Region lock granted after wait. - public int st_region_nowait; // Region lock granted without wait. - public int st_cur_file; // Current log file number. - public int st_cur_offset; // Current log file offset. - public int st_regsize; // Region size. + public int st_magic; + public int st_version; + public int st_mode; + public int st_lg_bsize; + public int st_lg_size; + public int st_w_bytes; + public int st_w_mbytes; + public int st_wc_bytes; + public int st_wc_mbytes; + public int st_wcount; + public int st_wcount_fill; + public int st_scount; + public int st_region_wait; + public int st_region_nowait; + public int st_cur_file; + public int st_cur_offset; + public int st_disk_file; + public int st_disk_offset; + public int st_regsize; + public int st_maxcommitperflush; + public int st_mincommitperflush; } - // end of DbLogStat.java diff --git a/bdb/java/src/com/sleepycat/db/DbLogc.java b/bdb/java/src/com/sleepycat/db/DbLogc.java new file mode 100644 index 00000000000..34368199d5e --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbLogc.java @@ -0,0 +1,39 @@ +/*- + * 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 index ff36ac61c99..c9e01225e3f 100644 --- a/bdb/java/src/com/sleepycat/db/DbLsn.java +++ b/bdb/java/src/com/sleepycat/db/DbLsn.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbLsn.java,v 11.5 2000/09/11 16:21:37 dda Exp $ + * $Id: DbLsn.java,v 11.8 2002/01/11 15:52:37 bostic Exp $ */ package com.sleepycat.db; diff --git a/bdb/java/src/com/sleepycat/db/DbMemoryException.java b/bdb/java/src/com/sleepycat/db/DbMemoryException.java index 67a29a1f16f..a5f66674c89 100644 --- a/bdb/java/src/com/sleepycat/db/DbMemoryException.java +++ b/bdb/java/src/com/sleepycat/db/DbMemoryException.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1999-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbMemoryException.java,v 11.3 2000/02/14 02:59:56 bostic Exp $ + * $Id: DbMemoryException.java,v 11.7 2002/01/11 15:52:37 bostic Exp $ */ package com.sleepycat.db; @@ -23,6 +23,27 @@ public class DbMemoryException extends DbException { 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/DbMpoolFStat.java b/bdb/java/src/com/sleepycat/db/DbMpoolFStat.java index 44497b3bf74..cc03b568fc3 100644 --- a/bdb/java/src/com/sleepycat/db/DbMpoolFStat.java +++ b/bdb/java/src/com/sleepycat/db/DbMpoolFStat.java @@ -1,28 +1,16 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. - * - * $Id: DbMpoolFStat.java,v 11.3 2000/02/14 02:59:56 bostic Exp $ - */ +/* DO NOT EDIT: automatically built by dist/s_java. */ package com.sleepycat.db; -/* - * This is filled in and returned by the - * DbMpool.fstat() method. - */ public class DbMpoolFStat { - public String file_name; // File name. - public int st_pagesize; // Page size. - 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 String file_name; + public int st_pagesize; + public int st_map; + public int st_cache_hit; + public int st_cache_miss; + public int st_page_create; + public int st_page_in; + public int st_page_out; } - // end of DbMpoolFStat.java diff --git a/bdb/java/src/com/sleepycat/db/DbMpoolStat.java b/bdb/java/src/com/sleepycat/db/DbMpoolStat.java index 8a6d75e367b..d2d854a8b8d 100644 --- a/bdb/java/src/com/sleepycat/db/DbMpoolStat.java +++ b/bdb/java/src/com/sleepycat/db/DbMpoolStat.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbMpoolStat.java,v 11.3 2000/02/14 02:59:56 bostic Exp $ + * $Id: DbMpoolStat.java,v 11.7 2002/01/11 15:52:38 bostic Exp $ */ package com.sleepycat.db; @@ -15,10 +15,6 @@ package com.sleepycat.db; */ public class DbMpoolStat { - /** - * @deprecated As of Berkeley DB 2.8.2, cachesize for mpool unavailable. - */ - public int st_cachesize; // Cache size. 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. diff --git a/bdb/java/src/com/sleepycat/db/DbMultipleDataIterator.java b/bdb/java/src/com/sleepycat/db/DbMultipleDataIterator.java new file mode 100644 index 00000000000..3c948ad37cd --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbMultipleDataIterator.java @@ -0,0 +1,46 @@ +/*- + * 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 new file mode 100644 index 00000000000..0a28d9507a1 --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbMultipleIterator.java @@ -0,0 +1,51 @@ +/*- + * 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 new file mode 100644 index 00000000000..0edae5801d4 --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbMultipleKeyDataIterator.java @@ -0,0 +1,56 @@ +/*- + * 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 new file mode 100644 index 00000000000..a4a578ed170 --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbMultipleRecnoDataIterator.java @@ -0,0 +1,51 @@ +/*- + * 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 index 4f962d9a334..7343caa8238 100644 --- a/bdb/java/src/com/sleepycat/db/DbOutputStreamErrcall.java +++ b/bdb/java/src/com/sleepycat/db/DbOutputStreamErrcall.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbOutputStreamErrcall.java,v 11.3 2000/02/14 02:59:56 bostic Exp $ + * $Id: DbOutputStreamErrcall.java,v 11.6 2002/01/11 15:52:39 bostic Exp $ */ package com.sleepycat.db; diff --git a/bdb/java/src/com/sleepycat/db/DbPreplist.java b/bdb/java/src/com/sleepycat/db/DbPreplist.java new file mode 100644 index 00000000000..e5fffa77e1e --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbPreplist.java @@ -0,0 +1,22 @@ +/*- + * 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/DbQueueStat.java b/bdb/java/src/com/sleepycat/db/DbQueueStat.java index 652878b1adb..67d229ab840 100644 --- a/bdb/java/src/com/sleepycat/db/DbQueueStat.java +++ b/bdb/java/src/com/sleepycat/db/DbQueueStat.java @@ -1,32 +1,21 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1999, 2000 - * Sleepycat Software. All rights reserved. - * - * $Id: DbQueueStat.java,v 11.5 2000/11/07 18:45:27 dda Exp $ - */ +/* DO NOT EDIT: automatically built by dist/s_java. */ package com.sleepycat.db; -/* - * This is filled in and returned by the - * Db.stat() method. - */ public class DbQueueStat { - public int qs_magic; // Magic number. - public int qs_version; // Version number. - public int qs_metaflags; // Metadata flags. - public int qs_nkeys; // Number of unique keys. - public int qs_ndata; // Number of data items. - public int qs_pagesize; // Page size. - public int qs_pages; // Data pages. - public int qs_re_len; // Fixed-length record length. - public int qs_re_pad; // Fixed-length record pad. - public int qs_pgfree; // Bytes free in data pages. - public int qs_first_recno; // First not deleted record. - public int qs_cur_recno; // Last allocated record number. + public int qs_magic; + public int qs_version; + public int qs_metaflags; + public int qs_nkeys; + public int qs_ndata; + public int qs_pagesize; + public int qs_extentsize; + public int qs_pages; + public int qs_re_len; + public int qs_re_pad; + public int qs_pgfree; + public int qs_first_recno; + public int qs_cur_recno; } - // end of DbQueueStat.java diff --git a/bdb/java/src/com/sleepycat/db/DbRecoveryInit.java b/bdb/java/src/com/sleepycat/db/DbRecoveryInit.java deleted file mode 100644 index b32eebcaa6c..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbRecoveryInit.java +++ /dev/null @@ -1,23 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. - * - * $Id: DbRecoveryInit.java,v 11.3 2000/02/14 02:59:56 bostic Exp $ - */ - -package com.sleepycat.db; - -/** - * - * @author Donald D. Anderson - */ -public interface DbRecoveryInit -{ - // methods - // - public abstract void recovery_init(DbEnv dbenv); -} - -// end of DbRecoveryInit.java diff --git a/bdb/java/src/com/sleepycat/db/DbRepStat.java b/bdb/java/src/com/sleepycat/db/DbRepStat.java new file mode 100644 index 00000000000..953d10eddd1 --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbRepStat.java @@ -0,0 +1,43 @@ +/* DO NOT EDIT: automatically built by dist/s_java. */ + +package com.sleepycat.db; + +public class DbRepStat +{ + public int st_status; + public DbLsn st_next_lsn; + public DbLsn st_waiting_lsn; + public int st_dupmasters; + public int st_env_id; + public int st_env_priority; + public int st_gen; + public int st_log_duplicated; + public int st_log_queued; + public int st_log_queued_max; + public int st_log_queued_total; + public int st_log_records; + public int st_log_requested; + public int st_master; + public int st_master_changes; + public int st_msgs_badgen; + public int st_msgs_processed; + public int st_msgs_recover; + public int st_msgs_send_failures; + public int st_msgs_sent; + public int st_newsites; + public int st_nsites; + public int st_nthrottles; + public int st_outdated; + public int st_txns_applied; + public int st_elections; + public int st_elections_won; + public int st_election_cur_winner; + public int st_election_gen; + public DbLsn st_election_lsn; + public int st_election_nsites; + public int st_election_priority; + public int st_election_status; + public int st_election_tiebreaker; + public int st_election_votes; +} +// end of DbRepStat.java diff --git a/bdb/java/src/com/sleepycat/db/DbRepTransport.java b/bdb/java/src/com/sleepycat/db/DbRepTransport.java new file mode 100644 index 00000000000..441c783b890 --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbRepTransport.java @@ -0,0 +1,19 @@ +/*- + * 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 index 78736b6ed1e..32f2727a78b 100644 --- a/bdb/java/src/com/sleepycat/db/DbRunRecoveryException.java +++ b/bdb/java/src/com/sleepycat/db/DbRunRecoveryException.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbRunRecoveryException.java,v 11.3 2000/02/14 02:59:56 bostic Exp $ + * $Id: DbRunRecoveryException.java,v 11.6 2002/01/11 15:52:40 bostic Exp $ */ package com.sleepycat.db; diff --git a/bdb/java/src/com/sleepycat/db/DbSecondaryKeyCreate.java b/bdb/java/src/com/sleepycat/db/DbSecondaryKeyCreate.java new file mode 100644 index 00000000000..ca2acde1b03 --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbSecondaryKeyCreate.java @@ -0,0 +1,22 @@ +/*- + * 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 index 201ff94c8f3..d3906d112c0 100644 --- a/bdb/java/src/com/sleepycat/db/DbTxn.java +++ b/bdb/java/src/com/sleepycat/db/DbTxn.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: DbTxn.java,v 11.5 2000/05/25 04:18:13 dda Exp $ + * $Id: DbTxn.java,v 11.17 2002/08/29 14:22:22 margo Exp $ */ package com.sleepycat.db; @@ -23,14 +23,44 @@ public class DbTxn 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() + public native void prepare(byte[] gid) throws DbException; - protected native void finalize() - throws Throwable; + 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 // diff --git a/bdb/java/src/com/sleepycat/db/DbTxnRecover.java b/bdb/java/src/com/sleepycat/db/DbTxnRecover.java deleted file mode 100644 index ee47935941d..00000000000 --- a/bdb/java/src/com/sleepycat/db/DbTxnRecover.java +++ /dev/null @@ -1,22 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 2000 - * Sleepycat Software. All rights reserved. - * - * $Id: DbTxnRecover.java,v 11.1 2000/06/29 18:08:17 dda Exp $ - */ - -package com.sleepycat.db; - -/* - * This interface is used by DbEnv.set_tx_recover() - * - */ -public interface DbTxnRecover -{ - // The value of recops is one of the Db.DB_TXN_* constants - public abstract int tx_recover(DbEnv env, Dbt dbt, DbLsn lsn, int recops); -} - -// end of DbBtreeCompare.java diff --git a/bdb/java/src/com/sleepycat/db/DbTxnStat.java b/bdb/java/src/com/sleepycat/db/DbTxnStat.java index e72addb00b1..78794aea504 100644 --- a/bdb/java/src/com/sleepycat/db/DbTxnStat.java +++ b/bdb/java/src/com/sleepycat/db/DbTxnStat.java @@ -1,40 +1,27 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. - * - * $Id: DbTxnStat.java,v 11.3 2000/02/14 02:59:56 bostic Exp $ - */ +/* DO NOT EDIT: automatically built by dist/s_java. */ package com.sleepycat.db; -/* - * This is filled in and returned by the - * DbTxnMgr.fstat() method. - */ public class DbTxnStat { public static class Active { - public int txnid; // Transaction ID - public int parentid; // Transaction ID of parent - public DbLsn lsn; // Lsn of the begin record + public int txnid; + public int parentid; + public DbLsn lsn; }; - - public DbLsn st_last_ckp; // lsn of the last checkpoint - public DbLsn st_pending_ckp; // last checkpoint did not finish - public long st_time_ckp; // time of last checkpoint (UNIX secs) - public int st_last_txnid; // last transaction id given out - public int st_maxtxns; // maximum number of active txns - public int st_naborts; // number of aborted transactions - public int st_nbegins; // number of begun transactions - public int st_ncommits; // number of committed transactions - public int st_nactive; // number of active transactions - public int st_maxnactive; // maximum active transactions - public Active st_txnarray[]; // array of active transactions - 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. + public DbLsn st_last_ckp; + public long st_time_ckp; + public int st_last_txnid; + public int st_maxtxns; + public int st_naborts; + public int st_nbegins; + public int st_ncommits; + public int st_nactive; + public int st_nrestores; + public int st_maxnactive; + public Active st_txnarray[]; + public int st_region_wait; + public int st_region_nowait; + public int st_regsize; } - // end of DbTxnStat.java diff --git a/bdb/java/src/com/sleepycat/db/DbUtil.java b/bdb/java/src/com/sleepycat/db/DbUtil.java new file mode 100644 index 00000000000..30ca93d03cc --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/DbUtil.java @@ -0,0 +1,98 @@ +/*- + * 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 index b097cbad802..60c00b1deb7 100644 --- a/bdb/java/src/com/sleepycat/db/Dbc.java +++ b/bdb/java/src/com/sleepycat/db/Dbc.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: Dbc.java,v 11.5 2000/05/25 04:18:13 dda Exp $ + * $Id: Dbc.java,v 11.9 2002/01/11 15:52:41 bostic Exp $ */ package com.sleepycat.db; @@ -34,6 +34,10 @@ public class Dbc 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; diff --git a/bdb/java/src/com/sleepycat/db/Dbt.java b/bdb/java/src/com/sleepycat/db/Dbt.java index bbb478cd542..f51d0419963 100644 --- a/bdb/java/src/com/sleepycat/db/Dbt.java +++ b/bdb/java/src/com/sleepycat/db/Dbt.java @@ -1,14 +1,19 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 - * Sleepycat Software. All rights reserved. + * Copyright (c) 1997-2002 + * Sleepycat Software. All rights reserved. * - * $Id: Dbt.java,v 11.6 2000/06/16 03:34:01 dda Exp $ + * $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 @@ -18,6 +23,34 @@ 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; @@ -25,86 +58,173 @@ public class Dbt // // 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) { - // internal_set_data is separated from set_data in case - // we want to have set_data automatically set some other - // fields (size, etc.) someday. - // - internal_set_data(data); + this.data = data; + this.must_create_data = false; } - public native byte[] get_data(); - private native void internal_set_data(byte[] data); - // These are not in the original DB interface, - // but they can be used to get/set the offset + // 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 native void set_offset(int off); - public native int get_offset(); + public int get_offset() + { + return offset; + } + + public void set_offset(int offset) + { + this.offset = offset; + } // key/data length - public native /*u_int32_t*/ int get_size(); - public native void set_size(/*u_int32_t*/ int size); + 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 native /*u_int32_t*/ int get_ulen(); - public native void set_ulen(/*u_int32_t*/ int ulen); + 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 native /*u_int32_t*/ int get_dlen(); - public native void set_dlen(/*u_int32_t*/ int dlen); + 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 native /*u_int32_t*/ int get_doff(); - public native void set_doff(/*u_int32_t*/ int doff); + public /*u_int32_t*/ int get_doff() + { + return doff; + } + + public void set_doff(/*u_int32_t*/ int doff) + { + this.doff = doff; + } // flags - public native /*u_int32_t*/ int get_flags(); - public native void set_flags(/*u_int32_t*/ int 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: you must set the data field to an array of - // at least four bytes before calling either of these. - // - public native void set_recno_key_data(int recno); - public native int get_recno_key_data(); - - public Dbt(byte[] data) + // 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) { - init(); - internal_set_data(data); - if (data != null) - set_size(data.length); + if (data == null) { + data = new byte[4]; + size = 4; + offset = 0; + } + DbUtil.int2array(recno, data, offset); } - public Dbt(byte[] data, int off, int len) + public int get_recno_key_data() { - this(data); - set_ulen(len); - set_offset(off); + return (DbUtil.array2int(data, offset)); } - public Dbt() + // Used internally by DbMultipleRecnoIterator + // + /*package*/ void set_recno_key_from_buffer(byte[] data, int offset) { - init(); + 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; - static { - Db.load_db(); - } + 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 new file mode 100644 index 00000000000..3a996c0d045 --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/xa/DbXAResource.java @@ -0,0 +1,190 @@ +/*- + * 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 new file mode 100644 index 00000000000..ba03d3ebf3e --- /dev/null +++ b/bdb/java/src/com/sleepycat/db/xa/DbXid.java @@ -0,0 +1,49 @@ +/*- + * 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 index f3a98c2c7d5..ea3d5f342ed 100644 --- a/bdb/java/src/com/sleepycat/examples/AccessExample.java +++ b/bdb/java/src/com/sleepycat/examples/AccessExample.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 + * Copyright (c) 1997-2002 * Sleepycat Software. All rights reserved. * - * $Id: AccessExample.java,v 11.5 2000/12/13 07:09:42 krinsky Exp $ + * $Id: AccessExample.java,v 11.12 2002/02/05 22:27:13 mjc Exp $ */ package com.sleepycat.examples; @@ -24,12 +24,6 @@ class AccessExample { } - private static void usage() - { - System.err.println("usage: AccessExample\n"); - System.exit(1); - } - public static void main(String argv[]) { try @@ -101,7 +95,7 @@ class AccessExample Db table = new Db(null, 0); table.set_error_stream(System.err); table.set_errpfx("AccessExample"); - table.open(FileName, null, Db.DB_BTREE, Db.DB_CREATE, 0644); + table.open(null, FileName, null, Db.DB_BTREE, Db.DB_CREATE, 0644); // // Insert records into the database, where the key is the user @@ -124,7 +118,7 @@ class AccessExample try { int err; - if ((err = table.put(null, + if ((err = table.put(null, key, data, Db.DB_NOOVERWRITE)) == Db.DB_KEYEXIST) { System.out.println("Key " + line + " already exists."); } @@ -174,8 +168,9 @@ class AccessExample void setString(String value) { - set_data(value.getBytes()); - set_size(value.length()); + byte[] data = value.getBytes(); + set_data(data); + set_size(data.length); } String getString() diff --git a/bdb/java/src/com/sleepycat/examples/BtRecExample.java b/bdb/java/src/com/sleepycat/examples/BtRecExample.java index 5101f676a0b..68365600748 100644 --- a/bdb/java/src/com/sleepycat/examples/BtRecExample.java +++ b/bdb/java/src/com/sleepycat/examples/BtRecExample.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 + * Copyright (c) 1997-2002 * Sleepycat Software. All rights reserved. * - * $Id: BtRecExample.java,v 11.6 2000/02/19 20:58:02 bostic Exp $ + * $Id: BtRecExample.java,v 11.11 2002/02/05 22:27:13 mjc Exp $ */ package com.sleepycat.examples; @@ -41,7 +41,7 @@ public class BtRecExample dbp.set_pagesize(1024); // 1K page sizes. dbp.set_flags(Db.DB_RECNUM); // Record numbers. - dbp.open(database, null, Db.DB_BTREE, Db.DB_CREATE, 0664); + dbp.open(null, database, null, Db.DB_BTREE, Db.DB_CREATE, 0664); // // Insert records into the database, where the key is the word @@ -177,36 +177,26 @@ public class BtRecExample // Open the word database. FileReader freader = new FileReader(wordlist); - BtRecExample app = new BtRecExample(new BufferedReader(freader)); + BtRecExample app = new BtRecExample(new BufferedReader(freader)); - // Close the word database. + // Close the word database. freader.close(); freader = null; app.stats(); app.run(); - } - catch (FileNotFoundException fnfe) { + } catch (FileNotFoundException fnfe) { System.err.println(progname + ": unexpected open error " + fnfe); System.exit (1); - } - catch (IOException ioe) { + } 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()); } - catch (DbException dbe) { - System.err.println("Exception: " + dbe); - System.exit(dbe.get_errno()); - } - System.exit(0); - } - - void - usage() - { - System.err.println("usage: " + progname); - System.exit(1); + System.exit(0); } // Prompts for a line, and keeps prompting until a non blank @@ -279,10 +269,11 @@ public class BtRecExample void setString(String value) { - set_data(value.getBytes()); - set_size(value.length()); + byte[] data = value.getBytes(); + set_data(data); + set_size(data.length); // must set ulen because sometimes a string is returned - set_ulen(value.length()); + set_ulen(data.length); } String getString() @@ -329,8 +320,9 @@ public class BtRecExample void setString(String value) { - set_data(value.getBytes()); - set_size(value.length()); + byte[] data = value.getBytes(); + set_data(data); + set_size(data.length); } int getRecno() diff --git a/bdb/java/src/com/sleepycat/examples/BulkAccessExample.java b/bdb/java/src/com/sleepycat/examples/BulkAccessExample.java new file mode 100644 index 00000000000..e6690197105 --- /dev/null +++ b/bdb/java/src/com/sleepycat/examples/BulkAccessExample.java @@ -0,0 +1,198 @@ +/*- + * 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 index f1b855836c5..acbd9f59621 100644 --- a/bdb/java/src/com/sleepycat/examples/EnvExample.java +++ b/bdb/java/src/com/sleepycat/examples/EnvExample.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 + * Copyright (c) 1997-2002 * Sleepycat Software. All rights reserved. * - * $Id: EnvExample.java,v 11.7 2000/09/25 13:16:51 dda Exp $ + * $Id: EnvExample.java,v 11.9 2002/01/11 15:52:42 bostic Exp $ */ package com.sleepycat.examples; diff --git a/bdb/java/src/com/sleepycat/examples/LockExample.java b/bdb/java/src/com/sleepycat/examples/LockExample.java index 33b7d0538ce..d450193146a 100644 --- a/bdb/java/src/com/sleepycat/examples/LockExample.java +++ b/bdb/java/src/com/sleepycat/examples/LockExample.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 + * Copyright (c) 1997-2002 * Sleepycat Software. All rights reserved. * - * $Id: LockExample.java,v 11.5 2001/01/04 14:23:30 dda Exp $ + * $Id: LockExample.java,v 11.8 2002/01/11 15:52:43 bostic Exp $ */ package com.sleepycat.examples; @@ -150,7 +150,7 @@ class LockExample extends DbEnv } did_get = false; DbLock lock = (DbLock)locks.elementAt(lockid); - lock.put(this); + lock_put(lock); } System.out.println("Lock #" + lockid + " " + (did_get ? "granted" : "released")); diff --git a/bdb/java/src/com/sleepycat/examples/TpcbExample.java b/bdb/java/src/com/sleepycat/examples/TpcbExample.java index 29a90790801..aa9d10b37bc 100644 --- a/bdb/java/src/com/sleepycat/examples/TpcbExample.java +++ b/bdb/java/src/com/sleepycat/examples/TpcbExample.java @@ -1,10 +1,10 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 + * Copyright (c) 1997-2002 * Sleepycat Software. All rights reserved. * - * $Id: TpcbExample.java,v 11.9 2000/04/01 15:52:15 dda Exp $ + * $Id: TpcbExample.java,v 11.16 2002/02/13 06:08:35 mjc Exp $ */ package com.sleepycat.examples; @@ -82,6 +82,10 @@ class TpcbExample extends DbEnv 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; @@ -117,8 +121,8 @@ class TpcbExample extends DbEnv try { dbp = new Db(this, 0); dbp.set_h_nelem(h_nelem); - dbp.open("account", null, - Db.DB_HASH, Db.DB_CREATE | Db.DB_TRUNCATE, 0644); + dbp.open(null, "account", null, Db.DB_HASH, + Db.DB_CREATE | Db.DB_TRUNCATE, 0644); } // can be DbException or FileNotFoundException catch (Exception e1) { @@ -154,8 +158,8 @@ class TpcbExample extends DbEnv dbp.set_h_ffactor(1); dbp.set_pagesize(512); - dbp.open("branch", null, - Db.DB_HASH, Db.DB_CREATE | Db.DB_TRUNCATE, 0644); + dbp.open(null, "branch", null, Db.DB_HASH, + Db.DB_CREATE | Db.DB_TRUNCATE, 0644); } // can be DbException or FileNotFoundException catch (Exception e3) { @@ -191,8 +195,8 @@ class TpcbExample extends DbEnv dbp.set_h_ffactor(0); dbp.set_pagesize(512); - dbp.open("teller", null, - Db.DB_HASH, Db.DB_CREATE | Db.DB_TRUNCATE, 0644); + dbp.open(null, "teller", null, Db.DB_HASH, + Db.DB_CREATE | Db.DB_TRUNCATE, 0644); } // can be DbException or FileNotFoundException catch (Exception e5) { @@ -218,8 +222,8 @@ class TpcbExample extends DbEnv try { dbp = new Db(this, 0); dbp.set_re_len(HISTORY_LEN); - dbp.open("history", null, - Db.DB_RECNO, Db.DB_CREATE | Db.DB_TRUNCATE, 0644); + dbp.open(null, "history", null, Db.DB_RECNO, + Db.DB_CREATE | Db.DB_TRUNCATE, 0644); } // can be DbException or FileNotFoundException catch (Exception e7) { @@ -349,13 +353,17 @@ class TpcbExample extends DbEnv int err; try { adb = new Db(this, 0); - adb.open("account", null, Db.DB_UNKNOWN, 0, 0); + adb.open(null, "account", null, Db.DB_UNKNOWN, + Db.DB_AUTO_COMMIT, 0); bdb = new Db(this, 0); - bdb.open("branch", null, Db.DB_UNKNOWN, 0, 0); + bdb.open(null, "branch", null, Db.DB_UNKNOWN, + Db.DB_AUTO_COMMIT, 0); tdb = new Db(this, 0); - tdb.open("teller", null, Db.DB_UNKNOWN, 0, 0); + tdb.open(null, "teller", null, Db.DB_UNKNOWN, + Db.DB_AUTO_COMMIT, 0); hdb = new Db(this, 0); - hdb.open("history", null, Db.DB_UNKNOWN, 0, 0); + hdb.open(null, "history", null, Db.DB_UNKNOWN, + Db.DB_AUTO_COMMIT, 0); } catch (DbException dbe) { errExit(dbe, "Open of db files failed"); @@ -494,7 +502,11 @@ class TpcbExample extends DbEnv tcurs.close(); hcurs.close(); - t.commit(0); + // 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); @@ -634,9 +646,9 @@ class TpcbExample extends DbEnv history = history == 0 ? HISTORY : history; if (verbose) - System.out.println((long)accounts + " Accounts " - + String.valueOf(branches) + " Branches " - + String.valueOf(tellers) + " Tellers " + System.out.println((long)accounts + " Accounts, " + + String.valueOf(branches) + " Branches, " + + String.valueOf(tellers) + " Tellers, " + String.valueOf(history) + " History"); if (iflag) { |