|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sourceforge.esw.util.SupportObject | +--net.sourceforge.esw.graph.Node | +--net.sourceforge.esw.properties.DefaultPropertySource
Default implementation of IPropertySource
.
Properties are any persistent data source that parameterizes behavior of a running application. That data source could be XML, a relational database, or a 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
implementor extends the INode
interface.
To create an 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() );
IPropertyAggregator
,
PropertyManager
,
PropertyFactory
, Serialized FormField Summary | |
protected boolean |
bWriteable
States whether this DefaultPropertySource instance is a
writeable IPropertySource instance. |
protected ITransducer |
transducer
The ITransducer instance for this
DefaultPropertySource instance. |
Fields inherited from class net.sourceforge.esw.graph.Node |
list, map, parents, value |
Fields inherited from class net.sourceforge.esw.util.SupportObject |
id, properties, propertyChildren, propertyListeners, vetoableChildren, vetoableListeners |
Constructor Summary | |
protected |
DefaultPropertySource(ITransducer aTransducer)
Creates a new DefaultPropertySource instance. |
protected |
DefaultPropertySource(ITransducer aTransducer,
boolean bWriteable)
Creates a new DefaultPropertySource instance with the
specified writeable setting. |
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 aWriteable)
Sets whether this IPropertySource instance is a writeable
IPropertySource instance. |
Methods inherited from class net.sourceforge.esw.graph.Node |
acceptVisitor, add, add, addParent, clear, clone, containsID, equals, get, get, getList, getParents, getValue, hashCode, hashCodeForNode, isEmpty, iterator, nodesEqual, remove, removeParent, setValue, size, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
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 |
Field Detail |
protected boolean bWriteable
DefaultPropertySource
instance is a
writeable IPropertySource
instance.protected ITransducer transducer
ITransducer
instance for this
DefaultPropertySource
instance.Constructor Detail |
protected DefaultPropertySource(ITransducer aTransducer)
DefaultPropertySource
instance. By default,
this DefaultPropertySource
instance is writable.aTransducer
- the ITransducer
instance used by this
DefaultPropertySource
instance to load
or save Properties.protected DefaultPropertySource(ITransducer aTransducer, boolean bWriteable)
DefaultPropertySource
instance with the
specified writeable setting.aTransducer
- the ITransducer
instance used by this
DefaultPropertySource
instance to load
or save Properties.aWriteable
- if true
, this IPropertySource
instance will be created as being writable, otherwise,
this IPropertySource
instance will be
read-only.Method Detail |
public boolean isWriteable()
IPropertySource
instance is a writeable
IPropertySource
instance.isWriteable
in interface IPropertySource
true
if this IPropertySource
instance is
writeable, false
if not.public void setWriteable(boolean aWriteable)
IPropertySource
instance is a writeable
IPropertySource
instance.setWriteable
in interface IPropertySource
aWriteable
- if true
, then this
IPropertySource
instance is writeable,
false
otherwise.public void save() throws java.lang.UnsupportedOperationException, java.lang.Exception
IPropertySource
instance.save
in interface IPropertySource
OptionNotSupportedException
- if the operation is unsupported.java.lang.Exception
- if an error occurs during the save process.public void load() throws java.lang.Exception
IPropertySource
instance.load
in interface IPropertySource
java.lang.Exception
- if any error occurs during the load process.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |