public class VFSLibSettings extends Object
Modifier and Type | Field and Description |
---|---|
static String |
LOG_PREFIX
Prefix used for the log messages created by this module.
|
static String |
MSG_PREFIX
Prefix used for the log messages like "VFSLIB-0001".
|
Constructor and Description |
---|
VFSLibSettings()
Constructor method.
|
Modifier and Type | Method and Description |
---|---|
void |
check()
Performs some simple tests for the caches and configurations and creates log messages.
|
Properties |
getDeployProps()
Gets the global version information.
|
Logger |
getLogger()
Gets the global logging instance.
|
Locale |
getLogLocale()
Gets the global locale used for logging.
|
static VFSFileSystemManager |
getManagerAllProtocols()
Get a shared instance of the Commons
FileSystemManager with support for all protocols. |
static VFSFileSystemManager |
getManagerNetwork()
Get a shared instance of the Commons
FileSystemManager holding the network connections. |
byte[] |
getReleaseNotes()
Provides the locale specific release notes (
core package). |
static VFSLibSettings |
getSharedInstance()
Convenience method to get a shared instance.
|
Locale |
getUserLocale()
Gets the global user locale.
|
static String |
getUserMessage(String code)
Convenience method to get a localized official message for the user.
|
static String |
getUserText(String variable)
Convenience method to get a localized text for the user.
|
static String |
getUserText(String variable,
String[] regex,
String[] replacement)
Convenience method to get a localized text for the user.
|
static void |
log(Level level,
String message)
Convenience method to log a message.
|
static void |
log(Level level,
Throwable throwable)
Convenience method to log an exception.
|
static void |
logMessage(Level level,
String message)
Convenience method to log a message.
|
static void |
logMessage(String code,
Level level)
Convenience method to log a localized official message.
|
void |
setLogger(Logger logger)
Sets the global logging instance.
|
void |
setUserLocale(Locale locale)
Sets the global user locale.
|
public static final String MSG_PREFIX
public static final String LOG_PREFIX
public static VFSFileSystemManager getManagerNetwork()
FileSystemManager
holding the network connections.
Here, the connections are managed while the global VFSFileSystemManager
does not.
The manager provides support for "real" network protocols like "http" or "sftp", all file based
protocols like "jar" and "file" are automatically removed.
public static VFSFileSystemManager getManagerAllProtocols()
FileSystemManager
with support for all protocols.
This one should be used when accessing files/folders on the classpath either "jar": or "file:".
public void check()
If either the configurations, or the message codes, or the build properties are absent, then the application should be interrupted since this is fatal.
public Logger getLogger()
public void setLogger(Logger logger)
logger
- Logging instanceNullPointerException
- Error indicationpublic Locale getUserLocale()
public void setUserLocale(Locale locale) throws IllegalArgumentException
Make sure that the given new locale is supported by the settings class.
locale
- Locale instanceIllegalArgumentException
- Error indicationpublic Locale getLogLocale()
At the moment this is static since exceptions and most System.outs are in English.
public Properties getDeployProps()
public byte[] getReleaseNotes()
core
package).null
if an error occurredpublic static VFSLibSettings getSharedInstance()
public static void log(Level level, String message)
Make sure that the message applies to the current log locale (normally English). The log prefix like "[vfslib]" is prepended.
level
- The log levelmessage
- The log messagepublic static void log(Level level, Throwable throwable)
Make sure that the message applies to the current log locale (normally English). The log prefix like "[vfslib]" is prepended.
level
- The log levelthrowable
- The exceptionpublic static void logMessage(Level level, String message)
Make sure that the message applies to the current log locale (normally English). The log prefix like "[vfslib]" is prepended.
level
- The log levelmessage
- The log messagepublic static void logMessage(String code, Level level)
The message is logged using the current log locale (normally English). The domain identifier is printed (e.g. "VFSLIB-0006") while the package log prefix is omitted (e.g. "[vfslib]").
code
- The log message id like "VFSLIB-0006"level
- The log levelpublic static String getUserMessage(String code)
The message is returned using the current user locale. The domain identifier is prepended (e.g. "VFSLIB-0006").
code
- The message code of interest, don't pass null
valuesnull
if code does not existpublic static String getUserText(String variable)
The message is returned using the current user locale.
variable
- The variable, don't pass null
valuespublic static String getUserText(String variable, String[] regex, String[] replacement)
The message is returned using the current user locale (e.g. "eng_US").
variable
- The variable without class prefix, don't pass null
valuesregex
- The regular expressionreplacement
- The replacement string
Copyright © 2005-2024 Leisenfels GmbH. All rights reserved.