edu.usc.cse.desi.model
Class AbstractDataModel

java.lang.Object
  extended byedu.usc.cse.desi.model.AbstractDESIModel
      extended byedu.usc.cse.desi.model.AbstractDataModel
All Implemented Interfaces:
java.util.EventListener, IObjectWithProperties, java.beans.PropertyChangeListener, java.io.Serializable
Direct Known Subclasses:
AbstractConnectionDataModel, AbstractNodeDataModel, DESIDataModel

public abstract class AbstractDataModel
extends AbstractDESIModel
implements IObjectWithProperties

All Data Model objects will inherrit from this class. This class will provide the support for properties.

Author:
NeLs Started on Aug 11, 2004
See Also:
Serialized Form

Field Summary
protected  PropertyHolder myPropertyHolder
           
protected  PropertyInitializer myPropetyInitializer
           
 
Fields inherited from class edu.usc.cse.desi.model.AbstractDESIModel
listeners
 
Constructor Summary
AbstractDataModel()
           
AbstractDataModel(PropertyInitializer initializer)
           
 
Method Summary
 PropertyInitializer getMyPropertyInitializer()
          This can be used for situations where new Model objects need to be created and there is no direct access to DESIDataModel.
 java.util.Collection getProperties()
          This method returns a Collection of all the Propery objects for the given implementor.
 java.lang.String getPropertyDisplayName(java.lang.String prop_name)
          Properties, in addition to having values also have display names.
 java.lang.Object getPropertyValue(java.lang.String prop_name)
          This method should gets the given property.
 boolean hasProperty(java.lang.String prop_name)
          Checks to see if the object has the given property.
 void setPropertyValue(java.lang.String prop_name, java.lang.Object value)
          This method will set the given property with the given value.
 
Methods inherited from class edu.usc.cse.desi.model.AbstractDESIModel
addPropertyChangeListener, firePropertyChange, propertyChange, reinitialize, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myPropertyHolder

protected PropertyHolder myPropertyHolder

myPropetyInitializer

protected PropertyInitializer myPropetyInitializer
Constructor Detail

AbstractDataModel

public AbstractDataModel(PropertyInitializer initializer)

AbstractDataModel

public AbstractDataModel()
Method Detail

getMyPropertyInitializer

public PropertyInitializer getMyPropertyInitializer()
This can be used for situations where new Model objects need to be created and there is no direct access to DESIDataModel. You can just call getMyPropetyInitializer() on a nearby host or component.

Returns:
Returns the myPropetyInitializer.

getPropertyDisplayName

public java.lang.String getPropertyDisplayName(java.lang.String prop_name)
                                        throws PropertyNotFoundException
Description copied from interface: IObjectWithProperties
Properties, in addition to having values also have display names. This method will return the display name for the given property.

Specified by:
getPropertyDisplayName in interface IObjectWithProperties
Parameters:
prop_name -
Returns:
Throws:
PropertyNotFoundException

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String prop_name)
                                  throws PropertyNotFoundException
Description copied from interface: IObjectWithProperties
This method should gets the given property. If the property does not exist, a PropertyNotFoundException is thrown.

Specified by:
getPropertyValue in interface IObjectWithProperties
Parameters:
prop_name - The name of the property to get.
Returns:
Object - The value of the given property.
Throws:
PropertyNotFoundException - Thrown if the given property does not exist for this type.

hasProperty

public boolean hasProperty(java.lang.String prop_name)
Description copied from interface: IObjectWithProperties
Checks to see if the object has the given property.

Specified by:
hasProperty in interface IObjectWithProperties
Parameters:
prop_name - String - The name of the property.
Returns:
true - This object has the given property. false - This object doesn't have the given property.

setPropertyValue

public void setPropertyValue(java.lang.String prop_name,
                             java.lang.Object value)
                      throws PropertyNotFoundException,
                             java.lang.ClassCastException
Description copied from interface: IObjectWithProperties
This method will set the given property with the given value. If the property does not exist, a PropertyNotFoundException is thrown. If the type of the value is not compatable with the type of the property, it throws a ClassCastException.

Specified by:
setPropertyValue in interface IObjectWithProperties
Parameters:
prop_name - String - The name of the proerty to be set.
value - Object - The value to set the property to.
Throws:
java.lang.ClassCastException - Thrown if there is a mismatch between the given value type and the type of the property.
PropertyNotFoundException - Thrown if this object doesn't have the given property.

getProperties

public java.util.Collection getProperties()
Description copied from interface: IObjectWithProperties
This method returns a Collection of all the Propery objects for the given implementor.

Specified by:
getProperties in interface IObjectWithProperties
Returns:
Collection - A Collection of Property Objects.