use of org.jrobin.core.RrdException in project i2p.i2p by i2p.
the class RrdGraphDefTemplate method resolveLine.
private void resolveLine(Node parentNode) throws RrdException {
validateTagsOnlyOnce(parentNode, new String[] { "datasource", "color", "legend", "width" });
String datasource = null, legend = null;
Paint color = null;
float width = 1.0F;
Node[] childNodes = getChildNodes(parentNode);
for (Node childNode : childNodes) {
String nodeName = childNode.getNodeName();
if (nodeName.equals("datasource")) {
datasource = getValue(childNode);
} else if (nodeName.equals("color")) {
color = getValueAsColor(childNode);
} else if (nodeName.equals("legend")) {
legend = getValue(childNode);
} else if (nodeName.equals("width")) {
width = (float) getValueAsDouble(childNode);
}
}
if (datasource != null) {
if (color != null) {
rrdGraphDef.line(datasource, color, legend, width);
} else {
rrdGraphDef.line(datasource, BLIND_COLOR, legend, width);
}
} else {
throw new RrdException("Incomplete LINE settings");
}
}
use of org.jrobin.core.RrdException in project i2p.i2p by i2p.
the class RrdGraphDefTemplate method resolvePrint.
private void resolvePrint(Node parentNode, boolean isInGraph) throws RrdException {
validateTagsOnlyOnce(parentNode, new String[] { "datasource", "cf", "format" });
String datasource = null, cf = null, format = null;
Node[] childNodes = getChildNodes(parentNode);
for (Node childNode : childNodes) {
String nodeName = childNode.getNodeName();
if (nodeName.equals("datasource")) {
datasource = getValue(childNode);
} else if (nodeName.equals("cf")) {
cf = getValue(childNode);
} else if (nodeName.equals("format")) {
format = getValue(childNode);
}
}
if (datasource != null && cf != null && format != null) {
if (isInGraph) {
rrdGraphDef.gprint(datasource, cf, format);
} else {
rrdGraphDef.print(datasource, cf, format);
}
} else {
throw new RrdException("Incomplete " + (isInGraph ? "GRPINT" : "PRINT") + " settings");
}
}
use of org.jrobin.core.RrdException in project i2p.i2p by i2p.
the class RrdGraphDefTemplate method resolveSDef.
private void resolveSDef(Node parentNode) throws RrdException {
validateTagsOnlyOnce(parentNode, new String[] { "name", "source", "cf" });
String name = null, source = null, cf = null;
Node[] childNodes = getChildNodes(parentNode);
for (Node childNode : childNodes) {
String nodeName = childNode.getNodeName();
if (nodeName.equals("name")) {
name = getValue(childNode);
} else if (nodeName.equals("source")) {
source = getValue(childNode);
} else if (nodeName.equals("cf")) {
cf = getValue(childNode);
}
}
if (name != null && source != null && cf != null) {
rrdGraphDef.datasource(name, source, cf);
} else {
throw new RrdException("Incomplete SDEF settings");
}
}
use of org.jrobin.core.RrdException in project i2p.i2p by i2p.
the class RrdGraphDefTemplate method resolveDef.
private void resolveDef(Node parentNode) throws RrdException {
validateTagsOnlyOnce(parentNode, new String[] { "name", "rrd", "source", "cf", "backend" });
String name = null, rrd = null, source = null, cf = null, backend = null;
Node[] childNodes = getChildNodes(parentNode);
for (Node childNode : childNodes) {
String nodeName = childNode.getNodeName();
if (nodeName.equals("name")) {
name = getValue(childNode);
} else if (nodeName.equals("rrd")) {
rrd = getValue(childNode);
} else if (nodeName.equals("source")) {
source = getValue(childNode);
} else if (nodeName.equals("cf")) {
cf = getValue(childNode);
} else if (nodeName.equals("backend")) {
backend = getValue(childNode);
}
}
if (name != null && rrd != null && source != null && cf != null) {
rrdGraphDef.datasource(name, rrd, source, cf, backend);
} else {
throw new RrdException("Incomplete DEF settings");
}
}
use of org.jrobin.core.RrdException in project i2p.i2p by i2p.
the class RrdGraphDefTemplate method resolveStack.
private void resolveStack(Node parentNode) throws RrdException {
validateTagsOnlyOnce(parentNode, new String[] { "datasource", "color", "legend" });
String datasource = null, legend = null;
Paint color = null;
Node[] childNodes = getChildNodes(parentNode);
for (Node childNode : childNodes) {
String nodeName = childNode.getNodeName();
if (nodeName.equals("datasource")) {
datasource = getValue(childNode);
} else if (nodeName.equals("color")) {
color = getValueAsColor(childNode);
} else if (nodeName.equals("legend")) {
legend = getValue(childNode);
}
}
if (datasource != null) {
if (color != null) {
rrdGraphDef.stack(datasource, color, legend);
} else {
rrdGraphDef.stack(datasource, BLIND_COLOR, legend);
}
} else {
throw new RrdException("Incomplete STACK settings");
}
}
Aggregations