Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r2672 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . ippm ls ma

Subject: perfsonar development work

List archive

perfsonar: r2672 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . ippm ls ma


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r2672 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . ippm ls ma
  • Date: Sun, 19 Aug 2007 13:04:42 -0400

Author: nina
Date: 2007-08-19 13:04:42 -0400 (Sun, 19 Aug 2007)
New Revision: 2672

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/EchoMARequest.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/MetadataListResponseListener.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/NMWGHelper.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/IPPMRequest.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSResponseListener.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequestPerfsonar2_0.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest_Errors.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest_NMWG2.java
Log:
NMWGHelper class updated to support chaining. Override
process(Element data, ArrayList<Element> metadataChain) to process data
entry and corresponding metadata items. This method is invoked for every data
item in the document.

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/EchoMARequest.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/EchoMARequest.java
2007-08-16 15:06:12 UTC (rev 2671)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/EchoMARequest.java
2007-08-19 17:04:42 UTC (rev 2672)
@@ -20,6 +20,9 @@
package org.perfsonar.perfsonarui;


+import java.util.ArrayList;
+import java.util.Iterator;
+
import org.jdom.Element;
import org.jdom.Namespace;
import org.perfsonar.perfsonarui.plugins.IPerfsonarResponse;
@@ -139,21 +142,22 @@
final IPerfsonarResponse listener) throws Exception {
if (isInterrupted()) return;
NMWGHelper helper = new NMWGHelper() {
- /* (non-Javadoc)
- * @see
org.perfsonar.perfsonarui.NMWGHelper#process(org.w3c.dom.Node,
java.lang.String, org.w3c.dom.Node, java.lang.String)
- */
+
@Override
- public void process(Node data, String dataID, Node
metadata,
- String metaDataID) {
- if (metadata instanceof org.w3c.dom.Element) {
- String result =
getText((org.w3c.dom.Element)metadata);
- if (result != null)
- ((EchoResponse) listener).setStatus(result);
- } if (data instanceof org.w3c.dom.Element) {
- String result = getText((org.w3c.dom.Element)data);
- if (result != null)
- ((EchoResponse)
listener).setStatusExplanation(result);
- }
+ public void process(org.w3c.dom.Element data,
ArrayList<org.w3c.dom.Element> metadataChain) throws Exception {
+ Iterator<org.w3c.dom.Element> i = metadataChain.iterator();
+ while (i.hasNext()) {
+ org.w3c.dom.Element metadata = i.next();
+ String result = getText((org.w3c.dom.Element)metadata);
+ if (result != null)
+ ((EchoResponse) listener).setStatus(result);
+ }
+
+ if (data instanceof org.w3c.dom.Element) {
+ String result = getText((org.w3c.dom.Element)data);
+ if (result != null)
+ ((EchoResponse)
listener).setStatusExplanation(result);
+ }
}
};
try {

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/MetadataListResponseListener.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/MetadataListResponseListener.java
2007-08-16 15:06:12 UTC (rev 2671)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/MetadataListResponseListener.java
2007-08-19 17:04:42 UTC (rev 2672)
@@ -29,7 +29,7 @@
* An
{@link
AbstractPerfsonarResponse} descendant to receive and process the response of
* metadata request
{@link
IPerfsonarRequest#MA_MetadataRetrieveRequest}.
* Adds an
{@link
IUserData} instance to the
{@link
MetaDataList}.
- * <br>See example at
{@link
NMWGHelper#process(org.w3c.dom.Node, String, org.w3c.dom.Node, String)}.
+ * <br>See example at
{@link
NMWGHelper#process(org.w3c.dom.Node, String, org.w3c.dom.Node, String,
IUserData)}.
* @author Nina Jeliazkova

*
*/

Modified: branches/perfsonarui/src/org/perfsonar/perfsonarui/NMWGHelper.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/NMWGHelper.java
2007-08-16 15:06:12 UTC (rev 2671)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/NMWGHelper.java
2007-08-19 17:04:42 UTC (rev 2672)
@@ -20,20 +20,24 @@

package org.perfsonar.perfsonarui;

+import java.util.ArrayList;
+
+import org.perfsonar.perfsonarui.plugins.IUserData;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
import org.w3c.dom.traversal.DocumentTraversal;
import org.w3c.dom.traversal.NodeFilter;
-import org.w3c.dom.traversal.TreeWalker;
+import org.w3c.dom.traversal.NodeIterator;

/**
* This is a helper class to extract metadata and corresponding data
elements from
{@link
org.w3c.dom.Document}.
- * Process the document and calls
{@link
#process(Node, String, Node, String)} at each metadata, thus making
metadata/data pair easily available.
+ * Process the document and calls
{@link
#public abstract void process(Element data, ArrayList<Element>
metadataChain)} for each data item, where metadataChain contains all chained
metadata entries for this data.
<pre>
NMWGHelper helper = new NMWGHelper() {
- public void process(Node data, String dataID, Node metadata,
- String metaDataID) {
+ public void process(Element data, ArrayList<Element>
metadataChain) {
+
//do metadata/data processing
}
};
@@ -43,47 +47,83 @@
*
*/
public abstract class NMWGHelper {
-
+ protected String namespace_select;
+ protected String namespace_nmwg;
+ protected String metadataIdRef="metadataIdRef";
+ protected String id="id";
+ public NMWGHelper() {
+ setNamespace_select("http://ggf.org/ns/nmwg/ops/select/2.0/";);
+ setNamespace_nmwg("http://ggf.org/ns/nmwg/base/2.0/";);
+ }
+ public NMWGHelper(String namespace_select) {
+ setNamespace_select(namespace_select);
+ }
+ public synchronized String getNamespace_select() {
+ return namespace_select;
+ }
+
+ public synchronized void setNamespace_select(String namespace_select) {
+ this.namespace_select = namespace_select;
+ }
+
/**
- * Processes the document and calls
{@link
#process(Node, String, Node, String)} for each metadata-data pair.
+ * Processes the document and calls
{@link
#process(Node, String, Node, String, IUserData)} for each metadata-data pair.
* @param doc
{@link
Document}
* @throws Exception
*/
- public void process(Document doc) throws Exception{
- TreeWalker walker =
-
((DocumentTraversal)doc).createTreeWalker(doc.getDocumentElement(),
- NodeFilter.SHOW_ELEMENT, new
MetadataFilter(),true);
+ public void process(Document doc) throws Exception {
+ NodeList data =
doc.getElementsByTagNameNS(getNamespace_nmwg(), "data");
+ for (int i=0; i < data.getLength(); i++)
+ if (data.item(i) instanceof Element) {
+
+ Element data_element = (Element) data.item(i);

-// The TreeWalker starts out positioned at the root
- Node metadata = walker.firstChild();
- while (metadata != null) {
- traverseData(doc, metadata);
- metadata = walker.nextSibling();
- }
+ NodeIterator iterator = ((DocumentTraversal)
doc).createNodeIterator(
+ doc.getDocumentElement(),
+ NodeFilter.SHOW_ELEMENT,
+ new
MetadataFilter(data_element.getAttribute(metadataIdRef)),
+ true);
+ Node metadata;
+ ArrayList<Element> metadataChain = new ArrayList<Element>();
+ while ((metadata = iterator.nextNode()) != null) {
+ processChain(doc,(Element)metadata,metadataChain);
+ }
+ //System.out.println("Processing data
\t"+data_element.getAttribute(getId()));
+ process(data_element,metadataChain);

+ }
+
}
-
- public void traverseData(Document doc, Node metadata) throws
Exception {
- String metadataIDRef = ((Element) metadata).getAttribute("id");
- TreeWalker walker =
-
((DocumentTraversal)doc).createTreeWalker(doc.getDocumentElement(),
- NodeFilter.SHOW_ELEMENT, new
DataFilter(metadataIDRef),true);
+ public abstract void process(Element data, ArrayList<Element>
metadataChain) throws Exception;
+
+ public void processChain(Document doc, Element metadata,
ArrayList<Element> metadataChain) throws Exception {
+ //Logger.debug("Processing chain\t"+'\t' +
metadata.getAttribute("id"));
+ metadataChain.add(metadata);
+ NodeList select = metadata.getElementsByTagNameNS(namespace_select,
"subject");
+ if (select.getLength() ==0) return; //no chaining

- Node data = walker.firstChild();
- while (data != null) {
- String dataID = ((Element) data).getAttribute("id");
- String metaDataID = ((Element)
data).getAttribute("metadataIdRef");
- process(data, dataID, metadata, metaDataID);
- data = walker.nextSibling();
- }
-
- }
+ for (int i=0; i < select.getLength(); i++)
+ if (select.item(i) instanceof Element) {
+ String metadataIDRef = ((Element)
select.item(i)).getAttribute(metadataIdRef);
+ NodeIterator iterator = ((DocumentTraversal)
doc).createNodeIterator(
+ doc.getDocumentElement(),
+ NodeFilter.SHOW_ELEMENT,
+ new MetadataFilter(metadataIDRef),
+ true);
+ Node chainedMetadata;
+ while ((chainedMetadata = iterator.nextNode()) != null) {
+
processChain(doc,((Element)chainedMetadata),metadataChain);
+ }
+ }
+ }
/**
* Override this method to process metadata and data element
* @param data
{@link
org.w3c.dom.Node} Data element from NMWG schema, corresponding to metadata
element below
* @param dataID Data element identifier
* @param metadata
{@link
org.w3c.dom.Node} Metadata element
* @param metaDataID Metadata element identifier
+ * @param userData TODO
+ * @return TODO
* @throws Exception
* <br>Example:
* <pre>
@@ -104,37 +144,40 @@
};
* </pre>
*/
- public abstract void process(Node data, String dataID, Node metadata,
String metaDataID) throws Exception;
+
+ public synchronized String getNamespace_nmwg() {
+ return namespace_nmwg;
+ }
+ public synchronized void setNamespace_nmwg(String namespace_nmwg) {
+ this.namespace_nmwg = namespace_nmwg;
+ }
+ public synchronized String getId() {
+ return id;
+ }
+ public synchronized void setId(String id) {
+ this.id = id;
+ }
+ public synchronized String getMetadataIdRef() {
+ return metadataIdRef;
+ }
+ public synchronized void setMetadataIdRef(String metadataIdRef) {
+ this.metadataIdRef = metadataIdRef;
+ }
+
}
class MetadataFilter implements NodeFilter {
-
+ protected String id = "";
+
+ public MetadataFilter(String id) {
+ this.id = id;
+ }
public short acceptNode(Node node) {
-
- Element candidate = (Element) node;
- String name = candidate.getLocalName();
- if (name.equals("metadata")) return FILTER_ACCEPT;
+ if (node instanceof Element) {
+ Element candidate = (Element) node;
+ String name = candidate.getLocalName();
+ if (name.equals("metadata")
+ && candidate.getAttribute("id").equals(id)) return
FILTER_ACCEPT;
+ }
return FILTER_SKIP;
-
}
}
-
-class DataFilter implements NodeFilter {
- final String m = "metadataIdRef";
- String metadataIDRef = "";
- public DataFilter(String metadataIDRef) {
- super();
- this.metadataIDRef = metadataIDRef;
- }
- public short acceptNode(Node node) {
-
- Element candidate = (Element) node;
- String name = candidate.getLocalName();
- if (name.equals("data")
- && candidate.hasAttribute(m)
- && candidate.getAttribute(m).equals(metadataIDRef)
- ) return FILTER_ACCEPT;
-
- return FILTER_SKIP;
-
- }
-}

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/IPPMRequest.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/IPPMRequest.java
2007-08-16 15:06:12 UTC (rev 2671)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/ippm/IPPMRequest.java
2007-08-19 17:04:42 UTC (rev 2672)
@@ -21,6 +21,7 @@

import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;

import javax.swing.JOptionPane;
import javax.xml.parsers.DocumentBuilder;
@@ -252,11 +253,8 @@

public void processMetadataKeyRequest(Document dataSetupResp, final
MetadataListResponseListener responseListener, final IUserData queryData){
NMWGHelper helper = new NMWGHelper() {
- @Override
- public void traverseData(Document doc, Node metadata) throws
Exception {
- org.w3c.dom.Element element = (org.w3c.dom.Element)
metadata;

-
+ public void traverseMetaData(Document doc,
org.w3c.dom.Element element) throws Exception {
NodeList params =
element.getElementsByTagNameNS(URI_nmwg[version][1], "parameter");
if (params.getLength() > 0) {
IUserData userData = new IPPMUserData();
@@ -270,22 +268,27 @@
}
if
(!userData.getResponse(IPPMUserData.IFNAME_SRC).trim().equals(AbstractUserData.NULL_DATA))

responseListener.addUserData(userData);
- else
- super.traverseData(doc, metadata);
- } else super.traverseData(doc, metadata);
+
+ }
}

- /* (non-Javadoc)
- * @see
org.perfsonar.perfsonarui.NMWGHelper#process(org.w3c.dom.Node,
java.lang.String, org.w3c.dom.Node, java.lang.String)
- */
+ public void process(Document doc) throws Exception {
+ NodeList data =
doc.getElementsByTagNameNS(getNamespace_nmwg(), "metadata");
+ for (int i=0; i < data.getLength(); i++)
+ if (data.item(i) instanceof org.w3c.dom.Element) {
+ traverseMetaData(doc,
((org.w3c.dom.Element)data.item(i)));
+ }
+ super.process(doc);
+ }
@Override
- public void process(Node data, String dataID, Node
metadata,
- String metaDataID) {
- String status = processNode(metadata);
- if (status.equals("error.ma.data")) {
- String response = processNode(data) + "\nPossible
cause: No measurements for the selected date. \nTry to select different
date.";
- JOptionPane.showMessageDialog(null,
response,status,JOptionPane.ERROR_MESSAGE);
- }
+ public void process(org.w3c.dom.Element data,
ArrayList<org.w3c.dom.Element> metadataChain) throws Exception {
+ for (int i=0; i < metadataChain.size();i++) {
+ String status = processNode(metadataChain.get(i));
+ if (status.equals("error.ma.data")) {
+ String response = processNode(data) + "\nPossible
cause: No measurements for the selected date. \nTry to select different
date.";
+ JOptionPane.showMessageDialog(null,
response,status,JOptionPane.ERROR_MESSAGE);
+ }
+ }
}
};
try {

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSResponseListener.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSResponseListener.java
2007-08-16 15:06:12 UTC (rev 2671)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSResponseListener.java
2007-08-19 17:04:42 UTC (rev 2672)
@@ -50,12 +50,9 @@
@Override
public void process(IPerfsonarRequest request, IUserData uData,
Document response) throws Exception {
NMWGHelper helper = new NMWGHelper() {
- /* (non-Javadoc)
- * @see
org.perfsonar.perfsonarui.NMWGHelper#process(org.w3c.dom.Node,
java.lang.String, org.w3c.dom.Node, java.lang.String)
- */
@Override
- public void process(Node data, String dataID, Node
metadata,
- String metaDataID) {
+ public void process(Element data, java.util.ArrayList<Element>
metadataChain) throws Exception {
+
if (data instanceof org.w3c.dom.Element) {

System.out.println(data.getNodeName());

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequestPerfsonar2_0.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequestPerfsonar2_0.java
2007-08-16 15:06:12 UTC (rev 2671)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequestPerfsonar2_0.java
2007-08-19 17:04:42 UTC (rev 2672)
@@ -24,6 +24,7 @@
import org.perfsonar.perfsonarui.AbstractUserData;
import org.perfsonar.perfsonarui.PSLogger;
import org.perfsonar.perfsonarui.plugins.ITimeValueResponse;
+import org.perfsonar.perfsonarui.plugins.IUserData;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -78,6 +79,9 @@
processResultCode(data, userData);
super.processData(data, userData, timeValueResponse);
}
+ protected void processMetadata(Node metadata, IUserData userData) {
+ processMetadata(metadata, (UserData) userData);
+ }
protected void processMetadata(Node metadata, UserData userData) {
if (isInterrupted()) return;
NodeList subject = metadata.getChildNodes();

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest_Errors.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest_Errors.java
2007-08-16 15:06:12 UTC (rev 2671)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest_Errors.java
2007-08-19 17:04:42 UTC (rev 2672)
@@ -56,9 +56,51 @@
}
protected PSCountsDatum createCountsDatum() {
return new PSErrorsDatum();
+
}
+
+ protected void processMetadata(Node metadata, UserData userData) {
+ if (isInterrupted()) return;
+ userData.clear();
+// System.out.println("Process
metadata\t"+((Element)metadata).getAttribute("id"));
+ NodeList subject =
((Element)metadata).getElementsByTagNameNS(URI_perfsonar[perfsonar_version][1],
"subject");
+ if (subject.getLength() == 0) return;
+ for (int m=0; m<subject.getLength(); m++)
+ if (subject.item(m) instanceof Element) {
+
+ NodeList nmwgt_interface =
((Element)subject.item(m)).getElementsByTagNameNS(URI_nmwgt[nmwg_version],
"interface");
+
+ for (int i=0; i < nmwgt_interface.getLength();i++) {
+ NodeList ifc = nmwgt_interface.item(i).getChildNodes();
+
+ for (int j=0; j < ifc.getLength();j++) {
+ Node node = ifc.item(j);
+ //System.out.println(node.getNodeValue());
+ if ((node != null) && (node instanceof
org.w3c.dom.Element)) {
+ Node child = node.getFirstChild();
+ if (child != null) {
+
userData.setResponse(node.getLocalName(),child.getNodeValue());
+
//System.out.println(node.getLocalName()+'\t'+child.getNodeValue());
+ }
+ }
+ }
+ }
+ }
+ userData.setDirection(userData.getResponse(UserData.C_DIRECTION));
+
+ Node eventType =
((org.w3c.dom.Element)metadata).getElementsByTagNameNS(URI_nmwg[nmwg_version],"eventType").item(0);
+ if (eventType != null) {
+ String event = eventType.getFirstChild().getNodeValue();
+ if (userData.isInput())
+ userData.getEndpoint().setEvent(event,0);
+ else if (userData.isOutput())
+ userData.getEndpoint().setEvent(event,1);
+ else userData.getEndpoint().setEvent(event,-1); //both
+ }
+ }

protected void processData(Node data, UserData userData,
ITimeValueResponse timeValueResponse) {
+ //System.out.println("Process data " +
((Element)data).getAttribute("id"));
//String dataId = userData.getId();
String dataId = ((org.w3c.dom.Element)data).getAttribute("id");
timeValueResponse.clear(userData.getType());
@@ -87,6 +129,7 @@
}

protected synchronized void processData(Node data, UserData userData) {
+
//result code
NodeList datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_perfsonar[perfsonar_version][1],"datum");

@@ -103,7 +146,7 @@
processDatum((org.w3c.dom.Element)n, d,t);
counts += d.getCount();

- logger.warn(">>\t" + userData.getId() + '\t'+
userData.getHostname(AbstractUserData.ID_RESPONSE) + '\t' +
+ logger.debug(">>\t" + userData.toString() + '\t' +
userData.getId() + '\t'+ userData.getHostname(AbstractUserData.ID_RESPONSE) +
'\t' +
d.getCount()+ '\t' + d.getType()+ '\t' +
t.getTime()+ '\t' + t.getType());
} catch (UnsupportedTypeException x) {
logger.error(x);

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest_NMWG2.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest_NMWG2.java
2007-08-16 15:06:12 UTC (rev 2671)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest_NMWG2.java
2007-08-19 17:04:42 UTC (rev 2672)
@@ -19,6 +19,9 @@
*/
package org.perfsonar.perfsonarui.ma;

+import java.util.ArrayList;
+import java.util.Iterator;
+
import org.jdom.Element;
import org.jdom.Namespace;
import org.perfsonar.perfsonarui.AbstractMARequest;
@@ -526,18 +529,20 @@
* @see
org.perfsonar.perfsonarui.NMWGHelper#process(org.w3c.dom.Node,
java.lang.String, org.w3c.dom.Node, java.lang.String)
*/
@Override
- public void process(Node data, String dataID, Node
metadata,
- String metaDataID) {
- UserData userData = new UserData();
- userData.setEndpoint(queryData.getEndpoint());
- processMetadata(metadata,userData);
- userData.setResponse(IUserData.C_DATAID,dataID);
- userData.setResponse(IUserData.C_METADATAID,metaDataID);
-
- processDataKey(data, userData);
- processDataParameters(data, userData);
+ public void process(org.w3c.dom.Element data,
ArrayList<org.w3c.dom.Element> metadataChain) throws Exception {
+ UserData myData = new UserData();
+
myData.setResponse(IUserData.C_DATAID,data.getAttribute(getId()));
+ myData.setEndpoint(queryData.getEndpoint());

- responseListener.addUserData(userData);
+ Iterator<org.w3c.dom.Element> i = metadataChain.iterator();
+ while (i.hasNext()) {
+ org.w3c.dom.Element metadata = i.next();
+ processMetadata(metadata,myData);
+
myData.setResponse(IUserData.C_METADATAID,metadata.getAttribute(getId()));
+ }
+ responseListener.addUserData(myData);
+ processDataKey(data, myData);
+ processDataParameters(data, myData);
}
};
try {
@@ -556,13 +561,18 @@
* @see
org.perfsonar.perfsonarui.NMWGHelper#process(org.w3c.dom.Node,
java.lang.String, org.w3c.dom.Node, java.lang.String)
*/
@Override
- public void process(Node data, String dataID, Node
metadata,
- String metaDataID) {
- processMetadata(metadata,userData);
- userData.setResponse(IUserData.C_DATAID,dataID);
- userData.setResponse(IUserData.C_METADATAID,metaDataID);
+ public void process(org.w3c.dom.Element data,
ArrayList<org.w3c.dom.Element> metadataChain) throws Exception {
+ Iterator<org.w3c.dom.Element> i = metadataChain.iterator();
+ while (i.hasNext()) {
+ org.w3c.dom.Element metadata = i.next();
+ processMetadata(metadata,userData);
+
userData.setResponse(IUserData.C_METADATAID,metadata.getAttribute(getId()));
+ }
+
+
userData.setResponse(IUserData.C_DATAID,data.getAttribute(getId()));
+ processData(data, userData,
responseListener.getTimeValueResponse());

- processData(data, userData,
responseListener.getTimeValueResponse());
+
}
};
ITimeValueResponse tvResponse = ((TimeValueResponseListener)
responseListener).getTimeValueResponse();
@@ -579,20 +589,20 @@

public void presentDataFromResponse(Document dataSetupResp, final
TimeValueListResponseListener responseListener, final UserData userData){
NMWGHelper helper = new NMWGHelper() {
- /* (non-Javadoc)
- * @see
org.perfsonar.perfsonarui.NMWGHelper#process(org.w3c.dom.Node,
java.lang.String, org.w3c.dom.Node, java.lang.String)
- */
+
@Override
- public void process(Node data, String dataID, Node
metadata,
- String metaDataID) {
+ public void process(org.w3c.dom.Element data,
ArrayList<org.w3c.dom.Element> metadataChain) throws Exception {
+ Iterator<org.w3c.dom.Element> i = metadataChain.iterator();
+ while (i.hasNext()) {
+ org.w3c.dom.Element metadata = i.next();
+ processMetadata(metadata,userData);
+
userData.setResponse(IUserData.C_METADATAID,metadata.getAttribute(getId()));
+ }
+
userData.setResponse(IUserData.C_DATAID,data.getAttribute(getId()));

- processMetadata(metadata,userData);
- userData.setResponse(IUserData.C_DATAID,dataID);
- userData.setResponse(IUserData.C_METADATAID,metaDataID);
-
MetaDataList list = responseListener.getDataList();

-
+
int index = list.indexOf(userData);
UserData ud = (UserData) list.get(index);
if (ud !=null) {
@@ -601,8 +611,10 @@
if (index >= 0) {
processData(data, ud);
}
- }
+ }
}
+
+
};
if (responseListener.getDataList() != null) {
try {
@@ -618,19 +630,20 @@
public void presentDataFromResponse(Document dataSetupResp,
UserDataResponseListener responseListener, final UserData userData){
if (isInterrupted()) return;
NMWGHelper helper = new NMWGHelper() {
- /* (non-Javadoc)
- * @see
org.perfsonar.perfsonarui.NMWGHelper#process(org.w3c.dom.Node,
java.lang.String, org.w3c.dom.Node, java.lang.String)
- */
+
@Override
- public void process(Node data, String dataID, Node
metadata,
- String metaDataID) {
+ public void process(org.w3c.dom.Element data,
ArrayList<org.w3c.dom.Element> metadataChain) throws Exception {
+ Iterator<org.w3c.dom.Element> i = metadataChain.iterator();
+ while (i.hasNext()) {
+ org.w3c.dom.Element metadata = i.next();
+ processMetadata(metadata,userData);
+
userData.setResponse(IUserData.C_METADATAID,metadata.getAttribute(getId()));
+ }
+
userData.setResponse(IUserData.C_DATAID,data.getAttribute(getId()));
+ processData(data, userData);

- processMetadata(metadata,userData);
- userData.setResponse(IUserData.C_DATAID,dataID);
- userData.setResponse(IUserData.C_METADATAID,metaDataID);

- processData(data, userData);
-
+
}
};
try {
@@ -639,7 +652,10 @@
logger.error(x);
}
}
- protected void processMetadata(Node metadata, UserData userData) {
+ protected void processMetadata(Node metadata, IUserData userData) {
+ processMetadata(metadata, (UserData) userData);
+ }
+ protected void processMetadata(Node metadata, UserData userData) {
if (isInterrupted()) return;
NodeList subject = metadata.getChildNodes();
for (int m=0; m<subject.getLength(); m++) {
@@ -668,7 +684,7 @@
else userData.getEndpoint().setEvent(event,-1); //both
}
}
- protected void processDataKey(Node data, UserData userData) {
+ protected void processDataKey(Node data, IUserData userData) {

NodeList keys =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwg[nmwg_version],IUserData.C_KEY);
if (keys.getLength() > 0) { //assign key
@@ -676,7 +692,7 @@
if (key != null) userData.setKey(key);
}
}
- protected void processDataParameters(Node data, UserData userData) {
+ protected void processDataParameters(Node data, IUserData userData) {

NodeList parameters =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwg[nmwg_version],"parameters");
for (int i=0; i < parameters.getLength();i++) {



  • perfsonar: r2672 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . ippm ls ma, svnlog, 08/19/2007

Archive powered by MHonArc 2.6.16.

Top of Page