db4o 6.1

com.db4o.tools
Class Defragment

java.lang.Object
  extended by com.db4o.tools.Defragment

Deprecated. Please use com.db4o.defragment.Defragment

public class Defragment
extends java.lang.Object

old Deframent source code, now replaced by the built-in functionality in com.db4o.defragment.Defragment.

This class is deprecated. Please use Defragment.
This class is delivered as sourcecode in the path ../com/db4o/tools/

Prerequites:
- The database file may not be in use.
- All stored classes need to be available.
- If you use yor own special Db4o translators, they need to be installed before starting Defragment.

Performed tasks:
- Free filespace is removed.
- Deleted IDs are removed.
- Unavailable classes are removed.
- Unavailable class members are removed.
- Class indices are restored.
- Previous rename tasks are removed.

Backup:
Defragment creates a backup file with the name [filename].bak. If a file with this name is already present, Defragment will not run for safety reasons.

Recommendations:
- Keep the backup copy of your database file.
- Always back up your class files with your database files also.
You will need them to restore the full data of all objects from old database file versions.
- Scan the output log for "Class not available" messages.

You may also run this task programmatically on a scheduled basis. In this case note that Defragment modifies db4o configuration parameters. You may have to restore them for your application. See the private methods Defragment#configureDb4o() and Db4o#restoreConfiguration() in the sourcecode of com.db4o.tools.Defragment.java for the exact changed parameters that may need to be restored.


Constructor Summary
Defragment()
          Deprecated. the main method is the only entry point
 
Method Summary
static void main(java.lang.String[] args)
          Deprecated. the main method that runs Defragment.
 void run(java.lang.String filename, boolean forceBackupDelete)
          Deprecated. programmatic interface to run Defragment with a forced delete of a possible old Defragment backup.
static void setSecondClass(java.lang.String className)
          Deprecated. allows to specify a class to be treated as "second class".
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Defragment

public Defragment()
Deprecated. 
the main method is the only entry point

Method Detail

main

public static void main(java.lang.String[] args)
Deprecated. 
the main method that runs Defragment.

Parameters:
args - a String array of length 1, with the name of the database file as element 0.

setSecondClass

public static void setSecondClass(java.lang.String className)
Deprecated. 
allows to specify a class to be treated as "second class". Second class objects are not migrated to the new database on their own. A second class objects is only migrated, if it is referenced by another object.

Parameters:
className - the fully qualified classname, including the package name for Java, including the namespaces and assembly name for .NET. Format examples:
Java: 'com.db4o.f1.Pilot'
.NET: 'com.db4o.f1.Pilot, MyAssembly'

run

public void run(java.lang.String filename,
                boolean forceBackupDelete)
Deprecated. 
programmatic interface to run Defragment with a forced delete of a possible old Defragment backup.
This method is supplied for regression tests only. It is not recommended to be used by application programmers.

Parameters:
filename - the database file.
forceBackupDelete - forces deleting an old backup. Not recommended.

db4o 6.1