Class XMLPropertyListConfiguration

All Implemented Interfaces:
Cloneable, Configuration, EventSource, FileBasedConfiguration, HierarchicalConfiguration<ImmutableNode>, ImmutableConfiguration, ImmutableHierarchicalConfiguration, FileBased, FileLocatorAware, SynchronizerSupport, InMemoryNodeModelSupport, NodeKeyResolver<ImmutableNode>, NodeModelSupport<ImmutableNode>

public class XMLPropertyListConfiguration extends BaseHierarchicalConfiguration implements FileBasedConfiguration, FileLocatorAware
Property list file (plist) in XML FORMAT as used by Mac OS X (http://www.apple.com/DTDs/PropertyList-1.0.dtd). This configuration doesn't support the binary FORMAT used in OS X 10.4.

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:00Z</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
  • Constructor Details

    • 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(HierarchicalConfiguration<ImmutableNode> configuration)
      Creates a new instance of XMLPropertyListConfiguration and copies the content of the specified configuration into this object.
      Parameters:
      configuration - the configuration to copy
      Since:
      1.4
  • Method Details

    • setPropertyInternal

      protected void setPropertyInternal(String key, Object value)
      Description copied from class: AbstractHierarchicalConfiguration
      Sets the value of the specified property.
      Overrides:
      setPropertyInternal in class AbstractHierarchicalConfiguration<ImmutableNode>
      Parameters:
      key - the key of the property to set
      value - the new value of this property
    • addPropertyInternal

      protected void addPropertyInternal(String key, Object value)
      Description copied from class: AbstractHierarchicalConfiguration
      Adds the property with the specified key. This task will be delegated to the associated ExpressionEngine, so the passed in key must match the requirements of this implementation.
      Overrides:
      addPropertyInternal in class AbstractHierarchicalConfiguration<ImmutableNode>
      Parameters:
      key - the key of the new property
      value - the value of the new property
    • initFileLocator

      public void initFileLocator(FileLocator locator)
      Stores the current file locator. This method is called before I/O operations.
      Specified by:
      initFileLocator in interface FileLocatorAware
      Parameters:
      locator - the current FileLocator
    • read

      public void read(Reader in) throws ConfigurationException
      Description copied from interface: FileBased
      Reads the content of this object from the given reader. Client code should not call this method directly, but use a FileHandler for reading data.
      Specified by:
      read in interface FileBased
      Parameters:
      in - the reader
      Throws:
      ConfigurationException - if a non-I/O related problem occurs, e.g. the data read does not have the expected format
    • write

      public void write(Writer out) throws ConfigurationException
      Description copied from interface: FileBased
      Writes the content of this object to the given writer. Client code should not call this method directly, but use a FileHandler for writing data.
      Specified by:
      write in interface FileBased
      Parameters:
      out - the writer
      Throws:
      ConfigurationException - if a non-I/O related problem occurs, e.g. the data read does not have the expected format