perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6235 - in trunk/perfsonar-base/sample-service: . src src/main src/main/java src/main/java/net src/main/java/net/geant src/main/java/net/geant/perfsonar src/main/java/net/geant/perfsonar/mp src/main/java/net/geant/perfsonar/mp/sshtelnet src/main/resources src/main/resources/net src/main/resources/net/geant src/main/resources/net/geant/perfsonar src/main/resources/net/geant/perfsonar/mp src/main/resources/net/geant/perfsonar/mp/sshtelnet src/test src/test/java src/test/java/net src/test/java/net/geant src/test/java/net/geant/perfsonar src/test/java/net/geant/perfsonar/mp src/test/java/net/geant/perfsonar/mp/sshtelnet
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/ps-java-services] r6235 - in trunk/perfsonar-base/sample-service: . src src/main src/main/java src/main/java/net src/main/java/net/geant src/main/java/net/geant/perfsonar src/main/java/net/geant/perfsonar/mp src/main/java/net/geant/perfsonar/mp/sshtelnet src/main/resources src/main/resources/net src/main/resources/net/geant src/main/resources/net/geant/perfsonar src/main/resources/net/geant/perfsonar/mp src/main/resources/net/geant/perfsonar/mp/sshtelnet src/test src/test/java src/test/java/net src/test/java/net/geant src/test/java/net/geant/perfsonar src/test/java/net/geant/perfsonar/mp src/test/java/net/geant/perfsonar/mp/sshtelnet
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6235 - in trunk/perfsonar-base/sample-service: . src src/main src/main/java src/main/java/net src/main/java/net/geant src/main/java/net/geant/perfsonar src/main/java/net/geant/perfsonar/mp src/main/java/net/geant/perfsonar/mp/sshtelnet src/main/resources src/main/resources/net src/main/resources/net/geant src/main/resources/net/geant/perfsonar src/main/resources/net/geant/perfsonar/mp src/main/resources/net/geant/perfsonar/mp/sshtelnet src/test src/test/java src/test/java/net src/test/java/net/geant src/test/java/net/geant/perfsonar src/test/java/net/geant/perfsonar/mp src/test/java/net/geant/perfsonar/mp/sshtelnet
- Date: Wed, 20 Mar 2013 21:57:01 +0000 (GMT)
- Authentication-results: sfpop-ironport04.merit.edu; dkim=neutral (message not signed) header.i=none
Author: psnc.pietrzak
Date: 2013-03-20 21:57:01 +0000 (Wed, 20 Mar 2013)
New Revision: 6235
Added:
trunk/perfsonar-base/sample-service/pom.xml
trunk/perfsonar-base/sample-service/src/
trunk/perfsonar-base/sample-service/src/main/
trunk/perfsonar-base/sample-service/src/main/java/
trunk/perfsonar-base/sample-service/src/main/java/net/
trunk/perfsonar-base/sample-service/src/main/java/net/geant/
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/Command.java
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/ConfigurationFileChecker.java
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/Router.java
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/SSHTelnetMPService.java
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/ServiceController.java
trunk/perfsonar-base/sample-service/src/main/resources/
trunk/perfsonar-base/sample-service/src/main/resources/configuration.xml
trunk/perfsonar-base/sample-service/src/main/resources/net/
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/sshtelnet/
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/sshtelnet/LSRegister.template
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/sshtelnet/MetadataKeyResponse.template
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/sshtelnet/SetupDataResponse.template
trunk/perfsonar-base/sample-service/src/test/
trunk/perfsonar-base/sample-service/src/test/java/
trunk/perfsonar-base/sample-service/src/test/java/net/
trunk/perfsonar-base/sample-service/src/test/java/net/geant/
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/SSHTelnetMPWebServiceTest.java
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/sshtelnet/
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/sshtelnet/LSRegisterTest.java
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/sshtelnet/SSHTelnetMPTest.java
Log:
Sample service that uses base via API and annotations.
Added: trunk/perfsonar-base/sample-service/pom.xml
===================================================================
--- trunk/perfsonar-base/sample-service/pom.xml (rev
0)
+++ trunk/perfsonar-base/sample-service/pom.xml 2013-03-20 21:57:01 UTC (rev
6235)
@@ -0,0 +1,112 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>net.geant.perfsonar</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.0</version>
+ <relativePath>../../parent/</relativePath>
+ </parent>
+
+ <artifactId>sample-service</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <name>Sample perfSONAR service and tests for the framework.</name>
+
+ <developers>
+ <developer>
+ <id>blazej.pietrzak</id>
+ <name>Blazej Pietrzak</name>
+
<email></email>
+ <organization>PSNC</organization>
+
<organizationUrl>http://www.man.poznan.pl/</organizationUrl>
+ <roles>
+ <role>architect</role>
+ <role>developer</role>
+ </roles>
+ <timezone>+1</timezone>
+ </developer>
+ </developers>
+
+ <properties>
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>net.geant.perfsonar.base</groupId>
+ <artifactId>base</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>net.geant.perfsonar.base</groupId>
+ <artifactId>ls</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>net.geant.perfsonar.base</groupId>
+ <artifactId>annotations</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency> <!-- Remove it if you want to use API instead of
annotations -->
+ <groupId>net.geant.perfsonar.base</groupId>
+ <artifactId>apt</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.9</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.geant.perfsonar.base</groupId>
+ <artifactId>base</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.geant.perfsonar.base</groupId>
+ <artifactId>messaging</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.geant.perfsonar.base</groupId>
+ <artifactId>ls</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-bundle</artifactId>
+ <version>2.4.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+
<Export-Package>net.geant.perfsonar.*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added:
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/Command.java
===================================================================
---
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/Command.java
(rev 0)
+++
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/Command.java
2013-03-20 21:57:01 UTC (rev 6235)
@@ -0,0 +1,171 @@
+package net.geant.perfsonar.mp.sshtelnet;
+
+import java.io.IOException;
+
+import net.geant.perfsonar.annotations.Namespace;
+import net.geant.perfsonar.annotations.XPath;
+
+public class Command {
+
+ public static final Command PING = new Command("ping", "ping an [ip
address]", "[ip address]", "IP_PING");
+
+ public static Command SHOW_ENVIRONMENT = new Command("show
environment", "show chassis environment", "",
"http://schemas.perfsonar.net/tools/sshtelnet/STATUS_SHOW_ENVIRONMENT/1.0");
+
+ public static final Command TRACE_IPV4 = new Command("trace", "trace
the IPv4 path to [ip address]", "[ip address]",
"http://schemas.perfsonar.net/tools/sshtelnet/IP_TRACEROUTE/1.0");
+
+ public static final Command TRACE_IPV6 = new Command("trace ipv6",
"trace the ipv6 path to [IPv6 address]", "[IPv6 address]",
"http://schemas.perfsonar.net/tools/sshtelnet/IPv6_TRACEROUTE/1.0");
+
+ public static final Command SHOW_INTERFACES_FILTERS = new
Command("show interfaces filters", "display ip access lists", "",
"http://schemas.perfsonar.net/tools/sshtelnet/IP_ACCESS_LIST/1.0");
+
+ //public static final Command SHOW_IPV6_INTERFACES_FILTERS = new
Command("show interfaces filters", "display IPv6 access lists");
+
+ public static final Command SHOW_IPV6_INTERFACES = new Command("show
interfaces", "display the interfaces which are configured for IPv6",
"[interface] extensive",
"http://schemas.perfsonar.net/tools/sshtelnet/IPv6_INTERFACES/1.0");
+
+ public static final Command PING_IPV6 = new Command("ping inet6",
"ping an [IPv6 address]", "[IPv6 address]",
"http://schemas.perfsonar.net/tools/sshtelnet/IPv6_PING/1.0");
+
+ public static final Command TRACEROUTER_IPV6 = new
Command("traceroute inet6", "trace the ipv6 path to [ipv6 address]", "[IPv6
address]",
"http://schemas.perfsonar.net/tools/sshtelnet/IPv6_TRACEROUTE/1.0");
+
+ private static Router currentRouter;
+
+ private String routerName;
+
+ private String name;
+ private String description;
+ private String syntax;
+
+ private Router router;
+
+ private String eventType;
+
+ private Command(String name, String description, String syntax,
String eventType) {
+ this(currentRouter, name, description, syntax, eventType);
+ }
+
+ private Command(Router router, String name, String description,
String syntax, String eventType) {
+ this.router = router;
+ this.name = name;
+ this.description = description;
+ this.syntax = syntax;
+ this.eventType = eventType;
+ }
+
+ public Command() {
+ this(currentRouter, null, null, null, null);
+ }
+
+ public String getEventType() {
+ return eventType;
+ }
+
+ @XPath(xpath="nmwg:message/nmwg:metadata/nmwg:eventType/text()")
+ public void setEventType(String eventType) {
+ this.eventType = eventType;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getSyntax() {
+ return syntax;
+ }
+
+ public void execute() throws IOException {
+ //router.execute(this);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((description == null) ? 0 :
description.hashCode());
+ result = prime * result + ((name == null) ? 0 :
name.hashCode());
+ result = prime * result + ((syntax == null) ? 0 :
syntax.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Command other = (Command) obj;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (syntax == null) {
+ if (other.syntax != null)
+ return false;
+ } else if (!syntax.equals(other.syntax))
+ return false;
+ return true;
+ }
+
+ public void setCurrentRouter(Router router) {
+ Command.currentRouter = router;
+ this.router = router;
+ }
+
+ public void setRouter(Router router) {
+ this.router = router;
+ }
+
+
@XPath(xpath="nmwg:message/nmwg:metadata/nmwg:parameters/nmwg:parameter[@name='command']/@value")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
@XPath(xpath="nmwg:message/nmwg:metadata/nmwg:parameters/nmwg:parameter[@name='description']/@value")
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+
@XPath(xpath="nmwg:message/nmwg:metadata/nmwg:parameters/nmwg:parameter[@name='syntax']/@value")
+ public void setSyntax(String syntax) {
+ this.syntax = syntax;
+ }
+
+ @Override
+ public String toString() {
+ return "Command [name=" + name + ", description=" +
description
+ + ", syntax=" + syntax + ", router=" +
(router != null ? router.getName() : routerName) + "]";
+ }
+
+ public String getResult() {
+ return "For address family: IPv4 Unicast@@@@@@For address
family: IPv6 Unicast@@@@@@For address family: VPNv4 Unicast@@@@@@For address
family: IPv4 Multicast@@@@@@For address family: IPv6 Multicast@@@@@@For
address family: NSAP Unicast@@@---END---";
+ }
+
+ public String getRouterName() {
+ return routerName;
+ }
+
+
@XPath(xpath="nmwg:message/nmwg:metadata/nmwg:subject/nmwgtopo:endPoint/text()",
namespaces=@Namespace(prefix="nmwgtopo",
uri="http://ggf.org/ns/nmwg/topology/2.0/"))
+ public void setRouterName(String routerName) {
+ this.routerName = routerName;
+ }
+
+ public Command newInstance() {
+ final Command result = new Command();
+ result.setDescription(this.description);
+ result.setEventType(this.eventType);
+ result.setName(this.name);
+ result.setRouterName(this.routerName);
+ result.setSyntax(this.syntax);
+ return result;
+ }
+}
Added:
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/ConfigurationFileChecker.java
===================================================================
---
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/ConfigurationFileChecker.java
(rev 0)
+++
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/ConfigurationFileChecker.java
2013-03-20 21:57:01 UTC (rev 6235)
@@ -0,0 +1,70 @@
+package net.geant.perfsonar.mp.sshtelnet;
+
+import static net.geant.perfsonar.messaging.XPathDeserializer.any;
+import static net.geant.perfsonar.messaging.XPathDeserializer.declarePrefix;
+import static net.geant.perfsonar.messaging.XPathDeserializer.whenXPath;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import net.geant.perfsonar.ls.LSRegistrationTask;
+import net.geant.perfsonar.messaging.Helper;
+import net.geant.perfsonar.messaging.XPathDeserializer;
+
+import org.xml.sax.InputSource;
+
+/**
+ * Scheduler task that checks every second whether configuration file has
changed.
+ * When it's changed it reads the configuration and injects to object model.
+ *
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class ConfigurationFileChecker implements Runnable {
+
+ private File file = new File("src/main/resources/configuration.xml");
+ private long lastModified = 0;
+ private final SSHTelnetMPService service;
+
+ public ConfigurationFileChecker(SSHTelnetMPService
sshTelnetMPService) {
+ this.service = sshTelnetMPService;
+ }
+
+ public void run() {
+ if (!file.exists()) {
+ System.err.println("Configuration file: " +
file.getAbsolutePath()
+ + " is missing");
+ return;
+ }
+
+ if (file.lastModified() > lastModified) {
+ lastModified = file.lastModified();
+ configureDeserialization();
+ XPathDeserializer deserializer = new
XPathDeserializer();
+ try {
+ deserializer.deserialize(new InputSource(new
FileInputStream(file)));
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ private void configureDeserialization() {
+ //When configuring XPath the configurator creates a subclass
of SSHTelnetMPService that registers method invocations.
+ //The instance executes base class constructor of
SSHTelnetMPService which creates this task.
+ //This guard prevents calls from subclass instances forever
when configuring XPath.
+ if (Helper.isConfigurationInstance(service))
+ return;
+
+ declarePrefix("ns",
"http://service.perfsonar.org/ns/config/base/0.9/");
+
+ try {
+ whenXPath(
+
"ns:configuration/ns:service/ns:auxiliaryComponents/ns:component[@name='scheduling']/ns:actions/ns:action[@name='registration']/ns:option[@name='interval']/@value")
+ .then(SSHTelnetMPService.class,
service).setLookupServiceInterval(any(String.class));
+
+ whenXPath(
+
"ns:configuration/ns:service/ns:auxiliaryComponents/ns:component[@name='scheduling']/ns:actions/ns:action[@name='registration']/ns:option[starts-with(@name,
'lsAddress')]/@value")
+
.then(LSRegistrationTask.class).addLSAddress(any(String.class));
+ } catch (Exception ex) { }
+ }
+}
Added:
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/Router.java
===================================================================
---
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/Router.java
(rev 0)
+++
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/Router.java
2013-03-20 21:57:01 UTC (rev 6235)
@@ -0,0 +1,148 @@
+package net.geant.perfsonar.mp.sshtelnet;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class Router {
+
+ private static final int PORT_UNDEFINED = -1;
+
+ public String name;
+
+ public InetAddress address;
+
+ public int port;
+
+ private String id;
+
+ private List<Command> commands = new ArrayList<Command>();
+
+ public Router() {
+
+ }
+
+ public Router(String id, String name, InetAddress address, Command...
commands) {
+ this(id, name, address, PORT_UNDEFINED, commands);
+ }
+
+ public Router(String id, String name, InetAddress address, int port,
Command... commands) {
+ this.id = id;
+ this.name = name;
+ this.address = address;
+ this.port = port;
+ for (Command c : commands) {
+ c.setRouter(this);
+ addCommand(c);
+ }
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public InetAddress getAddress() {
+ return address;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public void addCommand(Command command) {
+ commands.add(command);
+ }
+
+ public List<Command> getCommands() {
+ return Collections.unmodifiableList(commands);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((address == null) ? 0 :
address.hashCode());
+ result = prime * result
+ + ((commands == null) ? 0 :
commands.hashCode());
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((name == null) ? 0 :
name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Router other = (Router) obj;
+ if (address == null) {
+ if (other.address != null)
+ return false;
+ } else if (!address.equals(other.address))
+ return false;
+ if (commands == null) {
+ if (other.commands != null)
+ return false;
+ } else if (!commands.equals(other.commands))
+ return false;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+// public RouterConnection connect() throws IOException {
+// //return connectionManager.connect(url, port);
+// return null;
+// }
+
+ @Override
+ public String toString() {
+ return "Router [name=" + name + ", address=" + address + ",
id=" + id
+ + ", commands=" + commands + "]";
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setAddress(String address) throws UnknownHostException {
+ this.address = InetAddress.getAllByName(address)[0];
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void startAddingCommands(String routerId) {
+ // TODO Auto-generated method stub
+
+ }
+
+// public void execute(Command command) throws IOException {
+// RouterConnection conn = null;
+// try {
+// conn = connect();
+// //command.result =
device.filter(conn.execute(device.toCommand(command)));
+// } finally {
+// if (conn != null)
+// conn.close();
+// }
+// }
+}
Added:
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/SSHTelnetMPService.java
===================================================================
---
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/SSHTelnetMPService.java
(rev 0)
+++
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/SSHTelnetMPService.java
2013-03-20 21:57:01 UTC (rev 6235)
@@ -0,0 +1,99 @@
+package net.geant.perfsonar.mp.sshtelnet;
+
+import static net.geant.perfsonar.Configuration.configure;
+import static net.geant.perfsonar.Configuration.when;
+import static
net.geant.perfsonar.ls.LSRegistrationTask.registerToLookupService;
+import static net.geant.perfsonar.messaging.XPathDeserializer.any;
+import static net.geant.perfsonar.messaging.XPathDeserializer.whenXPath;
+
+import javax.xml.ws.WebServiceProvider;
+
+import net.geant.perfsonar.PerfSONAR;
+import net.geant.perfsonar.ServiceType;
+import net.geant.perfsonar.ls.LSRegistrationTask;
+
+@WebServiceProvider
+public class SSHTelnetMPService extends PerfSONAR {
+
+ private static final int HOUR = 60 * 60;
+
+ private static final int SECOND = 1;
+
+ private final LSRegistrationTask lsRegistrationTask = new
LSRegistrationTask(
+ logger, this);
+ private int lsInterval = HOUR;
+
+ public SSHTelnetMPService() {
+ super();
+
+ scheduler.runEvery(HOUR, lsRegistrationTask);
+ scheduler.runEvery(SECOND, new
ConfigurationFileChecker(this));
+ }
+
+ @Override
+ public ServiceType getServiceType() {
+ return ServiceType.MP;
+ }
+
+ @Override
+ public String getServiceName() {
+ return "SSHTELNET";
+ }
+
+ static {
+ try {
+ if (!isUsingAPT()) {
+ // if apt is not in classpath (maven dependencies)
one must
+ // provide configuration using API
+ configure(when("MetadataKeyRequest").then(
+ ServiceController.class)
+
.listAvailableRoutersAndCommands());
+
+ configure(when("SetupDataRequest")
+
.then(ServiceController.class).execute(
+
any(Command.class)));
+
+
configure(registerToLookupService(ServiceController.class)
+
.listAvailableRoutersAndCommands());
+
+ whenXPath(
+
"nmwg:message/nmwg:metadata/nmwg:subject/nmwgtopo:endPoint/text()")
+
.then(Command.class).setRouterName(any(String.class));
+
+
whenXPath("nmwg:message/nmwg:metadata/nmwg:eventType/text()")
+
.then(Command.class).setEventType(any(String.class));
+
+ whenXPath(
+
"nmwg:message/nmwg:metadata/nmwg:parameters/nmwg:parameter[@name='command']/@value")
+
.then(Command.class).setName(any(String.class));
+
+ whenXPath(
+
"nmwg:message/nmwg:metadata/nmwg:parameters/nmwg:parameter[@name='description']/@value")
+
.then(Command.class).setDescription(any(String.class));
+
+ whenXPath(
+
"nmwg:message/nmwg:metadata/nmwg:parameters/nmwg:parameter[@name='syntax']/@value")
+
.then(Command.class).setSyntax(any(String.class));
+ }
+ } catch (Exception ex) {
+ }
+ }
+
+ /**
+ * Sets timeout in seconds between subsequent
registrations/keepalives to
+ * Lookup Service.
+ */
+ public synchronized void setLookupServiceInterval(String interval) {
+ lsInterval = Integer.parseInt(interval);
+ scheduler.stop(lsRegistrationTask);
+ scheduler.runEvery(lsInterval, lsRegistrationTask);
+ }
+
+ /**
+ * Returns timeout in seconds between subsequent
registrations/keepalives to
+ * Lookup Service.
+ */
+ public synchronized int getLookupServiceInterval() {
+ return lsInterval;
+ }
+}
Added:
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/ServiceController.java
===================================================================
---
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/ServiceController.java
(rev 0)
+++
trunk/perfsonar-base/sample-service/src/main/java/net/geant/perfsonar/mp/sshtelnet/ServiceController.java
2013-03-20 21:57:01 UTC (rev 6235)
@@ -0,0 +1,31 @@
+package net.geant.perfsonar.mp.sshtelnet;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.List;
+
+import net.geant.perfsonar.annotations.LookupServiceRegister;
+import net.geant.perfsonar.annotations.request.MetadataKey;
+import net.geant.perfsonar.annotations.request.SetupData;
+
+public class ServiceController {
+ public ServiceController() { }
+
+ @MetadataKey
+ @LookupServiceRegister
+ public List<Router> listAvailableRoutersAndCommands() throws
UnknownHostException {
+ return Arrays.asList(
+ new Router("metadata0", "Cisco",
InetAddress.getAllByName("10.10.14.4")[0],
+ Command.SHOW_ENVIRONMENT, Command.PING),
+ new Router("metadata1", "JuniperGeantAmsterdam",
InetAddress.getByName("10.10.14.5"),
+ Command.SHOW_INTERFACES_FILTERS));
+ }
+
+ @SetupData
+ public Command execute(Command command) throws IOException {
+ command.execute();
+ return command;
+ }
+}
Added:
trunk/perfsonar-base/sample-service/src/main/resources/configuration.xml
===================================================================
--- trunk/perfsonar-base/sample-service/src/main/resources/configuration.xml
(rev 0)
+++ trunk/perfsonar-base/sample-service/src/main/resources/configuration.xml
2013-03-20 21:57:01 UTC (rev 6235)
@@ -0,0 +1,132 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<configuration xmlns="http://service.perfsonar.org/ns/config/base/0.9/">
+ <service name="sshtelnet-mp">
+ <lookupInformation>
+ <option name="accessPoint"
value="http://localhost:${tomcat.port}/${project.artifactId}/services/SSHTelnet"/>
+ <option name="serviceName" value="Geant3 JAVA - SSHTelnet MP"/>
+ <option name="serviceType" value="MP"/>
+ </lookupInformation>
+
+ <!-- Message Handlers - message types and service engines -->
+
+ <messageHandler>
+
+ <message type="EchoRequest"
+
handler="org.perfsonar.base2.service.messages.GenericMessageHandler">
+ <option name="ServiceEngine"
+
value="org.perfsonar.service.measurementPoint.EchoServiceEngine" />
+ <option name="authN" value="no" />
+ </message>
+
+ <message type="MetadataKeyRequest"
+
handler="org.perfsonar.base2.service.messages.GenericMessageHandler">
+ <option name="ServiceEngine"
+
value="org.perfsonar.service.measurementPoint.ServiceCapabilitiesEngine" />
+ <option name="authN" value="no" />
+ </message>
+
+ <message type="SetupDataRequest"
+
handler="org.perfsonar.base2.service.messages.GenericMessageHandler">
+ <option name="ServiceEngine"
+
value="org.perfsonar.service.measurementPoint.SetupDataServiceEngine" />
+ <option name="authN" value="no" />
+ </message>
+
+ </messageHandler>
+
+ <!-- Additional auxiliary components -->
+
+ <auxiliaryComponents>
+ <component name="migrator"
className="org.perfsonar.base2.service.configuration.migration.MigratorComponent">
+ <option name="config-directory" value="${old-config-directory}" />
+ </component>
+ <component name="XMLDB"
className="org.perfsonar.base2.service.storage.xml.XMLDBComponent">
+ <option name="dataStorageClassName"
value="org.perfsonar.base2.service.storage.xml.exist.ExistHTTPDataStorage" />
+ <option name="uri"
value="http://localhost:${tomcat.port}/exist/rest/db"/>
+ <option name="username" value="sshtelnet"/>
+ <option name="password" value="sshtelnet"/>
+ </component>
+
+ <component name="Configuration"
className="org.perfsonar.service.measurementPoint.Configuration">
+ <option name="metadata-file"
value="${config.path}/sshtelnetmetadata.xml" />
+ <option name="token-path" value="${token.path}" />
+ </component>
+
+ <!-- auth configuration -->
+ <component name="auth"
className="org.perfsonar.base2.service.authn.component.wssec.WSSecAuthNComponent">
+ <option name="as_endpoint"
value="http://homer.rediris.es:8080/geant2-java-as-1.2/services/SimpleService"/>
+ <option name="comp_id" value="urn:compId"/>
+ </component>
+
+ <!-- Scheduler -->
+ <component name="scheduling"
className="org.perfsonar.base2.service.scheduler.SchedulingComponent">
+ <option name="schedulerClassName"
value="org.perfsonar.base2.service.scheduler.SimpleScheduler"/>
+ <option name="interval" value="60"/>
+
+ <actions>
+ <action name="registration"
className="org.perfsonar.base2.service.registration.LSRegistrationAction">
+ <option name="status" value="on" />
+ <option name="interval" value="2" />
+ <option name="registerDataSource"
value="org.perfsonar.base2.service.registration.MetadataExistDBRegisterDataSource"/>
+ <option name="registerEventType"
value="http://ogf.org/ns/nmwg/tools/org/perfsonar/service/lookup/registration/summary/2.0"/>
+ <option name="registrator"
value="org.perfsonar.base2.service.registration.GenericLSRegistrator"/>
+ <option name="lsAddress-1"
value="http://localhost:9000/perfsonar-ls"/>
+ </action>
+
+ <!-- Checks whether a given metadata file has changed and updates
it in the database.
+ If the given metadata file is not stored in the database it
is added. -->
+ <action name="metadata-updater"
className="org.perfsonar.service.measurementPoint.MetadataUpdater">
+ <!-- Should the user configured in the "Configuration" section
be created if it does not exist -->
+ <option name="create-user" value="yes" />
+
+ <!-- login and password for the user that has rights to create
user accounts. Obligatory only when "create-user" option is set to "yes" -->
+ <option name="username" value="admin" />
+ <option name="password" value="" />
+ </action>
+ </actions>
+ </component>
+ </auxiliaryComponents>
+
+ <extension name="registerExtension-registerDataSource">
+ <option name="exist-config" value="XMLDB" />
+ </extension>
+
+ <!--
....................................................................................
-->
+
+ <!-- Protocol mappings, XML elements and their bingings -->
+
+ <protocolMappings>
+
+
+ <!-- default mapping -->
+
+
+ <!-- general mappings -->
+ <element name="{*}message"
+ mapping="org.perfsonar.base2.xml.nmwg.Message"/>
+ <element name="{*}metadata"
+ mapping="org.perfsonar.base2.xml.nmwg.Metadata"/>
+ <element name="{*}eventType"
+ mapping="org.perfsonar.base2.xml.nmwg.EventType"/>
+ <element name="{*}data"
+ mapping="org.perfsonar.base2.xml.nmwg.Data"/>
+ <element name="{*}subject"
+ mapping="org.perfsonar.base2.xml.nmwg.Subject"/>
+ <element name="{*}parameters"
+ mapping="org.perfsonar.base2.xml.nmwg.Parameters"/>
+ <element name="{*}parameter"
+ mapping="org.perfsonar.base2.xml.nmwg.Parameter"/>
+ <element name="*"
+ mapping="org.perfsonar.base2.xml.Element"/>
+ <element
name="{http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/xquery/1.0/}subject"
+ mapping="org.perfsonar.base2.xml.TextElement"/>
+
+
+ </protocolMappings>
+
+
+ </service>
+
+
+</configuration>
Added:
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/sshtelnet/LSRegister.template
===================================================================
---
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/sshtelnet/LSRegister.template
(rev 0)
+++
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/sshtelnet/LSRegister.template
2013-03-20 21:57:01 UTC (rev 6235)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nmwg:message id="${requestId}" type="LSRegisterRequest"
xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+ <nmwg:metadata id="serviceLookupInfo">
+
<nmwg:eventType>http://ogf.org/ns/nmwg/tools/org/perfsonar/service/lookup/registration/service/2.0</nmwg:eventType>
+ <nmwg:subject id="commonParameters" name="perfsonar">
+ <psservice:service id="serviceParameters"
xmlns:psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/">
+
<psservice:accessPoint>http://localhost:9000/perfsonar-sshtelnet-mp</psservice:accessPoint>
+
<psservice:serviceName>${service.serviceName}</psservice:serviceName>
+
<psservice:serviceType>${service.serviceType}</psservice:serviceType>
+ </psservice:service>
+ </nmwg:subject>
+ </nmwg:metadata>
+ <nmwg:data metadataIdRef="serviceLookupInfo">
+ <nmwg:metadata id="metadata0">
+ <nmwg:subject
id="subject0">DummyCiscoRouter</nmwg:subject>
+ <nmwg:parameters id="metaParams0">
+ <nmwg:parameter name="class_name"
value="org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoAdapter"
/>
+ <nmwg:parameter name="url" value="0.0.0.0" />
+ <nmwg:parameter name="port" value="0" />
+ <nmwg:parameter name="prompt"
value="DummyRouter>" />
+ <nmwg:parameter name="rate" value="500" />
+ <nmwg:parameter name="username"
value="dummyUser" />
+ <nmwg:parameter name="password"
value="ab05D8Z22537EdEzaWmlmA==" />
+ <nmwg:parameter name="timeout" value="10000"
/>
+ <nmwg:parameter name="numberOfUsers"
value="0" />
+ <nmwg:parameter name="cache" value="0" />
+ </nmwg:parameters>
+ </nmwg:metadata>
+ </nmwg:data>
+</nmwg:message>
Added:
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/sshtelnet/MetadataKeyResponse.template
===================================================================
---
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/sshtelnet/MetadataKeyResponse.template
(rev 0)
+++
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/sshtelnet/MetadataKeyResponse.template
2013-03-20 21:57:01 UTC (rev 6235)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<nmwg:message id="${requestId}_resp" messageIdRef="${requestId}"
type="MetadataKeyResponse" xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+#set( $idx = 0 )
+#foreach ($router in $result)
+ <nmwg:metadata id="metadata${idx}">
+ <nmwg:subject id="subject${idx}">${router.name}</nmwg:subject>
+ <nmwg:parameters id="metaParams${idx}">
+ <nmwg:parameter name="url" value="${router.address.hostAddress}"
/>
+ </nmwg:parameters>
+ </nmwg:metadata>
+ <nmwg:metadata id="resultCodeMeta_${idx}">
+ <nmwg:subject id="resultCodeSubj_${idx}"
metadataIdRef="metadata${idx}" />
+ <nmwg:eventType>success.mp.sshtelnet</nmwg:eventType>
+ </nmwg:metadata>
+ <nmwg:data id="resultCodeData_${idx}"
metadataIdRef="resultCodeMeta_${idx}">
+ <nmwgr:datum
xmlns:nmwgr="http://ggf.org/ns/nmwg/result/2.0/">Successfully executed
MetaDataKeyRequest</nmwgr:datum>
+ </nmwg:data>
+#set( $idx = $idx + 1 )
+#end
+#set( $idx = 0 )
+#foreach ($router in $result)
+ <nmwg:data id="data${idx}" metadataIdRef="metadata${idx}">
+#foreach ($command in $router.commands)
+ <nmwgr:datum xmlns:nmwgr="http://ggf.org/ns/nmwg/result/2.0/">
+ <nmwg:parameters id="params${idx}">
+ <nmwg:parameter name="command" value="${command.name}" />
+ <nmwg:parameter name="description"
value="${command.description}" />
+#if (${command.syntax})
+ <nmwg:parameter name="syntax" />
+#else
+ <nmwg:parameter name="syntax" value="${command.syntax} />
+#end
+ </nmwg:parameters>
+ <nmwg:eventType>${command.eventType}</nmwg:eventType>
+ </nmwgr:datum>
+#end
+ </nmwg:data>
+#set( $idx = $idx + 1 )
+#end
+</nmwg:message>
\ No newline at end of file
Added:
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/sshtelnet/SetupDataResponse.template
===================================================================
---
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/sshtelnet/SetupDataResponse.template
(rev 0)
+++
trunk/perfsonar-base/sample-service/src/main/resources/net/geant/perfsonar/mp/sshtelnet/SetupDataResponse.template
2013-03-20 21:57:01 UTC (rev 6235)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<nmwg:message xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
id="${requestId}_resp" messageIdRef="${requestId}" type="SetupDataResponse">
+#set ($idx = 0)
+#foreach ($command in $result)
+ <nmwg:metadata id="meta${idx}">
+ <nmwg:subject id="subject${idx}">
+ <nmwgtopo:endPoint
xmlns:nmwgtopo="http://ggf.org/ns/nmwg/topology/2.0/"
type="hostname">${command.routerName}</nmwgtopo:endPoint>
+ </nmwg:subject>
+ <nmwg:parameters id="params${idx}" />
+ <nmwg:eventType>${command.eventType}</nmwg:eventType>
+ </nmwg:metadata>
+ <nmwg:data id="data${idx}" metadataIdRef="meta${idx}">
+ <nmwg:datum>${command.result}</nmwg:datum>
+ </nmwg:data>
+ <nmwg:metadata id="resultCodeMeta_meta${idx}">
+ <nmwg:subject id="resultCodeSubj_meta${idx}"
metadataIdRef="meta${idx}" />
+ <nmwg:eventType>success.mp.sshtelnet</nmwg:eventType>
+ </nmwg:metadata>
+ <nmwg:data id="resultCodeData_meta${idx}"
metadataIdRef="resultCodeMeta_meta${idx}">
+ <nmwgr:datum
xmlns:nmwgr="http://ggf.org/ns/nmwg/result/2.0/">Successfully executed
request</nmwgr:datum>
+ </nmwg:data>
+#set ($idx = $idx + 1)
+#end
+</nmwg:message>
Added:
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/SSHTelnetMPWebServiceTest.java
===================================================================
---
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/SSHTelnetMPWebServiceTest.java
(rev 0)
+++
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/SSHTelnetMPWebServiceTest.java
2013-03-20 21:57:01 UTC (rev 6235)
@@ -0,0 +1,45 @@
+package net.geant.perfsonar;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import javax.xml.ws.Endpoint;
+
+import net.geant.perfsonar.helpers.PerfSONARServiceClient;
+import net.geant.perfsonar.helpers.Response;
+import net.geant.perfsonar.mp.sshtelnet.SSHTelnetMPService;
+import net.geant.perfsonar.templates.NMWG;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+public class SSHTelnetMPWebServiceTest {
+ private static final String REQUEST_ID = "request1";
+ private static final String SERVICE_URL =
"http://localhost:9000/perfsonar-java-sshtelnet-mp";
+
+ private SSHTelnetMPService service = new SSHTelnetMPService();
+ private Endpoint endpoint;
+
+ @Before
+ public void givenSSHTelnetMPWebService() throws InterruptedException,
IOException {
+ endpoint = Endpoint.publish(SERVICE_URL, service);
+
+ }
+
+ @After
+ public void stopServices() {
+ endpoint.stop();
+ service.stop();
+ endpoint = null;
+ service = null;
+ }
+
+ @Test
+ public void shouldSayEcho() throws SAXException, InterruptedException
{
+ final PerfSONARServiceClient client = new
PerfSONARServiceClient(SERVICE_URL);
+ assertEquals(new Response(NMWG.toEchoResponse(REQUEST_ID)),
client.echo(REQUEST_ID));
+ }
+}
Added:
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/sshtelnet/LSRegisterTest.java
===================================================================
---
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/sshtelnet/LSRegisterTest.java
(rev 0)
+++
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/sshtelnet/LSRegisterTest.java
2013-03-20 21:57:01 UTC (rev 6235)
@@ -0,0 +1,21 @@
+package net.geant.perfsonar.mp.sshtelnet;
+
+import net.geant.perfsonar.PerfSONAR;
+import net.geant.perfsonar.ls.LSRegisterTestBase;
+
+public class LSRegisterTest extends LSRegisterTestBase {
+ private SSHTelnetMPService service;
+
+ @Override
+ protected PerfSONAR givenService() {
+ if (service == null)
+ service = new SSHTelnetMPService();
+ return service;
+ }
+
+ @Override
+ protected int getLSInterval() {
+ return service.getLookupServiceInterval();
+ }
+
+}
Added:
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/sshtelnet/SSHTelnetMPTest.java
===================================================================
---
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/sshtelnet/SSHTelnetMPTest.java
(rev 0)
+++
trunk/perfsonar-base/sample-service/src/test/java/net/geant/perfsonar/mp/sshtelnet/SSHTelnetMPTest.java
2013-03-20 21:57:01 UTC (rev 6235)
@@ -0,0 +1,74 @@
+package net.geant.perfsonar.mp.sshtelnet;
+
+import static net.geant.perfsonar.templates.SelfTestResult.failure;
+import static net.geant.perfsonar.templates.SelfTestResult.success;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import net.geant.perfsonar.helpers.PerfSONARClient;
+import net.geant.perfsonar.helpers.Response;
+import net.geant.perfsonar.templates.NMWG;
+import net.geant.perfsonar.templates.SelfTestResult;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.SAXException;
+
+public class SSHTelnetMPTest {
+
+ protected Logger logger = LoggerFactory.getLogger(getClass());
+
+ static final String REQUEST_ID = "request1";
+ private PerfSONARClient client;
+ private final SSHTelnetMPService service = new SSHTelnetMPService();
+
+ @Before
+ public void givenPerfSONARClient() {
+ client = new PerfSONARClient(service);
+ }
+
+ @Test
+ public void checkEcho() throws Exception {
+ assertEquals(new Response(NMWG.toEchoResponse(REQUEST_ID)),
client.echo(REQUEST_ID));
+ }
+
+ @Test
+ public void checkSelfTest() throws SAXException {
+ assertEquals(
+ new Response(NMWG.toSelfTestResponse(
+ REQUEST_ID,
+ new SelfTestResult[] {
+
success("test1", "Test passed.", "SSHTELNET", "MP"),
+
failure("test2", "Test failed.", "SSHTELNET", "MP"), })),
+ client.selfTest(REQUEST_ID));
+ }
+
+ @Test
+ public void checkMetadataKey() throws SAXException, IOException {
+ print(client.listAvailableCommands(REQUEST_ID).getReader());
+ }
+
+ @Test
+ public void checkSetupDataRequest() throws Exception {
+ final Command command1 = (Command) Command.SHOW_ENVIRONMENT
+ .newInstance();
+ command1.setRouterName("host1");
+ final Command command2 = (Command)
Command.PING_IPV6.newInstance();
+ command2.setRouterName("host2");
+ print(client.executeCommands(REQUEST_ID, command1, command2)
+ .getReader());
+ }
+
+ private void print(Reader reader) throws IOException {
+ String printed = "";
+ for (int i = reader.read(); i != -1; i = reader.read()) {
+ printed += (char) i;
+ }
+
+ logger.debug(printed);
+ }
+}
- [pS-dev] [GEANT/SA2/ps-java-services] r6235 - in trunk/perfsonar-base/sample-service: . src src/main src/main/java src/main/java/net src/main/java/net/geant src/main/java/net/geant/perfsonar src/main/java/net/geant/perfsonar/mp src/main/java/net/geant/perfsonar/mp/sshtelnet src/main/resources src/main/resources/net src/main/resources/net/geant src/main/resources/net/geant/perfsonar src/main/resources/net/geant/perfsonar/mp src/main/resources/net/geant/perfsonar/mp/sshtelnet src/test src/test/java src/test/java/net src/test/java/net/geant src/test/java/net/geant/perfsonar src/test/java/net/geant/perfsonar/mp src/test/java/net/geant/perfsonar/mp/sshtelnet, svn-noreply, 03/20/2013
Archive powered by MHonArc 2.6.16.