1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * JdbDel.java --
|
---|
4 | * A component of the Greenstone digital library software
|
---|
5 | * from the New Zealand Digital Library Project at the
|
---|
6 | * University of Waikato, New Zealand.
|
---|
7 | *
|
---|
8 | * Copyright (C) 2009 The New Zealand Digital Library Project
|
---|
9 | *
|
---|
10 | * This program is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This program is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with this program; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | *
|
---|
24 | **********************************************************************/
|
---|
25 |
|
---|
26 | import java.io.BufferedInputStream;
|
---|
27 | import java.io.InputStream;
|
---|
28 |
|
---|
29 | import jdbm.RecordManager;
|
---|
30 | import jdbm.RecordManagerFactory;
|
---|
31 | import jdbm.helper.FastIterator;
|
---|
32 | import jdbm.htree.HTree;
|
---|
33 |
|
---|
34 | import java.io.IOException;
|
---|
35 | import java.util.Properties;
|
---|
36 |
|
---|
37 |
|
---|
38 | public class JdbDel
|
---|
39 | {
|
---|
40 | public static void print_usage()
|
---|
41 | {
|
---|
42 | System.err.println("Usage: java JdbDel database-name key");
|
---|
43 | System.exit(-1);
|
---|
44 | }
|
---|
45 |
|
---|
46 |
|
---|
47 | public static void main(String[] args)
|
---|
48 | {
|
---|
49 | int argc = args.length;
|
---|
50 |
|
---|
51 | // sanity check
|
---|
52 | if (argc!=2) {
|
---|
53 | print_usage();
|
---|
54 | }
|
---|
55 |
|
---|
56 | try {
|
---|
57 | String dbname = args[0];
|
---|
58 | JdbmAPI jdbm_api = new JdbmAPI(dbname,true);
|
---|
59 |
|
---|
60 | String key = args[1];
|
---|
61 |
|
---|
62 | jdbm_api.delete(key);
|
---|
63 | jdbm_api.close();
|
---|
64 | }
|
---|
65 |
|
---|
66 | catch (IOException e) {
|
---|
67 | e.printStackTrace();
|
---|
68 | }
|
---|
69 |
|
---|
70 | }
|
---|
71 |
|
---|
72 | }
|
---|
73 |
|
---|
74 |
|
---|