Return to Snippet

Revision: 37901
at December 20, 2010 04:23 by dogrizz


Updated Code
import java.io.File;

import com.db4o.ObjectContainer;
import com.db4o.ObjectServer;
import com.db4o.cs.Db4oClientServer;
import com.db4o.cs.config.ServerConfiguration;

public abstract class Db4oConnManager {

	private static final String DB4O_DB_FILE = "/home/dogrizz/db4o.db";

	private final static ObjectServer db;
	static {
		ServerConfiguration conf = Db4oClientServer.newServerConfiguration();
			db = Db4oClientServer.openServer(conf, DB4O_DB_FILE, 0);

	}

	public static ObjectContainer getManager() {

		return db.openClient();
	}

	public static void clear() {
		db.close();
		new File(DB4O_DB_FILE).delete();
	}

}

Revision: 37900
at December 20, 2010 04:22 by dogrizz


Initial Code
public abstract class Db4oConnManager {

	private static final String DB4O_DB_FILE = "/home/dogrizz/db4o.db";

	private final static ObjectServer db;
	static {
		ServerConfiguration conf = Db4oClientServer.newServerConfiguration();
			db = Db4oClientServer.openServer(conf, DB4O_DB_FILE, 0);

	}

	public static ObjectContainer getManager() {

		return db.openClient();
	}

	public static void clear() {
		db.close();
		new File(DB4O_DB_FILE).delete();
	}

}

Initial URL

                                

Initial Description
Factory for ObjectContainer for local db4o database

Initial Title
Db4o ObjectContainer factory

Initial Tags
java

Initial Language
Java