org.apache.commons.configuration.plist
Class XMLPropertyListConfiguration

java.lang.Object
  |
  +--org.apache.commons.configuration.AbstractConfiguration
        |
        +--org.apache.commons.configuration.HierarchicalConfiguration
              |
              +--org.apache.commons.configuration.AbstractHierarchicalFileConfiguration
                    |
                    +--org.apache.commons.configuration.plist.XMLPropertyListConfiguration
All Implemented Interfaces:
Cloneable, Configuration, FileConfiguration, Serializable

public class XMLPropertyListConfiguration
extends AbstractHierarchicalFileConfiguration

Mac OS X configuration file (http://www.apple.com/DTDs/PropertyList-1.0.dtd).

Example:

 <?xml version="1.0"?>
 <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
 <plist version="1.0">
     <dict>
         <key>string</key>
         <string>value1</string>

         <key>integer</key>
         <integer>12345</integer>

         <key>real</key>
         <real>-123.45E-1</real>

         <key>boolean</key>
         <true/>

         <key>date</key>
         <date>2005-01-01T12:00:00-0700</date>

         <key>data</key>
         <data>RHJhY28gRG9ybWllbnMgTnVucXVhbSBUaXRpbGxhbmR1cw==</data>

         <key>array</key>
         <array>
             <string>value1</string>
             <string>value2</string>
             <string>value3</string>
         </array>

         <key>dictionnary</key>
         <dict>
             <key>key1</key>
             <string>value1</string>
             <key>key2</key>
             <string>value2</string>
             <key>key3</key>
             <string>value3</string>
         </dict>

         <key>nested</key>
         <dict>
             <key>node1</key>
             <dict>
                 <key>node2</key>
                 <dict>
                     <key>node3</key>
                     <string>value</string>
                 </dict>
             </dict>
         </dict>

     </dict>
 </plist>
 

Since:
1.2
Version:
$Revision$, $Date: 2005-12-06 04:10:27 +0100 (Tue, 06 Dec 2005) $
Author:
Emmanuel Bourg
See Also:
Serialized Form

Inner Class Summary
static class XMLPropertyListConfiguration.ArrayNode
          Container for array elements.
static class XMLPropertyListConfiguration.PListNode
          Node extension with addXXX methods to parse the typed data passed by Digester.
 
Inner classes inherited from class org.apache.commons.configuration.AbstractHierarchicalFileConfiguration
AbstractHierarchicalFileConfiguration.FileConfigurationDelegate
 
Inner classes inherited from class org.apache.commons.configuration.HierarchicalConfiguration
HierarchicalConfiguration.BuilderVisitor, HierarchicalConfiguration.Node, HierarchicalConfiguration.NodeVisitor
 
Fields inherited from class org.apache.commons.configuration.AbstractConfiguration
END_TOKEN, START_TOKEN
 
Constructor Summary
XMLPropertyListConfiguration()
          Creates an empty XMLPropertyListConfiguration object which can be used to synthesize a new plist file by adding values and then saving().
XMLPropertyListConfiguration(File file)
          Creates and loads the property list from the specified file.
XMLPropertyListConfiguration(String fileName)
          Creates and loads the property list from the specified file.
XMLPropertyListConfiguration(URL url)
          Creates and loads the property list from the specified URL.
 
Method Summary
 void load(Reader in)
          Load the configuration from the specified reader.
 void save(Writer out)
          Save the configuration to the specified writer.
 
Methods inherited from class org.apache.commons.configuration.AbstractHierarchicalFileConfiguration
addPropertyDirect, clearProperty, clearTree, containsKey, createDelegate, 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, setProperty, setReloadingStrategy, setURL
 
Methods inherited from class org.apache.commons.configuration.HierarchicalConfiguration
addNodes, clearNode, clone, createAddPath, createNode, fetchAddNode, fetchNodeList, findLastPathNode, findPropertyNodes, getKeys, getMaxIndex, getRoot, nodeDefined, removeNode, setRoot, subset
 
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration
addProperty, clear, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getList, getList, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, getStringArray, interpolate, interpolate, interpolateHelper, isThrowExceptionOnMissing, resolveContainerStore, setDelimiter, setThrowExceptionOnMissing
 
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
addProperty, 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

XMLPropertyListConfiguration

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

XMLPropertyListConfiguration

public XMLPropertyListConfiguration(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

XMLPropertyListConfiguration

public XMLPropertyListConfiguration(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

XMLPropertyListConfiguration

public XMLPropertyListConfiguration(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

load

public void load(Reader in)
          throws ConfigurationException
Description copied from interface: FileConfiguration
Load the configuration from the specified reader.
Following copied from interface: org.apache.commons.configuration.FileConfiguration
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.
Following copied from interface: org.apache.commons.configuration.FileConfiguration
Parameters:
out - the writer
Throws:
ConfigurationException - if an error occurs during the save operation


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