perfsonar-dev - perfsonar: r4274 - in trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl: level0 level1 level1/jaxb
Subject: perfsonar development work
List archive
perfsonar: r4274 - in trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl: level0 level1 level1/jaxb
Chronological Thread
- From:
- To:
- Subject: perfsonar: r4274 - in trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl: level0 level1 level1/jaxb
- Date: Tue, 22 Jul 2008 19:34:33 -0400
Author: michael.bischoff
Date: 2008-07-22 19:34:32 -0400 (Tue, 22 Jul 2008)
New Revision: 4274
Added:
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/LsQuery.java
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/jaxb/ServiceImpl.java
Removed:
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/jaxb/AuthorativeLookupserviceImpl.java
Modified:
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level0/Level0Impl.java
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/DiscoveryProcessImpl.java
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/Level1Impl.java
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/jaxb/Result.java
Log:
clean up
Modified:
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level0/Level0Impl.java
===================================================================
---
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level0/Level0Impl.java
2008-07-22 23:18:30 UTC (rev 4273)
+++
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level0/Level0Impl.java
2008-07-22 23:34:32 UTC (rev 4274)
@@ -25,9 +25,6 @@
public class Level0Impl implements Level0LsClientInterface {
-// private static final String REGISTRATION_CONTROLL_EVENTTYPE =
"http://ogf.org/ns/nmwg/tools/org/perfsonar/service/lookup/query/control/xquery/2.0/";
-// private static final String SUMMARY_CONTROLL_EVENTTYPE =
"http://ogf.org/ns/nmwg/tools/org/perfsonar/service/lookup/discovery/control/xquery/2.0/";
-// private static final String DISCOVERY_EVENTTYPE =
"http://ogf.org/ns/nmwg/tools/org/perfsonar/service/lookup/discovery/xquery/1.0/";
private static final String QUERY_EVENTTYPE =
"service.lookup.xquery";//"http://ogf.org/ns/nmwg/tools/org/perfsonar/service/lookup/query/xquery/2.0/";
private final Logger logger =
Logger.getLogger(Level0Impl.class.getName());
private final MessageFactory messageFactory;
@@ -43,31 +40,6 @@
}
/* (non-Javadoc)
- * @see
org.perfsonar.lsclient.Level0LsClientInterface#gerRawSummaryControl(org.perfsonar.lsclient.data.LookupService,
java.lang.String)
- */
- public InputStream getRawSummaryControl(LookupService lookupService,
String xquery) throws LsQueryException, IllegalArgumentException {
- throw new UnsupportedOperationException("Because the spec is
still beeing worked on");
-// FIXME
-// String xml = makeXml("<xquery:subject id=\"sub1\">", xquery,
"</xquery:subject>", SUMMARY_CONTROLL_EVENTTYPE);
-// InputStream inputStream = send(createMessage(xml),
lookupService);
-// return new BufferedSoapStrippingStream(inputStream);
- }
- /* (non-Javadoc)
- * @see
org.perfsonar.lsclient.Level0LsClientInterface#getRawDiscovery(org.perfsonar.lsclient.data.LookupService,
java.lang.String)
- */
- public InputStream getRawDiscovery(LookupService lookupService,
String xquery) throws LsQueryException, IllegalArgumentException {
- throw new UnsupportedOperationException("Because the spec is
still beeing worked on");
-// FIXME
-// String xml = makeXml(
-// "<summary:subject
xmlns:summary=\"http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/summarization/2.0/\"
id=\"subject.1\">",
-// xquery,
-// "</summary:subject>",
-// DISCOVERY_EVENTTYPE
-// );
-// InputStream inputStream = send(createMessage(xml),
lookupService);
-// return new BufferedSoapStrippingStream(inputStream);
- }
- /* (non-Javadoc)
* @see
org.perfsonar.lsclient.Level0LsClientInterface#getRawQueryResult(org.perfsonar.lsclient.data.LookupService,
java.lang.String)
*/
public InputStream getRawQueryResult(LookupService lookupService,
String xquery) throws LsQueryException, IllegalArgumentException {
@@ -75,16 +47,6 @@
InputStream inputStream = send(createMessage(xml),
lookupService);
return new BufferedSoapStrippingStream(inputStream);
}
- /* (non-Javadoc)
- * @see
org.perfsonar.lsclient.Level0LsClientInterface#getRawRegistrationControl(org.perfsonar.lsclient.data.LookupService,
java.lang.String)
- */
- public InputStream getRawRegistrationControl(LookupService
lookupService, String xquery) throws LsQueryException,
IllegalArgumentException {
- throw new UnsupportedOperationException("Because the spec is
still beeing worked on");
-// FIXME
-// String xml = makeXml("<xquery:subject id=\"sub1\">", xquery,
"</xquery:subject>", REGISTRATION_CONTROLL_EVENTTYPE);
-// InputStream inputStream = send(createMessage(xml),
lookupService);
-// return new BufferedSoapStrippingStream(inputStream);
- }
private SOAPMessage createMessage(String bodyXml) throws
LsQueryException {
SOAPMessage message;
Modified:
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/DiscoveryProcessImpl.java
===================================================================
---
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/DiscoveryProcessImpl.java
2008-07-22 23:18:30 UTC (rev 4273)
+++
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/DiscoveryProcessImpl.java
2008-07-22 23:34:32 UTC (rev 4274)
@@ -93,46 +93,35 @@
e.printStackTrace();
return new DiscoveryStepImpl(e);
}
- return new DiscoveryStepImpl(result.getServices());
+ return new DiscoveryStepImpl(result.getLookupServices());
}
private InputStream queryRootLs() {
LookupService pointOfEntry =
determantPointOfEntry(rootServices);
- StringBuilder condition = new StringBuilder();
- if(!eventTypes.isEmpty()) {
- condition.append("false()");
- for(EventType eventType : eventTypes) {
- condition.append(" or
nmwg:metadata/summary:parameters/nmwg:parameter/@value='");
- condition.append(eventType.getValue());
- condition.append("'");
- }
- }
-// if(!elements.isEmpty()) {
-// if(!eventTypes.isEmpty()) {
-// condition.append(" and");
-// }
-// if(!eventTypes.isEmpty()) {
-//
-// }
-// }
+ LsQuery query = new LsQuery(elements,eventTypes,type) {
+ @Override
+ public String toString() {
+ String selectIds =
"/nmwg:store[@type=\'LSStore\']/nmwg:data["+eventTypeCondition+"]/@metadataIdRef";
+ return
+ "declare namespace
perfsonar=\'http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/\'; \n" +
+ "declare namespace
nmwg=\'http://ggf.org/ns/nmwg/base/2.0/\'; \n" +
+ "declare namespace
psservice=\'http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/\'; \n" +
+ "declare namespace
nmwgt=\'http://ggf.org/ns/nmwg/topology/2.0/\'; \n" +
+ "declare namespace
netutil=\'http://ggf.org/ns/nmwg/characteristic/utilization/2.0/\'; \n" +
+ "declare namespace
summary=\"http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/summarization/2.0/\";
\n" +
+ "\n" +
+
"/nmwg:store[@type=\'LSStore\']/nmwg:metadata[@id="
+ selectIds + "]/perfsonar:subject/psservice:service";
+ }
+ };
- String selectIds =
"/nmwg:store[@type=\'LSStore\']/nmwg:data["+condition+"]/@metadataIdRef";
-
InputStream inputStream = null;
while(!rootServices.isEmpty()) {
if(pointOfEntry==null) throw new
RuntimeException("None of the root lookupservices could be consulted");
try {
return level0.getRawQueryResult(
pointOfEntry,
- "declare namespace
perfsonar=\'http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/\'; \n" +
- "declare namespace
nmwg=\'http://ggf.org/ns/nmwg/base/2.0/\'; \n" +
- "declare namespace
psservice=\'http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/\'; \n" +
- "declare namespace
nmwgt=\'http://ggf.org/ns/nmwg/topology/2.0/\'; \n" +
- "declare namespace
netutil=\'http://ggf.org/ns/nmwg/characteristic/utilization/2.0/\'; \n" +
- "declare namespace
summary=\"http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/summarization/2.0/\";
\n" +
- "\n" +
-
"/nmwg:store[@type=\'LSStore\']/nmwg:metadata[@id="
+ selectIds + "]/perfsonar:subject/psservice:service"
+ query.toString()
);
} catch (LsQueryException e) {
e.printStackTrace();
Modified:
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/Level1Impl.java
===================================================================
---
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/Level1Impl.java
2008-07-22 23:18:30 UTC (rev 4273)
+++
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/Level1Impl.java
2008-07-22 23:34:32 UTC (rev 4274)
@@ -1,14 +1,21 @@
package nl.surfnet.perfsonar.lsclient.impl.level1;
+import java.io.InputStream;
+import java.io.StringReader;
import java.util.HashSet;
import java.util.Set;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.stream.StreamSource;
+import nl.surfnet.perfsonar.lsclient.impl.level1.jaxb.Result;
+
import org.perfsonar.lsclient.DiscoveryProcess;
import org.perfsonar.lsclient.Level0LsClientInterface;
import org.perfsonar.lsclient.Level1LsClientInterface;
+import org.perfsonar.lsclient.LsQueryException;
import org.perfsonar.lsclient.data.AuthorativeLookupservice;
import org.perfsonar.lsclient.data.EventType;
import org.perfsonar.lsclient.data.LookupService;
@@ -17,6 +24,9 @@
import org.perfsonar.lsclient.data.ServiceType;
import org.perfsonar.lsclient.data.TopologyElement;
import org.perfsonar.lsclient.helpers.AbstractLevel1;
+import org.perfsonar.model.Data;
+import org.perfsonar.model.Datum;
+import org.perfsonar.model.Message;
public class Level1Impl extends AbstractLevel1 implements
Level1LsClientInterface {
@@ -47,15 +57,34 @@
* @see
org.perfsonar.lsclient.Level1LsClientInterface#getLSQueryContent(org.perfsonar.lsclient.data.HomeLookupService,
java.util.Set, java.util.Set, java.util.Set)
*/
public Set<ServiceMeasurementMetadata>
getLSQueryContent(AuthorativeLookupservice hls, Set<TopologyElement>
elements, Set<EventType> eventTypes, Set<ServiceType> type) {
- // TODO Auto-generated method stub
+ //TODO
return null;
}
/* (non-Javadoc)
* @see
org.perfsonar.lsclient.Level1LsClientInterface#getLSQueryLocation(org.perfsonar.lsclient.data.HomeLookupService,
java.util.Set, java.util.Set, java.util.Set)
*/
public Set<ServiceMetadata>
getLSQueryLocation(AuthorativeLookupservice hls, Set<TopologyElement>
elements, Set<EventType> eventTypes, Set<ServiceType> type) {
- // TODO Auto-generated method stub
- return null;
+ LsQuery query = new LsQuery(elements,eventTypes,type) {
+ @Override
+ public String toString() {
+ return null;
+ }
+ };
+
+ try {
+ InputStream stream =
level0.getRawQueryResult(hls,query.toString());
+ Unmarshaller unmarshaller =
context.createUnmarshaller();
+ Message message = (Message)
unmarshaller.unmarshal(stream);
+ Data data = message.getDatas().get(0);
+ Datum datum = data.getDatums().get(0);
+ Result result = (Result) unmarshaller.unmarshal(new
StreamSource( new StringReader("<result>"+datum.getValue()+"</result>")));
+ return result.getServices();
+ } catch (LsQueryException e) {
+ return null;
+ } catch (JAXBException e) {
+ return null;
+ }
+
}
@Override
Added:
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/LsQuery.java
Deleted:
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/jaxb/AuthorativeLookupserviceImpl.java
Modified:
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/jaxb/Result.java
===================================================================
---
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/jaxb/Result.java
2008-07-22 23:18:30 UTC (rev 4273)
+++
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/jaxb/Result.java
2008-07-22 23:34:32 UTC (rev 4274)
@@ -11,17 +11,23 @@
import javax.xml.bind.annotation.XmlRootElement;
import org.perfsonar.lsclient.data.AuthorativeLookupservice;
+import org.perfsonar.lsclient.data.ServiceMetadata;
+
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Result {
- @XmlElement(name="service",
namespace="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/",
type=AuthorativeLookupserviceImpl.class)
- private List<AuthorativeLookupservice> services;
+ @XmlElement(name="service",
namespace="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/",
type=ServiceImpl.class)
+ private List<ServiceImpl> services;
- public Set<AuthorativeLookupservice> getServices() {
+ public Set<AuthorativeLookupservice> getLookupServices() {
if(services==null) return Collections.emptySet();
return new HashSet<AuthorativeLookupservice>(services);
}
+ public Set<ServiceMetadata> getServices() {
+ if(services==null) return Collections.emptySet();
+ return new HashSet<ServiceMetadata>(services);
+ }
}
Copied:
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/jaxb/ServiceImpl.java
(from rev 4036,
trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl/level1/jaxb/AuthorativeLookupserviceImpl.java)
- perfsonar: r4274 - in trunk/surfnet_java-lsclient-api-impl/src/main/java/nl/surfnet/perfsonar/lsclient/impl: level0 level1 level1/jaxb, svnlog, 07/22/2008
Archive powered by MHonArc 2.6.16.