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.
-
CustomizerHarness()
-
-
customize(String, ErrorLog)
- Uses the current customizer and connection to customize the
profile or profiles contained in the file with the given name.
-
customizeJar(ProfileIOContext)
- Uses the current customizer and connection to customize the
profiles contained in the passed JAR file.
-
customizeJar(String, ErrorLog)
- Uses the current customizer and connection to customize the
profiles contained in the file with the given name.
-
customizeProfile(ProfileIOContext)
- Uses the current customizer and connection to customize the profile
contained in the passed IOContext.
-
customizeProfiles(Enumeration)
- Uses the current customizer and connection to customize the enumerated
profiles.
-
customizeSer(String, ErrorLog)
- Uses the current customizer and connection to customize the
profile contained in the file with the given name.
-
getBackup()
-
-
getConnection(ErrorLog)
- Returns the connection specified by the url, user, password and
driver options.
-
getContext()
-
-
getCustomizer()
-
-
getDigests()
-
-
getDriver()
-
-
getHelp()
-
-
getOptionsQuery()
- Returns the routine for interactive inquiry of the password.
-
getPassword()
-
-
getUrl()
-
-
getUrlPrefix()
-
-
getUser()
-
-
hasValidContext(Profile)
- Returns true if the profile has a context name that matches one of
those listed in the context option, false otherwise.
-
isValidFilename(String)
- Returns true if the filename is one that the "customize" method
understands, false otherwise.
-
isVerbose()
-
-
main(String[])
- The command-line based entry point for this class.
-
mainStatus(String[])
- The command-line based entry point for this class.
-
setBackup(boolean)
-
-
setContext(String)
-
-
setCustomizer(ProfileCustomizer)
-
-
setDigests(String)
- Sets the digest algorithms to use when writing manifest entry for
customized profile within a jar file.
-
setDriver(String)
-
-
setHelp(boolean)
-
-
setOptionsQuery(TranslationOptionsQuery)
- Register a routine for interactive inquiry of the password.
-
setPassword(String)
-
-
setUrl(String)
-
-
setUrlPrefix(String)
-
-
setUser(String)
-
-
setVerbose(boolean)
-
CustomizerHarness
public CustomizerHarness()
getCustomizer
public ProfileCustomizer getCustomizer()
setCustomizer
public void setCustomizer(ProfileCustomizer customizer)
getHelp
public boolean getHelp()
setHelp
public void setHelp(boolean help)
getBackup
public boolean getBackup()
setBackup
public void setBackup(boolean backup)
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.
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.
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.
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.
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.
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.
getContext
public String getContext()
setContext
public void setContext(String context)
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.
getDriver
public String getDriver()
setDriver
public void setDriver(String driver)
getDigests
public String getDigests()
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").
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.
setOptionsQuery
public void setOptionsQuery(TranslationOptionsQuery qp)
- Register a routine for interactive inquiry of the password.
If null, set to default implementation.
getOptionsQuery
public TranslationOptionsQuery getOptionsQuery()
- Returns the routine for interactive inquiry of the password.
if not previously set, use default implementation;
getUrl
public String getUrl()
setUrl
public void setUrl(String url)
getUrlPrefix
public String getUrlPrefix()
setUrlPrefix
public void setUrlPrefix(String urlPrefix)
isVerbose
public boolean isVerbose()
setVerbose
public void setVerbose(boolean verbose)
getUser
public String getUser()
setUser
public void setUser(String user)
getPassword
public String getPassword()
setPassword
public void setPassword(String password)
isValidFilename
public static boolean isValidFilename(String filename)
- Returns true if the filename is one that the "customize" method
understands, false otherwise.
main
public static void main(String args[])
- The command-line based entry point for this class.
Calls System.exit with the result of mainStatus.
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