com.ibm.as400.registry
Class JavaReg

java.lang.Object
  |
  +--com.ibm.as400.registry.JavaReg

public class JavaReg
extends java.lang.Object

Provides a command line utility for importing/exporting registry data from/to a file. Files must have the extension .jreg. See the method description for main() below for a description of the command line parameters.

For convenience in migrating Windows registry data, the format of JREG files is nearly identical to that of Windows REG files. The only difference is the file header, which must consist of the following two lines in place of the Windows REGEDIT4 header:

 JAVAREG VERSION="1.0"
 APPLICATION="application name"|LDAP="server name"
 
If registry data is to be applied to the local file-based backing store, the input JREG file should identify the name of the application which is associated with the registry instance. For OpNav components this application name will always be OpNav.Java, as shown below.
 JAVAREG VERSION="1.0"
 APPLICATION="OpNav.Java"
 
If registry data is to be applied to the LDAP backing store the name of the LDAP server that provides access to the directory objects should be supplied. This may either be a DNS name or a dotted decimal address.
 JAVAREG VERSION="1.0"
 LDAP="rchasp04.rchland.ibm.com"
 

Reserved Pathnames

JavaReg maps the predefined Windows namespace roots to the following registry namespaces: JavaReg also modifies certain key names when encountered in imported JREG files. This is done to ensure consistency with the pathname constants defined by the ApplicationRegistry class.

Additional Data Types for Fields

In addition to the hex and dword keywords supported by Windows, two additional keywords are supported: int and boolean. int values are signed decimal numbers in the range -2147483648 to 2147483647.
 "MyAttribute"=int:-47
 
boolean values are strings with values of either true or false. Values are not case sensitive.
 "MyAttribute"=boolean:true
 

Since:
v5r1m0
See Also:
main(java.lang.String[])

Method Summary
static void main(java.lang.String[] args)
          Provides the command line interface.
static void processExport(java.io.File file, java.lang.String appName, java.lang.String namespace, java.lang.String path)
          Provides a programmatic interface for exporting registry data to a file.
static void processExportAS400(java.io.File file, java.lang.String appName, java.lang.String as400Name, java.lang.String IFSPath, java.lang.String namespace, java.lang.String path)
          Provides a programmatic interface for exporting registry data to a file.
static void processImport(java.io.File file)
          Provides a programmatic interface for importing registry data from a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        java.io.FileNotFoundException
Provides the command line interface.

 java com.ibm.as400.registry.JavaReg options
 

Options:

-import filename
Imports the specified file of registry information. If the filename does not have the .jreg extension it will be appended automatically before attempting to open the designated file.

-export filename
Exports registry contents to the specified file. If the filename does not have the .jreg extension it will be appended automatically.
-app[lication] application name
The application name of the registry containing data to be exported.
-namespace namespace
Identifies the namespace to be exported:  p[latform], a[pplication], u[ser] or s[ervers].
-path path
Identifies a node and its descendants in the namespace hierarchy to be exported. If the path contains spaces it should be enclosed in double quotes ("). If this parameter is omitted the entire namespace will be exported.

Since:
v5r1m0

processImport

public static void processImport(java.io.File file)
                          throws java.io.IOException,
                                 java.io.FileNotFoundException,
                                 RegistryException
Provides a programmatic interface for importing registry data from a file.

Parameters:
file - The file containing data to be imported.

Throws:
java.io.IOException - If the file cannot be read.
java.io.FileNotFoundException - If the specified file does not exist.
RegistryException - If the registry data does not conform to the required format. See the class description.

Since:
v5r1m0

processExport

public static void processExport(java.io.File file,
                                 java.lang.String appName,
                                 java.lang.String namespace,
                                 java.lang.String path)
                          throws java.io.IOException,
                                 RegistryException,
                                 NodeNotFoundException
Provides a programmatic interface for exporting registry data to a file.

Parameters:
file - The file to which registry data should be exported.
appName - The application name of the registry containing data to be exported.
namespace - Identifies the namespace to exported. Value must be one of the following: platform, application, user, or servers.
path - Identifies a node and its descendants in the namespace hierarchy to be exported. If the path contains spaces it should be enclosed in double quotes ("). If this parameter is null the entire namespace will be exported.

Throws:
java.io.IOException - If the file cannot be written.
RegistryException - If the registry data cannot be accessed.
NodeNotFoundException - If the specified registry node does not exist.

Since:
v5r1m0

processExportAS400

public static void processExportAS400(java.io.File file,
                                      java.lang.String appName,
                                      java.lang.String as400Name,
                                      java.lang.String IFSPath,
                                      java.lang.String namespace,
                                      java.lang.String path)
                               throws java.io.IOException,
                                      RegistryException,
                                      NodeNotFoundException
Provides a programmatic interface for exporting registry data to a file.

Parameters:
file - The file to which registry data should be exported.
appName - The application name of the registry containing data to be exported.
as400Name - The AS400 containing data to be exported.
IFSPath - The IFS directory on the as400 containing data to be exported.
namespace - Identifies the namespace to exported. Value must be one of the following: platform, application, user, or servers.
path - Identifies a node and its descendants in the namespace hierarchy to be exported. If the path contains spaces it should be enclosed in double quotes ("). If this parameter is null the entire namespace will be exported.

Throws:
java.io.IOException - If the file cannot be written.
RegistryException - If the registry data cannot be accessed.
NodeNotFoundException - If the specified registry node does not exist.

Since:
v5r1m0