Package org.ametys.runtime.servlet
Class RuntimeConfig
- java.lang.Object
-
- org.ametys.runtime.servlet.RuntimeConfig
-
public final class RuntimeConfig extends Object
Java representation of the WEB-INF/param/runtime.xml file.
Contains all runtime configuration values.
-
-
Field Summary
Fields Modifier and Type Field Description private static RuntimeConfig
__config
private File
_ametysHome
private Date
_buildDate
private Map<String,String>
_components
private String
_contextPath
private String
_defaultWorkspace
private Collection<String>
_excludedFeatures
private Collection<String>
_excludedPlugins
private Collection<String>
_excludedWorkspaces
private File
_externalKernel
private Map<String,File>
_externalPlugins
private Map<String,File>
_externalWorkspaces
private String
_initClass
private org.slf4j.Logger
_logger
private Map<String,String>
_overridenThemes
private Collection<String>
_pluginsLocations
private boolean
_safeMode
private String
_version
-
Constructor Summary
Constructors Modifier Constructor Description private
RuntimeConfig()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_configureApplication(Configuration config)
private void
_configureComponents(Configuration config)
private void
_configureExternal(Configuration config)
private void
_configurePlugins(Configuration config)
private void
_configureWorkspaces(Configuration config)
private File
_getFile(String path)
static void
configure(Configuration runtimeConf, Configuration externalConf, File ametysHome, String contextPath)
Configures the Runtime kernel.
This method must be called before getting the RuntimConfig instance.
Warning : the implementation allows this method to be called twice or more.File
getAmetysHome()
Returns the Ametys home directory.Date
getApplicationBuildDate()
Returns the application build date, if provided.String
getApplicationVersion()
Returns the application version nameMap<String,String>
getComponents()
Returns a Map<role, component id> containing the choosen implementation for the given component roleString
getDefaultWorkspace()
Returns the name of the default workspace.Collection<String>
getExcludedFeatures()
Returns a Collection containing the names of the excluded (deactivated) featuresCollection<String>
getExcludedPlugins()
Returns a Collection containing the names of the excluded (deactivated) pluginsCollection<String>
getExcludedWorkspaces()
Returns a Collection containing the names of the excluded (deactivated) workspacesFile
getExternalKernel()
Returns the absolute external location of the kernel, if any.
Returns null if the kernel is not externalized.Map<String,File>
getExternalPlugins()
Returns the declared external plugins (ie.Map<String,File>
getExternalWorkspaces()
Returns the declared external workspaces (ie.String
getInitClassName()
Returns the name of the class to be excuted at the end of the initialization process, if any.
May be null.static RuntimeConfig
getInstance()
Returns the shared instance of theRuntimeConfig
Map<String,String>
getOverridenThemes()
Return a Map association a workspace name and its associated themeCollection<String>
getPluginsLocations()
Returns a Collection containing the locations of the pluginsstatic boolean
isConfigured()
Returns true if the Runtime has been configured (ie.boolean
isSafeMode()
Returns true if safe mode is needed (ie.
-
-
-
Field Detail
-
__config
private static RuntimeConfig __config
-
_safeMode
private boolean _safeMode
-
_defaultWorkspace
private String _defaultWorkspace
-
_initClass
private String _initClass
-
_pluginsLocations
private final Collection<String> _pluginsLocations
-
_excludedPlugins
private final Collection<String> _excludedPlugins
-
_excludedFeatures
private final Collection<String> _excludedFeatures
-
_excludedWorkspaces
private final Collection<String> _excludedWorkspaces
-
_overridenThemes
private final Map<String,String> _overridenThemes
-
_components
private final Map<String,String> _components
-
_logger
private org.slf4j.Logger _logger
-
_contextPath
private String _contextPath
-
_buildDate
private Date _buildDate
-
_externalKernel
private File _externalKernel
-
_externalPlugins
private Map<String,File> _externalPlugins
-
_externalWorkspaces
private Map<String,File> _externalWorkspaces
-
_ametysHome
private File _ametysHome
-
-
Constructor Detail
-
RuntimeConfig
private RuntimeConfig()
-
-
Method Detail
-
getInstance
public static RuntimeConfig getInstance()
Returns the shared instance of theRuntimeConfig
- Returns:
- the shared instance of the
RuntimeConfig
-
isConfigured
public static boolean isConfigured()
Returns true if the Runtime has been configured (ie. if theconfigure(Configuration, Configuration, File, String)
method has been called.- Returns:
- true if the Runtime has been configured.
-
configure
public static void configure(Configuration runtimeConf, Configuration externalConf, File ametysHome, String contextPath)
Configures the Runtime kernel.
This method must be called before getting the RuntimConfig instance.
Warning : the implementation allows this method to be called twice or more. This is only to allow the Runtime to be re-started dynamically.
Be aware that this can cause the application to become unstable.- Parameters:
runtimeConf
- the Configuration of the Runtime kernel (ie the contents of the WEB-INF/param/runtime.xml file)externalConf
- the Configuration of external locations (ie the contents of the WEB-INF/param/external-locations.xml file)ametysHome
- The ametys home directorycontextPath
- the application context path
-
_configureWorkspaces
private void _configureWorkspaces(Configuration config)
-
_configurePlugins
private void _configurePlugins(Configuration config)
-
_configureComponents
private void _configureComponents(Configuration config)
-
_configureApplication
private void _configureApplication(Configuration config)
-
_configureExternal
private void _configureExternal(Configuration config)
-
isSafeMode
public boolean isSafeMode()
Returns true if safe mode is needed (ie. if there's been an error reading runtime.xml).- Returns:
- true if safe mode is needed.
-
getDefaultWorkspace
public String getDefaultWorkspace()
Returns the name of the default workspace. Null if none.- Returns:
- the name of the default workspace
-
getInitClassName
public String getInitClassName()
Returns the name of the class to be excuted at the end of the initialization process, if any.
May be null.- Returns:
- Returns the name of the class to be excuted at the end of the initialization process, if any
-
getPluginsLocations
public Collection<String> getPluginsLocations()
Returns a Collection containing the locations of the plugins- Returns:
- a Collection containing the locations of the plugins
-
getExternalPlugins
public Map<String,File> getExternalPlugins()
Returns the declared external plugins (ie. not located in the webapp context).- Returns:
- the declared external plugins
-
getExternalWorkspaces
public Map<String,File> getExternalWorkspaces()
Returns the declared external workspaces (ie. not located in the webapp context).- Returns:
- the declared external workspaces
-
getExternalKernel
public File getExternalKernel()
Returns the absolute external location of the kernel, if any.
Returns null if the kernel is not externalized.- Returns:
- the absolute external location of the kernel, if any.
-
getExcludedPlugins
public Collection<String> getExcludedPlugins()
Returns a Collection containing the names of the excluded (deactivated) plugins- Returns:
- a Collection containing the names of the excluded (deactivated) plugins
-
getExcludedFeatures
public Collection<String> getExcludedFeatures()
Returns a Collection containing the names of the excluded (deactivated) features- Returns:
- a Collection containing the names of the excluded (deactivated) features
-
getExcludedWorkspaces
public Collection<String> getExcludedWorkspaces()
Returns a Collection containing the names of the excluded (deactivated) workspaces- Returns:
- a Collection containing the names of the excluded (deactivated) workspaces
-
getOverridenThemes
public Map<String,String> getOverridenThemes()
Return a Map association a workspace name and its associated theme- Returns:
- a Map association a workspace name and its associated theme
-
getComponents
public Map<String,String> getComponents()
Returns a Map<role, component id> containing the choosen implementation for the given component role- Returns:
- a Map<role, component id> containing the choosen implementation for the given component role
-
getApplicationVersion
public String getApplicationVersion()
Returns the application version name- Returns:
- the application version name
-
getApplicationBuildDate
public Date getApplicationBuildDate()
Returns the application build date, if provided. May be null.- Returns:
- the application build date.
-
getAmetysHome
public File getAmetysHome()
Returns the Ametys home directory. Cannot be null.- Returns:
- The Ametys home directory.
-
-