scone.util
Class PersistentProperties

java.lang.Object
  extended by scone.util.PersistentProperties

public class PersistentProperties
extends java.lang.Object

Properties which are defined and stored in an XML document.

Properties files must contain a properties element which may contain property elements. There are three types of properties: boolean, choice and text.
Text properties are defined like this:

<property name="example1" type="text" value="example value"/>

Boolean properties are defined like this (the value may be true or false):
<property name="example2" type="boolean" value="true">

Choice properties are defined like this:
<property name="example3" type="choice" value="harald">
    <value>volkert</value>
    <value>harald</value>
    <value>matthias</value>
 </property>

Where the value elements contain possible choices.

Every Scone plugin has a properties file named [sconepath]/config/properties/[fullclassname].xml The class PersistentPropertiesGui can generate a dialog from such a properties file.


Constructor Summary
PersistentProperties(java.lang.String fileName)
          creates a new instance of PersitentProperties.
 
Method Summary
 java.lang.String get(java.lang.String name)
          returns the value of the specified property as a String
 java.util.Enumeration getKeys()
          returns an enumeration of the property names in the order in which they are defined in the xml document
 java.lang.String getName()
          returns the file name of the xml document
protected  java.lang.String getType(java.lang.String name)
          returns the type of this property
protected  java.util.Vector getValues(java.lang.String name)
          returns the possible values of a choice property or null if the property does not exist or if it is no choice property.
 void set(java.lang.String name, java.lang.String value)
          sets a property value.
 void store()
          stores the current property values to the xml document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentProperties

public PersistentProperties(java.lang.String fileName)
creates a new instance of PersitentProperties.

Parameters:
fileName - the file name of the XML definitions.
Method Detail

getKeys

public java.util.Enumeration getKeys()
returns an enumeration of the property names in the order in which they are defined in the xml document

Returns:
the enumeration of the property names

get

public java.lang.String get(java.lang.String name)
returns the value of the specified property as a String

Parameters:
name - the name of the property
Returns:
the value of the property as a String or null if the property does not exist

getValues

protected java.util.Vector getValues(java.lang.String name)
returns the possible values of a choice property or null if the property does not exist or if it is no choice property.

Parameters:
name - the name
Returns:
a Vector of the possible values

getType

protected java.lang.String getType(java.lang.String name)
returns the type of this property

Parameters:
name - the name of the property
Returns:
the type of the property or null if it does not exist

set

public void set(java.lang.String name,
                java.lang.String value)
sets a property value. If the property does not exist, a new text property will be created.

Parameters:
name - the name of the property
value - the value of the property

store

public void store()
stores the current property values to the xml document.


getName

public java.lang.String getName()
returns the file name of the xml document

Returns:
the file name of the xml document