|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.init.DefaultMagnoliaPropertiesResolver
@Singleton public class DefaultMagnoliaPropertiesResolver
Resolves the paths of the properties files to load. The name of the file can be defined as a context parameter in web.xml. Multiple paths, comma separated, are supported (the first existing file in the list will be used), and the following variables will be used:
${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
.
Field Summary | |
---|---|
protected static String |
DEFAULT_INITIALIZATION_PARAMETER
Default value for the MAGNOLIA_INITIALIZATION_FILE parameter. |
protected static String |
MAGNOLIA_INITIALIZATION_FILE
Context parameter name. |
Constructor Summary | |
---|---|
DefaultMagnoliaPropertiesResolver(javax.servlet.ServletContext context,
MagnoliaInitPaths initPaths)
|
Method Summary | |
---|---|
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 ? |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String MAGNOLIA_INITIALIZATION_FILE
protected static final String DEFAULT_INITIALIZATION_PARAMETER
Constructor Detail |
---|
@Inject public DefaultMagnoliaPropertiesResolver(javax.servlet.ServletContext context, MagnoliaInitPaths initPaths)
Method Detail |
---|
protected String getInitParameter(javax.servlet.ServletContext ctx, String name, String defaultValue)
protected List<String> getLocations()
public List<PropertySource> getSources()
MagnoliaPropertiesResolver
getSources
in interface MagnoliaPropertiesResolver
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |