All Packages    This Package  Previous  Next  

Class sqlj.runtime.profile.util.CustomizerHarness

java.lang.Object
   |
   +----sqlj.runtime.profile.util.CustomizerHarness

public class CustomizerHarness
extends Object
This class is a command-line utility which maps the customize method of a customizer instance over a collection of profiles. This utility assumes that the profiles exist in file format as serialized objects. Profiles can be customized individually, on a file-by-file basis, or as a collection packaged as a JAR.

Invoke the command line utility using the "-help" options for a description of options.

All output produced by this utility is written to standard out.


Constructor Index

 o CustomizerHarness()

Method Index

 o customize(String, ErrorLog)
Uses the current customizer and connection to customize the profile or profiles contained in the file with the given name.
 o customizeJar(ProfileIOContext)
Uses the current customizer and connection to customize the profiles contained in the passed JAR file.
 o customizeJar(String, ErrorLog)
Uses the current customizer and connection to customize the profiles contained in the file with the given name.
 o customizeProfile(ProfileIOContext)
Uses the current customizer and connection to customize the profile contained in the passed IOContext.
 o customizeProfiles(Enumeration)
Uses the current customizer and connection to customize the enumerated profiles.
 o customizeSer(String, ErrorLog)
Uses the current customizer and connection to customize the profile contained in the file with the given name.
 o getBackup()
 o getConnection(ErrorLog)
Returns the connection specified by the url, user, password and driver options.
 o getContext()
 o getCustomizer()
 o getDigests()
 o getDriver()
 o getHelp()
 o getOptionsQuery()
Returns the routine for interactive inquiry of the password.
 o getPassword()
 o getUrl()
 o getUrlPrefix()
 o getUser()
 o hasValidContext(Profile)
Returns true if the profile has a context name that matches one of those listed in the context option, false otherwise.
 o isValidFilename(String)
Returns true if the filename is one that the "customize" method understands, false otherwise.
 o isVerbose()
 o main(String[])
The command-line based entry point for this class.
 o mainStatus(String[])
The command-line based entry point for this class.
 o setBackup(boolean)
 o setContext(String)
 o setCustomizer(ProfileCustomizer)
 o setDigests(String)
Sets the digest algorithms to use when writing manifest entry for customized profile within a jar file.
 o setDriver(String)
 o setHelp(boolean)
 o setOptionsQuery(TranslationOptionsQuery)
Register a routine for interactive inquiry of the password.
 o setPassword(String)
 o setUrl(String)
 o setUrlPrefix(String)
 o setUser(String)
 o setVerbose(boolean)

Constructors

 o CustomizerHarness
 public CustomizerHarness()

Methods

 o getCustomizer
 public ProfileCustomizer getCustomizer()
 o setCustomizer
 public void setCustomizer(ProfileCustomizer customizer)
 o getHelp
 public boolean getHelp()
 o setHelp
 public void setHelp(boolean help)
 o getBackup
 public boolean getBackup()
 o setBackup
 public void setBackup(boolean backup)
 o customize
 public int customize(String filename,
                      ErrorLog log)
Uses the current customizer and connection to customize the profile or profiles contained in the file with the given name. Errors are written to the passed error log. The filename must have either a ".ser" or ".jar" extension.

 o customizeJar
 public int customizeJar(String filename,
                         ErrorLog log)
Uses the current customizer and connection to customize the profiles contained in the file with the given name. Errors are written to the passed error log. The filename must represent a JAR file.

 o customizeJar
 public int customizeJar(ProfileIOContext jar)
Uses the current customizer and connection to customize the profiles contained in the passed JAR file.

A status if returned describing the result of the call. PIO_ERROR is returned if an error occurs during the customization of any profile. If all profiles are remain unmodified after customization, PIO_UNMODIFIED is returned. Otherwise, PIO_MODIFIED is returned, indicating least one profile was modified. The customization terminates after the first profile that fails to be customized. Subsequent profiles are not read or customized.

Errors are written to the error log of the passed io context. The loader of the passed io context is used to load all profiles contained in the JAR.

Each jar entry in the input is written to the JAR output sequentially as it is customized. Accordingly, both the input and the output of the passed IO context must be able to be opened concurrently.

Parameters:
jar - a ProfileIOContext describes the JAR file to customize.
Returns:
the status of the operation otherwise.
 o customizeProfiles
 public int customizeProfiles(Enumeration profiles)
Uses the current customizer and connection to customize the enumerated profiles. Each profile in the enumeration is described using a ProfileIOContext that is used to read and write the profile.

A status if returned describing the result of the call. PIO_ERROR is returned if an error occurs during the customization of any profile. If all profiles are remain unmodified after customization, PIO_UNMODIFIED is returned. Otherwise, PIO_MODIFIED is returned, indicating that at least one profile was modified. The customization terminates after the first profile that fails to be customized. Subsequent profiles are not read or customized.

Errors are written to the error log particular to the context containing the profile in which the error occurred. The particular profile context's Loader is used to instantiate the profile.

Parameters:
profiles - an enumeration of ProfileIOContexts describing a collection of profiles.
 o customizeProfile
 public int customizeProfile(ProfileIOContext io)
Uses the current customizer and connection to customize the profile contained in the passed IOContext. Errors are written to the error log of the passed context. The context's Loader is used to instantiate the profile.

 o customizeSer
 public int customizeSer(String filename,
                         ErrorLog log)
Uses the current customizer and connection to customize the profile contained in the file with the given name. Errors are written to the passed error log. The filename must represent an SER file.

 o getContext
 public String getContext()
 o setContext
 public void setContext(String context)
 o hasValidContext
 public boolean hasValidContext(Profile profile)
Returns true if the profile has a context name that matches one of those listed in the context option, false otherwise. If the context option was not specified, returns true.

 o getDriver
 public String getDriver()
 o setDriver
 public void setDriver(String driver)
 o getDigests
 public String getDigests()
 o setDigests
 public void setDigests(String digests)
Sets the digest algorithms to use when writing manifest entry for customized profile within a jar file.

Parameters:
digests - a comma-separatd list of digest names (e.g. "SHA,MD5").
 o getConnection
 public Connection getConnection(ErrorLog log) throws SQLException
Returns the connection specified by the url, user, password and driver options.

Throws: SQLException
if the connection cannot be established.
 o setOptionsQuery
 public void setOptionsQuery(TranslationOptionsQuery qp)
Register a routine for interactive inquiry of the password. If null, set to default implementation.

 o getOptionsQuery
 public TranslationOptionsQuery getOptionsQuery()
Returns the routine for interactive inquiry of the password. if not previously set, use default implementation;

 o getUrl
 public String getUrl()
 o setUrl
 public void setUrl(String url)
 o getUrlPrefix
 public String getUrlPrefix()
 o setUrlPrefix
 public void setUrlPrefix(String urlPrefix)
 o isVerbose
 public boolean isVerbose()
 o setVerbose
 public void setVerbose(boolean verbose)
 o getUser
 public String getUser()
 o setUser
 public void setUser(String user)
 o getPassword
 public String getPassword()
 o setPassword
 public void setPassword(String password)
 o isValidFilename
 public static boolean isValidFilename(String filename)
Returns true if the filename is one that the "customize" method understands, false otherwise.

 o main
 public static void main(String args[])
The command-line based entry point for this class. Calls System.exit with the result of mainStatus.

 o mainStatus
 public static int mainStatus(String args[])
The command-line based entry point for this class. Returns non-zero if an error occurs.


All Packages    This Package  Previous  Next