org.apache.commons.configuration.plist
Class PropertyListConfiguration

java.lang.Object
  extended by org.apache.commons.configuration.event.EventSource
      extended by org.apache.commons.configuration.AbstractConfiguration
          extended by org.apache.commons.configuration.HierarchicalConfiguration
              extended by org.apache.commons.configuration.AbstractHierarchicalFileConfiguration
                  extended by org.apache.commons.configuration.plist.PropertyListConfiguration
All Implemented Interfaces:
Serializable, Cloneable, Configuration, ConfigurationListener, FileConfiguration

public class PropertyListConfiguration
extends AbstractHierarchicalFileConfiguration

NeXT / OpenStep style configuration. This configuration can read and write ASCII plist files. It support the GNUStep extension to specify date objects.

References:

Example:

 {
     foo = "bar";

     array = ( value1, value2, value3 );

     data = <4f3e0145ab>;

     date = <*D2007-05-05 20:05:00 +0100>;

     nested =
     {
         key1 = value1;
         key2 = value;
         nested =
         {
             foo = bar
         }
     }
 }
 

Since:
1.2
Version:
$Revision: 590474 $, $Date: 2007-10-30 22:35:11 +0100 (Di, 30 Okt 2007) $
Author:
Emmanuel Bourg
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.commons.configuration.AbstractHierarchicalFileConfiguration
AbstractHierarchicalFileConfiguration.FileConfigurationDelegate
 
Nested classes/interfaces inherited from class org.apache.commons.configuration.HierarchicalConfiguration
HierarchicalConfiguration.BuilderVisitor, HierarchicalConfiguration.Node, HierarchicalConfiguration.NodeVisitor
 
Field Summary
 
Fields inherited from class org.apache.commons.configuration.HierarchicalConfiguration
EVENT_ADD_NODES, EVENT_CLEAR_TREE, EVENT_SUBNODE_CHANGED
 
Fields inherited from class org.apache.commons.configuration.AbstractConfiguration
END_TOKEN, EVENT_ADD_PROPERTY, EVENT_CLEAR, EVENT_CLEAR_PROPERTY, EVENT_READ_PROPERTY, EVENT_SET_PROPERTY, START_TOKEN
 
Constructor Summary
PropertyListConfiguration()
          Creates an empty PropertyListConfiguration object which can be used to synthesize a new plist file by adding values and then saving().
PropertyListConfiguration(File file)
          Creates and loads the property list from the specified file.
PropertyListConfiguration(HierarchicalConfiguration c)
          Creates a new instance of PropertyListConfiguration and copies the content of the specified configuration into this object.
PropertyListConfiguration(String fileName)
          Creates and loads the property list from the specified file.
PropertyListConfiguration(URL url)
          Creates and loads the property list from the specified URL.
 
Method Summary
 void addProperty(String key, Object value)
          Add a property to the configuration.
 void load(Reader in)
          Load the configuration from the specified reader.
 void save(Writer out)
          Save the configuration to the specified writer.
 void setProperty(String key, Object value)
          Sets the value of the specified property.
 
Methods inherited from class org.apache.commons.configuration.AbstractHierarchicalFileConfiguration
addNodes, addPropertyDirect, clearProperty, clearTree, configurationChanged, containsKey, createDelegate, fetchNodeList, getBasePath, getDelegate, getEncoding, getFile, getFileName, getKeys, getProperty, getReloadingStrategy, getURL, isAutoSave, isEmpty, load, load, load, load, load, load, reload, save, save, save, save, save, save, setAutoSave, setBasePath, setDelegate, setEncoding, setFile, setFileName, setReloadingStrategy, setURL, subnodeConfigurationChanged
 
Methods inherited from class org.apache.commons.configuration.HierarchicalConfiguration
clearNode, clearNode, clearReferences, clone, configurationAt, configurationAt, configurationsAt, createAddPath, createNode, createSubnodeConfiguration, createSubnodeConfiguration, fetchAddNode, findLastPathNode, findPropertyNodes, getDefaultExpressionEngine, getExpressionEngine, getKeys, getMaxIndex, getRoot, getRootNode, interpolatedConfiguration, nodeDefined, nodeDefined, removeNode, removeNode, setDefaultExpressionEngine, setExpressionEngine, setRoot, setRootNode, subset
 
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration
addErrorLogListener, append, clear, clearPropertyDirect, copy, createInterpolator, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDefaultListDelimiter, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getList, getList, getListDelimiter, getLogger, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, getStringArray, getSubstitutor, interpolate, interpolate, interpolateHelper, isDelimiterParsingDisabled, isThrowExceptionOnMissing, resolveContainerStore, setDefaultListDelimiter, setDelimiter, setDelimiterParsingDisabled, setListDelimiter, setLogger, setThrowExceptionOnMissing
 
Methods inherited from class org.apache.commons.configuration.event.EventSource
addConfigurationListener, addErrorListener, clearConfigurationListeners, clearErrorListeners, createErrorEvent, createEvent, fireError, fireEvent, getConfigurationListeners, getErrorListeners, isDetailEvents, removeConfigurationListener, removeErrorListener, setDetailEvents
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.configuration.Configuration
clear, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getShort, getShort, getShort, getString, getString, getStringArray, subset
 

Constructor Detail

PropertyListConfiguration

public PropertyListConfiguration()
Creates an empty PropertyListConfiguration object which can be used to synthesize a new plist file by adding values and then saving().


PropertyListConfiguration

public PropertyListConfiguration(HierarchicalConfiguration c)
Creates a new instance of PropertyListConfiguration and copies the content of the specified configuration into this object.

Parameters:
c - the configuration to copy
Since:
1.4

PropertyListConfiguration

public PropertyListConfiguration(String fileName)
                          throws ConfigurationException
Creates and loads the property list from the specified file.

Parameters:
fileName - The name of the plist file to load.
Throws:
ConfigurationException - Error while loading the plist file

PropertyListConfiguration

public PropertyListConfiguration(File file)
                          throws ConfigurationException
Creates and loads the property list from the specified file.

Parameters:
file - The plist file to load.
Throws:
ConfigurationException - Error while loading the plist file

PropertyListConfiguration

public PropertyListConfiguration(URL url)
                          throws ConfigurationException
Creates and loads the property list from the specified URL.

Parameters:
url - The location of the plist file to load.
Throws:
ConfigurationException - Error while loading the plist file
Method Detail

setProperty

public void setProperty(String key,
                        Object value)
Description copied from class: HierarchicalConfiguration
Sets the value of the specified property.

Specified by:
setProperty in interface Configuration
Overrides:
setProperty in class AbstractHierarchicalFileConfiguration
Parameters:
key - the key of the property to set
value - the new value of this property

addProperty

public void addProperty(String key,
                        Object value)
Description copied from interface: Configuration
Add a property to the configuration. If it already exists then the value stated here will be added to the configuration entry. For example, if the property:
resource.loader = file
is already present in the configuration and you call
addProperty("resource.loader", "classpath")
Then you will end up with a List like the following:
["file", "classpath"]

Specified by:
addProperty in interface Configuration
Overrides:
addProperty in class AbstractConfiguration
Parameters:
key - The key to add the property to.
value - The value to add.

load

public void load(Reader in)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Load the configuration from the specified reader.

Parameters:
in - the reader
Throws:
ConfigurationException - if an error occurs during the load operation

save

public void save(Writer out)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Save the configuration to the specified writer.

Parameters:
out - the writer
Throws:
ConfigurationException - if an error occurs during the save operation


Copyright © 2001-2007 The Apache Software Foundation. All Rights Reserved.