|
db4o 6.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Configuration
configuration interface.
This interface contains methods to configure db4o.
The global Configuration context is available with Db4o.configure()
.
When an ObjectContainer or ObjectServer is opened, the global Configuration
context is cloned and copied into the ObjectContainer/ObjectServer.
That means every ObjectContainer/ObjectServer gets it's own copy of
configuration settings.
Most configuration settings should be set before opening an
ObjectContainer/ObjectServer.
Some configuration settings can be modified on an open
ObjectContainer/ObjectServer. The local Configuration context is
available with ExtObjectContainer.configure()
and ExtObjectServer.configure()
.
Method Summary | |
---|---|
void |
activationDepth(int depth)
sets the activation depth to the specified value. |
void |
addAlias(Alias alias)
adds a new Alias for a class, namespace or package. |
void |
allowVersionUpdates(boolean flag)
turns automatic database file format version updates on. |
void |
automaticShutDown(boolean flag)
turns automatic shutdown of the engine on and off. |
void |
blockSize(int bytes)
sets the storage data blocksize for new ObjectContainers. |
void |
bTreeCacheHeight(int height)
configures caching of BTree nodes. |
void |
bTreeNodeSize(int size)
configures the size of BTree nodes in indexes. |
void |
callbacks(boolean flag)
turns callback methods on and off. |
void |
callConstructors(boolean flag)
advises db4o to try instantiating objects with/without calling constructors. |
void |
classActivationDepthConfigurable(boolean flag)
turns individual class activation depth configuration on
and off. |
ClientServerConfiguration |
clientServer()
returns the freespace configuration interface. |
void |
detectSchemaChanges(boolean flag)
tuning feature: configures whether db4o checks all persistent classes upon system startup, for added or removed fields. |
DiagnosticConfiguration |
diagnostic()
returns the configuration interface for diagnostics. |
void |
disableCommitRecovery()
turns commit recovery off. |
void |
discardFreeSpace(int byteCount)
Deprecated. please call Db4o.configure().freespace().discardSmallerThan() |
void |
encrypt(boolean flag)
configures the use of encryption. |
void |
exceptionsOnNotStorable(boolean flag)
configures whether Exceptions are to be thrown, if objects can not be stored. |
void |
flushFileBuffers(boolean flag)
configures file buffers to be flushed during transaction commits. |
FreespaceConfiguration |
freespace()
returns the freespace configuration interface. |
void |
generateUUIDs(ConfigScope setting)
configures db4o to generate UUIDs for stored objects. |
void |
generateUUIDs(int setting)
Deprecated. Use generateUUIDs(ConfigScope) instead. |
void |
generateVersionNumbers(ConfigScope setting)
configures db4o to generate version numbers for stored objects. |
void |
generateVersionNumbers(int setting)
Deprecated. Use generateVersionNumbers(ConfigScope) instead. |
void |
internStrings(boolean doIntern)
Configures db4o to call intern() on strings upon retrieval. |
void |
io(IoAdapter adapter)
allows to configure db4o to use a customized byte IO adapter. |
void |
lockDatabaseFile(boolean flag)
can be used to turn the database file locking thread off. |
void |
markTransient(java.lang.String attributeName)
allows to mark fields as transient with custom attributes. |
void |
messageLevel(int level)
sets the detail level of db4o messages. |
ObjectClass |
objectClass(java.lang.Object clazz)
returns an ObjectClass object
to configure the specified class. |
boolean |
optimizeNativeQueries()
indicates whether Native Queries will be optimized dynamically. |
void |
optimizeNativeQueries(boolean optimizeNQ)
If set to true, db4o will try to optimize native queries dynamically at query execution time, otherwise it will run native queries in unoptimized mode as SODA evaluations. |
void |
password(java.lang.String pass)
protects the database file with a password. |
QueryConfiguration |
queries()
returns the Query configuration interface. |
void |
readOnly(boolean flag)
turns readOnly mode on and off. |
void |
reflectWith(Reflector reflector)
configures the use of a specially designed reflection implementation. |
void |
refreshClasses()
forces analysis of all Classes during a running session. |
void |
removeAlias(Alias alias)
Removes an alias previously added with addAlias . |
void |
reserveStorageSpace(long byteCount)
tuning feature only: reserves a number of bytes in database files. |
void |
setBlobPath(java.lang.String path)
configures the path to be used to store and read Blob data. |
void |
setClassLoader(java.lang.Object classLoader)
Deprecated. use reflectWith(new JdkReflector(classLoader)) instead |
void |
setOut(java.io.PrintStream outStream)
Assigns a PrintStream where db4o is to print its event messages. |
void |
testConstructors(boolean flag)
tuning feature: configures whether db4o should try to instantiate one instance of each persistent class on system startup. |
void |
unicode(boolean flag)
configures the storage format of Strings. |
void |
updateDepth(int depth)
specifies the global updateDepth. |
void |
weakReferenceCollectionInterval(int milliseconds)
configures the timer for WeakReference collection. |
void |
weakReferences(boolean flag)
turns weak reference management on or off. |
Method Detail |
---|
void activationDepth(int depth)
ObjectSet
of a query result, the result objects
will be activated to the configured activation depth.// Object foo is the result of a query, it is delivered by the ObjectSet Object foo = objectSet.next();foo.member1.member2.member3.member4.member5 will be a valid object
ObjectContainer#activate(member5, depth)
.
ObjectContainer#deactivate(Object, depth)
can be used to manually free memory by deactivating objects.
depth
- the desired global activation depth.configuring classes individually
void addAlias(Alias alias)
TypeAlias
provides an #equals() resolver to match
names directly.WildcardAlias
allows simple pattern matching
with one single '*' wildcard character.Alias
constructs by creating own resolvers
that implement the Alias
interface.
// Creating an Alias for a single class
Db4o.configure().addAlias(
new TypeAlias("com.f1.Pilot", "com.f1.Driver"));
// Accessing a .NET assembly from a Java package
Db4o.configure().addAlias(
new WildcardAlias(
"com.f1.*, F1RaceAssembly",
"com.f1.*"));
// Using a different local .NET assembly
Db4o.configure().addAlias(
new WildcardAlias(
"com.f1.*, F1RaceAssembly",
"com.f1.*, RaceClient"));
// Mapping a Java package onto another
Db4o.configure().addAlias(
new WildcardAlias(
"com.f1.*",
"com.f1.client*"));
void removeAlias(Alias alias)
addAlias
.
alias
- the alias to removevoid allowVersionUpdates(boolean flag)
void automaticShutDown(boolean flag)
Runtime.addShutdownHook()
System.runFinalizersOnExit(true)
and code
in the finalizer.true
.
flag
- whether db4o should shut down automatically.void blockSize(int bytes)
bytes
- the size in bytes from 1 to 127void bTreeNodeSize(int size)
size
- the number of elements held in one BTree node.void bTreeCacheHeight(int height)
height
- the height of the cache from the rootvoid callbacks(boolean flag)
flag
- false to turn callback methods offUsing callbacks
void callConstructors(boolean flag)
ObjectClass.callConstructor(boolean)
.
flag
- - specify true, to request calling constructors, specify
false to request not calling constructors.ObjectClass.callConstructor(boolean)
void classActivationDepthConfigurable(boolean flag)
individual class activation depth configuration
on
and off.
flag
- false to turn the possibility to individually configure class
activation depths offWhy activation?
void detectSchemaChanges(boolean flag)
false
,
if all necessary classes have been stored to the database file and none of them
have been modified since the last use.
true
flag
- the desired settingDiagnosticConfiguration diagnostic()
void disableCommitRecovery()
void discardFreeSpace(int byteCount)
Integer.MAX_VALUE
to this method to discard all free slots for
the best possible startup time.0
all space is reused
byteCount
- Slots with this size or smaller will be lost.void encrypt(boolean flag)
Db4o.openFile()
.
flag
- true for turning encryption on, false for turning encryption
off.password(java.lang.String)
void exceptionsOnNotStorable(boolean flag)
ObjectNotStorableException
if an object can not be stored.
flag
- true to throw Exceptions if objects can not be stored.void flushFileBuffers(boolean flag)
flag
- true for flushing file buffersFreespaceConfiguration freespace()
void generateUUIDs(int setting)
generateUUIDs(ConfigScope)
instead.
setting
- one of the following values:void generateUUIDs(ConfigScope setting)
the
- scope for UUID generation: disabled, generate for all classes, or configure individuallyvoid generateVersionNumbers(int setting)
generateVersionNumbers(ConfigScope)
instead.
setting
- one of the following values:void generateVersionNumbers(ConfigScope setting)
the
- scope for version number generation: disabled, generate for all classes, or configure individuallyvoid internStrings(boolean doIntern)
doIntern
- intern strings on retrieval if true, don't otherwisevoid io(IoAdapter adapter)
IoAdapter
to
write your own. Possible usecases could be improved performance
with a native library, mirrored write to two files or
read-on-write fail-safety control.
adapter
- - the IoAdaptervoid markTransient(java.lang.String attributeName)
attributeName
- - the fully qualified name of the attribute, including
it's namespacevoid messageLevel(int level)
PrintStream
.
level
- integer from 0 to 3setOut(java.io.PrintStream)
void lockDatabaseFile(boolean flag)
true
.
flag
- false
to turn database file locking off.ObjectClass objectClass(java.lang.Object clazz)
ObjectClass
object
to configure the specified class.
clazz
- class name, Class object, or example object.ObjectClass
object for configuration.void optimizeNativeQueries(boolean optimizeNQ)
true
.
optimizeNQ
- true, if db4o should try to optimize
native queries at query execution time, false otherwiseboolean optimizeNativeQueries()
optimizeNativeQueries(boolean)
void password(java.lang.String pass)
Db4o.openFile()
.
pass
- the password to be used.QueryConfiguration queries()
void readOnly(boolean flag)
Db4o.openFile()
will open files.
flag
- true
for configuring readOnly mode for subsequent
calls to Db4o.openFile()
.void reflectWith(Reflector reflector)
void refreshClasses()
setClassLoader(java.lang.Object)
void reserveStorageSpace(long byteCount)
ExtObjectContainer.configure()
) will
continually allocate space.
byteCount
- the number of bytes to reservevoid setBlobPath(java.lang.String path) throws java.io.IOException
path
- the path to be used
java.io.IOException
void setClassLoader(java.lang.Object classLoader)
classLoader
- the ClassLoader to be usedvoid setOut(java.io.PrintStream outStream)
PrintStream
where db4o is to print its event messages.
Db4o.configure().messageLevel()
to produce more detailed messages.
setOut(System.out)
to print messages to the
console.
outStream
- the new PrintStream
for messages.messageLevel(int)
void testConstructors(boolean flag)
false
,
if all persistent classes have public default constructors.
true
flag
- the desired settingvoid unicode(boolean flag)
Db4o.openFile()
.
db4o database files keep their string format after creation.
flag
- true
for turning Unicode support on, false
for turning
Unicode support off.void updateDepth(int depth)
ObjectContainer.set()
for further details.ObjectContainer.set()
will be updated.
depth
- the depth of the desired update.ObjectClass.updateDepth(int)
,
ObjectClass.cascadeOnUpdate(boolean)
,
Using callbacks
void weakReferences(boolean flag)
ExtObjectContainer.purge(java.lang.Object)
false
causes db4o to use hard
references to objects, preventing the garbage collection process
from disposing of unused objects.
true
.
void weakReferenceCollectionInterval(int milliseconds)
milliseconds
- the time in millisecondsClientServerConfiguration clientServer()
|
db4o 6.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |