@Test public void testExecute() throws RrdException, IOException, JRException { JRobinDataSource dataSource = (JRobinDataSource) new RrdXportCmd().executeCommand(getQueryString()); assertTrue(dataSource.next()); }
JRDataSource execute() throws RrdException, IOException { String startStr = getOptionValue("s", "start", DEFAULT_START); String endStr = getOptionValue("e", "end", DEFAULT_END); long span[] = Util.getTimestamps(startStr, endStr); dproc = new DataProcessor(span[0], span[1]); xports = new ArrayList<XPort>(); long step = parseLong(getOptionValue(null, "step", "1")); int maxRows = parseInt(getOptionValue("m", "maxrows", "400")); long minStep = (long) Math.ceil((span[1] - span[0]) / (double) (maxRows - 1)); step = Math.max(step, minStep); dproc.setFetchRequestResolution(step); dproc.setStep(step); String[] words = getRemainingWords(); if (words.length < 1) { throw new RrdException("Incomplete XPORT command"); } for (int i = 0; i < words.length; i++) { if (words[i].startsWith("DEF:")) { parseDef(words[i]); } else if (words[i].startsWith("CDEF:")) { parseCDef(words[i]); } else if (words[i].startsWith("XPORT:")) { parseXport(words[i]); } else { throw new RrdException("Invalid XPORT syntax: " + words[i]); } } JRDataSource result = xports.size() == 0 ? null : xport(); println(xports.size() == 0 ? "No XPORT statement found, nothing done" : result.toString()); return result; }
RrdXportCmd extends RrdToolCmd implements RrdGraphConstants { JRDataSource execute() throws RrdException, IOException { String startStr = getOptionValue("s", "start", DEFAULT_START); String endStr = getOptionValue("e", "end", DEFAULT_END); long span[] = Util.getTimestamps(startStr, endStr); dproc = new DataProcessor(span[0], span[1]); xports = new ArrayList<XPort>(); long step = parseLong(getOptionValue(null, "step", "1")); int maxRows = parseInt(getOptionValue("m", "maxrows", "400")); long minStep = (long) Math.ceil((span[1] - span[0]) / (double) (maxRows - 1)); step = Math.max(step, minStep); dproc.setFetchRequestResolution(step); dproc.setStep(step); String[] words = getRemainingWords(); if (words.length < 1) { throw new RrdException("Incomplete XPORT command"); } for (int i = 0; i < words.length; i++) { if (words[i].startsWith("DEF:")) { parseDef(words[i]); } else if (words[i].startsWith("CDEF:")) { parseCDef(words[i]); } else if (words[i].startsWith("XPORT:")) { parseXport(words[i]); } else { throw new RrdException("Invalid XPORT syntax: " + words[i]); } } JRDataSource result = xports.size() == 0 ? null : xport(); println(xports.size() == 0 ? "No XPORT statement found, nothing done" : result.toString()); return result; } }
RrdXportCmd extends RrdToolCmd implements RrdGraphConstants { JRDataSource execute() throws RrdException, IOException { String startStr = getOptionValue("s", "start", DEFAULT_START); String endStr = getOptionValue("e", "end", DEFAULT_END); long span[] = Util.getTimestamps(startStr, endStr); dproc = new DataProcessor(span[0], span[1]); xports = new ArrayList<XPort>(); long step = parseLong(getOptionValue(null, "step", "1")); int maxRows = parseInt(getOptionValue("m", "maxrows", "400")); long minStep = (long) Math.ceil((span[1] - span[0]) / (double) (maxRows - 1)); step = Math.max(step, minStep); dproc.setFetchRequestResolution(step); dproc.setStep(step); String[] words = getRemainingWords(); if (words.length < 1) { throw new RrdException("Incomplete XPORT command"); } for (int i = 0; i < words.length; i++) { if (words[i].startsWith("DEF:")) { parseDef(words[i]); } else if (words[i].startsWith("CDEF:")) { parseCDef(words[i]); } else if (words[i].startsWith("XPORT:")) { parseXport(words[i]); } else { throw new RrdException("Invalid XPORT syntax: " + words[i]); } } JRDataSource result = xports.size() == 0 ? null : xport(); println(xports.size() == 0 ? "No XPORT statement found, nothing done" : result.toString()); return result; }  }
RrdXportCmd extends RrdToolCmd implements RrdGraphConstants { JRDataSource execute() throws RrdException, IOException { String startStr = getOptionValue("s", "start", DEFAULT_START); String endStr = getOptionValue("e", "end", DEFAULT_END); long span[] = Util.getTimestamps(startStr, endStr); dproc = new DataProcessor(span[0], span[1]); xports = new ArrayList<XPort>(); long step = parseLong(getOptionValue(null, "step", "1")); int maxRows = parseInt(getOptionValue("m", "maxrows", "400")); long minStep = (long) Math.ceil((span[1] - span[0]) / (double) (maxRows - 1)); step = Math.max(step, minStep); dproc.setFetchRequestResolution(step); dproc.setStep(step); String[] words = getRemainingWords(); if (words.length < 1) { throw new RrdException("Incomplete XPORT command"); } for (int i = 0; i < words.length; i++) { if (words[i].startsWith("DEF:")) { parseDef(words[i]); } else if (words[i].startsWith("CDEF:")) { parseCDef(words[i]); } else if (words[i].startsWith("XPORT:")) { parseXport(words[i]); } else { throw new RrdException("Invalid XPORT syntax: " + words[i]); } } JRDataSource result = xports.size() == 0 ? null : xport(); println(xports.size() == 0 ? "No XPORT statement found, nothing done" : result.toString()); return result; }   }
RrdXportCmd extends RrdToolCmd implements RrdGraphConstants { JRDataSource execute() throws RrdException, IOException { String startStr = getOptionValue("s", "start", DEFAULT_START); String endStr = getOptionValue("e", "end", DEFAULT_END); long span[] = Util.getTimestamps(startStr, endStr); dproc = new DataProcessor(span[0], span[1]); xports = new ArrayList<XPort>(); long step = parseLong(getOptionValue(null, "step", "1")); int maxRows = parseInt(getOptionValue("m", "maxrows", "400")); long minStep = (long) Math.ceil((span[1] - span[0]) / (double) (maxRows - 1)); step = Math.max(step, minStep); dproc.setFetchRequestResolution(step); dproc.setStep(step); String[] words = getRemainingWords(); if (words.length < 1) { throw new RrdException("Incomplete XPORT command"); } for (int i = 0; i < words.length; i++) { if (words[i].startsWith("DEF:")) { parseDef(words[i]); } else if (words[i].startsWith("CDEF:")) { parseCDef(words[i]); } else if (words[i].startsWith("XPORT:")) { parseXport(words[i]); } else { throw new RrdException("Invalid XPORT syntax: " + words[i]); } } JRDataSource result = xports.size() == 0 ? null : xport(); println(xports.size() == 0 ? "No XPORT statement found, nothing done" : result.toString()); return result; }    }