db4o 7.12

com.db4o
Class Db4o

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

public class Db4o
extends java.lang.Object

factory class to start db4o database engines.

This class provides static methods to
- open single-user databases openFile(String)
- open db4o servers openServer(String, int)
- connect to db4o servers openClient(String, int, String, String)
- provide access to the global configuration context configure()
- print the version number of this db4o version main(String[])

See Also:
ExtDb4o for extended functionality.

Constructor Summary
Db4o()
           
 
Method Summary
static Configuration cloneConfiguration()
          Deprecated. use explicit configuration via Db4oEmbedded.newConfiguration() instead
static Configuration configure()
          Deprecated. use explicit configuration via Db4oEmbedded.newConfiguration() instead
static void main(java.lang.String[] args)
          prints the version name of this db4o version to System.out.
static Configuration newConfiguration()
          Deprecated. Use Db4oEmbedded.newConfiguration() instead.
static ObjectContainer openClient(Configuration config, java.lang.String hostName, int port, java.lang.String user, java.lang.String password)
          Deprecated. See the com.db4o.cs.Db4oClientServer class in db4o-X.x-cs-java.jar for methods to open db4o servers and db4o clients.
static ObjectContainer openClient(java.lang.String hostName, int port, java.lang.String user, java.lang.String password)
          Deprecated. See the com.db4o.cs.Db4oClientServer class in db4o-X.x-cs-java.jar for methods to open db4o servers and db4o clients.
static ObjectContainer openFile(Configuration config, java.lang.String databaseFileName)
          Deprecated. Use Db4oEmbedded.openFile(EmbeddedConfiguration, String) instead
static ObjectContainer openFile(java.lang.String databaseFileName)
          Deprecated. Use Db4oEmbedded.openFile(EmbeddedConfiguration, String) instead
static ObjectServer openServer(Configuration config, java.lang.String databaseFileName, int port)
          Deprecated. See the com.db4o.cs.Db4oClientServer class in db4o-X.x-cs-java.jar for methods to open db4o servers and db4o clients.
static ObjectServer openServer(java.lang.String databaseFileName, int port)
          Deprecated. See the com.db4o.cs.Db4oClientServer class in db4o-X.x-cs-java.jar for methods to open db4o servers and db4o clients.
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 db4o version to System.out.


configure

public static Configuration configure()
Deprecated. use explicit configuration via Db4oEmbedded.newConfiguration() instead

returns the global db4o Configuration context for the running JVM session.

The Configuration can be overriden in each ObjectContainer.

Returns:
the global configuration context

newConfiguration

public static Configuration newConfiguration()
Deprecated. Use Db4oEmbedded.newConfiguration() instead.

Creates a fresh Configuration instance.

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

cloneConfiguration

public static Configuration cloneConfiguration()
Deprecated. use explicit configuration via Db4oEmbedded.newConfiguration() instead

Creates a clone of the global db4o Configuration.

Returns:
a fresh configuration with all option values set to the values currently configured for the global db4o configuration context

openClient

public static ObjectContainer openClient(java.lang.String hostName,
                                         int port,
                                         java.lang.String user,
                                         java.lang.String password)
                                  throws Db4oIOException,
                                         OldFormatException,
                                         InvalidPasswordException
Deprecated. See the com.db4o.cs.Db4oClientServer class in db4o-X.x-cs-java.jar for methods to open db4o servers and db4o clients.

Operates just like openClient(Configuration, String, int, String, String), but uses the global db4o Configuration context. 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:
Db4oIOException - I/O operation failed or was unexpectedly interrupted.
OldFormatException - open operation failed because the database file is in old format and Configuration.allowVersionUpdates(boolean) is set to false.
InvalidPasswordException - password supplied for the connection is invalid.
See Also:
ObjectServer.grantAccess(java.lang.String, java.lang.String)

openClient

public static ObjectContainer openClient(Configuration config,
                                         java.lang.String hostName,
                                         int port,
                                         java.lang.String user,
                                         java.lang.String password)
                                  throws Db4oIOException,
                                         OldFormatException,
                                         InvalidPasswordException
Deprecated. See the com.db4o.cs.Db4oClientServer class in db4o-X.x-cs-java.jar for methods to open db4o servers and db4o clients.

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:
config - a custom Configuration instance to be obtained via Db4oEmbedded.newConfiguration()
hostName - the host name
port - the port the server is using
user - the user name
password - the user password
Returns:
an open ObjectContainer
Throws:
Db4oIOException - I/O operation failed or was unexpectedly interrupted.
OldFormatException - open operation failed because the database file is in old format and Configuration.allowVersionUpdates(boolean) is set to false.
InvalidPasswordException - password supplied for the connection is invalid.
See Also:
ObjectServer.grantAccess(java.lang.String, java.lang.String)

openFile

public static final ObjectContainer openFile(java.lang.String databaseFileName)
                                      throws Db4oIOException,
                                             DatabaseFileLockedException,
                                             IncompatibleFileFormatException,
                                             OldFormatException,
                                             DatabaseReadOnlyException
Deprecated. Use Db4oEmbedded.openFile(EmbeddedConfiguration, String) instead

Operates just like Db4oEmbedded#openFile(Configuration, String), but uses the global db4o Configuration context. 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 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 - 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 ObjectContainer openFile(Configuration config,
                                             java.lang.String databaseFileName)
                                      throws Db4oIOException,
                                             DatabaseFileLockedException,
                                             IncompatibleFileFormatException,
                                             OldFormatException,
                                             DatabaseReadOnlyException
Deprecated. Use Db4oEmbedded.openFile(EmbeddedConfiguration, String) instead

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 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:
config - a custom Configuration instance to be obtained via Db4oEmbedded.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)

openServer

public static final ObjectServer openServer(java.lang.String databaseFileName,
                                            int port)
                                     throws Db4oIOException,
                                            IncompatibleFileFormatException,
                                            OldFormatException,
                                            DatabaseFileLockedException,
                                            DatabaseReadOnlyException
Deprecated. See the com.db4o.cs.Db4oClientServer class in db4o-X.x-cs-java.jar for methods to open db4o servers and db4o clients.

Operates just like openServer(Configuration, String, int), but uses the global db4o Configuration context. 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 - an absolute or relative 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(). Specify a value < 0 if an arbitrary free port should be chosen - see ExtObjectServer.port().
Returns:
an ObjectServer listening on the specified port.
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)

openServer

public static final ObjectServer openServer(Configuration config,
                                            java.lang.String databaseFileName,
                                            int port)
                                     throws Db4oIOException,
                                            IncompatibleFileFormatException,
                                            OldFormatException,
                                            DatabaseFileLockedException,
                                            DatabaseReadOnlyException
Deprecated. See the com.db4o.cs.Db4oClientServer class in db4o-X.x-cs-java.jar for methods to open db4o servers and db4o clients.

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:
config - a custom Configuration instance to be obtained via Db4oEmbedded.newConfiguration()
databaseFileName - an absolute or relative 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(). Specify a value < 0 if an arbitrary free port should be chosen - see ExtObjectServer.port().
Returns:
an ObjectServer listening on the specified port.
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)

version

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

Returns:
version information as a String.

db4o 7.12

Copyright 2009 Versant Corporation. All rights reserved.