org.norther.tammi.core.config
Interface Configurable

All Known Subinterfaces:
ChartGenerator, ConfigurableConverter, ConfigurableFactory, HibernatePersisterFactory, HttpRelayFilter, IpMaskFilter, JasperReports, JFreeCharts, JFreeReports, JndiRealm, JSPEngine, Logger, MailSender, MemoryRealm, NativeRealm, OJBPersisterFactory, PersisterFactory, Realm, ReportEngine, RepositoryRealm, ServletEngine, Startup, TemplateEngine, ThreadedLogger, XMLPersisterFactory
All Known Implementing Classes:
AbstractChartGenerator, AbstractLogger, AbstractPersisterFactory, AbstractRealm, AbstractReportEngine, AbstractTemplateEngine, AbstractThreadedLogger, DefaultConfigurable, DefaultConfigurableConverter, DefaultConfigurableFactory, DefaultContextFactory, DefaultHibernatePersisterFactory, DefaultHttpRelayFilter, DefaultIpMaskFilter, DefaultJasperReports, DefaultJFreeCharts, DefaultJFreeReports, DefaultJndiRealm, DefaultJSPEngine, DefaultMailSender, DefaultMemoryRealm, DefaultNativeRealm, DefaultOJBPersisterFactory, DefaultRepositoryRealm, DefaultServletEngine, DefaultSessionFactory, DefaultStartup, DefaultXMLPersisterFactory, FreemarkerEngine, JDK4Logger, Log4JLogger, VelocityEngine

public interface Configurable

An interface to configurable objects defining properties for configuring their behaviour.

Author:
Ilkka Priha

Method Summary
 void addProperty(int index, String key, String value)
          Inserts a multivalued property at the specified index.
 void addProperty(String key, String value)
          Adds a multivalued property.
 void clearProperties()
          Clears all properties.
 boolean containsProperty(String key)
          Checks whether a property is defined.
 String getConfigKey()
          Gets the path finder key for resolving configuration paths.
 String[] getProperties(String key)
          Gets a multivalued property.
 String getProperty(String key)
          Gets a property.
 String getPropertyFilePath()
          Gets the property file path.
 int indexOfProperty(String key, String value)
          Returns the index of a multivalued property value.
 OrderedMap propertyMap()
          Returns a map of properties.
 OrderedMap propertyMap(String prefix)
          Returns a map of prefixed properties.
 Object removeProperty(String key)
          Removes a property.
 boolean removeProperty(String key, String value)
          Removes a multivalued property.
 void setConfigKey(String key)
          Sets the path finder key for resolving configuration paths.
 Object setProperties(String key, String[] values)
          Sets a multivalued property.
 Object setProperty(String key, String value)
          Sets a property.
 void setPropertyFilePath(String path)
          Sets the property file path.
 void setPropertyFilePath(String path, String encoding)
          Sets the property file path with encoding.
 void storeProperties()
          Stores properties to the property file.
 

Method Detail

getConfigKey

String getConfigKey()
Gets the path finder key for resolving configuration paths.

Returns:
the path finder key.

setConfigKey

void setConfigKey(String key)
Sets the path finder key for resolving configuration paths. The default key is PathFinderMBean.CONFIG.

Parameters:
key - the path finder key.

getPropertyFilePath

String getPropertyFilePath()
Gets the property file path.

Returns:
the property file path.

setPropertyFilePath

void setPropertyFilePath(String path)
Sets the property file path. The path may be an absolute file path, a file path relative to the specified config key folder or a URL. The properties will be loaded before the next get/set property operation.

Parameters:
path - a property file path.

setPropertyFilePath

void setPropertyFilePath(String path,
                         String encoding)
Sets the property file path with encoding. The path may be an absolute file path, a file path relative to the specified config key folder or a URL. The properties will be loaded before the next get/set property operation.

Parameters:
path - a property file path.
encoding - the encoding to use.

containsProperty

boolean containsProperty(String key)
Checks whether a property is defined.

Parameters:
key - the key.
Returns:
true for a defined property, false otherwise.

getProperty

String getProperty(String key)
Gets a property.

Parameters:
key - the key.
Returns:
the value or null.

setProperty

Object setProperty(String key,
                   String value)
Sets a property.

Parameters:
key - the key.
value - the value.
Returns:
the previous value.

getProperties

String[] getProperties(String key)
Gets a multivalued property.

Parameters:
key - the key.
Returns:
the values or null.

setProperties

Object setProperties(String key,
                     String[] values)
Sets a multivalued property.

Parameters:
key - the key.
values - the values.
Returns:
the previous value.

removeProperty

Object removeProperty(String key)
Removes a property.

Parameters:
key - the key.
Returns:
the removed value or null.

indexOfProperty

int indexOfProperty(String key,
                    String value)
Returns the index of a multivalued property value.

Parameters:
key - the key.
value - the value.
Returns:
the index of the value or -1.

addProperty

void addProperty(String key,
                 String value)
Adds a multivalued property.

Parameters:
key - the key.
value - the property.

addProperty

void addProperty(int index,
                 String key,
                 String value)
Inserts a multivalued property at the specified index.

Parameters:
index - the index.
key - the key.
value - the value.

removeProperty

boolean removeProperty(String key,
                       String value)
Removes a multivalued property.

Parameters:
key - the key.
value - the value.
Returns:
true if removed, false otherwise.

clearProperties

void clearProperties()
Clears all properties.


propertyMap

OrderedMap propertyMap()
Returns a map of properties. Multivalued properties are presented as string arrays.

Returns:
a map of properties.

propertyMap

OrderedMap propertyMap(String prefix)
Returns a map of prefixed properties. The prefix is removed from the keys of the returned map. Multivalued properties are presented as string arrays.

Parameters:
prefix - the prefix.
Returns:
a map of properties.

storeProperties

void storeProperties()
                     throws IOException
Stores properties to the property file.

Throws:
IOException - on I/O errors.


Copyright © 2004 The Norther Organization. All rights reserved.