db4o 4.0

com.db4o
Class Db4o

java.lang.Object
  extended bycom.db4o.Db4o
Direct Known Subclasses:
ExtDb4o

public class Db4o
extends java.lang.Object

factory class with static methods to configure and start the engine.

This class serves as a factory class, to open ObjectContainer instances on database files.

The global db4o Configuration object for the running Java session is available through the configure() method.

On running the Db4o class it prints the current version to System.out.

See Also:
ExtDb4o for extended functionality.

Constructor Summary
Db4o()
           
 
Method Summary
static Configuration configure()
          returns the global db4o Configuration context for the running JVM session.
static void licensedTo(java.lang.String emailAddress)
          enters the licensing information into licensed versions.
static void main(java.lang.String[] args)
          prints the version name of this version to System.out.
static ObjectContainer openClient(java.lang.String hostName, int port, java.lang.String user, java.lang.String password)
          opens an ObjectContainer client and connects it to the specified named server and port.
static ObjectContainer openFile(java.lang.String databaseFileName)
          opens an ObjectContainer on the specified database file for local use.
static ObjectServer openServer(java.lang.String databaseFileName, int port)
          opens an ObjectServer on the specified database file and port.
static java.lang.String version()
          returns the version name of the used db4o version.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Db4o

public Db4o()
Method Detail

main

public static void main(java.lang.String[] args)
prints the version name of this version to System.out.


configure

public static Configuration configure()
returns the global db4o Configuration context for the running JVM session.

The Configuration can be overriden in each ObjectContainer.

Returns:
Configuration the global Configuration context
See Also:
ObjectContainer#configure()

licensedTo

public static void licensedTo(java.lang.String emailAddress)
enters the licensing information into licensed versions.


openClient

public static ObjectContainer openClient(java.lang.String hostName,
                                         int port,
                                         java.lang.String user,
                                         java.lang.String password)
                                  throws java.io.IOException
opens an ObjectContainer client and connects it to the specified named server and port.

The server needs to allow access for the specified user and password.

A client ObjectContainer can be cast to ExtClient to use extended ExtObjectContainer and ExtClient methods.

Parameters:
hostName - the host name
port - the port the server is using
user - the user name
password - the user password
Returns:
an open ObjectContainer
Throws:
java.io.IOException
See Also:
ObjectServer#grantAccess()

openFile

public static final ObjectContainer openFile(java.lang.String databaseFileName)
                                      throws DatabaseFileLockedException
opens an ObjectContainer on the specified database file for local use.

Subsidiary calls with the same database file name will return the same ObjectContainer object.

Every call to openFile() requires a corresponding ObjectContainer.close().

Database files can only be accessed for readwrite 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:
databaseFileName - the full path to the database file
Returns:
an open ObjectContainer
Throws:
DatabaseFileLockedException
See Also:
Configuration#readOnly(), Configuration#encrypt(), Configuration#password()

openServer

public static final ObjectServer openServer(java.lang.String databaseFileName,
                                            int port)
                                     throws DatabaseFileLockedException
opens an ObjectServer on the specified database file and port.

If the server does not need to listen on a port because it will only be used in embedded mode with ObjectServer.openClient(), specify '0' as the port number.

Parameters:
databaseFileName - the full path to the database file
port - the port to be used, or 0, if the server should not open a port, because it will only be used with ObjectServer.openClient()
Returns:
an ObjectServer listening on the specified port.
Throws:
DatabaseFileLockedException
See Also:
Configuration#readOnly(), Configuration#encrypt(), Configuration#password()

version

public static final java.lang.String version()
returns the version name of the used db4o version.

Returns:
version information as a String

db4o 4.0