Package org.eclipse.rdf4j.common.app
Class AppConfiguration
java.lang.Object
org.eclipse.rdf4j.common.app.AppConfiguration
- All Implemented Interfaces:
Configuration
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private String
private String[]
private File
private String
private static final String
private static final String
private String
private LogConfiguration
private String
private Properties
private ProxySettings
private AppVersion
Fields inherited from interface org.eclipse.rdf4j.common.app.config.Configuration
DEFAULT_RESOURCES_LOCATION, DIR, RESOURCES_LOCATION
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new, uninitialized application configuration.AppConfiguration
(String applicationId) Create the application configuration.AppConfiguration
(String applicationId, String longName) Create the application configuration.AppConfiguration
(String applicationId, String longName, AppVersion version) Create the application configuration.AppConfiguration
(String applicationId, AppVersion version) Create the application configuration. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Configure the data dir.void
destroy()
Clean up configuration resources.Get the name of the application (e.g.String[]
Get the command line arguments of the application.Get the data directory as FileGet the full name of the application, which consists of the long name and the version number.Get logging configurationGet the long name of the application.Get the propertiesGet proxy settingsGet the version of the application.void
init()
Initialize the configuration settings.void
init
(boolean loadLogConfig) Initialize configuration and proxy settings, optionally load (logback) loggingvoid
load()
Load the configuration settings.private LogConfiguration
Load and instantiate the logging configuration.void
save()
Store configuration settings.final void
setApplicationId
(String applicationId) Set the application ID stringvoid
setCommandLineArgs
(String[] args) Set the command line arguments specified to the application.void
setDataDirName
(String dataDirName) Set the name of the data directoryprivate void
Set full name based upon long name and versionfinal void
setLongName
(String longName) Set the long name of the application.void
setProxySettings
(ProxySettings proxySettings) Set proxy settingsfinal void
setVersion
(AppVersion version) Set the version of the application.
-
Field Details
-
APP_CONFIG_FILE
- See Also:
-
DEFAULT_PREFIX
- See Also:
-
DEFAULT_LOGGING
- See Also:
-
applicationId
-
longName
-
fullName
-
version
-
commandLineArgs
-
dataDirName
-
dataDir
-
loggingConfiguration
-
proxySettings
-
properties
-
-
Constructor Details
-
AppConfiguration
public AppConfiguration()Create a new, uninitialized application configuration. -
AppConfiguration
Create the application configuration.- Parameters:
applicationId
- the ID of the application
-
AppConfiguration
Create the application configuration.- Parameters:
applicationId
- the ID of the applicationversion
- the application's version
-
AppConfiguration
Create the application configuration.- Parameters:
applicationId
- the ID of the applicationlongName
- the long name of the application
-
AppConfiguration
Create the application configuration.- Parameters:
applicationId
- the ID of the applicationlongName
- the long name of the applicationversion
- the application's version
-
-
Method Details
-
load
Description copied from interface:Configuration
Load the configuration settings. Settings will be loaded from a user and application specific location first. If no such settings exists, an attempt will be made to retrieve settings from a resource on the classpath. If no such settings exist either, settings will be loaded from a default resource on the classpath.- Specified by:
load
in interfaceConfiguration
- Throws:
IOException
- if the configuration settings could not be loaded due to an I/O problem.
-
save
Description copied from interface:Configuration
Store configuration settings. Settings will be stored in a user and application specific location.- Specified by:
save
in interfaceConfiguration
- Throws:
IOException
- if the configuration settings could not be saved due to an I/O problem.
-
init
Description copied from interface:Configuration
Initialize the configuration settings.- Specified by:
init
in interfaceConfiguration
- Throws:
IOException
- if the configuration settings could not be initialized because of an I/O problem.
-
init
Initialize configuration and proxy settings, optionally load (logback) logging- Parameters:
loadLogConfig
- load logging configuration- Throws:
IOException
-
destroy
Description copied from interface:Configuration
Clean up configuration resources.- Specified by:
destroy
in interfaceConfiguration
- Throws:
IOException
- if one or more resources could not be cleaned up. Implementations should attempt to clean up as many resources as possible before returning or throwing an exception.
-
getApplicationId
Get the name of the application (e.g. "AutoFocus" or "Metadata Server").- Returns:
- the name of the application
-
setApplicationId
Set the application ID string- Parameters:
applicationId
- string
-
setDataDirName
Set the name of the data directory- Parameters:
dataDirName
-
-
getLongName
Get the long name of the application.- Returns:
- the long name of the application
-
setLongName
Set the long name of the application.- Parameters:
longName
- the new name
-
getFullName
Get the full name of the application, which consists of the long name and the version number.- Returns:
- the full name of the application
-
setFullName
private void setFullName()Set full name based upon long name and version -
getVersion
Get the version of the application.- Returns:
- the version of the application
-
setVersion
Set the version of the application.- Parameters:
version
- the new version
-
getCommandLineArgs
Get the command line arguments of the application.- Returns:
- A String array, as (typically) specified to the main method.
-
setCommandLineArgs
Set the command line arguments specified to the application.- Parameters:
args
- A String array containing the arguments as specified to the main method.
-
getDataDir
Get the data directory as File- Returns:
- data directory
-
getLogConfiguration
Get logging configuration- Returns:
- log configuration
-
getProxySettings
Get proxy settings- Returns:
- proxy settings
-
setProxySettings
Set proxy settings- Parameters:
proxySettings
- proxy settings
-
configureDataDir
private void configureDataDir()Configure the data dir. Determination of the data dir might be deferred to Platform. -
loadLogConfiguration
private LogConfiguration loadLogConfiguration() throws ClassNotFoundException, InstantiationException, IllegalAccessExceptionLoad and instantiate the logging configuration.- Returns:
- the logging configuration
- Throws:
ClassNotFoundException
IllegalAccessException
InstantiationException
-
getProperties
Get the properties- Returns:
- Returns the properties.
-