1 19 20 package org.polepos.teams.db4o; 21 22 import java.io.*; 23 24 import com.db4o.*; 25 import com.db4o.ext.*; 26 27 31 public class Db4oCarLocal extends Db4oCar 32 { 33 34 private static final String FOLDER = "data/db4o"; 35 36 private static final String DB4O_FILE = "dbbench.yap"; 37 38 public Db4oCarLocal() { 39 super(Db4o.version().substring(5)); 40 41 } 42 43 46 public void initialize() 47 { 48 new File(FOLDER).mkdirs(); 49 deleteDatabaseFile(); 50 } 51 52 55 public ExtObjectContainer createObjectContainer() 56 { 57 return Db4o.openFile( path() ).ext(); 58 } 59 60 63 private void deleteDatabaseFile() 64 { 65 new File( path() ).delete(); 66 } 67 68 69 private final String path(){ 70 return FOLDER + "/" + DB4O_FILE; 71 72 } 73 74 75 } 76 | Popular Tags |