|
db4o 7.4 | ||||||||
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 | |
---|---|
int |
activationDepth()
gets the configured activation depth. |
void |
activationDepth(int depth)
sets the activation depth to the specified value. |
void |
add(ConfigurationItem configurationItem)
adds ConfigurationItems to be applied when an ObjectContainer or ObjectServer is opened. |
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 client/server configuration interface. |
void |
databaseGrowthSize(int bytes)
configures the size database files should grow in bytes, when no free slot is found within. |
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)
Deprecated. use a custom encrypting IoAdapter instead |
void |
exceptionsOnNotStorable(boolean flag)
configures whether Exceptions are to be thrown, if objects can not be stored. |
void |
flushFileBuffers(boolean flag)
Deprecated. Please use a NonFlushingIoAdapter instead. |
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. |
boolean |
internStrings()
returns true if strings will be interned. |
void |
internStrings(boolean flag)
configures db4o to call #intern() on strings upon retrieval. |
IoAdapter |
io()
returns the configured IoAdapter . |
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)
Deprecated. use a custom encrypting IoAdapter instead |
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 |
registerTypeHandler(TypeHandlerPredicate predicate,
TypeHandler4 typeHandler)
allows registering special TypeHandlers for customized marshalling and customized comparisons. |
void |
removeAlias(Alias alias)
Removes an alias previously added with addAlias(Alias) . |
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
int activationDepth()
void add(ConfigurationItem configurationItem)
configurationItem
- the ConfigurationItemvoid 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(
"Tutorial.F1.*, Tutorial",
"com.f1.*"));
// Mapping a Java package onto another
Db4o.configure().addAlias(
new WildcardAlias(
"com.f1.*",
"com.f1.client*"));
void removeAlias(Alias alias)
addAlias(Alias)
.
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) throws GlobalOnlyConfigException
bytes
- the size in bytes from 1 to 127
GlobalOnlyConfigException
void 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?
ClientServerConfiguration clientServer()
void databaseGrowthSize(int bytes)
bytes
- amount of bytesvoid detectSchemaChanges(boolean flag)
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) throws GlobalOnlyConfigException
IoAdapter
instead
Db4o.openFile(java.lang.String)
.
flag
- true for turning encryption on, false for turning encryption
off.
GlobalOnlyConfigException
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)
NonFlushingIoAdapter
instead.
NonFlushingIoAdapter
.
FreespaceConfiguration freespace()
void generateUUIDs(int setting)
generateUUIDs(ConfigScope)
instead.
setting
- one of the following values:void generateUUIDs(ConfigScope setting)
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)
setting
- the scope for version number generation: disabled, generate for all classes, or configure individuallyvoid internStrings(boolean flag)
flag
- true to intern stringsboolean internStrings()
void io(IoAdapter adapter) throws GlobalOnlyConfigException
IoAdapter
to
write your own. Possible usecases could be improved performance
with a native library, mirrored write to two files, encryption or
read-on-write fail-safety control.
adapter
- - the IoAdapter
GlobalOnlyConfigException
IoAdapter io()
IoAdapter
.
void 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) throws GlobalOnlyConfigException
IoAdapter
instead
Db4o.openFile(java.lang.String)
.
pass
- the password to be used.
GlobalOnlyConfigException
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) throws DatabaseReadOnlyException, com.db4o.foundation.NotSupportedException
ExtObjectContainer.configure()
) will
continually allocate space.
byteCount
- the number of bytes to reserve
DatabaseReadOnlyException
com.db4o.foundation.NotSupportedException
void 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.
messageLevel(int)
to produce more detailed messages.
setOut(System.out)
to print messages to the
console.messageLevel(int)
is used.
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(java.lang.String)
or Db4o.openServer(java.lang.String, int)
.
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(java.lang.Object)
for further details.ObjectContainer.set(java.lang.Object)
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 millisecondsvoid registerTypeHandler(TypeHandlerPredicate predicate, TypeHandler4 typeHandler)
predicate
- to specify for which classes and versions the
TypeHandler is to be used.typeHandler
- to be used for the classes that match the predicate.
|
db4o 7.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |