org.springframework.osgi.compendium.cm
Class ConfigAdminPropertiesFactoryBean

java.lang.Object
  extended by org.springframework.osgi.compendium.cm.ConfigAdminPropertiesFactoryBean
All Implemented Interfaces:
FactoryBean, InitializingBean, BundleContextAware

public class ConfigAdminPropertiesFactoryBean
extends Object
implements BundleContextAware, InitializingBean, FactoryBean

FactoryBean returning the properties stored under a given persistent id in the ConfigurationAdmin service. Once retrieved, the properties will remain the same, even when the configuration object that it maps, changes. Note: This implementation performs a lazy initialization of the properties to receive the most up to date configuration.

Author:
Costin Leau
See Also:
Configuration, ConfigurationAdmin, PropertiesFactoryBean

Constructor Summary
ConfigAdminPropertiesFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 Object getObject()
           
 Class getObjectType()
           
 String getPersistentId()
          Returns the persistentId.
 boolean isSingleton()
           
 void setBundleContext(BundleContext bundleContext)
          Set the BundleContext that this bean runs in.
 void setLocalOverride(boolean localOverride)
          Sets whether local properties override properties from files.
 void setPersistentId(String persistentId)
          Sets the ConfigurationAdmin persistent Id that the bean should read.
 void setProperties(Properties properties)
          Sets the local properties, e.g. via the nested tag in XML bean definitions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigAdminPropertiesFactoryBean

public ConfigAdminPropertiesFactoryBean()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

getObject

public Object getObject()
                 throws Exception
Specified by:
getObject in interface FactoryBean
Throws:
Exception

getObjectType

public Class getObjectType()
Specified by:
getObjectType in interface FactoryBean

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface FactoryBean

getPersistentId

public String getPersistentId()
Returns the persistentId.

Returns:
Returns the persistentId

setPersistentId

public void setPersistentId(String persistentId)
Sets the ConfigurationAdmin persistent Id that the bean should read.

Parameters:
persistentId - The persistentId to set.

setProperties

public void setProperties(Properties properties)
Sets the local properties, e.g. via the nested tag in XML bean definitions. These can be considered defaults, to be overridden by properties loaded from the Configuration Admin.


setLocalOverride

public void setLocalOverride(boolean localOverride)
Sets whether local properties override properties from files.

Default is "false": Properties from the Configuration Admin override local defaults. Can be switched to "true" to let local properties override the Configuration Admin properties.


setBundleContext

public void setBundleContext(BundleContext bundleContext)
Description copied from interface: BundleContextAware
Set the BundleContext that this bean runs in. Normally this can be used to initialize an object.

Specified by:
setBundleContext in interface BundleContextAware
Parameters:
bundleContext - the BundleContext object to be used by this object


Copyright © 2006-2009 Spring Framework. All Rights Reserved.