Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.wlevs.spring.support
Class ConfigurationPropertyPlaceholderConfigurer

    java.lang.Object
      |
      +--com.bea.wlevs.spring.support.ConfigurationPropertyPlaceholderConfigurer

public class ConfigurationPropertyPlaceholderConfigurer
extends java.lang.Object

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()`
`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(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

### ConfigurationPropertyPlaceholderConfigurer

    public ConfigurationPropertyPlaceholderConfigurer()

Method Detail

### getSessionManager

    public SessionManager getSessionManager()

### setSessionManager

    public void setSessionManager(SessionManager session)

### setPlaceholderPrefix

    public void setPlaceholderPrefix(java.lang.String placeholderPrefix)

  Set the prefix that a placeholder string starts with. The default is "${".

  See Also:
    `PropertyPlaceholderConfigurer#DEFAULT_PLACEHOLDER_PREFIX`

### setPlaceholderSuffix

    public void setPlaceholderSuffix(java.lang.String placeholderSuffix)

  Set the suffix that a placeholder string ends with. The default is "}".

  See Also:
    `PropertyPlaceholderConfigurer#DEFAULT_PLACEHOLDER_SUFFIX`

### setSystemPropertiesModeName

    public void setSystemPropertiesModeName(java.lang.String constantName)
                                     throws java.lang.IllegalArgumentException

  Set the system property mode by the name of the corresponding constant, e.g. "SYSTEM_PROPERTIES_MODE_OVERRIDE".

  Parameters:
    `constantName` - name of the constant
  Throws:
    java.lang.IllegalArgumentException - if an invalid constant was specified
  See Also:
    `setSystemPropertiesMode(int)`

### setSystemPropertiesMode

    public void setSystemPropertiesMode(int systemPropertiesMode)

  Set how to check system properties: as fallback, as override, or never. For example, will resolve ${user.dir} to the "user.dir" system property.

  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.

  See Also:
    `PropertyPlaceholderConfigurer#SYSTEM_PROPERTIES_MODE_NEVER`, `PropertyPlaceholderConfigurer#SYSTEM_PROPERTIES_MODE_FALLBACK`, `PropertyPlaceholderConfigurer#SYSTEM_PROPERTIES_MODE_OVERRIDE`, `setSystemPropertiesModeName(java.lang.String)`

### setSearchSystemEnvironment

    public void setSearchSystemEnvironment(boolean searchSystemEnvironment)

  Set whether to search for a matching system environment variable if no matching system property has been found. Only applied when "systemPropertyMode" is active (i.e. "fallback" or "override"), right after checking JVM system properties.

  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.

  See Also:
    `setSystemPropertiesMode(int)`, `System.getProperty(String)`, `System.getenv(String)`

### setIgnoreUnresolvablePlaceholders

    public void setIgnoreUnresolvablePlaceholders(boolean ignoreUnresolvablePlaceholders)

  Set whether to ignore unresolvable placeholders. Default is "false": An exception will be thrown if a placeholder cannot be resolved.

### setProperties

    public void setProperties(java.util.Properties properties)

  Set local properties, e.g. via the "props" tag in XML bean definitions. These can be considered defaults, to be overridden by properties loaded from files.

### setPropertiesArray

    public 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.

### setLocation

    public void setLocation(Resource location)

  Set a location of a properties file to be loaded.

  Can point to a classic properties file or to an XML file that follows JDK 1.5's properties XML format.

### setLocations

    public void setLocations(Resource[] locations)

  Set locations of properties files to be loaded.

  Can point to classic properties files or to XML files that follow JDK 1.5's properties XML format.

### setLocalOverride

    public void setLocalOverride(boolean localOverride)

  Set whether local properties override properties from files. Default is "false": properties from files override local defaults. Can be switched to "true" to let local properties override defaults from files.

### setIgnoreResourceNotFound

    public void setIgnoreResourceNotFound(boolean ignoreResourceNotFound)

  Set if failure to find the property resource should be ignored. True is appropriate if the properties file is completely optional. Default is "false".

### setFileEncoding

    public void setFileEncoding(java.lang.String encoding)

  Set the encoding to use for parsing properties files.

  Default is none, using the `java.util.Properties` default encoding.

  Only applies to classic properties files, not to XML files.

  See Also:
    `org.springframework.util.PropertiesPersister#load`

### resolvePlaceholder

    public java.lang.String resolvePlaceholder(java.lang.String placeholder,
                                               java.util.Properties props)

  Resolve the placeholder in the configuration system. Placeholders take the form A.B.C and we assume that the final one is the actual property we want to set while the prefixes are configuration objects that need to be navigated.

  Parameters:
    `placeholder` -
    `props` -

### setBundleContext

    public void setBundleContext(BundleContext bundleContext)

### postProcessBeforeInitialization

    public java.lang.Object postProcessBeforeInitialization(java.lang.Object bean,
                                                            java.lang.String beanName)
                                                     throws BeansException

### postProcessAfterInitialization

    public java.lang.Object postProcessAfterInitialization(java.lang.Object bean,
                                                           java.lang.String beanName)
                                                    throws BeansException

### postProcessBeforeInstantiation

    public java.lang.Object postProcessBeforeInstantiation(java.lang.Class beanClass,
                                                           java.lang.String beanName)
                                                    throws BeansException

### postProcessAfterInstantiation

    public boolean postProcessAfterInstantiation(java.lang.Object bean,
                                                 java.lang.String beanName)
                                          throws BeansException

### postProcessPropertyValues

    public PropertyValues postProcessPropertyValues(PropertyValues pvs,
                                                    java.beans.PropertyDescriptor[] pds,
                                                    java.lang.Object bean,
                                                    java.lang.String beanName)
                                             throws BeansException

### afterPropertiesSet

    public void afterPropertiesSet()
                            throws java.lang.Exception

### destroy

    public void destroy()
                 throws java.lang.Exception

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007 BEA Systems All Rights Reserved.