perfsonar-dev - nmwg: r261 - in trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow: . v2_0
Subject: perfsonar development work
List archive
- From:
- To: ,
- Subject: nmwg: r261 - in trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow: . v2_0
- Date: Thu, 6 Sep 2007 10:30:51 -0400
Author: michael.bischoff
Date: 2007-09-06 10:30:50 -0400 (Thu, 06 Sep 2007)
New Revision: 261
Added:
trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v2_0/
Modified:
trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v2_0/Datum.java
trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v2_0/Parameters.java
trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v2_0/Subject.java
Log:
changed package name to confirm with spec.
fixed datum attributes getting lost.
couple of other fixes enountered while testing.
Copied: trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v2_0 (from rev 258,
trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v1_0)
Modified: trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v2_0/Datum.java
===================================================================
--- trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v1_0/Datum.java 2007-08-15
12:57:06 UTC (rev 258)
+++ trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v2_0/Datum.java 2007-09-06
14:30:50 UTC (rev 261)
@@ -1,6 +1,7 @@
-package org.ggf.ns.nmwg.tools.flow.v1_0;
+package org.ggf.ns.nmwg.tools.flow.v2_0;
import org.ggf.ns.nmwg.time.v2_0.Time;
+import org.xml.sax.ContentHandler;
import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.helpers.NamespaceSupport;
@@ -106,6 +107,18 @@
/** Bytes Bytes */
private String bytes;
+ public Datum() {
+ parent = null;
+ id = "";
+ completed = false;
+
+ localName = "datum";
+ uri = "http://ggf.org/ns/nmwg/tools/flow/2.0/";
+ qName = "flow:datum";
+ prefix = "flow";
+ fileName = "org/ggf/ns/nmwg/tools/flow/v2_0/Datum.java";
+ }
+
/**
* Converts items into attributes for an xml tag.
*/
@@ -295,8 +308,7 @@
return true;
} else {
return super.addAttr(attr, value, nss);
- }
-
+ }
}
protected boolean addTopAttribute(String attr, String value) {
@@ -326,7 +338,7 @@
return true;
}
- private boolean addStatAttribute(String attr, String value) {
+ protected boolean addStatAttribute(String attr, String value) {
if(attr.equalsIgnoreCase("flows")) {
flows = value;
} else if(attr.equalsIgnoreCase("flowsTcp")) {
@@ -415,6 +427,189 @@
}
return true;
}
+
+ /**
+ * Converts the contents of this object into an xml tag.
+ */
+ public ContentHandler toXML(ContentHandler handler, NamespaceSupport
nss) throws Exception {
+ try {
+ handler.startElement(getUri(), getLocalName(),
getQName(), getAttributes(nss));
+ handler = getChildren(handler, nss);
+ handler.endElement(getUri(), getLocalName(),
getQName());
+
+ if(getCompleted()) {
+ nss.popContext();
+ unSetCompleted();
+ }
+ }
+ catch(Exception e) {
+ System.err.println("Error: " + getFileName() + "
toXML(ContentHandler, NamespaceSupport) XML formulation error.");
+ }
+ return handler;
+ }
+
+ /**
+ * Given a DOM element (a parent), construct
+ * the children elements.
+ */
+ public void getDOM(org.w3c.dom.Element parent) {
+ org.w3c.dom.Document doc = parent.getOwnerDocument();
+ org.w3c.dom.Element datum = doc.createElementNS(getUri(),
getQName());
+ parent.appendChild(datum);
+ if(!(getValue().equals(""))) {
+ datum.setAttribute("value", getValue());
+ }
+ if(!(getValueUnits().equals(""))) {
+ datum.setAttribute("valueUnits", getValueUnits());
+ }
+ if(!(getTimeType().equals(""))) {
+ datum.setAttribute("timeType", getTimeType());
+ }
+ if(!(getTimeValue().equals(""))) {
+ datum.setAttribute("timeValue", getTimeValue());
+ }
+ if(!(getNumBytes().equals(""))) {
+ datum.setAttribute("numBytes", getNumBytes());
+ }
+ if(!(getNumBytesUnits().equals(""))) {
+ datum.setAttribute("numBytesUnits",
getNumBytesUnits());
+ }
+ if(!getDateFirstSeen().equals("")) {
+ datum.setAttribute("dateFirstSeen",
getDateFirstSeen());
+ }
+ if(!getDuration().equals("")) {
+ datum.setAttribute("duration", getDuration());
+ }
+ if(!getProto().equals("")) {
+ datum.setAttribute("proto",getProto());
+ }
+ if(!getTopStatistic().equals("")) {
+ datum.setAttribute("topStatistic",getTopStatistic());
+ }
+ if(!getFlows().equals("")) {
+ datum.setAttribute("flows",getFlows());
+ }
+ if(!getPackets().equals("")) {
+ datum.setAttribute("packets",getPackets());
+ }
+ if(!getBytes().equals("")) {
+ datum.setAttribute("bytes",getBytes());
+ }
+ if(!getPps().equals("")) {
+ datum.setAttribute("pps",getPps());
+ }
+ if(!getBps().equals("")) {
+ datum.setAttribute("bps",getBps());
+ }
+ if(!getBpp().equals("")) {
+ datum.setAttribute("bpp",getBpp());
+ }
+ if(!getFlows().equals("")) {
+ datum.setAttribute("flows",getFlows());
+ }
+ if(!getFlowsTcp().equals("")) {
+ datum.setAttribute("flowsTcp",getFlowsTcp());
+ }
+ if(!getFlowsUdp().equals("")) {
+ datum.setAttribute("flowsUdp",getFlowsUdp());
+ }
+ if(!getFlowsIcmp().equals("")) {
+ datum.setAttribute("flowsIcmp",getFlowsIcmp());
+ }
+ if(!getFlowsOther().equals("")) {
+ datum.setAttribute("flowsOther",getFlowsOther());
+ }
+ if(!getPacketsTcp().equals("")) {
+ datum.setAttribute("packetsTcp",getPacketsTcp());
+ }
+ if(!getPacketsUdp().equals("")) {
+ datum.setAttribute("packetsUdp",getPacketsUdp());
+ }
+ if(!getPacketsIcmp().equals("")) {
+ datum.setAttribute("packetsIcmp",getPacketsIcmp());
+ }
+ if(!getPacketsOther().equals("")) {
+ datum.setAttribute("packetsOther",getPacketsOther());
+ }
+ if(!getBytesTcp().equals("")) {
+ datum.setAttribute("bytesTcp",getBytesTcp());
+ }
+ if(!getBytesUdp().equals("")) {
+ datum.setAttribute("bytesUdp",getBytesUdp());
+ }
+ if(!getBytesIcmp().equals("")) {
+ datum.setAttribute("bytesIcmp",getBytesIcmp());
+ }
+ if(!getBytesOther().equals("")) {
+ datum.setAttribute("bytesOther",getBytesOther());
+ }
+ if(!getFirst().equals("")) {
+ datum.setAttribute("first",getFirst());
+ }
+ if(!getLast().equals("")) {
+ datum.setAttribute("last",getLast());
+ }
+ if(!getMsecFirst().equals("")) {
+ datum.setAttribute("msecFirst",getMsecFirst());
+ }
+ if(!getMsecLast().equals("")) {
+ datum.setAttribute("msecLast",getMsecLast());
+ }
+ if(!getSequenceFailures().equals("")) {
+
datum.setAttribute("sequenceFailures",getSequenceFailures());
+ }
+ if(!getAdressFamily().equals("")) {
+ datum.setAttribute("adressFamily",getAdressFamily());
+ }
+ if(!getTimeFirstSeen().equals("")) {
+
datum.setAttribute("timeFirstSeen",getTimeFirstSeen());
+ }
+ if(!getMsecFirstSeen().equals("")) {
+
datum.setAttribute("msecFirstSeen",getMsecFirstSeen());
+ }
+ if(!getTimeLastSeen().equals("")) {
+ datum.setAttribute("timeLastSeen",getTimeLastSeen());
+ }
+ if(!getMsecLastSeen().equals("")) {
+ datum.setAttribute("msecLastSeen",getMsecLastSeen());
+ }
+ if(!getProtocol().equals("")) {
+ datum.setAttribute("protocol",getProtocol());
+ }
+ if(!getSourceAddress().equals("")) {
+
datum.setAttribute("sourceAddress",getSourceAddress());
+ }
+ if(!getSourcePort().equals("")) {
+ datum.setAttribute("sourcePort",getSourcePort());
+ }
+ if(!getDestinationAdress().equals("")) {
+
datum.setAttribute("destinationAdress",getDestinationAdress());
+ }
+ if(!getDestinationPort().equals("")) {
+
datum.setAttribute("destinationPort",getDestinationPort());
+ }
+ if(!getSourceAsNumber().equals("")) {
+
datum.setAttribute("sourceAsNumber",getSourceAsNumber());
+ }
+ if(!getDestinationAsNumber().equals("")) {
+
datum.setAttribute("destinationAsNumber",getDestinationAsNumber());
+ }
+ if(!getInputInterface().equals("")) {
+
datum.setAttribute("inputInterface",getInputInterface());
+ }
+ if(!getOutputInterface().equals("")) {
+
datum.setAttribute("outputInterface",getOutputInterface());
+ }
+ if(!getTcpFlag().equals("")) {
+ datum.setAttribute("tcpFlag",getTcpFlag());
+ }
+ if(!getTypeOfService().equals("")) {
+
datum.setAttribute("typeOfService",getTypeOfService());
+ }
+ if(getTime() != null) {
+ getTime().getDOM(datum);
+ }
+ }
public String getAdressFamily() {
return adressFamily;
Modified: trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v2_0/Parameters.java
===================================================================
--- trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v1_0/Parameters.java
2007-08-15 12:57:06 UTC (rev 258)
+++ trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v2_0/Parameters.java
2007-09-06 14:30:50 UTC (rev 261)
@@ -1,4 +1,4 @@
-package org.ggf.ns.nmwg.tools.flow.v1_0;
+package org.ggf.ns.nmwg.tools.flow.v2_0;
import org.ggf.ns.nmwg.base.v2_0.Parameter;
@@ -52,10 +52,10 @@
completed = false;
localName = "parameters";
- uri = "http://ggf.org/ns/nmwg/tools/flow/1.0/";
+ uri = "http://ggf.org/ns/nmwg/tools/flow/2.0/";
qName = "flow:parameters";
prefix = "flow";
- fileName = "org/ggf/ns/nmwg/tools/flow/v1_0/Parameters.java";
+ fileName = "org/ggf/ns/nmwg/tools/flow/v2_0/Parameters.java";
}
/* (non-Javadoc)
@@ -63,7 +63,7 @@
*/
public Parameter getParameterByName(String name) {
if (isAllowed(name)) {
- System.err.println("Error: "+ getFileName()+ "
'getParameterByName(String)' requested Parameter's name can't exist here.");
+ System.err.println("Error: "+ getFileName()+ "
'getParameterByName(String)' requested Parameter's name("+name+") can't exist
here.");
return null;
}
return (Parameter) parameterMap.get(name);
@@ -93,16 +93,16 @@
public void addParameter(Parameter newParameter) {
if (newParameter == null) {
System.err.println("Error: " + getFileName() + "
'addParameter(Paramter)' Parameter can't be null.");
- return; // todo IllegalArgumentExeception ?
+ return; // TODO IllegalArgumentExeception ?
}
- if (isAllowed(newParameter.getParameterName())) {
- System.err.println("Error: " + getFileName() + "
'addParameter(Parameter)' Parameter is not allowed here.");
+ if (!isAllowed(newParameter.getParameterName())) {
+ System.err.println("Error: " + getFileName() + "
'addParameter(Parameter)' Parameter("+newParameter.getParameterName()+") is
not allowed here.");
return;
}
// name is a unique key
- if (getParameterByName(newParameter.getParameterName()) !=
null) {
+ if (parameterMap.get(newParameter.getParameterName()) !=
null) {
System.err.println("Error: " + getFileName() + "
'setParameter(Parameter)' Duplicate parameter name: " +
newParameter.getParameterName()
+ " for id: " + newParameter.getId());
return;
}
@@ -125,5 +125,4 @@
addParameter(p);
}
-
}
Modified: trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v2_0/Subject.java
===================================================================
--- trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v1_0/Subject.java
2007-08-15 12:57:06 UTC (rev 258)
+++ trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow/v2_0/Subject.java
2007-09-06 14:30:50 UTC (rev 261)
@@ -1,7 +1,7 @@
-package org.ggf.ns.nmwg.tools.flow.v1_0;
+package org.ggf.ns.nmwg.tools.flow.v2_0;
import org.ggf.ns.nmwg.base.v2_0.Element;
-import org.ggf.ns.nmwg.topology.base.v3_0.Node;
+import org.ggf.ns.nmwg.topology.base.v3_0.Network;
import org.xml.sax.ContentHandler;
import org.xml.sax.helpers.NamespaceSupport;
@@ -13,7 +13,7 @@
*/
public class Subject extends org.ggf.ns.nmwg.base.v2_0.Subject {
- private Node node;
+ private Network network;
/**
* no arg constuctor
@@ -24,10 +24,10 @@
completed = false;
localName = "subject";
- uri = "http://ggf.org/ns/nmwg/tools/flow/1.0/";
+ uri = "http://ggf.org/ns/nmwg/tools/flow/2.0/";
qName = "flow:subject";
prefix = "flow";
- fileName = "org/ggf/ns/nmwg/tools/flow/v1_0/Parameters.java";
+ fileName = "org/ggf/ns/nmwg/tools/flow/v2_0/Subject.java";
}
/*
@@ -37,15 +37,13 @@
*/
@Override
public boolean addChild(Element newChild) {
- // we expect one child so fail if node is already set.
- // we expect that child to be a Node
- if (node != null && !(newChild instanceof Node)) {
- System.err.println("Error: " + getFileName()
- + " addChild(Element) unrecognized
child: " + newChild);
- return false;
+ // one node.
+ if (network == null && (newChild instanceof Network)) {
+ network = (Network) newChild;
+ return true;
}
- node = (Node) newChild;
- return true;
+ System.err.println("Error: " + getFileName() + "
addChild(Element) unrecognized child: " + newChild);
+ return false;
}
/*
@@ -85,8 +83,8 @@
*/
public ContentHandler getChildren(ContentHandler handler,
NamespaceSupport nss) throws Exception {
- if (getNode() != null) {
- handler = getNode().toXML(handler, nss);
+ if (getNetwork() != null) {
+ handler = getNetwork().toXML(handler, nss);
}
return handler;
}
@@ -107,13 +105,13 @@
subject.setAttribute("metadataIdRef",
getMetadataIdRef());
}
- if (getNode() != null) {
- getNode().getDOM(subject);
+ if (getNetwork() != null) {
+ getNetwork().getDOM(subject);
}
}
- public Node getNode() {
- return node;
+ public Network getNetwork() {
+ return network;
}
}
- nmwg: r261 - in trunk/nmwg/java/org/ggf/ns/nmwg/tools/flow: . v2_0, svnlog, 09/06/2007
Archive powered by MHonArc 2.6.16.