From: Sasa M. <sa...@us...> - 2004-07-22 07:23:56
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23408/org/jrobin/core Modified Files: XmlReader.java Added Files: DataImporter.java Log Message: Added interface for all clases which import data to RrdDb - not necessary now, but might be useful later (jrrd) --- NEW FILE: DataImporter.java --- /* ============================================================ * JRobin : Pure java implementation of RRDTool's functionality * ============================================================ * * Project Info: http://www.jrobin.org * Project Lead: Sasa Markovic (sa...@jr...); * * (C) Copyright 2003, by Sasa Markovic. * * Developers: Sasa Markovic (sa...@jr...) * Arne Vandamme (cob...@jr...) * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. */ package org.jrobin.core; import java.io.IOException; abstract class DataImporter { // header abstract String getVersion() throws RrdException, IOException; abstract long getLastUpdateTime() throws RrdException, IOException; abstract long getStep() throws RrdException, IOException; abstract int getDsCount() throws RrdException, IOException; abstract int getArcCount() throws RrdException, IOException; // datasource abstract String getDsName(int dsIndex) throws RrdException, IOException; abstract String getDsType(int dsIndex) throws RrdException, IOException; abstract long getHeartbeat(int dsIndex) throws RrdException, IOException; abstract double getMinValue(int dsIndex) throws RrdException, IOException; abstract double getMaxValue(int dsIndex) throws RrdException, IOException; // datasource state abstract double getLastValue(int dsIndex) throws RrdException, IOException; abstract double getAccumValue(int dsIndex) throws RrdException, IOException; abstract long getNanSeconds(int dsIndex) throws RrdException, IOException; // archive abstract String getConsolFun(int arcIndex) throws RrdException, IOException; abstract double getXff(int arcIndex) throws RrdException, IOException; abstract int getSteps(int arcIndex) throws RrdException, IOException; abstract int getRows(int arcIndex) throws RrdException, IOException; // archive state abstract double getStateAccumValue(int arcIndex, int dsIndex) throws RrdException, IOException; abstract int getStateNanSteps(int arcIndex, int dsIndex) throws RrdException, IOException; abstract double[] getValues(int arcIndex, int dsIndex) throws RrdException, IOException; long getEstimatedSize() throws RrdException, IOException { int dsCount = getDsCount(); int arcCount = getArcCount(); int rowCount = 0; for(int i = 0; i < arcCount; i++) { rowCount += getRows(i); } return RrdDef.calculateSize(dsCount, arcCount, rowCount); } } Index: XmlReader.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/XmlReader.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** XmlReader.java 20 May 2004 10:29:33 -0000 1.5 --- XmlReader.java 22 Jul 2004 07:23:46 -0000 1.6 *************** *** 31,35 **** import java.io.File; ! class XmlReader { private Element root; --- 31,35 ---- import java.io.File; ! class XmlReader extends DataImporter { private Element root; *************** *** 135,148 **** return values; } - - long getEstimatedSize() throws RrdException { - int dsCount = getDsCount(); - int arcCount = getArcCount(); - int rowCount = 0; - for(int i = 0; i < arcCount; i++) { - rowCount += getRows(i); - } - return RrdDef.calculateSize(dsCount, arcCount, rowCount); - } - } \ No newline at end of file --- 135,137 ---- |