source: main/trunk/greenstone2/common-src/src/jdbmedit/JdbDel.java@ 21402

Last change on this file since 21402 was 21402, checked in by davidb, 14 years ago

Refactoring of class to use API

File size: 1.8 KB
Line 
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
26import java.io.BufferedInputStream;
27import java.io.InputStream;
28
29import jdbm.RecordManager;
30import jdbm.RecordManagerFactory;
31import jdbm.helper.FastIterator;
32import jdbm.htree.HTree;
33
34import java.io.IOException;
35import java.util.Properties;
36
37
38public 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
Note: See TracBrowser for help on using the repository browser.