Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r2769 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . ma plugins

Subject: perfsonar development work

List archive

perfsonar: r2769 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . ma plugins


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r2769 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . ma plugins
  • Date: Tue, 4 Sep 2007 10:51:43 -0400

Author: nina
Date: 2007-09-04 10:51:41 -0400 (Tue, 04 Sep 2007)
New Revision: 2769

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractUserData.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequestPerfsonar2_0.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest_NMWG2.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IUserData.java
Log:
improved resultcodes handling

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractUserData.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractUserData.java
2007-09-04 13:23:50 UTC (rev 2768)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractUserData.java
2007-09-04 14:51:41 UTC (rev 2769)
@@ -19,6 +19,7 @@
*/
package org.perfsonar.perfsonarui;

+import java.util.ArrayList;
import java.util.Calendar;
import java.util.Hashtable;
import java.util.Observable;
@@ -267,31 +268,39 @@
public String toString() {
return qr.toString();
}
+ public ArrayList<String> getEventTypes() {
+ return qr.getEventTypes();
+ }
}

class QueryResponse implements Cloneable {
protected Hashtable[] query_response;
+ protected ArrayList<String> eventTypes;
public static String NULL_DATA="N/A";

public QueryResponse() {
query_response = new Hashtable[2];
query_response[0] = new Hashtable();
query_response[1] = new Hashtable();
+ eventTypes = new ArrayList<String>();
}
public void clear() {
query_response[0].clear();
query_response[1].clear();
+ eventTypes.clear();
}
public void clearResponse() {
query_response[1].clear();
+ eventTypes.clear();
}
public void putQuery(Object key,Object value) {
query_response[0].put(key,value);

}
public void putResponse(Object key,Object value) {
-
query_response[1].put(key,value);
+ if (IUserData.C_EVENTTYPE.equals(key))
+ eventTypes.add(value.toString());

}
public String getQuery(Object key) {
@@ -337,6 +346,12 @@
newqr.assign(this);
return newqr;
}
+ public ArrayList<String> getEventTypes() {
+ return eventTypes;
+ }
+ public void setEventTypes(ArrayList<String> eventTypes) {
+ this.eventTypes = eventTypes;
+ }




Modified: branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest.java
2007-09-04 13:23:50 UTC (rev 2768)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest.java
2007-09-04 14:51:41 UTC (rev 2769)
@@ -402,7 +402,7 @@
try{
MetaDataList dataList =
responseListener.getDataList();
//analyse <perfsonar:datum value="No Match" />

- NodeList nodelist =
dataSetupResp.getElementsByTagNameNS(URI_perfsonar[version],"datum");
+ NodeList nodelist =
dataSetupResp.getElementsByTagNameNS(URI_perfsonar[version],IUserData.C_DATUM);
for (int i=0; i < nodelist.getLength();i++) {
if
(nodelist.item(i).getAttributes().getNamedItem("value").getNodeValue().equals("No
Match"))
return;

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequestPerfsonar2_0.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequestPerfsonar2_0.java
2007-09-04 13:23:50 UTC (rev 2768)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequestPerfsonar2_0.java
2007-09-04 14:51:41 UTC (rev 2769)
@@ -65,71 +65,21 @@
if (nmwgr == null) nmwgr =
Namespace.getNamespace("nmwgr",URI_nmwgr);
}
protected synchronized void processResultCode(Node data, UserData
userData) {
- NodeList datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwgr,"datum");
+ NodeList datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwgr,IUserData.C_DATUM);

if (datum.getLength()>0)
for (int i=0; i < datum.getLength();i++) {
org.w3c.dom.Element d = (org.w3c.dom.Element)datum.item(i);
- logger.warn(">>\t" + userData.getId() + '\t'+
userData.getHostname(AbstractUserData.ID_RESPONSE) + '\t' +
d.getTextContent());
+
userData.setResponse(AbstractUserData.C_STATUS,userData.getEventTypes().toString()
+ "\t" + d.getTextContent());
+ //logger.warn(">>\t" + userData.getId() + '\t'+
userData.getHostname(AbstractUserData.ID_RESPONSE) + '\t' +
d.getTextContent());
}
+ else userData.setResponse(AbstractUserData.C_STATUS,"OK");
}
- /*
- @Override
- protected synchronized void processData(Node data, UserData userData) {
- //result code
- processResultCode(data, userData);
- super.processData(data, userData);
- }
- @Override
- protected void processData(Node data, UserData userData,
ITimeValueResponse timeValueResponse) {
- //result code
- 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();
- for (int m=0; m<subject.getLength(); m++) {
- NodeList interfaces = subject.item(m).getChildNodes();
- for (int i=0; i < interfaces.getLength();i++) {
- NodeList ifc = interfaces.item(i).getChildNodes();
- for (int j=0; j < ifc.getLength();j++) {
- Node node = ifc.item(j);
- if ((node != null) && (node instanceof
org.w3c.dom.Element)) {
- Node child = node.getFirstChild();
- if (child != null)
-
userData.setResponse(node.getLocalName(),node.getFirstChild().getNodeValue());
- }
- }
- }
- }
- userData.setDirection(userData.getResponse(UserData.C_DIRECTION));
-
- NodeList parameters =
((org.w3c.dom.Element)metadata).getElementsByTagNameNS(URI_nmwg[nmwg_version],"parameter");
- //will be looking for eventtypes
- for (int i=0; i < parameters.getLength(); i++) {
- Element node = (Element)parameters.item(i);
- if ("supportedEventType".equals( node.getAttribute("name"))) {
- String event = node.getTextContent();
- 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 processMetadata(Node metadata, UserData userData) {
if (isInterrupted()) return;
userData.clear();
-// System.out.println("Process
metadata\t"+((Element)metadata).getAttribute("id"));
+ 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++)
@@ -174,9 +124,9 @@
timeValueResponse.clear(getTimeValueSeriesName(userData, d));
timeValueResponse.setUserData(userData);
timeValueResponse.initializeResponse();
- NodeList datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_perfsonar[perfsonar_version][1],"datum");
+ NodeList datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_perfsonar[perfsonar_version][1],IUserData.C_DATUM);
if (datum.getLength() == 0)
- datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwg[nmwg_version],"datum");
+ datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwg[nmwg_version],IUserData.C_DATUM);


for (int i=0; i < datum.getLength();i++) {
@@ -194,6 +144,12 @@
}

timeValueResponse.finalizeResponse();
+
+ /*
+ datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwgr,IUserData.C_DATUM);
+ if (datum.getLength() > 0)
+ */
+ processResultCode(data, userData);
}

protected String getTimeValueSeriesName(UserData userData,
PSCountsDatum datum) {
@@ -204,11 +160,11 @@

}
protected synchronized void processData(Node data, UserData userData) {
-
+ System.out.println(((org.w3c.dom.Element)data).getAttribute("id"));
//result code
- NodeList datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_perfsonar[perfsonar_version][1],"datum");
+ NodeList datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_perfsonar[perfsonar_version][1],IUserData.C_DATUM);
if (datum.getLength()==0)
- datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwg[nmwg_version],"datum");
+ datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwg[nmwg_version],IUserData.C_DATUM);

if (datum.getLength()>0) {
double counts = 0;
@@ -243,7 +199,11 @@
setAverage(userData, d, Double.NaN);

}
- processResultCode(data, userData);
+ /*
+ datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwgr,IUserData.C_DATUM);
+ if (datum.getLength() > 0)
+ */
+ processResultCode(data, userData);
}

protected synchronized void setAverage(UserData userData,PSCountsDatum
datum, double average ) {

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest_NMWG2.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest_NMWG2.java
2007-09-04 13:23:50 UTC (rev 2768)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ma/MARequest_NMWG2.java
2007-09-04 14:51:41 UTC (rev 2769)
@@ -728,7 +728,7 @@
}
protected synchronized void processData(Node data, UserData userData)
{

- NodeList datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwg[nmwg_version],"datum");
+ NodeList datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwg[nmwg_version],IUserData.C_DATUM);
int count = 0;
//long time;
double bits = 0;
@@ -776,7 +776,7 @@
timeValueResponse.clear(userData.getType());
timeValueResponse.setUserData(userData);
timeValueResponse.initializeResponse();
- NodeList datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwg[nmwg_version],"datum");
+ NodeList datum =
((org.w3c.dom.Element)data).getElementsByTagNameNS(URI_nmwg[nmwg_version],IUserData.C_DATUM);
for (int i=0; i < datum.getLength();i++)
if ((datum.item(i) != null) && (datum.item(i) instanceof
org.w3c.dom.Element)) {
org.w3c.dom.Element d = (org.w3c.dom.Element)datum.item(i);

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IUserData.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IUserData.java
2007-09-04 13:23:50 UTC (rev 2768)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/IUserData.java
2007-09-04 14:51:41 UTC (rev 2769)
@@ -20,6 +20,7 @@
package org.perfsonar.perfsonarui.plugins;

import java.io.Serializable;
+import java.util.ArrayList;

import org.w3c.dom.Document;

@@ -32,8 +33,10 @@

public final static String C_KEY="key";
public final static String C_DATAID="id";
+ public final static String C_DATUM="datum";
public final static String C_METADATAID="metadataIdRef";
public final static String C_STATUS="STATUS";
+ public final static String C_EVENTTYPE="eventType";

/**
* Clears both query and response data.
@@ -147,4 +150,6 @@

public boolean isNotificationEnabled();
public void setNotificationEnabled(boolean value);
+
+ public ArrayList<String> getEventTypes();
}



  • perfsonar: r2769 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: . ma plugins, svnlog, 09/04/2007

Archive powered by MHonArc 2.6.16.

Top of Page