de.laures.cewolf.example
Class PageViewCountData

java.lang.Object
  extended byde.laures.cewolf.example.PageViewCountData
All Implemented Interfaces:
CategoryItemLinkGenerator, CategoryToolTipGenerator, DatasetProducer, LinkGenerator, java.io.Serializable, ToolTipGenerator

public class PageViewCountData
extends java.lang.Object
implements DatasetProducer, CategoryToolTipGenerator, CategoryItemLinkGenerator, java.io.Serializable

An example data producer.

Author:
Guido Laures
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface de.laures.cewolf.DatasetProducer
PRODUCER_ATTRIBUTE_NAME
 
Constructor Summary
PageViewCountData()
           
 
Method Summary
 java.lang.String generateLink(java.lang.Object data, int series, java.lang.Object category)
          Returns a link target for a special data item.
 java.lang.String generateToolTip(org.jfree.data.category.CategoryDataset arg0, int series, int arg2)
           
 java.lang.String getProducerId()
          Returns a unique ID for this DatasetProducer
 boolean hasExpired(java.util.Map params, java.util.Date since)
          This producer's data is invalidated after 5 seconds.
 java.lang.Object produceDataset(java.util.Map params)
          Produces some random data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageViewCountData

public PageViewCountData()
Method Detail

produceDataset

public java.lang.Object produceDataset(java.util.Map params)
                                throws DatasetProduceException
Produces some random data.

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:
an object of type org.jfree.data.Dataset.
Throws:
DatasetProduceException - if an error occured during production

hasExpired

public boolean hasExpired(java.util.Map params,
                          java.util.Date since)
This producer's data is invalidated after 5 seconds. By this method the producer can influence Cewolf's caching behaviour the way it wants to.

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

getProducerId

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

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

generateLink

public java.lang.String generateLink(java.lang.Object data,
                                     int series,
                                     java.lang.Object category)
Returns a link target for a special data item.

Specified by:
generateLink in interface CategoryItemLinkGenerator
Parameters:
data - the dataset
series - the series number
category - the category
See Also:
org.jfree.data.CategoryDataset

generateToolTip

public java.lang.String generateToolTip(org.jfree.data.category.CategoryDataset arg0,
                                        int series,
                                        int arg2)
Specified by:
generateToolTip in interface CategoryToolTipGenerator
See Also:
org.jfree.chart.tooltips.CategoryToolTipGenerator#generateToolTip(CategoryDataset, int, int)