KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > test > legacy > soda > engines > db4o > STDb4o


1 /* Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com
2
3 This file is part of the db4o open source object database.
4
5 db4o is free software; you can redistribute it and/or modify it under
6 the terms of version 2 of the GNU General Public License as published
7 by the Free Software Foundation and as clarified by db4objects' GPL
8 interpretation policy, available at
9 http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
10 Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
11 Suite 350, San Mateo, CA 94403, USA.
12
13 db4o is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */

21 package com.db4o.test.legacy.soda.engines.db4o;
22
23 import java.io.*;
24
25 import com.db4o.*;
26 import com.db4o.query.*;
27 import com.db4o.test.legacy.soda.*;
28
29 public class STDb4o implements STEngine {
30     
31     private final String JavaDoc FILE = "soda.yap";
32     
33     public static void main(String JavaDoc[] arguments) {
34         System.out.println(Db4o.version());
35     }
36     
37     private com.db4o.ObjectContainer con;
38     
39     public void reset(){
40         new File(FILE).delete();
41     }
42
43     public Query query() {
44         return con.query();
45     }
46     
47     public void open() {
48         Db4o.configure().messageLevel(-1);
49         
50         // a little bit more than default for
51
// the recursive ones
52
Db4o.configure().activationDepth(7);
53         
54         con = Db4o.openFile(FILE);
55     }
56
57     public void close() {
58         con.close();
59     }
60     
61     public void store(Object JavaDoc obj) {
62         con.set(obj);
63     }
64     
65     public void commit(){
66         con.commit();
67     }
68
69     public void delete(Object JavaDoc obj){
70         con.delete(obj);
71     }
72     
73 }
74
Popular Tags