String dump() throws IOException { return "== HEADER ==\n" + "signature:" + getSignature() + " lastUpdateTime:" + getLastUpdateTime() + " step:" + getStep() + " dsCount:" + getDsCount() + " arcCount:" + getArcCount() + "\n"; }
String dump() throws IOException { return "== HEADER ==\n" + "signature:" + getSignature() + " lastUpdateTime:" + getLastUpdateTime() + " step:" + getStep() + " dsCount:" + getDsCount() + " arcCount:" + getArcCount() + "\n"; }
/** * Copies object's internal state to another Archive object. * * @param other New Archive object to copy state to * @throws IOException Thrown in case of I/O error */ public void copyStateTo(RrdUpdater other) throws IOException { if (!(other instanceof Archive)) { throw new IllegalArgumentException( "Cannot copy Archive object to " + other.getClass().getName()); } Archive arc = (Archive) other; if (!arc.consolFun.get().equals(consolFun.get())) { throw new IllegalArgumentException("Incompatible consolidation functions"); } if (arc.steps.get() != steps.get()) { throw new IllegalArgumentException("Incompatible number of steps"); } int count = parentDb.getHeader().getDsCount(); for (int i = 0; i < count; i++) { int j = Util.getMatchingDatasourceIndex(parentDb, i, arc.parentDb); if (j >= 0) { states[i].copyStateTo(arc.states[j]); robins[i].copyStateTo(arc.robins[j]); } } }
/** * {@inheritDoc} * * Copies object's internal state to another Archive object. */ public void copyStateTo(Archive arc) throws IOException { if (arc.consolFun.get() != consolFun.get()) { throw new IllegalArgumentException("Incompatible consolidation functions"); } if (arc.steps.get() != steps.get()) { throw new IllegalArgumentException("Incompatible number of steps"); } int count = parentDb.getHeader().getDsCount(); for (int i = 0; i < count; i++) { int j = Util.getMatchingDatasourceIndex(parentDb, i, arc.parentDb); if (j >= 0) { states[i].copyStateTo(arc.states[j]); robins[i].copyStateTo(arc.robins[j]); } } }
void setFile(File newFile) { try { values = null; String path = newFile.getAbsolutePath(); RrdDb rrd = new RrdDb(path, true); try { Header header = rrd.getHeader(); String signature = header.getSignature(); String step = "" + header.getStep(); String lastTimestamp = header.getLastUpdateTime() + " [" + new Date(header.getLastUpdateTime() * 1000L) + "]"; String datasources = "" + header.getDsCount(); String archives = "" + header.getArcCount(); String size = rrd.getRrdBackend().getLength() + " bytes"; values = new Object[]{ path, signature, step, lastTimestamp, datasources, archives, size }; } finally { rrd.close(); } fireTableDataChanged(); } catch (Exception e) { Util.error(null, e); } } }
int dsCount = header.getDsCount(); datasources = new Datasource[dsCount]; for (int i = 0; i < dsCount; i++) {
int dsCount = header.getDsCount(); datasources = new Datasource[dsCount]; for (int i = 0; i < dsCount; i++) {
Archive(RrdDb parentDb, DataImporter reader, int arcIndex) throws IOException { this(parentDb, new ArcDef( reader.getConsolFun(arcIndex), reader.getXff(arcIndex), reader.getSteps(arcIndex), reader.getRows(arcIndex))); int n = parentDb.getHeader().getDsCount(); for (int i = 0; i < n; i++) { // restore state states[i].setAccumValue(reader.getStateAccumValue(arcIndex, i)); states[i].setNanSteps(reader.getStateNanSteps(arcIndex, i)); // restore robins double[] values = reader.getValues(arcIndex, i); robins[i].update(values); } }
Archive(RrdDb parentDb, DataImporter reader, int arcIndex) throws IOException { this(parentDb, new ArcDef( reader.getConsolFun(arcIndex), reader.getXff(arcIndex), reader.getSteps(arcIndex), reader.getRows(arcIndex))); int n = parentDb.getHeader().getDsCount(); for (int i = 0; i < n; i++) { // restore state states[i].setAccumValue(reader.getStateAccumValue(arcIndex, i)); states[i].setNanSteps(reader.getStateNanSteps(arcIndex, i)); // restore robins double[] values = reader.getValues(arcIndex, i); robins[i].update(values); } }
int dsCount = header.getDsCount();
rows.set(arcDef.getRows()); int n = parentDb.getHeader().getDsCount(); int numRows = rows.get(); states = new ArcState[n];
rows.set(arcDef.getRows()); int n = parentDb.getHeader().getDsCount(); int numRows = rows.get(); states = new ArcState[n];