db4o 7.4

com.db4o.defragment
Class DefragmentConfig

java.lang.Object
  extended by com.db4o.defragment.DefragmentConfig

public class DefragmentConfig
extends java.lang.Object

Configuration for a defragmentation run.

See Also:
Defragment

Field Summary
static java.lang.String BACKUP_SUFFIX
           
static boolean DEBUG
           
 
Constructor Summary
DefragmentConfig(java.lang.String origPath)
          Creates a configuration for a defragmentation run.
DefragmentConfig(java.lang.String origPath, java.lang.String backupPath)
          Creates a configuration for a defragmentation run with in-memory mapping.
DefragmentConfig(java.lang.String origPath, java.lang.String backupPath, ContextIDMapping mapping)
          Creates a configuration for a defragmentation run.
 
Method Summary
 java.lang.String backupPath()
           
 int blockSize()
           
 Configuration clonedDb4oConfig()
           
 Configuration db4oConfig()
           
 void db4oConfig(Configuration config)
           
 boolean fileNeedsUpgrade()
           
 boolean forceBackupDelete()
           
 void forceBackupDelete(boolean forceBackupDelete)
           
 ContextIDMapping mapping()
           
 int objectCommitFrequency()
           
 void objectCommitFrequency(int objectCommitFrequency)
           
 java.lang.String origPath()
           
 boolean readOnly()
           
 void readOnly(boolean flag)
          allows turning on and off readonly mode.

When changed classes are likely to be detected defragment, it may be required to open the original database in read/write mode.
 StoredClassFilter storedClassFilter()
           
 void storedClassFilter(StoredClassFilter storedClassFilter)
           
 java.lang.String tempPath()
           
 void upgradeFile(java.lang.String tempPath)
          Instruct the defragment process to upgrade the source file to the current db4o version prior to defragmenting it.
static Configuration vanillaDb4oConfig(int blockSize)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values

BACKUP_SUFFIX

public static final java.lang.String BACKUP_SUFFIX
See Also:
Constant Field Values
Constructor Detail

DefragmentConfig

public DefragmentConfig(java.lang.String origPath)
Creates a configuration for a defragmentation run. The backup and mapping file paths are generated from the original path by appending the default suffixes. All properties other than the provided paths are set to FALSE by default.

Parameters:
origPath - The path to the file to be defragmented. Must exist and must be a valid yap file.

DefragmentConfig

public DefragmentConfig(java.lang.String origPath,
                        java.lang.String backupPath)
Creates a configuration for a defragmentation run with in-memory mapping. All properties other than the provided paths are set to FALSE by default.

Parameters:
origPath - The path to the file to be defragmented. Must exist and must be a valid yap file.
backupPath - The path to the backup of the original file. No file should exist at this position, otherwise it will be OVERWRITTEN if forceBackupDelete() is set to true!

DefragmentConfig

public DefragmentConfig(java.lang.String origPath,
                        java.lang.String backupPath,
                        ContextIDMapping mapping)
Creates a configuration for a defragmentation run. All properties other than the provided paths are set to FALSE by default.

Parameters:
origPath - The path to the file to be defragmented. Must exist and must be a valid yap file.
backupPath - The path to the backup of the original file. No file should exist at this position, otherwise it will be OVERWRITTEN if forceBackupDelete() is set to true!
mapping - The intermediate mapping used internally.
Method Detail

origPath

public java.lang.String origPath()
Returns:
The path to the file to be defragmented.

backupPath

public java.lang.String backupPath()
Returns:
The path to the backup of the original file.

mapping

public ContextIDMapping mapping()
Returns:
The intermediate mapping used internally. For internal use only.

storedClassFilter

public StoredClassFilter storedClassFilter()
Returns:
The StoredClassFilter used to select stored class extents to be included into the defragmented file.

storedClassFilter

public void storedClassFilter(StoredClassFilter storedClassFilter)
Parameters:
storedClassFilter - The StoredClassFilter used to select stored class extents to be included into the defragmented file.

forceBackupDelete

public boolean forceBackupDelete()
Returns:
true, if an existing backup file should be deleted, false otherwise.

forceBackupDelete

public void forceBackupDelete(boolean forceBackupDelete)
Parameters:
forceBackupDelete - true, if an existing backup file should be deleted, false otherwise.

readOnly

public void readOnly(boolean flag)
allows turning on and off readonly mode.

When changed classes are likely to be detected defragment, it may be required to open the original database in read/write mode.

Readonly mode is the default setting.

Parameters:
flag - false, to turn off readonly mode.

readOnly

public boolean readOnly()
Returns:
true, if the original database file is to be opened in readonly mode.

db4oConfig

public Configuration db4oConfig()
Returns:
The db4o Configuration to be applied during the defragment process.

db4oConfig

public void db4oConfig(Configuration config)
Parameters:
config - The db4o Configuration to be applied during the defragment process.

objectCommitFrequency

public int objectCommitFrequency()

objectCommitFrequency

public void objectCommitFrequency(int objectCommitFrequency)
Parameters:
objectCommitFrequency - The number of processed object (slots) that should trigger an intermediate commit of the target file. Default: 0, meaning: never.

upgradeFile

public void upgradeFile(java.lang.String tempPath)
Instruct the defragment process to upgrade the source file to the current db4o version prior to defragmenting it. Use this option if your source file has been created with an older db4o version than the one you are using.

Parameters:
tempPath - The location for an intermediate, upgraded version of the source file.

fileNeedsUpgrade

public boolean fileNeedsUpgrade()

tempPath

public java.lang.String tempPath()

blockSize

public int blockSize()

vanillaDb4oConfig

public static Configuration vanillaDb4oConfig(int blockSize)

clonedDb4oConfig

public Configuration clonedDb4oConfig()

db4o 7.4

Copyright 2007 db4objects Inc. All rights reserved.