KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jrobin > core > DataImporter


1 /* ============================================================
2  * JRobin : Pure java implementation of RRDTool's functionality
3  * ============================================================
4  *
5  * Project Info: http://www.jrobin.org
6  * Project Lead: Sasa Markovic (saxon@jrobin.org);
7  *
8  * (C) Copyright 2003, by Sasa Markovic.
9  *
10  * Developers: Sasa Markovic (saxon@jrobin.org)
11  * Arne Vandamme (cobralord@jrobin.org)
12  *
13  * This library is free software; you can redistribute it and/or modify it under the terms
14  * of the GNU Lesser General Public License as published by the Free Software Foundation;
15  * either version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
18  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  * See the GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License along with this
22  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
23  * Boston, MA 02111-1307, USA.
24  */

25
26 package org.jrobin.core;
27
28 import java.io.IOException JavaDoc;
29
30 abstract class DataImporter {
31
32     // header
33
abstract String JavaDoc getVersion() throws RrdException, IOException JavaDoc;
34     abstract long getLastUpdateTime() throws RrdException, IOException JavaDoc;
35     abstract long getStep() throws RrdException, IOException JavaDoc;
36     abstract int getDsCount() throws RrdException, IOException JavaDoc;
37     abstract int getArcCount() throws RrdException, IOException JavaDoc;
38
39     // datasource
40
abstract String JavaDoc getDsName(int dsIndex) throws RrdException, IOException JavaDoc;
41     abstract String JavaDoc getDsType(int dsIndex) throws RrdException, IOException JavaDoc;
42     abstract long getHeartbeat(int dsIndex) throws RrdException, IOException JavaDoc;
43     abstract double getMinValue(int dsIndex) throws RrdException, IOException JavaDoc;
44     abstract double getMaxValue(int dsIndex) throws RrdException, IOException JavaDoc;
45
46     // datasource state
47
abstract double getLastValue(int dsIndex) throws RrdException, IOException JavaDoc;
48     abstract double getAccumValue(int dsIndex) throws RrdException, IOException JavaDoc;
49     abstract long getNanSeconds(int dsIndex) throws RrdException, IOException JavaDoc;
50
51     // archive
52
abstract String JavaDoc getConsolFun(int arcIndex) throws RrdException, IOException JavaDoc;
53     abstract double getXff(int arcIndex) throws RrdException, IOException JavaDoc;
54     abstract int getSteps(int arcIndex) throws RrdException, IOException JavaDoc;
55     abstract int getRows(int arcIndex) throws RrdException, IOException JavaDoc;
56
57     // archive state
58
abstract double getStateAccumValue(int arcIndex, int dsIndex) throws RrdException, IOException JavaDoc;
59     abstract int getStateNanSteps(int arcIndex, int dsIndex) throws RrdException, IOException JavaDoc;
60     abstract double[] getValues(int arcIndex, int dsIndex) throws RrdException, IOException JavaDoc;
61
62     long getEstimatedSize() throws RrdException, IOException JavaDoc {
63         int dsCount = getDsCount();
64         int arcCount = getArcCount();
65         int rowCount = 0;
66         for(int i = 0; i < arcCount; i++) {
67             rowCount += getRows(i);
68         }
69         return RrdDef.calculateSize(dsCount, arcCount, rowCount);
70     }
71
72     void release() throws RrdException, IOException JavaDoc {
73         // NOP
74
}
75
76 }
Popular Tags