db4o 8.0

com.db4o
Class Db4oEmbedded

java.lang.Object
  extended by com.db4o.Db4oEmbedded

public class Db4oEmbedded
extends java.lang.Object

Factory class to open db4o instances in embedded mode.

Since:
7.5
See Also:
class in db4o-[version]-cs-java[java-version].jar for methods to open db4o servers and db4o clients.

Constructor Summary
Db4oEmbedded()
           
 
Method Summary
static EmbeddedConfiguration newConfiguration()
          Creates a fresh EmbeddedConfiguration instance.
static EmbeddedObjectContainer openFile(EmbeddedConfiguration config, java.lang.String databaseFileName)
          opens an ObjectContainer on the specified database file for local use.
static EmbeddedObjectContainer openFile(java.lang.String databaseFileName)
          Same as calling openFile(EmbeddedConfiguration, String) with a fresh configuration (newConfiguration()).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Db4oEmbedded

public Db4oEmbedded()
Method Detail

newConfiguration

public static EmbeddedConfiguration newConfiguration()
Creates a fresh EmbeddedConfiguration instance.

Returns:
a fresh, independent configuration with all options set to their default values

openFile

public static final EmbeddedObjectContainer openFile(EmbeddedConfiguration config,
                                                     java.lang.String databaseFileName)
                                              throws Db4oIOException,
                                                     DatabaseFileLockedException,
                                                     IncompatibleFileFormatException,
                                                     OldFormatException,
                                                     DatabaseReadOnlyException
opens an ObjectContainer on the specified database file for local use.

A database file can only be opened once, subsequent attempts to open another ObjectContainer against the same file will result in a DatabaseFileLockedException.

Database files can only be accessed for read/write access from one process (one Java VM) at one time. All versions except for db4o mobile edition use an internal mechanism to lock the database file for other processes.

Parameters:
config - a custom Configuration instance to be obtained via newConfiguration
databaseFileName - an absolute or relative path to the database file
Returns:
an open ObjectContainer
Throws:
Db4oIOException - I/O operation failed or was unexpectedly interrupted.
DatabaseFileLockedException - the required database file is locked by another process.
IncompatibleFileFormatException - runtime configuration is not compatible with the configuration of the database file.
OldFormatException - open operation failed because the database file is in old format and Configuration.allowVersionUpdates(boolean) is set to false.
DatabaseReadOnlyException - database was configured as read-only.
See Also:
Configuration.readOnly(boolean), Configuration.encrypt(boolean), Configuration.password(java.lang.String)

openFile

public static final EmbeddedObjectContainer openFile(java.lang.String databaseFileName)
                                              throws Db4oIOException,
                                                     DatabaseFileLockedException,
                                                     IncompatibleFileFormatException,
                                                     OldFormatException,
                                                     DatabaseReadOnlyException
Same as calling openFile(EmbeddedConfiguration, String) with a fresh configuration (newConfiguration()).

Parameters:
databaseFileName - an absolute or relative path to the database file
Throws:
Db4oIOException
DatabaseFileLockedException
IncompatibleFileFormatException
OldFormatException
DatabaseReadOnlyException
See Also:
openFile(EmbeddedConfiguration, String)

db4o 8.0

Copyright 2009 Versant Corporation. All rights reserved.