Package com.db4o
Class Db4o
- java.lang.Object
-
- com.db4o.Db4o
-
public class Db4o extends java.lang.Object
Deprecated.factory class to start db4o database engines.
This class provides static methods to
- open single-user databasesopenFile(String)
- open db4o serversopenServer(String, int)
- connect to db4o serversopenClient(String, int, String, String)
- provide access to the global configuration contextconfigure()
- print the version number of this db4o versionmain(String[])
- See Also:
ExtDb4o for extended functionality.
-
-
Constructor Summary
Constructors Constructor Description Db4o()
Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Configuration
cloneConfiguration()
Deprecated.use explicit configuration viaDb4oEmbedded.newConfiguration()
insteadstatic Configuration
configure()
Deprecated.use explicit configuration viaDb4oEmbedded.newConfiguration()
insteadstatic void
main(java.lang.String[] args)
Deprecated.UseDb4oVersion.NAME
instead.static Configuration
newConfiguration()
Deprecated.UseDb4oEmbedded.newConfiguration()
instead.static ObjectContainer
openClient(Configuration config, java.lang.String hostName, int port, java.lang.String user, java.lang.String password)
Deprecated.See theDb4oClientServer
class in db4o client server library 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 theDb4oClientServer
class in db4o client server library for methods to open db4o servers and db4o clients.static ObjectContainer
openFile(Configuration config, java.lang.String databaseFileName)
Deprecated.static ObjectContainer
openFile(java.lang.String databaseFileName)
Deprecated.static ObjectServer
openServer(Configuration config, java.lang.String databaseFileName, int port)
Deprecated.See the Db4oClientServer class in db4o client server library for methods to open db4o servers and db4o clients.static ObjectServer
openServer(java.lang.String databaseFileName, int port)
Deprecated.See theDb4oClientServer
class in db4o client server library for methods to open db4o servers and db4o clients.static java.lang.String
version()
Deprecated.Since 8.1.
-
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
Deprecated.UseDb4oVersion.NAME
instead.prints the version name of this db4o version toSystem.out
.
-
configure
public static Configuration configure()
Deprecated.use explicit configuration viaDb4oEmbedded.newConfiguration()
insteadreturns the global db4oConfiguration
context for the running VM session.
TheConfiguration
can be overridden in eachObjectContainer
.- Returns:
- the global
configuration
context
-
newConfiguration
public static Configuration newConfiguration()
Deprecated.UseDb4oEmbedded.newConfiguration()
instead.Creates a freshConfiguration
instance.- Returns:
- a fresh, independent configuration with all options set to their default values
-
cloneConfiguration
public static Configuration cloneConfiguration()
Deprecated.use explicit configuration viaDb4oEmbedded.newConfiguration()
insteadCreates a clone of the global db4oConfiguration
.- 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 theDb4oClientServer
class in db4o client server library for methods to open db4o servers and db4o clients.Operates just likeopenClient(Configuration, String, int, String, String)
, but uses the global db4oConfiguration
context. opens anObjectContainer
client and connects it to the specified named server and port.
The server needs toallow access
for the specified user and password.
A clientObjectContainer
can be cast toExtClient
to use extendedExtObjectContainer
andExtClient
methods.- Parameters:
hostName
- the host nameport
- the port the server is usinguser
- the user namepassword
- 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 andConfiguration.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 theDb4oClientServer
class in db4o client server library for methods to open db4o servers and db4o clients.opens anObjectContainer
client and connects it to the specified named server and port.
The server needs toallow access
for the specified user and password.
A clientObjectContainer
can be cast toExtClient
to use extendedExtObjectContainer
andExtClient
methods.- Parameters:
config
- a customConfiguration
instance to be obtained viaDb4oEmbedded.newConfiguration()
hostName
- the host nameport
- the port the server is usinguser
- the user namepassword
- 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 andConfiguration.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.Operates just likeDb4oEmbedded#openFile(Configuration, String)
, but uses the global db4oConfiguration
context. opens anObjectContainer
on the specified database file for local use.
A database file can only be opened once, subsequent attempts to open anotherObjectContainer
against the same file will result in aDatabaseFileLockedException
.
Database files can only be accessed for readwrite access from one process (one 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
- runtimeconfiguration
is not compatible with the configuration of the database file.OldFormatException
- open operation failed because the database file is in old format andConfiguration.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.opens anObjectContainer
on the specified database file for local use.
A database file can only be opened once, subsequent attempts to open anotherObjectContainer
against the same file will result in aDatabaseFileLockedException
.
Database files can only be accessed for readwrite access from one process (one VM) at a time. All versions except for db4o mobile edition use an internal mechanism to lock the database file for other processes.- Parameters:
config
- a customConfiguration
instance to be obtained viaDb4oEmbedded.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
- runtimeconfiguration
is not compatible with the configuration of the database file.OldFormatException
- open operation failed because the database file is in old format andConfiguration.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 theDb4oClientServer
class in db4o client server library for methods to open db4o servers and db4o clients.Operates just likeopenServer(Configuration, String, int)
, but uses the global db4oConfiguration
context. opens anObjectServer
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 withObjectServer.openClient()
, specify '0' as the port number.- Parameters:
databaseFileName
- an absolute or relative path to the database fileport
- the port to be used, or 0, if the server should not open a port, because it will only be used withObjectServer.openClient()
. Specify a value < 0 if an arbitrary free port should be chosen - seeExtObjectServer.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
- runtimeconfiguration
is not compatible with the configuration of the database file.OldFormatException
- open operation failed because the database file is in old format andConfiguration.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 Db4oClientServer class in db4o client server library for methods to open db4o servers and db4o clients.opens anObjectServer
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 withObjectServer.openClient()
, specify '0' as the port number.- Parameters:
config
- a customConfiguration
instance to be obtained viaDb4oEmbedded.newConfiguration()
databaseFileName
- an absolute or relative path to the database fileport
- the port to be used, or 0, if the server should not open a port, because it will only be used withObjectServer.openClient()
. Specify a value < 0 if an arbitrary free port should be chosen - seeExtObjectServer.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
- runtimeconfiguration
is not compatible with the configuration of the database file.OldFormatException
- open operation failed because the database file is in old format andConfiguration.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()
Deprecated.Since 8.1. UseDb4oVersion.NAME
instead.returns the version name of the used db4o version.- Returns:
- version information as a
String
.
-
-