|
Oracle Fusion Middleware Java API Reference for Oracle Event Processing 11g Release 1 (11.1.1.7) E14303-11 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bea.wlevs.spring.support.ConfigurationPropertyPlaceholderConfigurer
An implementation of PropertyPlaceholderConfigurer
that understands the WLEvS configuration subsystem. Properties are accessed using standard conventions, for example <netio><port>9903</port></netio>
would be accessed using ${NetIO.port}.
In order for applications or bundles to take advantage of these features a bean of this type must be inserted in the application context configuration file for the bundle. So for example, in the simplest case:
<bean class="com.bea.wlevs.spring.support.ConfigurationPropertyPlaceholderConfigurer"/>
The bean is actually a org.springframework.beans.factory.config.BeanFactoryPostProcessor
which looks for property values delimited by "${" and "}". When it encounters values of this type it replaces the text with configuration information from the appropriate custom configuration file. There are several rules regarding the syntax and how it is replaced. In the simplest case the values are first treated as configuration object names and then as ConfigurationObject
attributes. So for example the netio subsystem might be configured as:
<netio> <name>MyNetIO</name> <port>9003</port> </netio>
Since the name must be used to identify the configuration object the appropriate syntax for this would be:
<property name="myprop" value="${MyNetIO.port}"/>
Some attributes are referenced indirectly by name in the configuration subsystem, so for example:
<jetty> <name>JettyServer</name> <network-io-name>MyNetIO</network-io-name> </jetty>
This indirection is supported by using the "$" symbol as a prefix to the name. So for the example above the netio port could be determined by using:
<property name="myprop" value="${JettyServer.$networkIoName.port}"/>
Note that tag names are converted to property names using camel-case conventions. In addition some configuration elements are unnamed and can be retrieved by type. The type is used is the class name of the ConfigurationObject
, with "." replaced by "_". So the example above could be modified by using:
<property name="myprop" value="{com_bea_wlevs_configuration_server_JettyType.$networkIoName.port}"/>
Custom configuration can be accessed both from the server configuration and the application configuration. All lookups are performed first against the application configuration before the server configuration is consulted. The application name is implicitly provided during the lookup, based on the bundle which contains the Spring configuration file.
Several properties can be used to modify the behaviour of the configurer, in particular providing fallbacks to system properties or static Spring properties. See the documentation for PropertyPlaceholderConfigurer
for more details.
Constructor Summary | |
ConfigurationPropertyPlaceholderConfigurer() |
Method Summary | |
void |
afterPropertiesSet() |
void |
destroy() |
com.bea.wlevs.configuration.SessionManager |
getSessionManager() |
java.lang.Object |
postProcessAfterInitialization(java.lang.Object bean, java.lang.String beanName) |
boolean |
postProcessAfterInstantiation(java.lang.Object bean, java.lang.String beanName) |
java.lang.Object |
postProcessBeforeInitialization(java.lang.Object bean, java.lang.String beanName) |
java.lang.Object |
postProcessBeforeInstantiation(java.lang.Class beanClass, java.lang.String beanName) |
PropertyValues |
postProcessPropertyValues(PropertyValues pvs, java.beans.PropertyDescriptor[] pds, java.lang.Object bean, java.lang.String beanName) |
java.lang.String |
resolvePlaceholder(java.lang.String placeholder, java.util.Properties props) Resolve the placeholder in the configuration system. |
void |
setBundleContext(BundleContext bundleContext) |
void |
setFileEncoding(java.lang.String encoding) Set the encoding to use for parsing properties files. |
void |
setIgnoreResourceNotFound(boolean ignoreResourceNotFound) Set if failure to find the property resource should be ignored. |
void |
setIgnoreUnresolvablePlaceholders(boolean ignoreUnresolvablePlaceholders) Set whether to ignore unresolvable placeholders. |
void |
setLocalOverride(boolean localOverride) Set whether local properties override properties from files. |
void |
setLocation(Resource location) Set a location of a properties file to be loaded. |
void |
setLocations(Resource[] locations) Set locations of properties files to be loaded. |
void |
setPlaceholderPrefix(java.lang.String placeholderPrefix) Set the prefix that a placeholder string starts with. |
void |
setPlaceholderSuffix(java.lang.String placeholderSuffix) Set the suffix that a placeholder string ends with. |
void |
setProperties(java.util.Properties properties) Set local properties, e.g. via the "props" tag in XML bean definitions. |
void |
setPropertiesArray(java.util.Properties[] propertiesArray) Set local properties, e.g. via the "props" tag in XML bean definitions, allowing for merging multiple properties sets into one. |
void |
setSearchSystemEnvironment(boolean searchSystemEnvironment) Set whether to search for a matching system environment variable if no matching system property has been found. |
void |
setSessionManager(com.bea.wlevs.configuration.SessionManager session) |
void |
setSystemPropertiesMode(int systemPropertiesMode) Set how to check system properties: as fallback, as override, or never. |
void |
setSystemPropertiesModeName(java.lang.String constantName) Set the system property mode by the name of the corresponding constant, e.g. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ConfigurationPropertyPlaceholderConfigurer()
Method Detail |
public com.bea.wlevs.configuration.SessionManager getSessionManager()
public void setSessionManager(com.bea.wlevs.configuration.SessionManager session)
public void setPlaceholderPrefix(java.lang.String placeholderPrefix)
PropertyPlaceholderConfigurer#DEFAULT_PLACEHOLDER_PREFIX
public void setPlaceholderSuffix(java.lang.String placeholderSuffix)
PropertyPlaceholderConfigurer#DEFAULT_PLACEHOLDER_SUFFIX
public void setSystemPropertiesModeName(java.lang.String constantName) throws java.lang.IllegalArgumentException
constantName
- name of the constantsetSystemPropertiesMode(int)
public void setSystemPropertiesMode(int systemPropertiesMode)
The default is "fallback": If not being able to resolve a placeholder with the specified properties, a system property will be tried. "override" will check for a system property first, before trying the specified properties. "never" will not check system properties at all.
PropertyPlaceholderConfigurer#SYSTEM_PROPERTIES_MODE_NEVER
, PropertyPlaceholderConfigurer#SYSTEM_PROPERTIES_MODE_FALLBACK
, PropertyPlaceholderConfigurer#SYSTEM_PROPERTIES_MODE_OVERRIDE
, setSystemPropertiesModeName(java.lang.String)
public void setSearchSystemEnvironment(boolean searchSystemEnvironment)
Default is "true". Switch this setting off to never resolve placeholders against system environment variables. Note that it is generally recommended to pass external values in as JVM system properties: This can easily be achieved in a startup script, even for existing environment variables.
NOTE: Access to environment variables does not work on the Sun VM 1.4, where the corresponding System.getenv(java.lang.String)
support was disabled - before it eventually got re-enabled for the Sun VM 1.5. Please upgrade to 1.5 (or higher) if you intend to rely on the environment variable support.
setSystemPropertiesMode(int)
, System.getProperty(String)
, System.getenv(String)
public void setIgnoreUnresolvablePlaceholders(boolean ignoreUnresolvablePlaceholders)
public void setProperties(java.util.Properties properties)
public void setPropertiesArray(java.util.Properties[] propertiesArray)
public void setLocation(Resource location)
Can point to a classic properties file or to an XML file that follows JDK 1.5's properties XML format.
public void setLocations(Resource[] locations)
Can point to classic properties files or to XML files that follow JDK 1.5's properties XML format.
public void setLocalOverride(boolean localOverride)
public void setIgnoreResourceNotFound(boolean ignoreResourceNotFound)
public void setFileEncoding(java.lang.String encoding)
Default is none, using the java.util.Properties
default encoding.
Only applies to classic properties files, not to XML files.
org.springframework.util.PropertiesPersister#load
public java.lang.String resolvePlaceholder(java.lang.String placeholder, java.util.Properties props)
placeholder
- props
- public void setBundleContext(BundleContext bundleContext)
public java.lang.Object postProcessBeforeInitialization(java.lang.Object bean, java.lang.String beanName) throws BeansException
public java.lang.Object postProcessAfterInitialization(java.lang.Object bean, java.lang.String beanName) throws BeansException
public java.lang.Object postProcessBeforeInstantiation(java.lang.Class beanClass, java.lang.String beanName) throws BeansException
public boolean postProcessAfterInstantiation(java.lang.Object bean, java.lang.String beanName) throws BeansException
public PropertyValues postProcessPropertyValues(PropertyValues pvs, java.beans.PropertyDescriptor[] pds, java.lang.Object bean, java.lang.String beanName) throws BeansException
public void afterPropertiesSet() throws java.lang.Exception
public void destroy() throws java.lang.Exception
|
Copyright © 2007, 2013 Oracle and/or its affiliates. All rights reserved. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |