org.tentackle.db
Class DbPreferencesFactory

java.lang.Object
  extended by org.tentackle.db.DbPreferencesFactory
All Implemented Interfaces:
PreferencesFactory

public class DbPreferencesFactory
extends Object
implements PreferencesFactory

Factory for DbPreferences. This class allows DbPreferences to be installed as the Preferences implementations via the java.util.prefs.PreferencesFactory system property.


Constructor Summary
DbPreferencesFactory()
           
 
Method Summary
 DbPreferencesKey createKey(Db db)
          Creates a new DbPreferencesKey.
 DbPreferencesNode createNode(Db db)
          Creates a new DbPreferencesNode.
All nodes are created through this method.
 DbPreferences createPreferences(boolean userMode)
          Creates a DbPreferences instance.
protected  DbPreferences createPreferences(DbPreferences parent, DbPreferencesNode node)
          Creates a DbPreferences instance from a parent and a node.
 DbPreferences createPreferences(DbPreferences parent, String name)
          Creates a DbPreferences instance from a parent and a name.
static void installPreferencesFactory(Db db, boolean autoSync)
          Installs the factory class for the Preferences-API.
 Preferences systemRoot()
          Returns the system root preference node.
 Preferences userRoot()
          Returns the user root preference node corresponding to the calling user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbPreferencesFactory

public DbPreferencesFactory()
Method Detail

installPreferencesFactory

public static void installPreferencesFactory(Db db,
                                             boolean autoSync)
Installs the factory class for the Preferences-API.

Parameters:
db - is the db-connection the prefs are stored
autoSync - is true if automatically sync with other JVMs (recommended)

userRoot

public Preferences userRoot()
Description copied from interface: java.util.prefs.PreferencesFactory
Returns the user root preference node corresponding to the calling user. In a server, the returned value will typically depend on some implicit client-context.

Specified by:
userRoot in interface PreferencesFactory

systemRoot

public Preferences systemRoot()
Description copied from interface: java.util.prefs.PreferencesFactory
Returns the system root preference node. (Multiple calls on this method will return the same object reference.)

Specified by:
systemRoot in interface PreferencesFactory

createPreferences

public DbPreferences createPreferences(boolean userMode)
Creates a DbPreferences instance.

Parameters:
userMode - true if user mode
Returns:
the preferences instance

createPreferences

public DbPreferences createPreferences(DbPreferences parent,
                                       String name)
Creates a DbPreferences instance from a parent and a name.

Parameters:
parent - the parent preferences node
name - the name of the child node
Returns:
the preferences instance

createPreferences

protected DbPreferences createPreferences(DbPreferences parent,
                                          DbPreferencesNode node)
                                   throws BackingStoreException
Creates a DbPreferences instance from a parent and a node. Protected scope!

Parameters:
parent - the parent preferences
node - the node
Returns:
the preferences instance
Throws:
BackingStoreException

createNode

public DbPreferencesNode createNode(Db db)
Creates a new DbPreferencesNode.
All nodes are created through this method. This allows replacing the concrete implementation by overriding the method.

Parameters:
db - the db connection
Returns:
the new node within the current db

createKey

public DbPreferencesKey createKey(Db db)
Creates a new DbPreferencesKey. All keys are created through this method. This allows replacing the concrete implementation by overriding the method.

Parameters:
db - the db connection
Returns:
the new key within the current db


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de