Package com.groiss.util
Class Settings
java.lang.Object
com.groiss.util.Settings
This class defines some settings of the server. The settings are read from the
configuration file. This implies that the configuration must be loaded when
this class is initialized.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Locale[]
Return the list of locales from the configuration.static File
Return the base directory (from the configuration).static ClassLoader
Get the application class loader.static NumberFormat
static NumberFormat
getDecimalFormatter
(String maxDigitSettings, NumberFormat original) returns aNumberFormat
where the max. fraction and integer digits are set as defined in the passed parameter. all other settings are copied from the passedNumberFormat
static String
Check if @enterprise resources are shadowed.static File
returns the current-error-filestatic File
Return the directory holding the form classes (from the configuration or default if none is configured).static String
return the name of the form class package (either com.dec.avw.appl. or com.groiss.forms.)static File
getJarArchive
(Class<?> clazz) Get the jar archive the given class is loaded from.static int
getLevel()
Deprecated.static File
static NumberFormat
static Pair<URL,
ClassLoader> getLocation
(String resourceName) static File
returns the current log-filestatic PrintWriter
static MessageDigest
Returns a new instance of the MessageDigest used by the system (e.g. in DMS)static String
Returns the Name of the MessageDigest algorithm used by the system (e.g. in DMS)getProcessRelation
(String key) Returns the list of process relations.static String
getProcessRelationText
(String key, boolean forward) static String
We store the resources of an application in the "classes" directory of the application.static String
Get the id of the server.Checks the classpath for duplicate entries.static File
Return the temporary directory (from the configuration or default if none is configured).static String
static File
static String
Returns a detailed version number containing the @enterprise implementation-version e.g.: "11.0.1234"static boolean
isFormclass
(String classname) boolean
Ask the object if it has been startedstatic void
Deprecated.use ownLogger
insteadstatic void
Deprecated.use ownLogger
insteadstatic void
Deprecated.use ownLogger
insteadstatic void
Deprecated.use ownLogger
insteadvoid
Reconfigure the service.static String
removeFormPackageName
(String classname) static void
Change the list of locales.static void
setBaseDir
(String dir) Deprecated, for removal: This API element is subject to removal in a future version.shall never be called by API programmers therefore will be removed in future versionsstatic void
Set the application class loader.void
shutdown()
This method is called on shutdown.void
startup()
This method is called when the object is "started".
-
Field Details
-
ALWAYS_OUT
public static final org.slf4j.Marker ALWAYS_OUT -
VERSION
The version of the code.- See Also:
-
FORM_PACKAGE_NAME
- See Also:
-
FORM_INTERFACE_PACKAGE_NAME
- See Also:
-
FORM_PACKAGE_NAME_OLD
- See Also:
-
-
Constructor Details
-
Settings
public Settings()
-
-
Method Details
-
setClassLoader
Set the application class loader.- Parameters:
cl
- a class loader
-
getClassLoader
Get the application class loader.- Returns:
- a class loader
-
log
Deprecated.use ownLogger
insteadWrite a message to the log. The message is written when the current log level is greater or equal the given level.- Parameters:
s
- the messagelevel
- the log level
-
logError
Deprecated.use ownLogger
insteadLog an error- Parameters:
err
- a throwable.
-
logError
Deprecated.use ownLogger
insteadPrints a header line and a stack trace for the given Error or Exception- Parameters:
err
- a throwable.errHeader
- the text for the header line
-
getBaseDir
Return the base directory (from the configuration).- Returns:
- a File object
-
getVarDir
-
getLocalDir
-
getTempDir
Return the temporary directory (from the configuration or default if none is configured).- Returns:
- a File object
-
getFormClassDir
Return the directory holding the form classes (from the configuration or default if none is configured).- Returns:
- a File object
-
setBaseDir
Deprecated, for removal: This API element is subject to removal in a future version.shall never be called by API programmers therefore will be removed in future versionsSet the base directory.- Parameters:
dir
- the directory path
-
getServerId
Get the id of the server.- Returns:
- a string containing the server name
-
getAvailableLocales
Return the list of locales from the configuration.- Returns:
- an array of Locale objects
-
setAvailableLocales
Change the list of locales.- Parameters:
l
- an array of Locale objects
-
getDecimalFormatter
-
getLocalNumberFormatter
-
startup
public void startup()Description copied from interface:Lifecycle
This method is called when the object is "started". -
shutdown
public void shutdown()Description copied from interface:Lifecycle
This method is called on shutdown. -
isRunning
public boolean isRunning()Description copied from interface:Service
Ask the object if it has been started -
reconfigure
public void reconfigure()Description copied from interface:Service
Reconfigure the service. We suggest, to implement this method, if you want to reconfigure the service from other components.- Specified by:
reconfigure
in interfaceService
-
getProcessRelations
Returns the list of process relations.- Returns:
- a map with the relation-key and a pair of names for each relation.
-
getProcessRelation
-
getProcessRelationText
-
getProcessRelationsList
-
getDecimalFormatter
returns aNumberFormat
where the max. fraction and integer digits are set as defined in the passed parameter. all other settings are copied from the passedNumberFormat
- Parameters:
maxDigitSettings
- the settings for the max. fraction and integer digits. e.g. 18,8 means 10 integer digits and 8 fraction digitsoriginal
- the reference-number-format - all other settings are copied from this format
-
getShadowedFiles
Checks the classpath for duplicate entries.- Returns:
MultiMap
containing all duplicate entries (key) and their occurances (value)
-
getEPShadowFiles
Check if @enterprise resources are shadowed.- Returns:
- null if resources are not loaded from jar file, empty string if no shadowing, else string containing shadow paths.
- Throws:
IOException
-
getJarArchive
Get the jar archive the given class is loaded from. -
getBootClasspath
-
getSystemClasspath
-
getApplicationClasspath
-
getClasspath
-
getLocation
-
getLevel
Deprecated.use ownLogger
instead- Returns:
- the current root-loglevel
-
logError
Deprecated.use ownLogger
insteadwrites logstatements to the root-logger- Parameters:
e
- the exceptionmsg
- the messagelevel
- the level
-
getLogFile
returns the current log-file- Returns:
- the file log-messages are written to
-
getErrorLogFile
returns the current-error-file- Returns:
- the file errors are writen to
-
getLogWriter
- Returns:
- a printwriter which writes to the log, the default loglevel is INFO
- See Also:
-
LogOutputStream
-
getMessageDigestAlgorithmName
Returns the Name of the MessageDigest algorithm used by the system (e.g. in DMS) -
getMessageDigest
Returns a new instance of the MessageDigest used by the system (e.g. in DMS) -
getFormPackage
return the name of the form class package (either com.dec.avw.appl. or com.groiss.forms.) -
isFormclass
-
removeFormPackageName
-
getResourceDir
We store the resources of an application in the "classes" directory of the application. The method returns the constant "classes". -
getTextCharset
-
getVersion
Returns a detailed version number containing the @enterprise implementation-version e.g.: "11.0.1234"
-
Logger
instead