net.sourceforge.esw.properties
Interface IPropertySource

All Superinterfaces:
java.lang.Cloneable, ICloneable, INode, ISupportObject, java.io.Serializable
All Known Subinterfaces:
IPropertyAggregator
All Known Implementing Classes:
DefaultPropertySource

public interface IPropertySource
extends INode

Provides save/load abilities to a set of properties.

Properties are any persistent data source that parameterizes behavior of a running application. That data source could be XML, a relational database, or java.util.Properties file.

For the ESW framework, properties are desinged to be aggregate. That is, multiple properites should be able to be searched against at a specific ranking. This allows many properity sources to be considered as one property source. It also allows one property source to override the properies found in another property source by holding a higher rank in the aggregate property set. See IPropertyAggregator for form information.

To load properties from their data source, call the load method.

Properties can be read-only or writable. The setWriteable and isWriteable methods determine whether an IPropertySource instance is writeable. Writeable indicates that a property cannot be saved, not that it cannot be added to this IPropertySource instance.

If the properties represented by this IPropertySource instance are writable, then the save method saves the properties to the represented property source.

To allow easy access to Properties, this IPropertySource interface extends the INode interface.

This interface is the root of the Properties framework. It provides the container for the storage and manipulation of properties.

To create a new instance of an IPropertySource and add it to the default IPropertyAggregator instance, see PropertyUtil.createXYZPropertySource().

To create a new instance of an IPropertySource independant of an IPropertyAggregator instance, see PropertyFactory.createPropertySource().

Examples:

    // To create a file based XML Property Source and add it to the default
    // IPropertyAggregator instance at the first, or highest, rank:
    PropertyUtil.createFileXMLPropertySource( "MyFilename.xml", 1 );

    // To create an URL based XML Property Source and add it to the default
    // IPropertyAggregator instance at the first, or highest, rank:
    PropertyUtil.createURLXMLPropertySource( "www.somewhere-that-does-not-exist.com", 1 );

    // To create an IPropertySource independant of the IPropertyAggregator:
    IPropertSource source = PropertyFactory.createPropertySource( getMyTransducer() );
 

See Also:
IPropertyAggregator, PropertyManager, PropertyFactory

Method Summary
 boolean isWriteable()
          Returns whether this IPropertySource instance is a writeable IPropertySource instance.
 void load()
          Loads properties from the properties source represented by this IPropertySource instance.
 void save()
          Saves all modified properties to the properties source represented by this IPropertySource instance.
 void setWriteable(boolean isWrite)
          Sets whether this IPropertySource instance is a writeable IPropertySource instance.
 
Methods inherited from interface net.sourceforge.esw.graph.INode
acceptVisitor, add, add, addParent, clear, containsID, get, get, getList, getParents, getValue, isEmpty, iterator, remove, removeParent, setValue, size
 
Methods inherited from interface net.sourceforge.esw.util.ISupportObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getID, getProperty, getPropertySize, propertyKeys, removeProperty, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener, setID, setProperty
 
Methods inherited from interface net.sourceforge.esw.util.ICloneable
clone
 

Method Detail

isWriteable

public boolean isWriteable()
Returns whether this IPropertySource instance is a writeable IPropertySource instance.
Returns:
true if this IPropertySource instance is writeable, false if not.

setWriteable

public void setWriteable(boolean isWrite)
Sets whether this IPropertySource instance is a writeable IPropertySource instance.
Parameters:
aWriteable - if true, then this IPropertySource instance is writeable, false otherwise.

save

public void save()
          throws java.lang.UnsupportedOperationException,
                 java.lang.Exception
Saves all modified properties to the properties source represented by this IPropertySource instance.
Throws:
java.lang.UnsupportedOperationException - if the operation is unsupported.
java.lang.Exception - if an error occurs during the save process.

load

public void load()
          throws java.lang.Exception
Loads properties from the properties source represented by this IPropertySource instance.
Throws:
java.lang.Exception - if any error occurs during the load process.


Copyright 2002 Free Software Foundation. All Rights Reserved.