org.dps.core.model
Interface IEveDataModel


public interface IEveDataModel

Interface for access to the data model. The methods in this interface are used to instantiate new top-level data model elements and apply visitors to arbitrary sub-trees of the data model tree.


Method Summary
 void addObserver(IDataObserver observer)
          Add an observer to be invoked during any visitor traversal.
 void apply(IDataVisitor v, CachedData d)
          Apply the specified visitor to cached data starting at the specified node.
 java.util.Date convertEpochToDate(long epochTime)
          Convert epochTime to a Date.
 java.lang.String formatDate(java.util.Date asDate)
          Format a date in a human-readable form.
 java.lang.String formatDate(long epochTime)
          Format a date in a human-readable form.
 IModelFactory getModelFactory()
          Get the model factory used to instantiate all model objects.
 void removeAllObservers()
          Remove all registered observers.
 boolean removeObserver(IDataObserver observer)
          Remove the named observer from future traversals.
 void setModelFactory(IModelFactory newFactory)
          Change the model factory to be used to instantiate all future model objects.
 

Method Detail

getModelFactory

IModelFactory getModelFactory()
Get the model factory used to instantiate all model objects.

Returns:
an instance of IModelFactory

setModelFactory

void setModelFactory(IModelFactory newFactory)
Change the model factory to be used to instantiate all future model objects.

Parameters:
newFactory - an instance of IModelFactory to replace the current model factory.

apply

void apply(IDataVisitor v,
           CachedData d)
           throws DPSException
Apply the specified visitor to cached data starting at the specified node. Cached data will be traversed according to the data model so that every reachable node is visited at least once.

Parameters:
v - the visitor to apply to each node.
d - the root where the traversal will start.
Throws:
DPSException - if an error occurs during the traversal.

addObserver

void addObserver(IDataObserver observer)
Add an observer to be invoked during any visitor traversal.

Parameters:
observer - the observer to invoke during any traversal.

removeObserver

boolean removeObserver(IDataObserver observer)
Remove the named observer from future traversals.

Parameters:
observer - the observer to remove.
Returns:
true if the referenced observer was installed (and is now removed), false otherwise.

removeAllObservers

void removeAllObservers()
Remove all registered observers.


convertEpochToDate

java.util.Date convertEpochToDate(long epochTime)
Convert epochTime to a Date. This is nothing more than a wrapper around "new Date(epochTime)" which is easy enough to insert in your own code. However, custom implementations of this method may choose to return Dates in a particular timezone. If unspecified, you should assume this method returns UTC dates.

Parameters:
epochTime - the epoch time (milliseconds since January 1, 1970) to convert.
Returns:
an instance of java.util.Date

formatDate

java.lang.String formatDate(java.util.Date asDate)
Format a date in a human-readable form. If unspecified, you should assume the format will be "yyyy-MM-dd HH:mm:ss z" as documented in java.text.SimpleDateFormatter.

Parameters:
asDate - the date to format.
Returns:
A human-readable string representation of the date.

formatDate

java.lang.String formatDate(long epochTime)
Format a date in a human-readable form. This method simply calls "convertEpochToDate" and passes the result to "formatDate(Date)".

Parameters:
epochTime - epoch time (milliseconds since January 1, 1970) to format.
Returns:
A human-readable string representation of the date.