perfsonar-dev - perfsonar: r5295 - in trunk/ps-mdm-lsclient-impl: . src/main/java/org/perfsonar/ri/lsclient/data/implementation src/main/java/org/perfsonar/ri/lsclient/handlers src/main/java/org/perfsonar/ri/lsclient/level1 src/main/java/org/perfsonar/ri/lsclient/xml src/test/java/org/perfsonar/ri/lsclient/level1/test
Subject: perfsonar development work
List archive
perfsonar: r5295 - in trunk/ps-mdm-lsclient-impl: . src/main/java/org/perfsonar/ri/lsclient/data/implementation src/main/java/org/perfsonar/ri/lsclient/handlers src/main/java/org/perfsonar/ri/lsclient/level1 src/main/java/org/perfsonar/ri/lsclient/xml src/test/java/org/perfsonar/ri/lsclient/level1/test
Chronological Thread
- From:
- To:
- Subject: perfsonar: r5295 - in trunk/ps-mdm-lsclient-impl: . src/main/java/org/perfsonar/ri/lsclient/data/implementation src/main/java/org/perfsonar/ri/lsclient/handlers src/main/java/org/perfsonar/ri/lsclient/level1 src/main/java/org/perfsonar/ri/lsclient/xml src/test/java/org/perfsonar/ri/lsclient/level1/test
- Date: Fri, 2 Oct 2009 04:47:50 -0400
Author: krzjed
Date: 2009-10-02 04:47:49 -0400 (Fri, 02 Oct 2009)
New Revision: 5295
Added:
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/data/implementation/ServiceImpl.java
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/handlers/ServiceCollectionHandler.java
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/handlers/ServiceHandler.java
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/xml/DiscoverySAXHandler.java
Removed:
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/jaxb/
trunk/ps-mdm-lsclient-impl/src/test/java/org/perfsonar/ri/lsclient/level1/test/TestJaxbTools.java
Modified:
trunk/ps-mdm-lsclient-impl/pom.xml
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/data/implementation/LookupServiceImpl.java
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/DiscoveryProcessImpl.java
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/LSMeasuredTopologyQuery.java
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/Level1Impl.java
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/RootHintsFileDownloader.java
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/xml/ResponseParser.java
Log:
jaxb code replace with sax code
Modified: trunk/ps-mdm-lsclient-impl/pom.xml
===================================================================
--- trunk/ps-mdm-lsclient-impl/pom.xml 2009-10-01 13:09:47 UTC (rev 5294)
+++ trunk/ps-mdm-lsclient-impl/pom.xml 2009-10-02 08:47:49 UTC (rev 5295)
@@ -6,7 +6,7 @@
<groupId>nl.surfnet.perfsonar</groupId>
<artifactId>LSclient-Implementation</artifactId>
<name>LS client Implementation</name>
- <version>1.1</version>
+ <version>1.1.1</version>
<packaging>jar</packaging>
<description>The implementation for LS client from Perfsonar. This is
the evolved version of the initial version developed at
Surfnet(www.surfnet.nl).</description>
<inceptionYear>2008</inceptionYear>
@@ -58,16 +58,6 @@
<dependencies>
<dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>2.1.7</version>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.1</version>
Modified:
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/data/implementation/LookupServiceImpl.java
===================================================================
---
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/data/implementation/LookupServiceImpl.java
2009-10-01 13:09:47 UTC (rev 5294)
+++
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/data/implementation/LookupServiceImpl.java
2009-10-02 08:47:49 UTC (rev 5295)
@@ -3,71 +3,15 @@
import java.net.URI;
import org.perfsonar.lsclient.data.AuthorativeLookupservice;
-import org.perfsonar.lsclient.data.Service;
-public class LookupServiceImpl implements AuthorativeLookupservice {
+public class LookupServiceImpl extends ServiceImpl implements
+ AuthorativeLookupservice {
- private AuthorativeLookupservice authorativeLookupService;
+ public LookupServiceImpl() {
+ }
- private String description;
+ public LookupServiceImpl(URI endPoint) {
+ super(endPoint);
+ }
- private URI endPoint;
-
- private String name;
-
- private String organization;
-
- public int compareTo(Service arg0) {
- return this.endPoint.toString()
- .compareTo(arg0.getEndPoint().toString());
- }
-
- public AuthorativeLookupservice getAuthorativeLookupService() {
- return this.authorativeLookupService;
- }
-
- public String getDescription() {
- return this.description;
- }
-
- public URI getEndPoint() {
- return this.endPoint;
- }
-
- public String getName() {
- return this.name;
- }
-
- public String getOrganization() {
- return this.organization;
- }
-
- public void setAuthorativeLookupService(
- AuthorativeLookupservice authorativeLookupService) {
- this.authorativeLookupService = authorativeLookupService;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setEndPoint(URI endPoint) {
- this.endPoint = endPoint;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setOrganization(String organization) {
- this.organization = organization;
- }
-
- public LookupServiceImpl() {
- }
-
- public LookupServiceImpl(URI endPoint) {
- this.endPoint = endPoint;
- }
-
}
Added:
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/data/implementation/ServiceImpl.java
Added:
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/handlers/ServiceCollectionHandler.java
Added:
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/handlers/ServiceHandler.java
Modified:
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/DiscoveryProcessImpl.java
===================================================================
---
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/DiscoveryProcessImpl.java
2009-10-01 13:09:47 UTC (rev 5294)
+++
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/DiscoveryProcessImpl.java
2009-10-02 08:47:49 UTC (rev 5295)
@@ -1,14 +1,12 @@
package org.perfsonar.ri.lsclient.level1;
+import java.io.IOException;
import java.io.InputStream;
-import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.stream.XMLStreamException;
+import javax.xml.parsers.ParserConfigurationException;
import org.apache.log4j.Logger;
import org.perfsonar.lsclient.DiscoveryProcess;
@@ -20,86 +18,100 @@
import org.perfsonar.lsclient.data.LookupService;
import org.perfsonar.lsclient.data.ServiceType;
import org.perfsonar.lsclient.data.TopologyElement;
-import org.perfsonar.ri.lsclient.level1.jaxb.JaxbTools;
-import org.perfsonar.ri.lsclient.level1.jaxb.ServiceImpl;
+import org.perfsonar.ri.lsclient.data.implementation.ServiceImpl;
+import org.perfsonar.ri.lsclient.handlers.ServiceCollectionHandler;
+import org.perfsonar.ri.lsclient.xml.ResponseParser;
+import org.xml.sax.SAXException;
public class DiscoveryProcessImpl implements DiscoveryProcess {
- protected final Logger logger = Logger.getLogger(getClass());
- private final Level0LsClientInterface level0;
- private final RootGlses rootServices;
- private final Set<TopologyElement> elements;
- private final Set<EventType> eventTypes;
- private final Set<ServiceType> type;
- private final JAXBContext context;
+ protected final Logger logger = Logger.getLogger(getClass());
+ private final Level0LsClientInterface level0;
+ private final RootGlses rootServices;
+ private final Set<TopologyElement> elements;
+ private final Set<EventType> eventTypes;
+ private final Set<ServiceType> type;
- public DiscoveryProcessImpl(Level0LsClientInterface level0,
JAXBContext context, RootGlses rootGlses, Set<TopologyElement> elements,
Set<EventType> eventTypes, Set<ServiceType> type) {
- if(rootGlses==null || rootGlses.isEmpty()) throw new
IllegalArgumentException("rootServices must be a non-null non-empty set.");
- this.level0 = level0;
- this.context = context;
- this.rootServices = rootGlses;
- this.elements = elements;
- this.eventTypes = eventTypes;
- this.type = type;
- }
+ public DiscoveryProcessImpl(Level0LsClientInterface level0,
+ RootGlses rootGlses, Set<TopologyElement> elements,
+ Set<EventType> eventTypes, Set<ServiceType> type) {
+ if (rootGlses == null || rootGlses.isEmpty())
+ throw new IllegalArgumentException(
+ "rootServices must be a non-null non-empty set.");
+ this.level0 = level0;
+ this.rootServices = rootGlses;
+ this.elements = elements;
+ this.eventTypes = eventTypes;
+ this.type = type;
+ }
- public Iterator<DiscoveryStep> iterator() {
- return new Iterator<DiscoveryStep>() {
-
- Set<LookupService> referralLookupservices;
-
- public boolean hasNext() {
- return referralLookupservices == null ||
!referralLookupservices.isEmpty();
- }
+ public Iterator<DiscoveryStep> iterator() {
+ return new Iterator<DiscoveryStep>() {
- public DiscoveryStep next() {
- if(referralLookupservices == null) {
- referralLookupservices = new
HashSet<LookupService>();
- return
firstStep(referralLookupservices);
- }
- return nextStep(referralLookupservices);
- }
+ Set<LookupService> referralLookupservices;
- public void remove() {
- new UnsupportedOperationException("Can't
remove steps");
- }
-
- };
- }
+ public boolean hasNext() {
+ return referralLookupservices == null
+ || !referralLookupservices.isEmpty();
+ }
- protected DiscoveryStep nextStep(Set<LookupService>
referralLookupservices) {
- // TODO query all referralLookupservices - only needed for
dLs not gLs
- throw new UnsupportedOperationException("not implemented");
- }
+ public DiscoveryStep next() {
+ if (referralLookupservices == null) {
+ referralLookupservices = new HashSet<LookupService>();
+ return firstStep(referralLookupservices);
+ }
+ return nextStep(referralLookupservices);
+ }
- protected DiscoveryStep firstStep(Set<LookupService>
referralLookupservices) {
- DiscoveryQuery query = new
DiscoveryQuery(elements,eventTypes,type);
-
- for(LookupService service : rootServices) {
- logger.debug("Using Gls: " + service);
-
- InputStream inputStream = null;
- try {
- inputStream =
level0.getRawDiscoveryResponse(service,query.toString());
- } catch (LsQueryException e) {
- rootServices.demote(service,e);
- continue;
- }
- try {
- Collection<ServiceImpl> services =
JaxbTools.unMarshallPerfsonarMessage(context, inputStream, ServiceImpl.class);
- logger.debug("First step succeded without
error. Result: ["+services+"]");
- return new DiscoveryStepImpl(new
HashSet<AuthorativeLookupservice>(services));
- } catch (JAXBException e) {
- rootServices.demote(service,e);
- continue;
- } catch (XMLStreamException e) {
- rootServices.demote(service,e);
- continue;
- } catch (LsQueryException e) {
- rootServices.demote(service,e);
- continue;
- }
- }
- return new DiscoveryStepImpl(new LsQueryException("None of
the root lookupservices could be consulted"));
- }
+ public void remove() {
+ new UnsupportedOperationException("Can't remove steps");
+ }
+
+ };
+ }
+
+ protected DiscoveryStep nextStep(Set<LookupService>
referralLookupservices) {
+ // TODO query all referralLookupservices - only needed for dLs not
gLs
+ throw new UnsupportedOperationException("not implemented");
+ }
+
+ protected DiscoveryStep firstStep(Set<LookupService>
referralLookupservices) {
+ DiscoveryQuery query = new DiscoveryQuery(elements, eventTypes,
type);
+
+ for (LookupService service : rootServices) {
+ logger.debug("Using Gls: " + service);
+
+ InputStream inputStream = null;
+ try {
+ inputStream = level0.getRawDiscoveryResponse(service, query
+ .toString());
+ } catch (LsQueryException e) {
+ rootServices.demote(service, e);
+ continue;
+ }
+ try {
+ ServiceCollectionHandler sch = new
ServiceCollectionHandler();
+ ResponseParser.parseDiscoveryResponse(inputStream, sch);
+ Set<ServiceImpl> services = sch.getMetadataSet();
+ logger.debug("First step succeded without error. Result: ["
+ + services + "]");
+ return new DiscoveryStepImpl(
+ new HashSet<AuthorativeLookupservice>(services));
+ } catch (LsQueryException e) {
+ logger.warn(e);
+ rootServices.demote(service, e);
+ } catch (ParserConfigurationException e) {
+ // Impossible
+ logger.warn("Impossible is nothing", e);
+ } catch (SAXException e) {
+ logger.warn(e);
+ rootServices.demote(service, e);
+ } catch (IOException e) {
+ logger.warn(e);
+ rootServices.demote(service, e);
+ }
+ }
+ return new DiscoveryStepImpl(new LsQueryException(
+ "None of the root lookupservices could be consulted"));
+ }
}
Modified:
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/LSMeasuredTopologyQuery.java
===================================================================
---
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/LSMeasuredTopologyQuery.java
2009-10-01 13:09:47 UTC (rev 5294)
+++
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/LSMeasuredTopologyQuery.java
2009-10-02 08:47:49 UTC (rev 5295)
@@ -8,53 +8,53 @@
* Class that represents query for interfaces measured by measurement
service.<br/>
* Method toString() returns XQuery.
*
- * @author kjedrzejewski
+ * @author krzjed
*
*/
public class LSMeasuredTopologyQuery {
- protected final Service measurmentService;
+ protected final Service measurmentService;
- /**
- * Constructor
- *
- * @param measurmentService
- * service which measures topology that have to be returned
- */
- public LSMeasuredTopologyQuery(Service measurmentService) {
- this.measurmentService = measurmentService;
- }
+ /**
+ * Constructor
+ *
+ * @param measurmentService
+ * service which measures topology that have to be returned
+ */
+ public LSMeasuredTopologyQuery(Service measurmentService) {
+ this.measurmentService = measurmentService;
+ }
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("declare namespace perfsonar='");
- builder.append(Namespaces.PERFSONAR).append("';\n");
- builder.append("declare namespace nmwg='");
- builder.append(Namespaces.NMWG).append("';\n");
- builder.append("declare namespace psservice='");
- builder.append(Namespaces.PSSERVICE).append("';\n");
- builder.append("declare namespace nmwgt='");
- builder.append(Namespaces.NMWGT).append("';\n");
- builder.append("declare namespace netutil='");
- builder.append(Namespaces.NETUTIL).append("';\n");
- builder.append("\n");
- builder.append("unordered(\n");
- builder.append(" let $meta :=
/nmwg:store[@type=\"");
- builder.append(Databases.LSSTORE);
- builder.append("\"]/nmwg:metadata[perfsonar:subject");
- builder.append("//psservice:accessPoint=\"");
-
builder.append(this.measurmentService.getEndPoint().toString());
- builder.append("\"]/@id\n");
- builder.append(" let $data :=
/nmwg:store[@type=\"");
- builder.append(Databases.LSSTORE);
-
builder.append("\"]/nmwg:data[@metadataIdRef=$meta]\n");
- builder.append(" return $data\n");
- builder.append(")");
- return builder.toString();
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("declare namespace perfsonar='");
+ builder.append(Namespaces.PERFSONAR).append("';\n");
+ builder.append("declare namespace nmwg='");
+ builder.append(Namespaces.NMWG).append("';\n");
+ builder.append("declare namespace psservice='");
+ builder.append(Namespaces.PSSERVICE).append("';\n");
+ builder.append("declare namespace nmwgt='");
+ builder.append(Namespaces.NMWGT).append("';\n");
+ builder.append("declare namespace netutil='");
+ builder.append(Namespaces.NETUTIL).append("';\n");
+ builder.append("\n");
+ builder.append("unordered(\n");
+ builder.append(" let $meta :=
/nmwg:store[@type=\"");
+ builder.append(Databases.LSSTORE);
+ builder.append("\"]/nmwg:metadata[perfsonar:subject");
+ builder.append("//psservice:accessPoint=\"");
+ builder.append(this.measurmentService.getEndPoint().toString());
+ builder.append("\"]/@id\n");
+ builder.append(" let $data :=
/nmwg:store[@type=\"");
+ builder.append(Databases.LSSTORE);
+
builder.append("\"]/nmwg:data[@metadataIdRef=$meta]\n");
+ builder.append(" return $data\n");
+ builder.append(")");
+ return builder.toString();
+ }
}
Modified:
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/Level1Impl.java
===================================================================
---
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/Level1Impl.java
2009-10-01 13:09:47 UTC (rev 5294)
+++
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/Level1Impl.java
2009-10-02 08:47:49 UTC (rev 5295)
@@ -3,15 +3,11 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLStreamException;
import org.apache.log4j.Logger;
import org.perfsonar.lsclient.DiscoveryProcess;
@@ -26,10 +22,10 @@
import org.perfsonar.lsclient.data.ServiceType;
import org.perfsonar.lsclient.data.TopologyElement;
import org.perfsonar.lsclient.helpers.AbstractLevel1;
+import org.perfsonar.ri.lsclient.data.implementation.ServiceImpl;
+import org.perfsonar.ri.lsclient.handlers.ServiceCollectionHandler;
import
org.perfsonar.ri.lsclient.handlers.ServiceMeasurementMetadataCollectionHandler;
import org.perfsonar.ri.lsclient.handlers.ServiceMeasurementMetadataHandler;
-import org.perfsonar.ri.lsclient.level1.jaxb.JaxbTools;
-import org.perfsonar.ri.lsclient.level1.jaxb.ServiceImpl;
import org.perfsonar.ri.lsclient.xml.ResponseParser;
import org.xml.sax.SAXException;
@@ -40,19 +36,11 @@
protected final Logger logger = Logger.getLogger(getClass());
protected final RootGlses rootGlses = new RootGlses();
- protected final JAXBContext context;
@SuppressWarnings("boxing")
public Level1Impl(Level0LsClientInterface level0) {
super(level0);
- JAXBContext newContext = null;
try {
- newContext = JAXBContext
- .newInstance("org.perfsonar.ri.lsclient.level1.jaxb");
- } catch (JAXBException e) {
- logger.error("Can't load JAXB context", e);
- }
- try {
String value = System.getProperty(EAGER_SYSTEM_KEY);
if (Boolean.valueOf(value)) {
rootGlses.ensureFilled();
@@ -61,8 +49,6 @@
logger
.warn("Wasn't allowed to read system property
\"application.perfsonar.lsclient.eagerRootLses\"");
}
-
- this.context = newContext;
}
/**
@@ -77,7 +63,7 @@
public DiscoveryProcess startDiscovery(Set<TopologyElement> elements,
Set<EventType> eventTypes, Set<ServiceType> types) {
rootGlses.ensureFilled();
- return new DiscoveryProcessImpl(level0, context, rootGlses, elements,
+ return new DiscoveryProcessImpl(level0, rootGlses, elements,
eventTypes, types);
}
@@ -109,24 +95,30 @@
return null;
}
};
- Collection<ServiceImpl> services;
+ Set<ServiceImpl> services;
try {
InputStream stream = level0
.getRawQueryResult(hls, query.toString());
- services = JaxbTools.unMarshallPerfsonarMessage(context, stream,
- ServiceImpl.class);
+ ServiceCollectionHandler sch = new ServiceCollectionHandler();
+ ResponseParser.parseDiscoveryResponse(stream, sch);
+ services = sch.getMetadataSet();
+ logger.debug("First step succeded without error. Result: ["
+ + services + "]");
for (ServiceImpl service : services)
- service.setAuthorativeLookupservice(hls);
+ service.setAuthorativeLookupService(hls);
return null;
- } catch (JAXBException e) {
+ } catch (LsQueryException e) {
logger.error(e);
return null; // TODO
- } catch (XMLStreamException e) {
+ } catch (ParserConfigurationException e) {
logger.error(e);
return null; // TODO
- } catch (LsQueryException e) {
+ } catch (SAXException e) {
logger.error(e);
return null; // TODO
+ } catch (IOException e) {
+ logger.error(e);
+ return null; // TODO
}
}
@@ -157,25 +149,31 @@
try {
InputStream stream = level0.getRawDiscoveryResponse(hls, query
.toString());
- Collection<ServiceImpl> result = JaxbTools
- .unMarshallPerfsonarMessage(context, stream,
- ServiceImpl.class);
+ ServiceCollectionHandler sch = new ServiceCollectionHandler();
+ ResponseParser.parseDiscoveryResponse(stream, sch);
+ Set<ServiceImpl> result = sch.getMetadataSet();
for (ServiceImpl service : result)
- service.setAuthorativeLookupservice(hls);
+ service.setAuthorativeLookupService(hls);
return new HashSet<Service>(result);
- } catch (JAXBException e) {
- logger.error("JAXB exception occoured while quering for
location",
- e);
- return Collections.emptySet(); // TODO
- } catch (XMLStreamException e) {
- logger.error(
- "XMLStream exception occoured while quering for
location",
- e);
- return Collections.emptySet(); // TODO
} catch (LsQueryException e) {
logger.error(
"LsQuery exception occoured while quering for location",
e);
return Collections.emptySet(); // TODO
+ } catch (ParserConfigurationException e) {
+ // Impossible
+ logger
+ .error(
+ "SAX parser configuration exception occoured
while quering for location",
+ e);
+ return Collections.emptySet(); // TODO
+ } catch (SAXException e) {
+ logger
+ .error("SAX exception occoured while quering for
location",
+ e);
+ return Collections.emptySet(); // TODO
+ } catch (IOException e) {
+ logger.error("IO exception occoured while quering for location",
e);
+ return Collections.emptySet(); // TODO
}
}
Modified:
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/RootHintsFileDownloader.java
===================================================================
---
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/RootHintsFileDownloader.java
2009-10-01 13:09:47 UTC (rev 5294)
+++
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/level1/RootHintsFileDownloader.java
2009-10-02 08:47:49 UTC (rev 5295)
@@ -13,9 +13,9 @@
import java.util.HashSet;
import java.util.Set;
+import org.apache.log4j.Logger;
import org.perfsonar.lsclient.data.LookupService;
-import org.perfsonar.ri.lsclient.level1.jaxb.ServiceImpl;
-import org.apache.log4j.Logger;
+import org.perfsonar.ri.lsclient.data.implementation.ServiceImpl;
public class RootHintsFileDownloader {
protected final Logger logger = Logger.getLogger(getClass());
Added:
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/xml/DiscoverySAXHandler.java
Modified:
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/xml/ResponseParser.java
===================================================================
---
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/xml/ResponseParser.java
2009-10-01 13:09:47 UTC (rev 5294)
+++
trunk/ps-mdm-lsclient-impl/src/main/java/org/perfsonar/ri/lsclient/xml/ResponseParser.java
2009-10-02 08:47:49 UTC (rev 5295)
@@ -9,6 +9,7 @@
import org.perfsonar.lsclient.LsQueryException;
import org.perfsonar.lsclient.data.ServiceMeasurementMetadata;
+import org.perfsonar.ri.lsclient.handlers.ServiceHandler;
import org.perfsonar.ri.lsclient.handlers.ServiceMeasurementMetadataHandler;
import org.perfsonar.ri.lsclient.level1.LSMeasuredTopologyQuery;
import org.xml.sax.SAXException;
@@ -58,4 +59,24 @@
}
}
}
+
+ public static void parseDiscoveryResponse(InputStream is,
+ ServiceHandler serviceHandler) throws
ParserConfigurationException,
+ SAXException, IOException, LsQueryException {
+ try {
+ SAXParserFactory saxFact = SAXParserFactory.newInstance();
+ saxFact.setNamespaceAware(true);
+ SAXParser sax = saxFact.newSAXParser();
+ DiscoverySAXHandler handler = new DiscoverySAXHandler(
+ serviceHandler);
+ sax.parse(is, handler);
+ } catch (SAXException e) {
+ Exception embedded = e.getException();
+ if (embedded != null && embedded instanceof LsQueryException) {
+ throw (LsQueryException) embedded;
+ } else {
+ throw e;
+ }
+ }
+ }
}
Deleted:
trunk/ps-mdm-lsclient-impl/src/test/java/org/perfsonar/ri/lsclient/level1/test/TestJaxbTools.java
- perfsonar: r5295 - in trunk/ps-mdm-lsclient-impl: . src/main/java/org/perfsonar/ri/lsclient/data/implementation src/main/java/org/perfsonar/ri/lsclient/handlers src/main/java/org/perfsonar/ri/lsclient/level1 src/main/java/org/perfsonar/ri/lsclient/xml src/test/java/org/perfsonar/ri/lsclient/level1/test, svnlog, 10/02/2009
Archive powered by MHonArc 2.6.16.