org.apache.wicket.resource
Class PropertiesFactory

java.lang.Object
  extended by org.apache.wicket.resource.PropertiesFactory
All Implemented Interfaces:
IPropertiesFactory

public class PropertiesFactory
extends java.lang.Object
implements IPropertiesFactory

Default implementation of IPropertiesFactory which uses the IResourceStreamLocator as defined by IPropertiesFactoryContext.getResourceStreamLocator() to load the Properties objects. Depending on the settings, it will assign ModificationWatchers to the loaded resources to support reloading.

Author:
Juergen Donnerstag
See Also:
IResourceSettings.getPropertiesFactory()

Constructor Summary
PropertiesFactory(IPropertiesFactoryContext context)
          Construct.
 
Method Summary
 void addListener(IPropertiesChangeListener listener)
          Add a listener which will be called when a change to the underlying resource stream (e.g.
 void clearCache()
          Remove all cached properties.
protected  java.util.Map<java.lang.String,Properties> getCache()
          For subclasses to get access to the cache
 java.util.List<IPropertiesLoader> getPropertiesLoaders()
          Gets the List of properties loader.
 Properties load(java.lang.Class<?> clazz, java.lang.String path)
          Load the properties associated with the path
protected  java.util.Map<java.lang.String,Properties> newPropertiesCache()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesFactory

public PropertiesFactory(IPropertiesFactoryContext context)
Construct.

Parameters:
context - context for properties factory
Method Detail

getPropertiesLoaders

public java.util.List<IPropertiesLoader> getPropertiesLoaders()
Gets the List of properties loader. You may add or remove properties loaders at your will.

Returns:
the List of properties loader

newPropertiesCache

protected java.util.Map<java.lang.String,Properties> newPropertiesCache()
Returns:
new Cache implementation

addListener

public void addListener(IPropertiesChangeListener listener)
Description copied from interface: IPropertiesFactory
Add a listener which will be called when a change to the underlying resource stream (e.g. properties file) has been detected

Specified by:
addListener in interface IPropertiesFactory
See Also:
IPropertiesFactory.addListener(org.apache.wicket.resource.IPropertiesChangeListener)

clearCache

public final void clearCache()
Description copied from interface: IPropertiesFactory
Remove all cached properties.

Specified by:
clearCache in interface IPropertiesFactory
See Also:
IPropertiesFactory.clearCache()

load

public Properties load(java.lang.Class<?> clazz,
                       java.lang.String path)
Description copied from interface: IPropertiesFactory
Load the properties associated with the path

Specified by:
load in interface IPropertiesFactory
Parameters:
clazz - The class requesting the properties
path - The path to identify the resource
Returns:
The properties
See Also:
IPropertiesFactory.load(java.lang.Class, java.lang.String)

getCache

protected final java.util.Map<java.lang.String,Properties> getCache()
For subclasses to get access to the cache

Returns:
Map


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.