franta-hg@1
|
1 |
/* ================================================================
|
franta-hg@1
|
2 |
* Cewolf : Chart enabling Web Objects Framework
|
franta-hg@1
|
3 |
* ================================================================
|
franta-hg@1
|
4 |
*
|
franta-hg@1
|
5 |
* Project Info: http://cewolf.sourceforge.net
|
franta-hg@1
|
6 |
* Project Lead: Guido Laures (guido@laures.de);
|
franta-hg@1
|
7 |
*
|
franta-hg@1
|
8 |
* (C) Copyright 2002, by Guido Laures
|
franta-hg@1
|
9 |
*
|
franta-hg@1
|
10 |
* This library is free software; you can redistribute it and/or modify it under the terms
|
franta-hg@1
|
11 |
* of the GNU Lesser General Public License as published by the Free Software Foundation;
|
franta-hg@1
|
12 |
* either version 2.1 of the License, or (at your option) any later version.
|
franta-hg@1
|
13 |
*
|
franta-hg@1
|
14 |
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
franta-hg@1
|
15 |
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
franta-hg@1
|
16 |
* See the GNU Lesser General Public License for more details.
|
franta-hg@1
|
17 |
*
|
franta-hg@1
|
18 |
* You should have received a copy of the GNU Lesser General Public License along with this
|
franta-hg@1
|
19 |
* library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
franta-hg@1
|
20 |
* Boston, MA 02111-1307, USA.
|
franta-hg@1
|
21 |
*/
|
franta-hg@1
|
22 |
|
franta-hg@1
|
23 |
package de.laures.cewolf;
|
franta-hg@1
|
24 |
|
franta-hg@1
|
25 |
import java.io.Serializable;
|
franta-hg@1
|
26 |
import java.util.Date;
|
franta-hg@1
|
27 |
import java.util.Map;
|
franta-hg@1
|
28 |
|
franta-hg@1
|
29 |
/**
|
franta-hg@1
|
30 |
* Produces a {@link org.jfree.data.Dataset} which will be rendered
|
franta-hg@1
|
31 |
* as a chart afterwards.
|
franta-hg@1
|
32 |
* @see org.jfree.data.Dataset
|
franta-hg@1
|
33 |
* @author Guido Laures
|
franta-hg@1
|
34 |
* @since 0.1
|
franta-hg@1
|
35 |
*/
|
franta-hg@1
|
36 |
public interface DatasetProducer extends Serializable {
|
franta-hg@1
|
37 |
|
franta-hg@1
|
38 |
/**
|
franta-hg@1
|
39 |
* By default the the name of the JSP attribute
|
franta-hg@1
|
40 |
* holding the producer instance is passed to the
|
franta-hg@1
|
41 |
* produceDataset method as a prameter.
|
franta-hg@1
|
42 |
*/
|
franta-hg@1
|
43 |
public static final String PRODUCER_ATTRIBUTE_NAME = "de.laures.cewolf.DatasetProducer.id";
|
franta-hg@1
|
44 |
|
franta-hg@1
|
45 |
/**
|
franta-hg@1
|
46 |
* Produces a {@link org.jfree.data.Dataset} object.
|
franta-hg@1
|
47 |
* @param params additional params for the dataset production. All elements
|
franta-hg@1
|
48 |
* of this HashMap are of type <code>java.io.Serializable</code>. This is
|
franta-hg@1
|
49 |
* necessary to ensure the the serialization of the dataset producer into
|
franta-hg@1
|
50 |
* the http session. To provide a producer with additional production
|
franta-hg@1
|
51 |
* parameters the <param> tag is used (see tag library documentation).
|
franta-hg@1
|
52 |
* It is recommended to synchronize implementations of this method to avoid
|
franta-hg@1
|
53 |
* concurrency problems.
|
franta-hg@1
|
54 |
* @return an object of type <code>org.jfree.data.Dataset</code>.
|
franta-hg@1
|
55 |
* @throws DatasetProduceException if an error occured during production
|
franta-hg@1
|
56 |
* @since 0.2
|
franta-hg@1
|
57 |
*/
|
franta-hg@1
|
58 |
Object produceDataset(Map params) throws DatasetProduceException;
|
franta-hg@1
|
59 |
|
franta-hg@1
|
60 |
/**
|
franta-hg@1
|
61 |
* This method is called by the Cewolf framework to check if a formerly
|
franta-hg@1
|
62 |
* produced data can be reused. If the data which had already been used
|
franta-hg@1
|
63 |
* for chart rendering is still valid this method should return <code>true</code>.
|
franta-hg@1
|
64 |
* If possible the Cewolf framework will try to reuse the rendered chart
|
franta-hg@1
|
65 |
* image. If this is not possible because of some circumstances (e.g. the chart
|
franta-hg@1
|
66 |
* had been removed from the image cache) the produceDataset method is called afterwards.
|
franta-hg@1
|
67 |
* Therefore there is no guarantee that the dataset production is always
|
franta-hg@1
|
68 |
* avoided if this method returns <code>true</true>.
|
franta-hg@1
|
69 |
* @param params the production parameters of the already produced data
|
franta-hg@1
|
70 |
* @param since the point in time when the already produced data had been produced
|
franta-hg@1
|
71 |
* @return <code>true</code> if the data which had been produced with the
|
franta-hg@1
|
72 |
* passed in parameters has expired since its creation, <code>false</code>
|
franta-hg@1
|
73 |
* otherwise
|
franta-hg@1
|
74 |
* @since 0.9
|
franta-hg@1
|
75 |
*/
|
franta-hg@1
|
76 |
boolean hasExpired(Map params, Date since);
|
franta-hg@1
|
77 |
|
franta-hg@1
|
78 |
/**
|
franta-hg@1
|
79 |
* Tis method returns a unique ID for a DatasetProducer from this class.
|
franta-hg@1
|
80 |
* Producers with the same ID are supposed to produce the same data when
|
franta-hg@1
|
81 |
* called with the same paramters.
|
franta-hg@1
|
82 |
* @return the unique ID for instances of this poducer class
|
franta-hg@1
|
83 |
* @since 0.9
|
franta-hg@1
|
84 |
*/
|
franta-hg@1
|
85 |
String getProducerId();
|
franta-hg@1
|
86 |
|
franta-hg@1
|
87 |
}
|