@Singleton public class DefaultMagnoliaPropertiesResolver extends Object implements MagnoliaPropertiesResolver
${servername}
: name of the server where the webapp is running, lowercase${webapp}
: the last token in the webapp path (e.g. magnoliaPublic
for a webapp
deployed at tomcat/webapps/magnoliaPublic
)
If no magnolia.initialization.file
context parameter is set, the following default is assumed:
<context-param> <param-name>magnolia.initialization.file</param-name> <param-value> WEB-INF/config/${servername}/${webapp}/magnolia.properties, WEB-INF/config/${servername}/magnolia.properties, WEB-INF/config/${webapp}/magnolia.properties, WEB-INF/config/default/magnolia.properties, WEB-INF/config/magnolia.properties </param-value> </context-param>
Using the ${servername}
and ${webapp}
properties you can easily bundle in the same webapp
different set of configurations which are automatically applied dependending on the server name (useful for switching
between development, test and production instances where the repository configuration need to be different) or the
webapp name (useful to bundle both the public and admin log4j/jndi/bootstrap configuration in the same war). By
default the initializer will try to search for the file in different location with different combination of
servername
and webapp
: the default
fallback directory will be used if no other
environment-specific directory has been added.
The variables are provided by MagnoliaInitPaths
.
Modifier and Type | Field and Description |
---|---|
protected static String |
DEFAULT_INITIALIZATION_PARAMETER
Default value for the MAGNOLIA_INITIALIZATION_FILE parameter.
|
protected static String |
MAGNOLIA_INITIALIZATION_FILE
Context parameter name.
|
Constructor and Description |
---|
DefaultMagnoliaPropertiesResolver(javax.servlet.ServletContext context,
MagnoliaInitPaths initPaths) |
Modifier and Type | Method and Description |
---|---|
protected String |
getInitParameter(javax.servlet.ServletContext ctx,
String name,
String defaultValue) |
protected List<String> |
getLocations()
Used in tests, potentially in subclasses.
|
List<PropertySource> |
getSources()
Returns the paths to load, TODO: in which order ?
|
protected static final String MAGNOLIA_INITIALIZATION_FILE
protected static final String DEFAULT_INITIALIZATION_PARAMETER
@Inject public DefaultMagnoliaPropertiesResolver(javax.servlet.ServletContext context, MagnoliaInitPaths initPaths)
protected String getInitParameter(javax.servlet.ServletContext ctx, String name, String defaultValue)
public List<PropertySource> getSources()
MagnoliaPropertiesResolver
getSources
in interface MagnoliaPropertiesResolver
Copyright © 2003–2018 Magnolia International Ltd.. All rights reserved.