edu.sdsc.inca.consumer
Class TimeSeriesBean

java.lang.Object
  extended by org.jfree.data.general.AbstractDataset
      extended by org.jfree.data.general.AbstractSeriesDataset
          extended by org.jfree.data.xy.AbstractXYDataset
              extended by org.jfree.data.xy.AbstractIntervalXYDataset
                  extended by org.jfree.data.time.TimeSeriesCollection
                      extended by edu.sdsc.inca.consumer.TimeSeriesBean
All Implemented Interfaces:
de.laures.cewolf.DatasetProducer, de.laures.cewolf.links.LinkGenerator, de.laures.cewolf.links.XYItemLinkGenerator, de.laures.cewolf.tooltips.ToolTipGenerator, de.laures.cewolf.tooltips.XYToolTipGenerator, java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, org.jfree.data.DomainInfo, org.jfree.data.general.Dataset, org.jfree.data.general.SeriesChangeListener, org.jfree.data.general.SeriesDataset, org.jfree.data.xy.IntervalXYDataset, org.jfree.data.xy.XYDataset

public class TimeSeriesBean
extends org.jfree.data.time.TimeSeriesCollection
implements de.laures.cewolf.DatasetProducer, de.laures.cewolf.tooltips.XYToolTipGenerator, de.laures.cewolf.links.XYItemLinkGenerator

A dataset producer for graphing time series data based on an xpath values in a xml document. This is implemented by extending the time series dataset to pull values from xpaths. There is a main xpath expression used to pick out filter the document. Relative xpath expressions are used for the xaxis value, yaxis value, tooltip, and url.

Author:
Shava Smallen <ssmallen@sdsc.edu>
See Also:
Serialized Form

Field Summary
static java.lang.String NAMESPACE_DECLS
           
 
Fields inherited from interface de.laures.cewolf.DatasetProducer
PRODUCER_ATTRIBUTE_NAME
 
Constructor Summary
TimeSeriesBean(java.lang.String id)
          Create a new time series collection with the specified id
 
Method Summary
 java.lang.String generateLink(int index)
          Return the link to use when the given date point index is moused over
 java.lang.String generateLink(java.lang.Object data, int series, int item)
          Return the link to use when the cursor is hovered over a data point
 java.lang.String generateToolTip(int index)
          Return the link to use when the given date point index is moused over
 java.lang.String generateToolTip(org.jfree.data.xy.XYDataset data, int series, int item)
          Return the text to display when the cursor is hovered a data point
 java.lang.String getLabel()
          Return label description to be used in legend
 java.lang.String getProducerId()
          Returns a unique ID for this DatasetProducer
 boolean hasExpired(java.util.Map params, java.util.Date since)
          This method influences Cewolf's caching behaviour.
 java.lang.Object produceDataset(java.util.Map params)
          Return a time series collection using data supplied from the provided xpaths
 void setLabel(java.lang.String label)
          Set description of series to be used in graph legend
 void setLinkXpath(java.lang.String linkXpath)
          Set the xpath to retrieve the link to use for a given data point
 void setTimestampXpath(java.lang.String timestampXpath)
          Set the xpath to retrieve the timestamp to use for a given data point
 void setTooltipXpath(java.lang.String tooltipXpath)
          Set the xpath to retrieve the tooltip text to use for a given data point
 void setValueXpath(java.lang.String valueXpath)
          Set the xpath to retrieve the a data point value
 void setXml(java.lang.String xml)
          Set the xml document to extract time series from
 void setXpath(java.lang.String xpath)
          Set the absolute xpath to a datapoint
 
Methods inherited from class org.jfree.data.time.TimeSeriesCollection
addSeries, equals, getDomainBounds, getDomainIsPointsInTime, getDomainLowerBound, getDomainOrder, getDomainUpperBound, getEndX, getEndY, getItemCount, getSeries, getSeries, getSeries, getSeriesCount, getSeriesKey, getStartX, getStartY, getSurroundingItems, getX, getX, getXPosition, getXValue, getY, hashCode, indexOf, removeAllSeries, removeSeries, removeSeries, setDomainIsPointsInTime, setXPosition
 
Methods inherited from class org.jfree.data.xy.AbstractIntervalXYDataset
getEndXValue, getEndYValue, getStartXValue, getStartYValue
 
Methods inherited from class org.jfree.data.xy.AbstractXYDataset
getYValue
 
Methods inherited from class org.jfree.data.general.AbstractSeriesDataset
indexOf, seriesChanged
 
Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, clone, fireDatasetChanged, getGroup, hasListener, notifyListeners, removeChangeListener, setGroup, validateObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.data.xy.IntervalXYDataset
getEndXValue, getEndYValue, getStartXValue, getStartYValue
 

Field Detail

NAMESPACE_DECLS

public static final java.lang.String NAMESPACE_DECLS
See Also:
Constant Field Values
Constructor Detail

TimeSeriesBean

public TimeSeriesBean(java.lang.String id)
Create a new time series collection with the specified id

Parameters:
id - a unique identifier for identifying this time series collection
Method Detail

generateLink

public java.lang.String generateLink(java.lang.Object data,
                                     int series,
                                     int item)
Return the link to use when the cursor is hovered over a data point

Specified by:
generateLink in interface de.laures.cewolf.links.XYItemLinkGenerator
Parameters:
data - This object.
series - The series index containing the data point
item - The index of the data point in the series
Returns:
A string containing a url

generateLink

public java.lang.String generateLink(int index)
Return the link to use when the given date point index is moused over

Parameters:
index - The index of the data point that was moused over
Returns:
A url for the given datapoint

generateToolTip

public java.lang.String generateToolTip(org.jfree.data.xy.XYDataset data,
                                        int series,
                                        int item)
Return the text to display when the cursor is hovered a data point

Specified by:
generateToolTip in interface de.laures.cewolf.tooltips.XYToolTipGenerator
Parameters:
data - This object.
series - The series index containing the data point
item - The index of the data point in the series
Returns:
A string containing a url

generateToolTip

public java.lang.String generateToolTip(int index)
Return the link to use when the given date point index is moused over

Parameters:
index - The index of the data point that was moused over
Returns:
A url for the given datapoint

getLabel

public java.lang.String getLabel()
Return label description to be used in legend

Returns:
A string containing a short description of the series

getProducerId

public java.lang.String getProducerId()
Returns a unique ID for this DatasetProducer

Specified by:
getProducerId in interface de.laures.cewolf.DatasetProducer

hasExpired

public boolean hasExpired(java.util.Map params,
                          java.util.Date since)
This method influences Cewolf's caching behaviour. Example of invalid data after a day (86,400 seconds): log.debug(getClass().getName() + "hasExpired()"); return (System.currentTimeMillis() - since.getTime()) > 86400000;

Specified by:
hasExpired in interface de.laures.cewolf.DatasetProducer

produceDataset

public java.lang.Object produceDataset(java.util.Map params)
                                throws de.laures.cewolf.DatasetProduceException
Return a time series collection using data supplied from the provided xpaths

Specified by:
produceDataset in interface de.laures.cewolf.DatasetProducer
Parameters:
params - Additional params for the dataset production.
Returns:
A TimeSeriesCollection object with data and timeestamps.
Throws:
de.laures.cewolf.DatasetProduceException - if trouble generating data

setLabel

public void setLabel(java.lang.String label)
Set description of series to be used in graph legend

Parameters:
label - A string containing a label

setLinkXpath

public void setLinkXpath(java.lang.String linkXpath)
Set the xpath to retrieve the link to use for a given data point

Parameters:
linkXpath - A relative xpath

setTooltipXpath

public void setTooltipXpath(java.lang.String tooltipXpath)
Set the xpath to retrieve the tooltip text to use for a given data point

Parameters:
tooltipXpath - A relative xpath

setTimestampXpath

public void setTimestampXpath(java.lang.String timestampXpath)
Set the xpath to retrieve the timestamp to use for a given data point

Parameters:
timestampXpath - A relative xpath

setValueXpath

public void setValueXpath(java.lang.String valueXpath)
Set the xpath to retrieve the a data point value

Parameters:
valueXpath - A relative xpath

setXml

public void setXml(java.lang.String xml)
Set the xml document to extract time series from

Parameters:
xml - A string containing a xml document

setXpath

public void setXpath(java.lang.String xpath)
Set the absolute xpath to a datapoint

Parameters:
xpath - An absolute xpath