com.ibm.as400.registry
Class Registry

java.lang.Object
  |
  +--com.ibm.as400.registry.Registry
Direct Known Subclasses:
ApplicationRegistry, AS400Registry, WindowsRegistry

public abstract class Registry
extends java.lang.Object

The abstract base class for all registry implementations. A concrete Registry subclass is provided for each supported backing store: the Windows registry, binary files in the local file system (known as the application registry because it is scoped to a designated application), and an LDAP directory. The static method getInstance returns a single immutable instance of the desired type.

All Registry implementations support the same set of hierarchical namespaces:

Registry implementations typically define pathname constants that provide a logical organization of nodes within a given namespace. However, no ordering is imposed on the session namespace - applications are free to structure this data however they choose. To avoid naming collisions, it's recommended that the application define a root node in the session namespace which serves to partition this data from that of other applications which may be active in the same Java VM.

Registry defines the abstract method getRoot which returns the root node of the desired namespace.

Since:
v5r1m0
See Also:
WindowsRegistry, ApplicationRegistry, LDAPRegistry

Field Summary
static int APPLICATION_REGISTRY
          Indicates that registry objects should be loaded from/saved to a local backing store associated with the application.
static java.lang.String APPLICATION_ROOT
          Identifies the root of the application namespace.
static int AS400_REGISTRY
           
static int LDAP_REGISTRY
          Indicates that registry objects should be loaded from/saved to a network directory accessible from an LDAP server.
static java.lang.String PLATFORM_ROOT
          Identifies the root of the platform namespace.
protected static int REGISTRY_VERSION
           
static java.lang.String SERVERS_ROOT
          Identifies the root of the servers namespace.
static java.lang.String SESSION_ROOT
          Identifies the root of the session namespace.
static java.lang.String USER_ROOT
          Identifies the root of the user namespace.
static int WINDOWS_REGISTRY
          Indicates that registry objects are to be loaded from/saved to the Windows registry.
 
Method Summary
static Registry getInstance()
          Returns the shared ApplicationRegistry instance.
static Registry getInstance(int type)
          Returns a shared Registry instance of the desired type.
abstract  RegistryNode getRoot(java.lang.String namespace)
          Returns the root of a registry namespace.
static int getVersion()
          Returns the package version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REGISTRY_VERSION

protected static final int REGISTRY_VERSION

WINDOWS_REGISTRY

public static final int WINDOWS_REGISTRY
Indicates that registry objects are to be loaded from/saved to the Windows registry. On non-Windows platforms this setting has no effect and the application registry will be used.

APPLICATION_REGISTRY

public static final int APPLICATION_REGISTRY
Indicates that registry objects should be loaded from/saved to a local backing store associated with the application. Clients should call ApplicationRegistry.setApplicationName to identify the application. An application name may also be specified on the system property registry.application.name. The default if no application name is specified is "MyApplication".

LDAP_REGISTRY

public static final int LDAP_REGISTRY
Indicates that registry objects should be loaded from/saved to a network directory accessible from an LDAP server. Clients should call LDAPRegistry.setServerName to identify the server. A server name may also be specified on the system property registry.server.name. If no server name is supplied an exception will be thrown the first time an attempt is made to access the registry.

AS400_REGISTRY

public static final int AS400_REGISTRY

PLATFORM_ROOT

public static final java.lang.String PLATFORM_ROOT
Identifies the root of the platform namespace. The platform namespace contains information about software installed on the platform on which the application is running.

APPLICATION_ROOT

public static final java.lang.String APPLICATION_ROOT
Identifies the root of the application namespace. The application namespace contains information about the application and its components.

USER_ROOT

public static final java.lang.String USER_ROOT
Identifies the root of the user namespace. The user namespace contains a sub-hierarchy for each platform user, which contains user preferences and customization data. getRoot will return the appropriate RegistryNode for the current platform user.

SERVERS_ROOT

public static final java.lang.String SERVERS_ROOT
Identifies the root of the servers namespace. The servers namespace contains a sub-hierarchy for each data server that the application connects to.

SESSION_ROOT

public static final java.lang.String SESSION_ROOT
Identifies the root of the session namespace. The session namespace contains volatile data which is only preserved for the duration of the current process.
Method Detail

getInstance

public static Registry getInstance(int type)
Returns a shared Registry instance of the desired type.
Parameters:
type - A constant that identifies the type of backing store to be used.
Returns:
The requested Registry instance.
Throws:
java.lang.IllegalArgumentException - If the type specified is not valid.
Since:
v5r1m0

getInstance

public static Registry getInstance()
Returns the shared ApplicationRegistry instance. Convenience method for obtaining a reference to the default registry type.
Returns:
The shared ApplicationRegistry instance.
Since:
v5r1m0

getRoot

public abstract RegistryNode getRoot(java.lang.String namespace)
                              throws RegistryException
Returns the root of a registry namespace.
Parameters:
namespace - A constant that identifies the desired namespace root.
Returns:
The root of the specified namespace.
Throws:
RegistryException - If the specified root cannot be accessed.
Since:
v5r1m0
See Also:
RegistryNode

getVersion

public static int getVersion()
Returns the package version. The version is expressed as a hex value. For example, in the v5r1m0 release getVersion would return 0x00050100.
Returns:
The version of the com.ibm.as400.registry package.
Since:
v5r1m0