Skip to Content.
Sympa Menu

perfsonar-dev - r2034 - in branches/SSHTelnet-MP-STABLE: ant/ssh src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters

Subject: perfsonar development work

List archive

r2034 - in branches/SSHTelnet-MP-STABLE: ant/ssh src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters


Chronological Thread 
  • From:
  • To:
  • Subject: r2034 - in branches/SSHTelnet-MP-STABLE: ant/ssh src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters
  • Date: Wed, 7 Feb 2007 05:58:42 -0500

Author: stijn
Date: 2007-02-07 05:58:41 -0500 (Wed, 07 Feb 2007)
New Revision: 2034

Modified:
branches/SSHTelnet-MP-STABLE/ant/ssh/sshtelnetMP-pre-install-targets.xml
branches/SSHTelnet-MP-STABLE/ant/ssh/sshtelnetMP-release-targets.xml

branches/SSHTelnet-MP-STABLE/src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/WebserviceEngineAdapter.java
Log:
First Item of Bug 138 fixed
(Error when no device element is inserted in the request file)

Modified:
branches/SSHTelnet-MP-STABLE/ant/ssh/sshtelnetMP-pre-install-targets.xml
===================================================================
--- branches/SSHTelnet-MP-STABLE/ant/ssh/sshtelnetMP-pre-install-targets.xml
2007-02-06 20:43:09 UTC (rev 2033)
+++ branches/SSHTelnet-MP-STABLE/ant/ssh/sshtelnetMP-pre-install-targets.xml
2007-02-07 10:58:41 UTC (rev 2034)
@@ -25,7 +25,7 @@

<target name="pre-install">

- <echo>Preparing the installation of RRD MA...</echo>
+ <echo>Preparing the installation of SSH Telnet MP...</echo>

<echo></echo>
<echo>Answer to all questions. If you go wrong, cancel (ctrl-c) and
start again.</echo>

Modified: branches/SSHTelnet-MP-STABLE/ant/ssh/sshtelnetMP-release-targets.xml
===================================================================
--- branches/SSHTelnet-MP-STABLE/ant/ssh/sshtelnetMP-release-targets.xml
2007-02-06 20:43:09 UTC (rev 2033)
+++ branches/SSHTelnet-MP-STABLE/ant/ssh/sshtelnetMP-release-targets.xml
2007-02-07 10:58:41 UTC (rev 2034)
@@ -64,7 +64,6 @@
<delete dir="tmp/${service.name}/perfsonar/ant/tcmp"/>
<delete dir="tmp/${service.name}/perfsonar/ant/tops"/>
<delete dir="tmp/${service.name}/perfsonar/ant/xmlls"/>
- <delete dir="tmp/${service.name}/perfsonar/ant/flowmp"/>

<delete dir="tmp/${service.name}/perfsonar/conf/template"/>

@@ -111,7 +110,7 @@

</delete>

- <tar destfile="${service.name}-1.0.tar"
+ <tar destfile="${service.name}.tar"
basedir="tmp/"
longfile="gnu"
excludes=".svn/**"
@@ -119,11 +118,11 @@

<delete dir="tmp"/>

- <gzip zipfile="${service.name}-1.0.tar.gz"
- src="${service.name}-1.0.tar"
+ <gzip zipfile="${service.name}.tar.gz"
+ src="${service.name}.tar"
/>

- <delete file="${service.name}-1.0.tar"/>
+ <delete file="${service.name}.tar"/>

</target>


Modified:
branches/SSHTelnet-MP-STABLE/src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/WebserviceEngineAdapter.java
===================================================================
---
branches/SSHTelnet-MP-STABLE/src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/WebserviceEngineAdapter.java
2007-02-06 20:43:09 UTC (rev 2033)
+++
branches/SSHTelnet-MP-STABLE/src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/WebserviceEngineAdapter.java
2007-02-07 10:58:41 UTC (rev 2034)
@@ -1,7 +1,10 @@
/*
- * Created/Updated on November 21th, 2006
- * Version Number: 0.5
+ * Created/Updated on February, 7th 2007
+ * Version Number: 0.6
* Project: perfSonar
+ *
+ * Stijn Verstichel
()
+ * Stijn Melis
()
*/
package
org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters;

@@ -53,7 +56,7 @@
private String serviceEngineType = null;

private Message[] messages;
-
+
private static int count = 0;

// ---------------------- class-fields
@@ -89,7 +92,7 @@
devices.add(devicesTokenizer.nextToken());

}
-
+
registerServiceWithLS();

} catch (SystemException e) {
@@ -126,7 +129,7 @@
// call received");

logger.info("COUNT: " + count++);
-
+
Metadata[] requestMetadata = request.getMetadataArray();
Data[] requestData = request.getDataArray();
Subject subject = requestMetadata[0].getSubject();
@@ -148,11 +151,17 @@

for (int i = 0; i < requestMetadata.length; i++) {
Subject subjectTemp =
requestMetadata[i].getSubject();
+ boolean deviceElementOK = true;
+ String value = "";

- EndPoint endpoint = (EndPoint)
subjectTemp.getChildArray()[0];
- String value = endpoint.getValue();
+ try {
+ EndPoint endpoint = (EndPoint)
subjectTemp.getChildArray()[0];
+ value = endpoint.getValue();
+ } catch (Exception e) {
+ deviceElementOK = false;
+ }

- if (devices.contains(value)) {
+ if (deviceElementOK &&
devices.contains(value)) {

Message message = new Message();

message.setMetadata(requestMetadata[i]);
@@ -162,119 +171,110 @@
if
(requestData[j].getMetadataIdRef().equalsIgnoreCase(

metadataIdRef))

message.setData(requestData[j]);
-
+
String serviceEngineString =
properties
- .getProperty("service.mp." + value
- + ".class_name");
-
- RequestExecutingThread
requestExecutingThread =
- new RequestExecutingThread(i,
actionType, serviceEngineString,
- message,
requestMetadata[i], requestMonitor);
-
+
.getProperty("service.mp." + value + ".class_name");
+
+ RequestExecutingThread
requestExecutingThread = new RequestExecutingThread(
+ i, actionType,
serviceEngineString, message,
+ requestMetadata[i],
requestMonitor);
+
requestExecutingThread.start();

/**
- try {
- Message message = new Message();
-
message.setMetadata(requestMetadata[i]);
- String metadataIdRef =
requestMetadata[i].getId();
-
- for (int j = 0; j <
requestData.length; j++)
- if (requestData[j].getMetadataIdRef()
- .equalsIgnoreCase(metadataIdRef))
- message.setData(requestData[j]);
-
- ServiceEngine serviceEngine =
ServiceEngineFactory
- .getServiceEngine(properties
- .getProperty("service.mp." + value
- + ".class_name"));
- messages[i] =
serviceEngine.takeAction(actionType,
- message);
-
- // Inclusion of the result code tags
- Metadata resultCodeMetadata = new
Metadata();
-
resultCodeMetadata.setId("resultCodeMeta_"
- + requestMetadata[i].getId());
-
- Subject resultCodeSubject = new
Subject();
-
resultCodeSubject.setId("resultCodeSubj_"
- + requestMetadata[i].getId());
-
resultCodeSubject.setMetadataIdRef(requestMetadata[i]
- .getId());
-
- EventType resultCodeEventType = new
EventType();
-
resultCodeEventType.setId("resultCodeEventType_"
- + requestMetadata[i].getId());
- resultCodeEventType
-
.setEventType("success.mp.sshtelnet");
-
-
resultCodeMetadata.addChild(resultCodeSubject);
-
resultCodeMetadata.addChild(resultCodeEventType);
-
- Data resultCodeData = new Data();
-
resultCodeData.setId("resultCodeData_"
- + requestMetadata[i].getId());
-
resultCodeData.setMetadataIdRef("resultCodeMeta_"
- + requestMetadata[i].getId());
-
- Datum resultCodeDatum = new Datum();
-
resultCodeDatum.setId("resultCodeDatum_"
- + requestMetadata[i].getId());
- resultCodeDatum
- .setValue("Successfully executed
request");
-
-
resultCodeData.addChild(resultCodeDatum);
-
-
messages[i].setMetadata(resultCodeMetadata);
- messages[i].setData(resultCodeData);
-
- } catch (PerfSONARException e) {
-
- messages[i] = new Message();
-
messages[i].setMetadata(requestMetadata[i]);
- String metadataIdRef =
requestMetadata[i].getId();
-
- for (int j = 0; j <
requestData.length; j++)
- if (requestData[j].getMetadataIdRef()
- .equalsIgnoreCase(metadataIdRef))
- messages[i].setData(requestData[j]);
-
- Metadata resultCodeMetadata = new
Metadata();
-
resultCodeMetadata.setId("resultCodeMeta_"
- + requestMetadata[i].getId());
-
- Subject resultCodeSubject = new
Subject();
-
resultCodeSubject.setId("resultCodeSubj_"
- + requestMetadata[i].getId());
-
resultCodeSubject.setMetadataIdRef(requestMetadata[i]
- .getId());
-
- EventType resultCodeEventType = new
EventType();
-
resultCodeEventType.setId("resultCodeEventType_"
- + requestMetadata[i].getId());
-
resultCodeEventType.setEventType(e.getResultCode());
-
-
resultCodeMetadata.addChild(resultCodeSubject);
-
resultCodeMetadata.addChild(resultCodeEventType);
-
- Data resultCodeData = new Data();
-
resultCodeData.setId("resultCodeData_"
- + requestMetadata[i].getId());
-
resultCodeData.setMetadataIdRef("resultCodeMeta_"
- + requestMetadata[i].getId());
-
- Datum resultCodeDatum = new Datum();
-
resultCodeDatum.setId("resultCodeDatum_"
- + requestMetadata[i].getId());
-
resultCodeDatum.setValue(e.getResultDescription());
-
-
resultCodeData.addChild(resultCodeDatum);
-
-
messages[i].setMetadata(resultCodeMetadata);
- messages[i].setData(resultCodeData);
-
-
logger.error(e.getResultDescription());
- }
+ * try { Message message = new
Message();
+ *
message.setMetadata(requestMetadata[i]); String
+ * metadataIdRef =
requestMetadata[i].getId();
+ *
+ * for (int j = 0; j <
requestData.length; j++) if
+ * (requestData[j].getMetadataIdRef()
+ * .equalsIgnoreCase(metadataIdRef))
+ * message.setData(requestData[j]);
+ *
+ * ServiceEngine serviceEngine =
ServiceEngineFactory
+ * .getServiceEngine(properties
.getProperty("service.mp." +
+ * value + ".class_name"));
messages[i] =
+ *
serviceEngine.takeAction(actionType, message);
+ * // Inclusion of the result code
tags Metadata
+ * resultCodeMetadata = new
Metadata();
+ *
resultCodeMetadata.setId("resultCodeMeta_" +
+ * requestMetadata[i].getId());
+ *
+ * Subject resultCodeSubject = new
Subject();
+ *
resultCodeSubject.setId("resultCodeSubj_" +
+ * requestMetadata[i].getId());
+ *
resultCodeSubject.setMetadataIdRef(requestMetadata[i]
+ * .getId());
+ *
+ * EventType resultCodeEventType =
new EventType();
+ *
resultCodeEventType.setId("resultCodeEventType_" +
+ * requestMetadata[i].getId());
resultCodeEventType
+ *
.setEventType("success.mp.sshtelnet");
+ *
+ *
resultCodeMetadata.addChild(resultCodeSubject);
+ *
resultCodeMetadata.addChild(resultCodeEventType);
+ *
+ * Data resultCodeData = new Data();
+ *
resultCodeData.setId("resultCodeData_" +
+ * requestMetadata[i].getId());
+ *
resultCodeData.setMetadataIdRef("resultCodeMeta_" +
+ * requestMetadata[i].getId());
+ *
+ * Datum resultCodeDatum = new
Datum();
+ *
resultCodeDatum.setId("resultCodeDatum_" +
+ * requestMetadata[i].getId());
resultCodeDatum
+ * .setValue("Successfully executed
request");
+ *
+ *
resultCodeData.addChild(resultCodeDatum);
+ *
+ *
messages[i].setMetadata(resultCodeMetadata);
+ *
messages[i].setData(resultCodeData);
+ * } catch (PerfSONARException e) {
+ *
+ * messages[i] = new Message();
+ *
messages[i].setMetadata(requestMetadata[i]); String
+ * metadataIdRef =
requestMetadata[i].getId();
+ *
+ * for (int j = 0; j <
requestData.length; j++) if
+ * (requestData[j].getMetadataIdRef()
+ * .equalsIgnoreCase(metadataIdRef))
+ *
messages[i].setData(requestData[j]);
+ *
+ * Metadata resultCodeMetadata = new
Metadata();
+ *
resultCodeMetadata.setId("resultCodeMeta_" +
+ * requestMetadata[i].getId());
+ *
+ * Subject resultCodeSubject = new
Subject();
+ *
resultCodeSubject.setId("resultCodeSubj_" +
+ * requestMetadata[i].getId());
+ *
resultCodeSubject.setMetadataIdRef(requestMetadata[i]
+ * .getId());
+ *
+ * EventType resultCodeEventType =
new EventType();
+ *
resultCodeEventType.setId("resultCodeEventType_" +
+ * requestMetadata[i].getId());
+ *
resultCodeEventType.setEventType(e.getResultCode());
+ *
+ *
resultCodeMetadata.addChild(resultCodeSubject);
+ *
resultCodeMetadata.addChild(resultCodeEventType);
+ *
+ * Data resultCodeData = new Data();
+ *
resultCodeData.setId("resultCodeData_" +
+ * requestMetadata[i].getId());
+ *
resultCodeData.setMetadataIdRef("resultCodeMeta_" +
+ * requestMetadata[i].getId());
+ *
+ * Datum resultCodeDatum = new
Datum();
+ *
resultCodeDatum.setId("resultCodeDatum_" +
+ * requestMetadata[i].getId());
+ *
resultCodeDatum.setValue(e.getResultDescription());
+ *
+ *
resultCodeData.addChild(resultCodeDatum);
+ *
+ *
messages[i].setMetadata(resultCodeMetadata);
+ *
messages[i].setData(resultCodeData);
+ *
+ *
logger.error(e.getResultDescription()); }
*/

} else {
@@ -313,21 +313,31 @@

resultCodeData.setMetadataIdRef("resultCodeMeta_"
+
requestMetadata[i].getId());

- Datum resultCodeDatum = new Datum();
-
resultCodeDatum.setId("resultCodeDatum_"
- +
requestMetadata[i].getId());
- resultCodeDatum.setValue("Requested
device not supported");
+ Datum resultCodeDatum = null;
+ if (deviceElementOK) {
+ resultCodeDatum = new Datum();
+
resultCodeDatum.setId("resultCodeDatum_"
+ +
requestMetadata[i].getId());
+ resultCodeDatum
+
.setValue("Requested device not supported");
+ } else {
+ resultCodeDatum = new Datum();
+
resultCodeDatum.setId("resultCodeDatum_"
+ +
requestMetadata[i].getId());
+ resultCodeDatum
+ .setValue("No
Device element given in request");
+ }


resultCodeData.addChild(resultCodeDatum);


messages[i].setMetadata(resultCodeMetadata);
messages[i].setData(resultCodeData);
-
+
requestMonitor.setCompleted(i, null);

}
}
-
+
while (!requestMonitor.isCompleted()) {
try {
Toolkit toolkit =
Toolkit.getDefaultToolkit();
@@ -337,9 +347,9 @@
e.printStackTrace();
}
}
-
+
Message[] resultMessages =
requestMonitor.getResultMessages();
-
+
for (int i = 0; i < messages.length; i++) {
if (messages[i] == null)
messages[i] = resultMessages[i];
@@ -399,20 +409,21 @@
subject = new Subject();
subject.setId("subject" + tokencounter);
subject.setSubject(token);
-
+
Parameters metaParams = new Parameters();
- metaParams.setId("metaParams"+tokencounter);
-
+ metaParams.setId("metaParams" + tokencounter);
+
Parameter metaparam = new Parameter();
metaparam.setParameterName("url");
try {
-
metaparam.setParameterValue(properties.getProperty("service.r.mp." + token +
".url"));
+ metaparam.setParameterValue(properties
+ .getProperty("service.r.mp."
+ token + ".url"));
} catch (SystemException e1) {
e1.printStackTrace();
}
-
+
metaParams.addChild(metaparam);
-
+
respMetaData[tokencounter].addChild(subject);
respMetaData[tokencounter].addChild(metaParams);

@@ -558,23 +569,20 @@
return response;

}
-
+
private void registerServiceWithLS() {
/**
- try {
- ServiceLSRegistrator registrator = new
GenericServiceLSRegistrator
- (new
PropertiesServiceDescription(),
- null);
-
- registrator.initRegistrator();
-
- Message responseMessage =
registrator.register("http://chaos4.test:8080/axis/services/LookupService";);
- System.out.println(responseMessage);
- } catch (PerfSONARException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- */
+ * try { ServiceLSRegistrator registrator = new
+ * GenericServiceLSRegistrator (new
PropertiesServiceDescription(),
+ * null);
+ *
+ * registrator.initRegistrator();
+ *
+ * Message responseMessage =
+ *
registrator.register("http://chaos4.test:8080/axis/services/LookupService";);
+ * System.out.println(responseMessage); } catch
(PerfSONARException e) { //
+ * TODO Auto-generated catch block e.printStackTrace(); }
+ */
}

// THREAD TESTING PURPOSES
@@ -597,16 +605,13 @@

public static void main(String[] args) {
/**
+ * try { new WebserviceEngineAdapter().new
+ * SimpleThread("Jamaica").start(); new
WebserviceEngineAdapter().new
+ * SimpleThread("Fiji").start(); } catch (SystemException e)
{ // TODO
+ * Auto-generated catch block e.printStackTrace(); }
+ */
+
try {
- new WebserviceEngineAdapter().new
SimpleThread("Jamaica").start();
- new WebserviceEngineAdapter().new
SimpleThread("Fiji").start();
- } catch (SystemException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- */
-
- try {
WebserviceEngineAdapter adapter = new
WebserviceEngineAdapter();
} catch (SystemException e) {
// TODO Auto-generated catch block



  • r2034 - in branches/SSHTelnet-MP-STABLE: ant/ssh src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters, svnlog, 02/07/2007

Archive powered by MHonArc 2.6.16.

Top of Page