perfsonar-dev - perfsonar: r3886 - in branches/perfsonarui/src: . org/perfsonar/perfsonarui org/perfsonar/perfsonarui/lookingglass org/perfsonar/perfsonarui/ls org/perfsonar/perfsonarui/plugins org/perfsonar/perfsonarui/test org/perfsonar/perfsonarui/test/ls org/perfsonar/perfsonarui/ui org/perfsonar/perfsonarui/ui/actions
Subject: perfsonar development work
List archive
perfsonar: r3886 - in branches/perfsonarui/src: . org/perfsonar/perfsonarui org/perfsonar/perfsonarui/lookingglass org/perfsonar/perfsonarui/ls org/perfsonar/perfsonarui/plugins org/perfsonar/perfsonarui/test org/perfsonar/perfsonarui/test/ls org/perfsonar/perfsonarui/ui org/perfsonar/perfsonarui/ui/actions
Chronological Thread
- From:
- To:
- Subject: perfsonar: r3886 - in branches/perfsonarui/src: . org/perfsonar/perfsonarui org/perfsonar/perfsonarui/lookingglass org/perfsonar/perfsonarui/ls org/perfsonar/perfsonarui/plugins org/perfsonar/perfsonarui/test org/perfsonar/perfsonarui/test/ls org/perfsonar/perfsonarui/ui org/perfsonar/perfsonarui/ui/actions
- Date: Tue, 27 May 2008 12:43:55 -0400
Author: nina
Date: 2008-05-27 12:43:55 -0400 (Tue, 27 May 2008)
New Revision: 3886
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSManager.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSQueryMetadata.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSQueryRaw.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSQueryServices.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSQueryServicesEvents.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSXQuery.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/UnmarshalException.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/XML.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/XQueryParams.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/ls/LSQueryMetadataTest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/ls/LSQueryRawTest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/ls/LSQueryServicesEventsTest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/ls/LSQueryServicesTest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/ls/LSTest.java
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractMARequest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/PerfsonarSchema.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassTab.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSRequest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSResponseListener.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MAEndpoint.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/LSRequestTest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ShowEndpointsAction.java
branches/perfsonarui/src/perfsonarui.classes
Log:
Lookup service support. Use LSManager.java singleton to obtain addresses of
the "root"lookup services. Use LSXQuery.java derived classes to query and
retrieve information from a Lookup service.
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractMARequest.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractMARequest.java
2008-05-27 16:43:49 UTC (rev 3885)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/AbstractMARequest.java
2008-05-27 16:43:55 UTC (rev 3886)
@@ -73,6 +73,8 @@
public static String NMWG = "http://ggf.org/ns/nmwg/";
public static String NMWG2 = "http://ggf.org/ns/nmwg/base/2.0/";
protected static String URI_nmwgr =
"http://ggf.org/ns/nmwg/result/2.0/";
+ public static String PSUI =
"http://ggf.org/ns/nmwg/tools/org/perfsonar-ui/1.0/";
+
protected static PSLogger logger = new
PSLogger(AbstractMARequest.class);
protected long id;
protected PropertyChangeSupport propertyChangeSupport;
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/PerfsonarSchema.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/PerfsonarSchema.java
2008-05-27 16:43:49 UTC (rev 3885)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/PerfsonarSchema.java
2008-05-27 16:43:55 UTC (rev 3886)
@@ -39,6 +39,7 @@
protected final String schema;
protected static Hashtable<String,IPerfsonarSchema> schemas = new
Hashtable<String,IPerfsonarSchema>();
+ protected static Hashtable<String,String> eventTypes2schema = null;
/**
* @deprecated , will become protected. Use
{@link
#getInstance("your_schema")};
* @param schema
@@ -69,11 +70,28 @@
return hash;
}
public static IPerfsonarSchema getInstance(String schema) {
-
- IPerfsonarSchema s = schemas.get(schema);
+ //for backward compatibility with MA.conf.
+ if (eventTypes2schema == null) {
+ eventTypes2schema = new Hashtable<String,String>();
+
eventTypes2schema.put("http://ggf.org/ns/nmwg/characteristic/utilization/2.0",
"http://schemas.perfsonar.net/2.0");
+
eventTypes2schema.put("http://ggf.org/ns/nmwg/characteristic/errors/2.0",
"http://schemas.perfsonar.net/2.0");
+
eventTypes2schema.put("http://ggf.org/ns/nmwg/characteristic/discards/2.0",
"http://schemas.perfsonar.net/2.0");
+ eventTypes2schema.put("utilization", "NMWG2v2_netutil");
+ eventTypes2schema.put("ippm_aggregated", "ippm");
+ eventTypes2schema.put("ripe", "ippm");
+ eventTypes2schema.put("bwctl", "bwctl");
+ eventTypes2schema.put("ls", "ls");
+ eventTypes2schema.put("as", "as");
+ eventTypes2schema.put("lg", "lg");
+ eventTypes2schema.put("flowsa", "flowsa");
+
+ }
+ String translated = eventTypes2schema.get(schema);
+ if (translated == null) translated = schema;
+ IPerfsonarSchema s = schemas.get(translated);
if (s == null) {
- s = new PerfsonarSchema(schema);
- schemas.put(schema,s);
+ s = new PerfsonarSchema(translated);
+ schemas.put(translated,s);
}
return s;
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassTab.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassTab.java
2008-05-27 16:43:49 UTC (rev 3885)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LookingGlassTab.java
2008-05-27 16:43:55 UTC (rev 3886)
@@ -101,7 +101,7 @@
@Override
public List<IPerfsonarSchema> getSupportedRequests() {
ArrayList<IPerfsonarSchema> list = new ArrayList<IPerfsonarSchema>();
- list.add(new PerfsonarSchema("lg"));
+ list.add(PerfsonarSchema.getInstance("lg"));
//this is the string appearing in MA.conf
//is LG dealing with a single schema/service, or there is a need to
support more?
return list;
Added: branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSManager.java
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSQueryMetadata.java
Added: branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSQueryRaw.java
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSQueryServices.java
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSQueryServicesEvents.java
Modified: branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSRequest.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSRequest.java
2008-05-27 16:43:49 UTC (rev 3885)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSRequest.java
2008-05-27 16:43:55 UTC (rev 3886)
@@ -24,8 +24,6 @@
package org.perfsonar.perfsonarui.ls;
-import java.io.InputStream;
-
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -34,10 +32,22 @@
import org.perfsonar.perfsonarui.plugins.IUserData;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MetaDataList;
+import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
+import org.w3c.dom.Element;
public class LSRequest extends AbstractMARequest {
protected String resource;
+
+ private final static String XPATH_NAMESPACE_DECLARATIONS =
+ "declare namespace nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";
\n" +
+ "declare namespace
perfsonar=\"http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/\"; \n" +
+ "declare namespace
psservice=\"http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/\"; \n" +
+ "declare namespace
xquery=\"http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/xquery/1.0/\";
\n";
+
+ public static String XQUERY =
"http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/xquery/1.0/";
+ public static String PSSERVICE =
"http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/";
+
public String getResource() {
return resource;
}
@@ -46,63 +56,85 @@
this.resource = resource;
}
- public LSRequest(String resource) {
- setResource(resource);
- }
+
public LSRequest() {
- this("org/perfsonar/perfsonarui/ls/LSQueryRequest.xml");
+ super();
}
+
+ public Document createRequest(String xquery) throws Exception {
+ DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ DOMImplementation dom = builder.getDOMImplementation();
+ Document document = dom.createDocument(NMWG2, E_MESSAGE, null);
+
+
+ Element message = document.getDocumentElement();
//document.createElementNS(NMWG2, E_MESSAGE);
+ message.setAttribute(E_TYPE, LS_QueryRequest);
+ message.setAttribute(E_ID,"id");
+ message.setPrefix("nmwg");
+
+ Element metadata = document.createElementNS(NMWG2,E_METADATA);
+ String metadataid = "meta1";
+ metadata.setAttribute(E_ID, metadataid);
+ metadata.setPrefix("nmwg");
+
+ Element xquerynode = document.createElementNS(XQUERY, E_SUBJECT);
+ String xqueryid = "subject1";
+ xquerynode.setAttribute(E_ID, xqueryid);
+ xquerynode.setPrefix("xquery");
+
+ StringBuilder b = new StringBuilder();
+ b.append(XPATH_NAMESPACE_DECLARATIONS);
+ b.append(xquery);
+
+ xquerynode.appendChild(document.createTextNode(b.toString()));
+
+ Element eventtype= document.createElementNS(NMWG2,"eventType" );
+
eventtype.appendChild(document.createTextNode("service.lookup.xquery"));
+ eventtype.setPrefix("nmwg");
+
+ Element data = document.createElementNS(NMWG2,E_DATA);
+ data.setAttribute(E_ID, "data");
+ data.setAttribute(E_METADATAIDREF, metadataid);
+ data.setPrefix("nmwg");
+
+ //document.appendChild(message);
+ message.appendChild(metadata);
+ metadata.appendChild(xquerynode);
+ metadata.appendChild(eventtype);
+ message.appendChild(data);
+
+
+ return document;
+ }
@Override
- public Document createRequest(IUserData uData, String messageType)
- throws Exception {
- String inputFile;
-
- inputFile = resource;
-
- Document request = null;
- DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
-
- try {
- DocumentBuilder builder =
factory.newDocumentBuilder();
- InputStream stream =
this.getClass().getClassLoader().getResourceAsStream(inputFile);
-
- request = builder.parse(stream);
-
- } catch (Exception x) {
- throw new Exception("CreateDataRequest",x);
- }
-
-
- logger.debug(request);
-
- return request;
-
+ public Document createRequest(IUserData uData, String messageType)
throws Exception {
+ return
createRequest("//nmwg:store/nmwg:metadata/perfsonar:subject/psservice:service");
}
@Override
public Document createRequest(MAEndpoint endpoint, MetaDataList query,
String messageType) throws Exception {
- // TODO Auto-generated method stub
- return null;
+ return
createRequest("//nmwg:store/nmwg:data[@metadataIdRef='"
+
+ endpoint.getEndpoint()
+ + "']/nmwg:metadata");
}
@Override
public String getMessageNamespace() {
- // TODO Auto-generated method stub
- return null;
+ return NMWG2;
}
public String[] getNamespaces() {
- // TODO Auto-generated method stub
- return null;
+ return new String[] {NMWG2,XQUERY};
}
public String getRequestType() {
- // TODO Auto-generated method stub
- return null;
+ return LS_QueryRequest;
}
public void process(IUserData uData, Document response,
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSResponseListener.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSResponseListener.java
2008-05-27 16:43:49 UTC (rev 3885)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSResponseListener.java
2008-05-27 16:43:55 UTC (rev 3886)
@@ -31,6 +31,7 @@
import org.perfsonar.perfsonarui.AbstractPerfsonarResponse;
import org.perfsonar.perfsonarui.NMWGHelper;
+import org.perfsonar.perfsonarui.PerfsonarSchema;
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
import org.perfsonar.perfsonarui.plugins.IUserData;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
@@ -53,33 +54,24 @@
@Override
public void process(Element data, java.util.ArrayList<Element>
metadataChain) throws Exception {
- if (data instanceof org.w3c.dom.Element) {
- System.out.println(data.getNodeName());
- System.out.println(data.getLocalName());
- System.out.println(data.getNamespaceURI());
-
System.out.println(data.lookupPrefix(data.getNamespaceURI()));
-
- NodeList nodes = data.getChildNodes();
- for (int i=0; i < nodes.getLength(); i++) {
- Node child = nodes.item(i);
-
- System.out.println(child.getNodeName());
- System.out.println(child.getNamespaceURI());
-
System.out.println(child.lookupPrefix(child.getNamespaceURI()));
-
- String text = child.getTextContent();
-
- if (text != null)
- try {
- System.out.println(text);
- //parseLSQuery(text);
-
- } catch (Exception x) {
- x.printStackTrace();
- }
- }
- }
+ //NodeList nodes =
data.getElementsByTagNameNS("http://ggf.org/ns/nmwg/result/2.0/", "datum");
+ NodeList nodes =
data.getElementsByTagNameNS(LSRequest.PSSERVICE,"datum");
+ for (int i=0; i < nodes.getLength(); i++)
+ if (nodes.item(i).getNodeType() ==
Node.ELEMENT_NODE) {
+ Node child = nodes.item(i);
+ String text = child.getTextContent();
+
+ if (text != null)
+ try {
+
+ parseLSQuery(text);
+
+ } catch (Exception x) {
+ x.printStackTrace();
+ }
+ }
+
}
};
try {
@@ -91,42 +83,30 @@
}
protected void parseLSQuery(String text) throws Exception {
+ System.out.println(text);
+ logger.debug(text);
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
-
DocumentBuilder builder = factory.newDocumentBuilder();
-
- StringReader stringInput = new StringReader(text);
-
+ StringReader stringInput = new
StringReader("<services>"+text+"</services>");
Document lsResponse = builder.parse(new InputSource(stringInput));
stringInput.close();
stringInput = null;
- endpoints.add(getEndpoint(lsResponse.getDocumentElement()));
- //printNode(lsResponse.getDocumentElement(), 1);
+ NodeList service =
lsResponse.getDocumentElement().getElementsByTagNameNS(LSRequest.PSSERVICE,
"service");
+ for (int i=0; i < service.getLength(); i++)
+ if (service.item(i).getNodeType() ==
Node.ELEMENT_NODE)
+
endpoints.add(LSXQuery.getEndpoint((Element)service.item(i)));
+
+ //getEndpoint(lsResponse.getDocumentElement()));
}
+ /**
+ * @param service
+ * @return
+ */
- protected MAEndpoint getEndpoint(Node service) {
- if ("service".equals(service.getLocalName())) {
- MAEndpoint endpoint = new MAEndpoint();
- NodeList children = service.getChildNodes();
- for (int i=0; i < children.getLength(); i++) {
- Node item = children.item(i);
- if
("serviceName".equals(item.getLocalName()))
-
endpoint.setTitle(item.getTextContent());
- else if
("accessPoint".equals(item.getLocalName()))
-
endpoint.setEndpoint(item.getTextContent());
- else if
("serviceType".equals(item.getLocalName()))
-
endpoint.setSchema(item.getTextContent());
- if
("serviceDescription".equals(item.getLocalName()))
-
endpoint.setDescription(item.getTextContent());
- }
-
- return endpoint;
- } else return null;
-
- }
+
protected void printNode(Node node, int level) {
StringBuffer r = new StringBuffer();
@@ -136,12 +116,6 @@
System.out.print(node.getNodeName());
if (node.getFirstChild() !=null)
System.out.println("\tText: "
+node.getFirstChild().getNodeValue());
- //NamedNodeMap attr = node.getAttributes();
-
- /*
- for (int i=0; i < attr.getLength(); i++)
- System.out.println(r.toString()+"Attr:
"+attr.item(i));
- */
NodeList children = node.getChildNodes();
for (int i=0; i < children.getLength(); i++)
Added: branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/LSXQuery.java
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/UnmarshalException.java
Added: branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/XML.java
Added: branches/perfsonarui/src/org/perfsonar/perfsonarui/ls/XQueryParams.java
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MAEndpoint.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MAEndpoint.java
2008-05-27 16:43:49 UTC (rev 3885)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/plugins/MAEndpoint.java
2008-05-27 16:43:55 UTC (rev 3886)
@@ -43,14 +43,37 @@
*
* @author Nina Jeliazkova
<b>Modified</b> 2005-12-10
*/
-public class MAEndpoint extends Observable {
+/*
+serviceName perfSONAR PIONIER RRD MA
+accessPoint
http://rrdma.perfsonar.pionier.net.pl:8080/geant2-java-rrd-ma/services/MeasurementArchiveService
+serviceType ma
+serviceDescription perfSONAR PIONIER RRD MA
+serviceVersion 3.0
+organization PIONIER
+contactEmail
+*/
+public class MAEndpoint extends Observable implements Comparable<MAEndpoint>
{
protected boolean enabled = true;
+ //organisation
+ protected String title = "";
+ //service description
protected String description;
- protected String title = "";
+ //contact email
+ protected String contact;
+ //access point
protected String endpoint = "";
+ // serviceType
+ protected String serviceType = "";
+ // serviceVersion
+ protected String serviceVersion = "";
+ // serviceName
+ protected String serviceName = "";
+ //
protected String authRealm = "";
protected String[] event = {"utilization","utilization"};
protected IPerfsonarSchema type;
+
+
protected String status = "?";
protected Object statusExplanation = "?"; //"<html>Run <u>Service
status</u> <br>for availability info.</html>";
protected boolean alive = true;
@@ -289,5 +312,39 @@
public void setDescription(String description) {
this.description = description;
}
-
+ public String getContact() {
+ return contact;
+ }
+ public void setContact(String contact) {
+ this.contact = contact;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) return false;
+ else if (obj instanceof MAEndpoint)
+ return ((MAEndpoint)obj).getEndpoint().equals(getEndpoint());
+ else return false;
+ }
+ public int compareTo(MAEndpoint arg0) {
+ if (arg0 == null) return -1;
+ return getEndpoint().compareTo(arg0.getEndpoint());
+ }
+ public String getServiceName() {
+ return serviceName;
+ }
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+ public String getServiceType() {
+ return serviceType;
+ }
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+ public String getServiceVersion() {
+ return serviceVersion;
+ }
+ public void setServiceVersion(String serviceVersion) {
+ this.serviceVersion = serviceVersion;
+ }
}
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/LSRequestTest.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/LSRequestTest.java
2008-05-27 16:43:49 UTC (rev 3885)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/LSRequestTest.java
2008-05-27 16:43:55 UTC (rev 3886)
@@ -24,60 +24,66 @@
package org.perfsonar.perfsonarui.test;
+import java.io.File;
import java.io.FileWriter;
import junit.framework.TestCase;
import org.perfsonar.perfsonarui.AbstractUserData;
+import org.perfsonar.perfsonarui.FilePerfsonarResponse;
import org.perfsonar.perfsonarui.PSException;
import org.perfsonar.perfsonarui.PSLogger;
import org.perfsonar.perfsonarui.SmartMARequest;
+import org.perfsonar.perfsonarui.aa.FileAARequest;
import org.perfsonar.perfsonarui.ls.LSRequest;
import org.perfsonar.perfsonarui.ls.LSResponseListener;
import org.perfsonar.perfsonarui.playground.PlaygroundPerfsonarResponse;
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MAEndpointList;
+import org.w3c.dom.Document;
public class LSRequestTest extends TestCase {
+ protected String testLS =
"PIONIER-LS,http://ls.perfsonar.pionier.net.pl:8080/xml-ls/services/LookupService,ls,,ls,ls";
+
@Override
protected void setUp() throws Exception {
super.setUp();
PSLogger.configureLog4j(true);
}
- public void test() {
+
+ public void testCreateRequest() throws Exception {
+ AbstractUserData udata = new AbstractUserData();
+ udata.setResponse(AbstractUserData.DOCUMENT_RESPONSE,"");
+ udata.setEndpoint(new MAEndpoint(testLS));
+ LSRequest request = new LSRequest();
+ Document doc = request.createRequest(udata,
LSRequest.LS_QueryRequest);
+ FilePerfsonarResponse f = new FilePerfsonarResponse(new
File("lsrequest.xml"));
+ f.process(request, udata, doc);
+ assertTrue(new File("lsrequest.xml").exists());
+ }
+
+ public void test() throws Exception {
SmartMARequest smart = new SmartMARequest() {
@Override
public IPerfsonarRequest createMARequest(MAEndpoint
endpoint) throws PSException {
- return new
LSRequest("org/perfsonar/perfsonarui/ls/LSQueryRequestFull.xml");
+ return new LSRequest();
}
};
AbstractUserData udata = new AbstractUserData();
udata.setResponse(AbstractUserData.DOCUMENT_RESPONSE,"");
- //udata.setEndpoint(new
MAEndpoint("ISTF-LS,http://selena.acad.bg:8070/axis/services/LookupService,ls,,ls,ls"));
- //udata.setEndpoint(new
MAEndpoint("GN2-LS,http://stats.geant2.net/perfsonar/XML-LS/LookupService,ls,,ls,ls"));
- //udata.setEndpoint(new
MAEndpoint("PIONIER-LS,http://loco4.man.poznan.pl:8090/axis/services/LookupService,ls,,ls,ls"));
- udata.setEndpoint(new
MAEndpoint("RNP-LS,http://ls-rnp.gt-med.ufsc.br:8080/axis/services/LookupService,ls,,ls,ls"));
- /*
-ACAD/ISTF: http://selena.acad.bg:8070/axis/services/LookupService
-PIONIER: http://loco4.man.poznan.pl:8090/axis/services/LookupService
-RNP::
-> are there any other services available?
+ udata.setEndpoint(new
MAEndpoint("PIONIER-LS,http://ls.perfsonar.pionier.net.pl:8080/xml-ls/services/LookupService,ls,,ls,ls"));
- */
PlaygroundPerfsonarResponse response = new
PlaygroundPerfsonarResponse(udata);
smart.makeRequest(udata, IPerfsonarRequest.LS_QueryRequest,
response, false);
assertNotNull(udata.getResponse(AbstractUserData.DOCUMENT_RESPONSE));
- try {
+
FileWriter w = new FileWriter("ls_response.xml");
//System.out.println(udata.getResponse(AbstractUserData.DOCUMENT_RESPONSE));
w.write(udata.getResponse(AbstractUserData.DOCUMENT_RESPONSE));
w.flush();
w.close();
- //smart.isReady();
- } catch (Exception x) {
-
- }
+
}
public void testProcess() {
@@ -88,7 +94,9 @@
}
};
AbstractUserData udata = new AbstractUserData();
- udata.setEndpoint(new
MAEndpoint("ISTF-LS,http://selena.acad.bg:8070/axis/services/LookupService,ls,,ls,ls"));
+
+ udata.setEndpoint(new
MAEndpoint("BREN-LS,http://uran.acad.bg:8080/XML-LS/services/LookupService,ls,,ls,ls"));
+ //udata.setEndpoint(new
MAEndpoint("ISTF-LS,http://selena.acad.bg:8070/axis/services/LookupService,ls,,ls,ls"));
// udata.setEndpoint(new
MAEndpoint("GN2-LS,http://stats.geant2.net/perfsonar/XML-LS/LookupService,ls,,ls,ls"));
// udata.setEndpoint(new
MAEndpoint("RNP-LS,http://ls-rnp.gt-med.ufsc.br:8080/axis/services/LookupService,ls,,ls,ls"));
MAEndpointList endpoints = new MAEndpointList();
@@ -98,6 +106,20 @@
System.out.println(endpoints.get(i));
//smart.isReady();
}
+ public void testListener() throws Exception {
+ MAEndpointList endpoints = new MAEndpointList();
+ LSResponseListener listener = new
LSResponseListener(endpoints);
+ FileAARequest helper = new FileAARequest(new
File("data/ls/ls_response.xml"));
+ Document doc = helper.createRequest(null,null);
+ listener.process(null, null, doc);
+ System.out.println(endpoints);
+ assertEquals(1,endpoints.size());
+
assertEquals("http://rrdma.perfsonar.pionier.net.pl:8080/geant2-java-rrd-ma/services/MeasurementArchiveService",endpoints.get(0).getEndpoint());
+ System.out.println(endpoints.get(0).getTitle());
+ System.out.println(endpoints.get(0).getEvent(0));
+ System.out.println(endpoints.get(0).getEvent(1));
+ System.out.println(endpoints.get(0).getSchema());
+ }
}
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/ls/LSQueryMetadataTest.java
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/ls/LSQueryRawTest.java
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/ls/LSQueryServicesEventsTest.java
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/test/ls/LSQueryServicesTest.java
Added: branches/perfsonarui/src/org/perfsonar/perfsonarui/test/ls/LSTest.java
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
2008-05-27 16:43:49 UTC (rev 3885)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
2008-05-27 16:43:55 UTC (rev 3886)
@@ -47,6 +47,8 @@
import org.perfsonar.perfsonarui.PSLogger;
import org.perfsonar.perfsonarui.ResponseData;
import org.perfsonar.perfsonarui.SmartMARequest;
+import org.perfsonar.perfsonarui.ls.LSManager;
+import org.perfsonar.perfsonarui.ma.MAPerfsonarModel;
import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
import org.perfsonar.perfsonarui.plugins.ITimeValueResponse;
import org.perfsonar.perfsonarui.plugins.IUserData;
@@ -520,14 +522,20 @@
url = line.getOptionValue( 'e' );
try {
endpointList.readEndpoints(new URL(url));
+ LSManager.getInstance(new URL(url));
} catch (Exception x) {
try {
logger.error(x);
endpointList.readEndpoints(new
File("MA.conf"));
+ LSManager.getInstance(new URL(url));
} catch (Exception ex) {
logger.error(ex);
}
}
+ } else try {
+ LSManager.getInstance(new File("MA.conf"));
+ } catch (Exception x) {
+ logger.error(x);
}
int maxDataEntries = 8;
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ShowEndpointsAction.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ShowEndpointsAction.java
2008-05-27 16:43:49 UTC (rev 3885)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/ShowEndpointsAction.java
2008-05-27 16:43:55 UTC (rev 3886)
@@ -109,7 +109,7 @@
actions[i] = null;
}
protected PSUIAction[] createActions() {
- PSUIAction[] actions = new PSUIAction[6];
+ PSUIAction[] actions = new PSUIAction[7];
PSUIAction a = new SelectAllEndpointsAction(endpoints,true,"Select
all");
actions[1] = a;
@@ -132,6 +132,8 @@
a = new NewEndpointAction(endpoints);
actions[5] = a;
+ a = new LSRetrieveEndpointsAction(endpoints);
+ actions[6] = a;
return actions;
}
protected MAEndpointsPanel createEndpointsPanel(PSUIAction[] actions) {
Modified: branches/perfsonarui/src/perfsonarui.classes
===================================================================
--- branches/perfsonarui/src/perfsonarui.classes 2008-05-27 16:43:49
UTC (rev 3885)
+++ branches/perfsonarui/src/perfsonarui.classes 2008-05-27 16:43:55
UTC (rev 3886)
@@ -1,6 +1,7 @@
org/perfsonar/perfsonarui/*.class
org/perfsonar/perfsonarui/plugins/*.class
org/perfsonar/perfsonarui/aa/*.class
+org/perfsonar/perfsonarui/ls/*.class
org/perfsonar/perfsonarui/log4.console
org/perfsonar/perfsonarui/log4.properties
- perfsonar: r3886 - in branches/perfsonarui/src: . org/perfsonar/perfsonarui org/perfsonar/perfsonarui/lookingglass org/perfsonar/perfsonarui/ls org/perfsonar/perfsonarui/plugins org/perfsonar/perfsonarui/test org/perfsonar/perfsonarui/test/ls org/perfsonar/perfsonarui/ui org/perfsonar/perfsonarui/ui/actions, svnlog, 05/27/2008
Archive powered by MHonArc 2.6.16.