Package org.jrobin.core

Examples of org.jrobin.core.RrdException


    if (tokens.length == 2 || tokens.length == 3) {
      XPort xport = new XPort(tokens[1], tokens.length == 3 ? tokens[2] : null);
      xports.add(xport);
    }
    else {
      throw new RrdException("Invalid XPORT syntax: " + word);
    }
  }
View Full Code Here


  }

  Object execute() throws RrdException, IOException {
    String[] words = getRemainingWords();
    if (words.length != 2) {
      throw new RrdException("Invalid rrdinfo syntax");
    }
    String path = words[1], info;
    RrdDb rrd = getRrdDbReference(path);
    try {
      info = getInfo(rrd);
View Full Code Here

  }

  Object execute() throws RrdException, IOException {
    String[] words = getRemainingWords();
    if (words.length != 2) {
      throw new RrdException("Invalid rrddump syntax");
    }
    String path = words[1];
    RrdDb rrdDb = getRrdDbReference(path);
    try {
      String xml = rrdDb.getXml();
View Full Code Here

  static long parseLong(String value) throws RrdException {
    try {
      return Long.parseLong(value);
    }
    catch (NumberFormatException nfe) {
      throw new RrdException(nfe);
    }
  }
View Full Code Here

  static int parseInt(String value) throws RrdException {
    try {
      return Integer.parseInt(value);
    }
    catch (NumberFormatException nfe) {
      throw new RrdException(nfe);
    }
  }
View Full Code Here

    }
    try {
      return Double.parseDouble(value);
    }
    catch (NumberFormatException nfe) {
      throw new RrdException(nfe);
    }
  }
View Full Code Here

    // NON-OPTIONS

    String[] words = getRemainingWords();
    // the first word must be a filename
    if (words.length < 2) {
      throw new RrdException("Image filename must be specified");
    }
    gdef.setFilename(words[1]);
    // parse remaining words, in no particular order
    for (int i = 2; i < words.length; i++) {
      if (words[i].startsWith("DEF:")) {
        parseDef(gdef, words[i]);
      }
      else if (words[i].startsWith("CDEF:")) {
        parseCDef(gdef, words[i]);
      }
      else if (words[i].startsWith("PRINT:")) {
        parsePrint(gdef, words[i]);
      }
      else if (words[i].startsWith("GPRINT:")) {
        parseGPrint(gdef, words[i]);
      }
      else if (words[i].startsWith("COMMENT:")) {
        parseComment(gdef, words[i]);
      }
      else if (words[i].startsWith("HRULE:")) {
        parseHRule(gdef, words[i]);
      }
      else if (words[i].startsWith("VRULE:")) {
        parseVRule(gdef, words[i]);
      }
      else if (words[i].startsWith("LINE1:") || words[i].startsWith("LINE2:") || words[i].startsWith("LINE3:")) {
        parseLine(gdef, words[i]);
      }
      else if (words[i].startsWith("AREA:")) {
        parseArea(gdef, words[i]);
      }
      else if (words[i].startsWith("STACK:")) {
        parseStack(gdef, words[i]);
      }
      else {
        throw new RrdException("Unexpected GRAPH token encountered: " + words[i]);
      }
    }
   
    return gdef;
    }
View Full Code Here

    }

  private void parseLine(RrdGraphDef graphDef, String word) throws RrdException {
    String[] tokens1 = new ColonSplitter(word).split();
    if (tokens1.length != 2 && tokens1.length != 3) {
      throw new RrdException("Invalid LINE statement: " + word);
    }
    String[] tokens2 = tokens1[1].split("#");
    if (tokens2.length != 1 && tokens2.length != 2) {
      throw new RrdException("Invalid LINE statement: " + word);
    }
    float width = Integer.parseInt(tokens1[0].substring(tokens1[0].length() - 1));
    String name = tokens2[0];
    Paint color = tokens2.length == 2 ? Util.parseColor(tokens2[1]) : BLIND_COLOR;
    String legend = tokens1.length == 3 ? tokens1[2] : null;
View Full Code Here

  }

  private void parseArea(RrdGraphDef graphDef, String word) throws RrdException {
    String[] tokens1 = new ColonSplitter(word).split();
    if (tokens1.length != 2 && tokens1.length != 3) {
      throw new RrdException("Invalid AREA statement: " + word);
    }
    String[] tokens2 = tokens1[1].split("#");
    if (tokens2.length != 1 && tokens2.length != 2) {
      throw new RrdException("Invalid AREA statement: " + word);
    }
    String name = tokens2[0];
    Paint color = tokens2.length == 2 ? Util.parseColor(tokens2[1]) : BLIND_COLOR;
    String legend = tokens1.length == 3 ? tokens1[2] : null;
    graphDef.area(name, color, legend);
View Full Code Here

  }

  private void parseStack(RrdGraphDef graphDef, String word) throws RrdException {
    String[] tokens1 = new ColonSplitter(word).split();
    if (tokens1.length != 2 && tokens1.length != 3) {
      throw new RrdException("Invalid STACK statement: " + word);
    }
    String[] tokens2 = tokens1[1].split("#");
    if (tokens2.length != 1 && tokens2.length != 2) {
      throw new RrdException("Invalid STACK statement: " + word);
    }
    String name = tokens2[0];
    Paint color = tokens2.length == 2 ? Util.parseColor(tokens2[1]) : BLIND_COLOR;
    String legend = tokens1.length == 3 ? tokens1[2] : null;
    graphDef.stack(name, color, legend);
View Full Code Here

TOP

Related Classes of org.jrobin.core.RrdException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.