Package org.appng.core.service
Class PropertySupport
- java.lang.Object
-
- org.appng.core.service.PropertySupport
-
public class PropertySupport extends Object
A service offering methods for initializing and retrieving the configurationProperties
of the platform, aSite
or anApplication
.- Author:
- Matthias Müller
- See Also:
Properties
,PropertyHolder
-
-
Field Summary
Fields Modifier and Type Field Description static String
PREFIX_PLATFORM
static String
PROP_PATTERN
-
Constructor Summary
Constructors Constructor Description PropertySupport(PropertyHolder propertyHolder)
Creates a newPropertySupport
using the givenPropertyHolder
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
getNodePrefix(String nodeId)
Returns the dot-separated property-prefix for a node-property.static Properties
getProperties(Properties platFormConfig, Site site, Application application, boolean addPlatformScope)
Aggregates theProperties
of the platform, the givenSite
and givenApplication
to a singleProperties
object, using a prefix for determining the origin of a certain property.The prefix for a site-property issite.
, for a platform-property it's "platform.".static String
getPropertyName(Site site, Application application, String name)
Returns the dot-separated full name for a given property, depending on whether aSite
and/or anApplication
are given.static String
getPropertyPrefix(Site site, Application application)
Returns the dot-separated property-prefix, depending on whether aSite
and/or anApplication
are given.static String
getSitePrefix(Site site)
Returns the dot-separated property-prefix for a site-property.void
initNodeConfig(boolean finalize)
Initializes the node configuration with the default values.void
initPlatformConfig(String rootPath, Boolean devMode)
void
initPlatformConfig(String rootPath, Boolean devMode, Properties immutableOverrides, boolean finalize)
Initializes the platform configuration with the default values.void
initSiteProperties(SiteImpl site, Properties platformConfig)
Initializes theSite
configuration with the default values.
-
-
-
Field Detail
-
PREFIX_PLATFORM
public static final String PREFIX_PLATFORM
- See Also:
- Constant Field Values
-
PROP_PATTERN
public static final String PROP_PATTERN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PropertySupport
public PropertySupport(PropertyHolder propertyHolder)
Creates a newPropertySupport
using the givenPropertyHolder
.- Parameters:
propertyHolder
- thePropertyHolder
to use
-
-
Method Detail
-
getProperties
public static Properties getProperties(Properties platFormConfig, Site site, Application application, boolean addPlatformScope)
Aggregates theProperties
of the platform, the givenSite
and givenApplication
to a singleProperties
object, using a prefix for determining the origin of a certain property.The prefix for a site-property issite.
, for a platform-property it's "platform.". For anApplication
property no prefix is used.- Parameters:
platFormConfig
- the platform configuration, only needed ifaddPlatformScope
istrue
.site
- theSite
to retrieveProperties
from (may be null)application
- theApplication
to retrieveProperties
from (may be null)addPlatformScope
- set totrue
to add the platform properties- Returns:
- the aggregated
Properties
with prefixed entries - See Also:
Properties.getPlainProperties()
-
getPropertyName
public static String getPropertyName(Site site, Application application, String name)
Returns the dot-separated full name for a given property, depending on whether aSite
and/or anApplication
are given.- Parameters:
site
- theSite
, may benull
application
- theApplication
, may benull
name
- the raw name of the property, without dot-notation- Returns:
- the full name of the property.
-
getPropertyPrefix
public static String getPropertyPrefix(Site site, Application application)
Returns the dot-separated property-prefix, depending on whether aSite
and/or anApplication
are given.- Parameters:
site
- theSite
, may benull
application
- theApplication
, may benull
-
getSitePrefix
public static String getSitePrefix(Site site)
Returns the dot-separated property-prefix for a site-property.- Parameters:
site
- theSite
- Returns:
- the dot-separated property-prefix
-
initSiteProperties
public void initSiteProperties(SiteImpl site, Properties platformConfig)
Initializes theSite
configuration with the default values. The properties are added to thePropertyHolder
thisPropertySupport
was created with.- Parameters:
site
- theSite
to initialize theProperties
forplatformConfig
- the platform configuration- See Also:
PropertySupport(PropertyHolder)
,SiteProperties
-
initPlatformConfig
public void initPlatformConfig(String rootPath, Boolean devMode, Properties immutableOverrides, boolean finalize)
Initializes the platform configuration with the default values. The properties are added to thePropertyHolder
thisPropertySupport
was created with.- Parameters:
rootPath
- the root path of the platform (seePlatform.Property.PLATFORM_ROOT_PATH
)devMode
- value for thePlatform.Property.DEV_MODE
property to setimmutableOverrides
- someProperties
used to override the default valuesfinalize
- whether or not to callPropertyHolder.setFinal()
- See Also:
PropertySupport(PropertyHolder)
,Platform.Property
-
getNodePrefix
public static String getNodePrefix(String nodeId)
Returns the dot-separated property-prefix for a node-property.- Parameters:
nodeId
- the node id as returned byMessaging.getNodeId(org.appng.api.Environment)
- Returns:
- the dot-separated property-prefix
-
initNodeConfig
public void initNodeConfig(boolean finalize)
Initializes the node configuration with the default values. The properties are added to thePropertyHolder
thisPropertySupport
was created with.- Parameters:
finalize
- whether or not to callPropertyHolder.setFinal()
- See Also:
PropertySupport(PropertyHolder)
-
-