de.laures.cewolf.example
Class RandomXYData

java.lang.Object
  extended byde.laures.cewolf.example.RandomXYData
All Implemented Interfaces:
DatasetProducer, java.io.Serializable

public class RandomXYData
extends java.lang.Object
implements DatasetProducer, java.io.Serializable

Sample DatasetProducer whioh creates random XYDatasets.

Author:
Guido Laures
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface de.laures.cewolf.DatasetProducer
PRODUCER_ATTRIBUTE_NAME
 
Constructor Summary
RandomXYData()
           
 
Method Summary
 java.lang.String getProducerId()
          Tis method returns a unique ID for a DatasetProducer from this class.
 boolean hasExpired(java.util.Map params, java.util.Date since)
          This method is called by the Cewolf framework to check if a formerly produced data can be reused.
 java.lang.Object produceDataset(java.util.Map params)
          Produces a random XYDataset.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomXYData

public RandomXYData()
Method Detail

produceDataset

public java.lang.Object produceDataset(java.util.Map params)
                                throws DatasetProduceException
Produces a random XYDataset.

Specified by:
produceDataset in interface DatasetProducer
Parameters:
params - additional params for the dataset production. All elements of this HashMap are of type java.io.Serializable. This is necessary to ensure the the serialization of the dataset producer into the http session. To provide a producer with additional production parameters the <param> tag is used (see tag library documentation). It is recommended to synchronize implementations of this method to avoid concurrency problems.
Returns:
a random XYDataset
Throws:
DatasetProduceException - if an error occured during production

hasExpired

public boolean hasExpired(java.util.Map params,
                          java.util.Date since)
Description copied from interface: DatasetProducer
This method is called by the Cewolf framework to check if a formerly produced data can be reused. If the data which had already been used for chart rendering is still valid this method should return true. If possible the Cewolf framework will try to reuse the rendered chart image. If this is not possible because of some circumstances (e.g. the chart had been removed from the image cache) the produceDataset method is called afterwards. Therefore there is no guarantee that the dataset production is always avoided if this method returns true.

Specified by:
hasExpired in interface DatasetProducer
Parameters:
params - the production parameters of the already produced data
since - the point in time when the already produced data had been produced
Returns:
true if the data which had been produced with the passed in parameters has expired since its creation, false otherwise
See Also:
DatasetProducer.hasExpired(Map, Date)

getProducerId

public java.lang.String getProducerId()
Description copied from interface: DatasetProducer
Tis method returns a unique ID for a DatasetProducer from this class. Producers with the same ID are supposed to produce the same data when called with the same paramters.

Specified by:
getProducerId in interface DatasetProducer
Returns:
the unique ID for instances of this poducer class