public class DigesterSettings
extends java.lang.Object
implements com.lf.commons.model.ConfigurableUnit, com.lf.commons.plaf.LookAndFeelListener
log4j
that comes with the great VFS library is disabled here
since the Leisenfels modules uses java.util.logging
.
Remember that the knock-out command line arguments have already been evaluated by the
Digester
main class. If you plan to add further arguments to be processed here
these have to be added to the printUsage()
method also.
Modifier and Type | Field and Description |
---|---|
java.io.File |
configDir
Local directory to use for storage of configuration files.
|
static java.lang.String |
LOG_PREFIX
Prefix used for the log messages created by this module.
|
static java.lang.String |
MSG_PREFIX
Prefix used for the log messages like "COMMONS-0001".
|
static java.lang.String |
PACKAGE_PREFIX
This base package.
|
protected static DigesterSettings |
sharedInstance
Shared
DigesterSettings instance. |
Constructor and Description |
---|
DigesterSettings()
Constructor method.
|
Modifier and Type | Method and Description |
---|---|
void |
configureUnit(java.lang.String id,
com.lf.commons.config.Configuration config)
Restores values from persistent data stores.
|
void |
displaySplashMessage(java.lang.String text)
Displays the given text as message for the JVM splash screen.
|
void |
evalArgumentsCLI(java.util.Hashtable<java.lang.String,java.lang.String[]> config,
java.lang.String[] args)
Evaluates command line arguments passed to the application (except knock-out args).
|
void |
evalArgumentsGUI(java.util.Hashtable<java.lang.String,java.lang.String[]> config,
java.lang.String[] args,
java.util.Vector<java.util.logging.LogRecord> messages,
java.lang.String[] fileargs)
Evaluates command line arguments passed to the application (except knock-out args).
|
static void |
exit(int code)
Quits this application.
|
static int |
extractLocalization(java.lang.Class clazz)
Searches for localization patterns and reads the object texts into the configuration.
|
static int |
extractLocalization(java.lang.Object target)
Searches for localization patterns and reads the object texts into the configuration.
|
protected void |
finalize()
Cares for proper cleanup after releasing the object.
|
java.lang.String[] |
getArguments()
Provides the argument array passed to the main method.
|
java.io.File |
getConfigDir()
Get the local path to the configuration directory of the application (in the user's home).
|
DigesterController |
getController()
Provides the event callback instance (controller in MVC terms).
|
com.lf.commons.task.CronTaskManager |
getCronManager()
Provides the application specific manager running regularly tasks.
|
com.lf.commons.crypto.CryptoManager |
getCryptoManager()
Provides the application specific manager for cryptographic operations.
|
com.lf.commons.crypto.CryptoManager |
getCryptoManagerPGP()
Provides the application specific manager for cryptographic operations (PGP engine).
|
java.io.File |
getCurrentLogFile()
Provides the proper reference of the current log file (rotation is detected).
|
com.lf.commons.lang.DeployProps |
getDeployProps()
Gets the global version information.
|
static java.lang.String |
getEnglishMessage(java.lang.String code)
Convenience method to get a localized official message for the user.
|
static java.lang.String |
getEnglishText(java.lang.Class clazz,
java.lang.String variable)
Convenience method to get the original (English) text.
|
static java.lang.String |
getEnglishText(java.lang.Class clazz,
java.lang.String variable,
java.lang.String[] regex,
java.lang.String[] replacement)
Convenience method to get the original (English) text.
|
com.lf.commons.i18n.I18NConfiguration |
getEnglishTexts()
Provides the English texts for the GUI (labels, tooltips etc.).
|
java.io.File |
getEvaluationFile()
Provides the local file indicating that the software is still being evaluated for installer.
|
java.lang.String[] |
getFileArgs()
Provides the file argument array passed to the main method.
|
DigesterHelp |
getHelpDelegate()
Gets the global help delegate.
|
static java.lang.String |
getHelpID(java.lang.String id)
Convenience method for utilizing the help delegate.
|
java.lang.String |
getI18NBase()
Provides the global resource path for internationalization resources.
|
com.lf.commons.i18n.I18NConfiguration |
getI18NTexts()
Provides the locale specific texts for the GUI (labels, tooltips etc.).
|
java.lang.String |
getJVMID()
Provides the unique identification of the current JVM (system wide).
|
org.apache.commons.vfs2.FileObject |
getLicenseAgreement()
Provides the locale specific license agreement (
core package). |
java.io.File |
getLicenseFile()
Provides the local license file reference.
|
DigesterLicenseManager |
getLicenseManager()
Provides the application specific manager for cryptographic operations.
|
java.lang.String |
getLogEncoding()
Gets the global encoding used for logging.
|
java.lang.String |
getLogfileName()
Provides the current log file used by the application.
|
java.util.logging.Logger |
getLogger()
Gets the global logging instance.
|
com.lf.commons.i18n.Locale |
getLogLocale()
Gets the global locale used for logging.
|
com.lf.commons.msg.MessageCodes |
getMessageCodes()
Provides the global message codes handlers.
|
DigesterModel |
getModel()
Provides the dynamic configuration reference (model in MVC terms).
|
com.lf.commons.crypto.PassphraseProvider |
getPassphraseProviderAES()
Returns the key provider.
|
com.lf.commons.crypto.PassphraseProvider |
getPassphraseProviderSignature()
Returns the signature provider.
|
com.lf.commons.task.PeriodicTaskManager |
getPeriodicTaskManager()
Provides the application specific manager for periodically executed tasks.
|
com.lf.commons.dialog.ReleaseNotes |
getReleaseNotes()
Provides the locale specific release notes (
core package). |
org.apache.commons.vfs2.FileObject |
getReleaseNotesURL()
Provides the locale specific release notes (
core package). |
org.apache.commons.vfs2.FileObject |
getRootResourcePath()
Provides the global resource path for configuration files.
|
static DigesterSettings |
getSharedInstance()
Convenience method to get a shared instance.
|
java.util.Vector<com.lf.commons.i18n.Locale> |
getSupportedLocales(boolean synonyms)
Returns the locales currently supported by the package.
|
java.io.PrintStream |
getSystemErr()
Provides the original standard error channel.
|
java.io.PrintStream |
getSystemOut()
Provides the original standard output channel.
|
java.lang.String |
getTitle()
Gets the main window title which may be extracted from the command line parameters.
|
org.apache.commons.vfs2.FileObject[] |
getURLArgs()
Provides the URL argument array passed to the main method.
|
com.lf.commons.i18n.Locale |
getUserLocale()
Gets the global user locale.
|
static java.lang.String |
getUserMessage(java.lang.String code)
Convenience method to get a localized official message for the user.
|
static java.lang.String |
getUserText(java.lang.Class clazz,
java.lang.String variable)
Convenience method to get a localized text for the user.
|
static java.lang.String |
getUserText(java.lang.Class clazz,
java.lang.String variable,
java.lang.String[] regex,
java.lang.String[] replacement)
Convenience method to get a localized text for the user.
|
DigesterView |
getView()
Provides the main window reference (view in MVC terms).
|
void |
installGlobalAccelerators(javax.swing.JDialog dialog)
Convenience to add the global accelerators like "F1" (help) for a specific dialog.
|
static boolean |
isHelpLocaleSupported(com.lf.commons.i18n.Locale locale)
Checks whether a help system is available for the given locale.
|
static int |
localize(java.lang.Object target,
java.lang.Class targetclazz)
Searches for localization patterns and sets the object texts from the configuration.
|
static void |
log(java.util.logging.Level level,
java.lang.String message)
Convenience method to log a message.
|
static void |
logMessage(java.lang.String code,
java.util.logging.Level level)
Convenience method to log a localized official message.
|
static void |
logMessage(java.lang.String code,
java.util.logging.Level level,
java.lang.String[] regex,
java.lang.String[] replacement)
Convenience method to log a localized official message.
|
static void |
logMessage(java.lang.String code,
java.util.logging.Level level,
java.lang.String regex,
java.lang.String replacement)
Convenience method to log a localized official message.
|
void |
lookAndFeelChanged(java.lang.String plaf,
java.lang.String theme)
Reacts on changes of the look & feel performed by the manager.
|
void |
prepareManagersCLI()
Prepares the managers for the CLI application.
|
static void |
registerConfigurable(java.lang.String id,
com.lf.commons.model.ConfigurableUnit unit)
Convenience method to allow for simple registration of a Digester configurable unit.
|
void |
setConfigDir(java.io.File dir)
Set the local path to the configuration directory of the application (in the user's home).
|
void |
setLicenseManager(DigesterLicenseManager manager)
Sets the application specific manager for cryptographic operations.
|
void |
setModel(DigesterModel model)
Sets the dynamic configuration reference (model in MVC terms).
|
void |
setupUserLocale(com.lf.commons.i18n.Locale locale,
java.util.Vector<java.util.logging.LogRecord> messages)
Sets the global user locale.
|
void |
setUserLocale(com.lf.commons.i18n.Locale locale)
Sets the global user locale.
|
void |
storeUnit(java.lang.String id,
com.lf.commons.config.Configuration config)
Stores the current configuration values persistently.
|
void |
unitRegistered(com.lf.commons.model.ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was registered with a model.
|
void |
unitUnregistered(com.lf.commons.model.ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was unregistered with a model.
|
static void |
unregisterConfigurable(com.lf.commons.model.ConfigurableUnit unit)
Convenience method to allow for simple unregistration of a Digester configurable unit.
|
static void |
unregisterConfigurable(java.lang.String id)
Convenience method to allow for simple unregistration of a Digester configurable unit.
|
void |
updateComponentTreeUI()
The (hidden) components should be refreshed by
SwingUtilities.updateComponentTreeUI() . |
void |
updateEDTMonitor()
Activates/deactivates the monitor detecting GUI freezes.
|
protected static DigesterSettings sharedInstance
DigesterSettings
instance.public static final java.lang.String MSG_PREFIX
public static final java.lang.String LOG_PREFIX
public static final java.lang.String PACKAGE_PREFIX
public java.io.File configDir
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void evalArgumentsGUI(java.util.Hashtable<java.lang.String,java.lang.String[]> config, java.lang.String[] args, java.util.Vector<java.util.logging.LogRecord> messages, java.lang.String[] fileargs)
System.out
and exit. Then the
logging is installed and all messages after this point will be printed using logging. Then
the other arguments supported by the application are evaluated, and finally the unknown
arguments are presented to the user while these parameters are simply ignored.
While this method is executed all attributes of the DigesterSettings
class
are loaded. When it is finished all settings can be fully utilized.
config
- The configuration with optionsargs
- Array of strings with console argumentsmessages
- Optional messages to be loggedfileargs
- Optional file argument for call on Windows/Macpublic void prepareManagersCLI()
public void evalArgumentsCLI(java.util.Hashtable<java.lang.String,java.lang.String[]> config, java.lang.String[] args)
config
- The configuration with optionsargs
- Array of strings with console argumentspublic void setupUserLocale(com.lf.commons.i18n.Locale locale, java.util.Vector<java.util.logging.LogRecord> messages) throws java.lang.IllegalArgumentException
locale
- Locale instancemessages
- Called before logger is installed, so we collect log messagesjava.lang.IllegalArgumentException
- Error indicationpublic java.util.Vector<com.lf.commons.i18n.Locale> getSupportedLocales(boolean synonyms)
synonyms
- Also add the ISO 639-1/2 synonyms like "deu_DE" for "ger_DE"?public org.apache.commons.vfs2.FileObject getRootResourcePath()
public java.lang.String getI18NBase()
public com.lf.commons.msg.MessageCodes getMessageCodes()
public com.lf.commons.i18n.Locale getUserLocale()
public void setUserLocale(com.lf.commons.i18n.Locale locale)
setupUserLocale
method.
locale
- User localepublic com.lf.commons.i18n.Locale getLogLocale()
public java.lang.String getLogEncoding()
public java.util.logging.Logger getLogger()
public java.io.File getConfigDir()
public void setConfigDir(java.io.File dir)
dir
- The local configuration directorypublic java.lang.String getJVMID()
public java.lang.String getLogfileName()
getCurrentLogFile()
public java.io.File getCurrentLogFile()
getLogfileName()
public java.io.PrintStream getSystemOut()
public java.io.PrintStream getSystemErr()
public com.lf.commons.i18n.I18NConfiguration getI18NTexts()
public com.lf.commons.i18n.I18NConfiguration getEnglishTexts()
public static int localize(java.lang.Object target, java.lang.Class targetclazz)
target
- The target object to be localizedtargetclazz
- The target clazz, maybe a superclasspublic static int extractLocalization(java.lang.Object target)
target
- The target object to be localizedpublic static int extractLocalization(java.lang.Class clazz)
clazz
- The target class to be localizedpublic void setModel(DigesterModel model)
model
- The dynamic configurationpublic DigesterModel getModel()
public DigesterView getView()
public DigesterController getController()
public java.lang.String[] getArguments()
public java.lang.String[] getFileArgs()
public org.apache.commons.vfs2.FileObject[] getURLArgs()
public com.lf.commons.crypto.CryptoManager getCryptoManager()
public DigesterLicenseManager getLicenseManager()
public void setLicenseManager(DigesterLicenseManager manager)
manager
- The pre-configured cryptographic managerpublic com.lf.commons.task.CronTaskManager getCronManager()
public com.lf.commons.task.PeriodicTaskManager getPeriodicTaskManager()
public com.lf.commons.lang.DeployProps getDeployProps()
public java.lang.String getTitle()
public java.io.File getLicenseFile()
public java.io.File getEvaluationFile()
public static DigesterSettings getSharedInstance()
public static void log(java.util.logging.Level level, java.lang.String message)
level
- The log levelmessage
- The log messagepublic static void logMessage(java.lang.String code, java.util.logging.Level level)
code
- The log message id like "DIGEST-0006"level
- The log levelpublic static void logMessage(java.lang.String code, java.util.logging.Level level, java.lang.String regex, java.lang.String replacement)
code
- The log message id like "DIGEST-0006"level
- The log levelregex
- The regular expressionreplacement
- The replacement stringpublic static void logMessage(java.lang.String code, java.util.logging.Level level, java.lang.String[] regex, java.lang.String[] replacement)
code
- The log message id like "DIGEST-0006"level
- The log levelregex
- The regular expressionsreplacement
- The replacement stringspublic static java.lang.String getUserMessage(java.lang.String code)
code
- The message code of interest, don't pass null
valuesnull
if code does not existpublic static java.lang.String getEnglishMessage(java.lang.String code)
code
- The message code of interest, don't pass null
valuesnull
if code does not existpublic static java.lang.String getUserText(java.lang.Class clazz, java.lang.String variable)
clazz
- The class for getting the class prefixvariable
- The variable without class prefix, don't pass null
valuesnull
if variable does not existpublic static java.lang.String getUserText(java.lang.Class clazz, java.lang.String variable, java.lang.String[] regex, java.lang.String[] replacement)
clazz
- The class for getting the class prefixvariable
- The variable without class prefix, don't pass null
valuesregex
- The regular expressionsreplacement
- The replacement stringsnull
if variable does not existpublic static java.lang.String getEnglishText(java.lang.Class clazz, java.lang.String variable)
clazz
- The class for getting the class prefixvariable
- The variable without class prefix, don't pass null
valuesnull
if variable does not existpublic static java.lang.String getEnglishText(java.lang.Class clazz, java.lang.String variable, java.lang.String[] regex, java.lang.String[] replacement)
clazz
- The class for getting the class prefixvariable
- The variable without class prefix, don't pass null
valuesregex
- The regular expressionreplacement
- The replacement stringpublic org.apache.commons.vfs2.FileObject getReleaseNotesURL()
core
package).
public com.lf.commons.dialog.ReleaseNotes getReleaseNotes()
core
package).
public void configureUnit(java.lang.String id, com.lf.commons.config.Configuration config)
configureUnit
in interface com.lf.commons.model.ConfigurableUnit
id
- The unique identifier for the instanceconfig
- The configurationpublic void storeUnit(java.lang.String id, com.lf.commons.config.Configuration config)
storeUnit
in interface com.lf.commons.model.ConfigurableUnit
id
- The unique identifier for the instanceconfig
- The configurationpublic void unitRegistered(com.lf.commons.model.ApplicationModel model, java.lang.String id)
unitRegistered
in interface com.lf.commons.model.ConfigurableUnit
model
- The application modelid
- The unique identifier for the instancepublic void unitUnregistered(com.lf.commons.model.ApplicationModel model, java.lang.String id)
unitUnregistered
in interface com.lf.commons.model.ConfigurableUnit
model
- The application modelid
- The unique identifier for the instancepublic void lookAndFeelChanged(java.lang.String plaf, java.lang.String theme)
lookAndFeelChanged
in interface com.lf.commons.plaf.LookAndFeelListener
plaf
- The current look & feel in fully qualified notationtheme
- The configuration of the specific look & feel, may be null
public void updateComponentTreeUI()
SwingUtilities.updateComponentTreeUI()
.
May be called by the manager if font sizes, colors etc. have been changed.
updateComponentTreeUI
in interface com.lf.commons.plaf.LookAndFeelListener
public static void registerConfigurable(java.lang.String id, com.lf.commons.model.ConfigurableUnit unit)
id
- The unique id defined byunit
- The configurable unit to be addedjava.lang.NullPointerException
- If parameters are null
public static void unregisterConfigurable(com.lf.commons.model.ConfigurableUnit unit)
unit
- The unit to be removedjava.lang.NullPointerException
- If parameters are null
public static void unregisterConfigurable(java.lang.String id)
id
- The unique identifierjava.lang.NullPointerException
- If parameters are null
public static boolean isHelpLocaleSupported(com.lf.commons.i18n.Locale locale)
locale
- The locale to be checkedpublic DigesterHelp getHelpDelegate()
public static java.lang.String getHelpID(java.lang.String id)
id
- One of the declared static fields of DigesterHelp
null
public void updateEDTMonitor()
public void installGlobalAccelerators(javax.swing.JDialog dialog)
dialog
- The dialogpublic com.lf.commons.crypto.CryptoManager getCryptoManagerPGP()
public com.lf.commons.crypto.PassphraseProvider getPassphraseProviderAES()
public com.lf.commons.crypto.PassphraseProvider getPassphraseProviderSignature()
public org.apache.commons.vfs2.FileObject getLicenseAgreement()
core
package).
public void displaySplashMessage(java.lang.String text)
text
- The message to be displayedpublic static void exit(int code)
code
- Return code, 0=OK, 1=error, -1=do not exit finallyCopyright © 2005-2015 Leisenfels UG. All rights reserved.