franta-hg@1: /* ================================================================
franta-hg@1: * Cewolf : Chart enabling Web Objects Framework
franta-hg@1: * ================================================================
franta-hg@1: *
franta-hg@1: * Project Info: http://cewolf.sourceforge.net
franta-hg@1: * Project Lead: Guido Laures (guido@laures.de);
franta-hg@1: *
franta-hg@1: * (C) Copyright 2002, by Guido Laures
franta-hg@1: *
franta-hg@1: * This library is free software; you can redistribute it and/or modify it under the terms
franta-hg@1: * of the GNU Lesser General Public License as published by the Free Software Foundation;
franta-hg@1: * either version 2.1 of the License, or (at your option) any later version.
franta-hg@1: *
franta-hg@1: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
franta-hg@1: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
franta-hg@1: * See the GNU Lesser General Public License for more details.
franta-hg@1: *
franta-hg@1: * You should have received a copy of the GNU Lesser General Public License along with this
franta-hg@1: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
franta-hg@1: * Boston, MA 02111-1307, USA.
franta-hg@1: */
franta-hg@1:
franta-hg@1: package de.laures.cewolf;
franta-hg@1:
franta-hg@1: import java.io.Serializable;
franta-hg@1: import java.util.Date;
franta-hg@1: import java.util.Map;
franta-hg@1:
franta-hg@1: /**
franta-hg@1: * Produces a {@link org.jfree.data.Dataset} which will be rendered
franta-hg@1: * as a chart afterwards.
franta-hg@1: * @see org.jfree.data.Dataset
franta-hg@1: * @author Guido Laures
franta-hg@1: * @since 0.1
franta-hg@1: */
franta-hg@1: public interface DatasetProducer extends Serializable {
franta-hg@1:
franta-hg@1: /**
franta-hg@1: * By default the the name of the JSP attribute
franta-hg@1: * holding the producer instance is passed to the
franta-hg@1: * produceDataset method as a prameter.
franta-hg@1: */
franta-hg@1: public static final String PRODUCER_ATTRIBUTE_NAME = "de.laures.cewolf.DatasetProducer.id";
franta-hg@1:
franta-hg@1: /**
franta-hg@1: * Produces a {@link org.jfree.data.Dataset} object.
franta-hg@1: * @param params additional params for the dataset production. All elements
franta-hg@1: * of this HashMap are of type java.io.Serializable
. This is
franta-hg@1: * necessary to ensure the the serialization of the dataset producer into
franta-hg@1: * the http session. To provide a producer with additional production
franta-hg@1: * parameters the <param> tag is used (see tag library documentation).
franta-hg@1: * It is recommended to synchronize implementations of this method to avoid
franta-hg@1: * concurrency problems.
franta-hg@1: * @return an object of type org.jfree.data.Dataset
.
franta-hg@1: * @throws DatasetProduceException if an error occured during production
franta-hg@1: * @since 0.2
franta-hg@1: */
franta-hg@1: Object produceDataset(Map params) throws DatasetProduceException;
franta-hg@1:
franta-hg@1: /**
franta-hg@1: * This method is called by the Cewolf framework to check if a formerly
franta-hg@1: * produced data can be reused. If the data which had already been used
franta-hg@1: * for chart rendering is still valid this method should return true
.
franta-hg@1: * If possible the Cewolf framework will try to reuse the rendered chart
franta-hg@1: * image. If this is not possible because of some circumstances (e.g. the chart
franta-hg@1: * had been removed from the image cache) the produceDataset method is called afterwards.
franta-hg@1: * Therefore there is no guarantee that the dataset production is always
franta-hg@1: * avoided if this method returns true.
franta-hg@1: * @param params the production parameters of the already produced data
franta-hg@1: * @param since the point in time when the already produced data had been produced
franta-hg@1: * @return true
if the data which had been produced with the
franta-hg@1: * passed in parameters has expired since its creation, false
franta-hg@1: * otherwise
franta-hg@1: * @since 0.9
franta-hg@1: */
franta-hg@1: boolean hasExpired(Map params, Date since);
franta-hg@1:
franta-hg@1: /**
franta-hg@1: * Tis method returns a unique ID for a DatasetProducer from this class.
franta-hg@1: * Producers with the same ID are supposed to produce the same data when
franta-hg@1: * called with the same paramters.
franta-hg@1: * @return the unique ID for instances of this poducer class
franta-hg@1: * @since 0.9
franta-hg@1: */
franta-hg@1: String getProducerId();
franta-hg@1:
franta-hg@1: }