rest collector call added

This commit is contained in:
lucio 2019-10-23 17:19:44 +02:00
parent 61b3f1c140
commit 4dc045bdee
2 changed files with 28 additions and 33 deletions

View File

@ -6,20 +6,11 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
@ -27,7 +18,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>

View File

@ -17,6 +17,7 @@ import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.api.DiscoveryException;
import org.gcube.resources.discovery.client.queries.api.Query;
import org.gcube.resources.discovery.icclient.stubs.CollectorStub;
import org.gcube.resources.discovery.icclient.stubs.CollectorStubRestImpl;
import org.gcube.resources.discovery.icclient.stubs.MalformedQueryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -70,11 +71,14 @@ public class ICClient implements DiscoveryClient<String> {
//helper
private CollectorStub getStub() {
//find endpoint address in service map currently in scope
String address = ServiceMap.instance.endpoint(localname);
log.info("connectinfg to "+address);
//obtain a JAXWS stub configured for gCube calls
ServiceMap serviceMap = ServiceMap.instance;
String address = serviceMap.endpoint(localname);
log.info("connecting to {}",address);
if (serviceMap.version().equals("2.0.0"))
return new CollectorStubRestImpl(address);
else
return stubFor(collector).at(URI.create(address));
}
//helper