perfsonar-dev - r2133 - in branches/SSHTelnet-MP-STABLE: ant ant/ssh conf src/org/perfsonar/commons/messages
Subject: perfsonar development work
List archive
r2133 - in branches/SSHTelnet-MP-STABLE: ant ant/ssh conf src/org/perfsonar/commons/messages
Chronological Thread
- From:
- To:
- Subject: r2133 - in branches/SSHTelnet-MP-STABLE: ant ant/ssh conf src/org/perfsonar/commons/messages
- Date: Fri, 23 Feb 2007 09:46:59 -0500
Author: melis
Date: 2007-02-23 09:46:58 -0500 (Fri, 23 Feb 2007)
New Revision: 2133
Modified:
branches/SSHTelnet-MP-STABLE/ant/const.properties
branches/SSHTelnet-MP-STABLE/ant/ssh/sshtelnetMP-configure-targets.xml
branches/SSHTelnet-MP-STABLE/conf/service.properties
branches/SSHTelnet-MP-STABLE/src/org/perfsonar/commons/messages/EchoRequest.java
Log:
EchoRequest integration
Modified: branches/SSHTelnet-MP-STABLE/ant/const.properties
===================================================================
--- branches/SSHTelnet-MP-STABLE/ant/const.properties 2007-02-23 14:11:55
UTC (rev 2132)
+++ branches/SSHTelnet-MP-STABLE/ant/const.properties 2007-02-23 14:46:58
UTC (rev 2133)
@@ -1,7 +1,7 @@
#This file was created by the Ant configuration script.
#Wed Feb 14 10:26:51 CET 2007
package.root=org/perfsonar
-service.home=/opt/apache-tomcat-5.5.20/webapps
+
target.port=8080
api.windowtitle=perfSONAR
release.basename=perfSONAR
Modified:
branches/SSHTelnet-MP-STABLE/ant/ssh/sshtelnetMP-configure-targets.xml
===================================================================
--- branches/SSHTelnet-MP-STABLE/ant/ssh/sshtelnetMP-configure-targets.xml
2007-02-23 14:11:55 UTC (rev 2132)
+++ branches/SSHTelnet-MP-STABLE/ant/ssh/sshtelnetMP-configure-targets.xml
2007-02-23 14:46:58 UTC (rev 2133)
@@ -64,7 +64,7 @@
<entry key="service.ls.registration_file" value=""/>
<entry key="service.mp.class_name"
value="org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.WebserviceEngineAdapter"/>
- <entry key="service.mp.message_types"
value="SetupDataRequest,MetadataKeyRequest" />
+ <entry key="service.mp.message_types"
value="SetupDataRequest,MetadataKeyRequest,EchoRequest" />
</propertyfile>
Modified: branches/SSHTelnet-MP-STABLE/conf/service.properties
===================================================================
--- branches/SSHTelnet-MP-STABLE/conf/service.properties 2007-02-23
14:11:55 UTC (rev 2132)
+++ branches/SSHTelnet-MP-STABLE/conf/service.properties 2007-02-23
14:46:58 UTC (rev 2133)
@@ -6,7 +6,7 @@
service.r.access_point=http\://localhost\:8080/TelnetSSHMP/services/TelnetSSH
service.ls.registration_file=
service.log.log4j.config=D\:\\temp\\20070201/conf/log4j.properties
-service.mp.message_types=SetupDataRequest,MetadataKeyRequest
+service.mp.message_types=SetupDataRequest,MetadataKeyRequest,EchoRequest
service.mp.class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.WebserviceEngineAdapter
service.r.service_type=SSH/Telnet MP
service.r.ls_url=
Modified:
branches/SSHTelnet-MP-STABLE/src/org/perfsonar/commons/messages/EchoRequest.java
===================================================================
---
branches/SSHTelnet-MP-STABLE/src/org/perfsonar/commons/messages/EchoRequest.java
2007-02-23 14:11:55 UTC (rev 2132)
+++
branches/SSHTelnet-MP-STABLE/src/org/perfsonar/commons/messages/EchoRequest.java
2007-02-23 14:46:58 UTC (rev 2133)
@@ -6,11 +6,20 @@
package org.perfsonar.commons.messages;
+import org.perfsonar.service.commons.exceptions.PerfSONARException;
+import org.perfsonar.service.commons.exceptions.DataFormatException;
+import org.perfsonar.service.commons.exceptions.RequestException;
import org.perfsonar.service.commons.exceptions.SystemException;
+import org.perfsonar.service.commons.exceptions.ResourceException;
import org.perfsonar.service.commons.engine.ActionType;
+import org.perfsonar.service.commons.util.ResultCodesUtil;
+import org.ggf.ns.nmwg.base.v2_0.Message;
import org.ggf.ns.nmwg.base.v2_0.Metadata;
+import org.ggf.ns.nmwg.base.v2_0.Data;
+import org.ggf.ns.nmwg.base.v2_0.EventType;
+import java.util.ArrayList;
import java.util.Map;
@@ -48,6 +57,116 @@
}
+ public Message execute(Message reqMessage) {
+ ArrayList<Message> output = new ArrayList<Message>();
+ for (Message inputMessage: extractMultipleRequests(reqMessage)) {
+
+ try {
+
+ output.add(
+ executeEcho(inputMessage));
+
+ } catch (PerfSONARException e) {
+
+ output.add(
+ ResultCodesUtil.createResultCodeMetadata(
+ null, e));
+
+ }
+
+ }
+
+ //do one message from all result messages
+ Message respMessage = mergeMultipleResponses(output);
+
+ //if no metadata inside, print error
+ if (respMessage.getMetadataMap().values().size() == 0) {
+ ResultCodesUtil.createResultCodeMetadata(
+ respMessage,
+ new PerfSONARException(
+ "warning.common.no_metadata",
+ "No output metadata was returned by MessageHandler."+
+ " Maybe there was no data trigger, or data trigger "+
+ " didn't have valid metadataIdRef? ")
+ );
+
+ }
+
+ respMessage.setId(reqMessage.getId() + "_resp");
+ respMessage.setType(reqMessage.getType().replaceFirst("Request",
"Response"));
+ respMessage.setMessageIdRef(reqMessage.getId());
+
+ return respMessage;
+
+ }
+
+
+ protected Message executeEcho(Message request)
+ throws SystemException, RequestException, DataFormatException,
ResourceException {
+
+ Data data = request.getDataArray()[0];
+ Metadata metadata = request.getMetadata(data.getMetadataIdRef());
+
+ EventType eventType = metadata.getEventType();
+ if (eventType == null) {
+ logger.debug("EchoRequest.executeEcho: The request does not
contain "
+ + "eventType element");
+ throw new SystemException(
+ "error.request",
+ "EchoRequest.executeEcho: The request does
not contain "
+ + "eventType element");
+ }
+
+ Message response = null;
+
+ if (eventType.getEventType().equals("echo")) {
+ response = executeSimpleEcho();
+ } else if (eventType.getEventType().equals("")) {
+ response = getEmptyEventTypeResponse();
+ } else {
+ response = serviceEngine.takeAction(getType(), request);
+ }
+
+ return response;
+
+ }
+
+
+ protected Message executeSimpleEcho() {
+
+ logger.debug("EchoRequest: executeSimpleEcho()");
+
+ Message response = new Message();
+
+ PerfSONARException pex =
+ new PerfSONARException(
+ "success.echo",
+ "This is the echo response from the
service.");
+
+ ResultCodesUtil.createResultCodeMetadata(response, pex);
+
+ return response;
+
+ }
+
+
+ protected Message getEmptyEventTypeResponse() {
+
+ Message response = new Message();
+
+ PerfSONARException pex =
+ new PerfSONARException(
+ "error.echo",
+ "EventType is empty.");
+
+ ResultCodesUtil.createResultCodeMetadata(response, pex);
+
+ return response;
+
+ }
+
+
+
} //EchoRequest
- r2133 - in branches/SSHTelnet-MP-STABLE: ant ant/ssh conf src/org/perfsonar/commons/messages, svnlog, 02/23/2007
Archive powered by MHonArc 2.6.16.