Fixing client

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-client@131285 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-09-12 12:45:05 +00:00
parent 97535bbbae
commit 7feed01453
3 changed files with 25 additions and 14 deletions

View File

@ -7,7 +7,7 @@
</parent>
<groupId>org.gcube.information-system</groupId>
<artifactId>resource-registry-client</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<name>Resource Registry Client</name>
<description>Contains Idempotent API for Resource Registry</description>
@ -24,7 +24,12 @@
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-generic-clients</artifactId>

View File

@ -3,7 +3,8 @@
*/
package org.gcube.informationsystem.resourceregistry.client.plugin;
import org.gcube.common.clients.GCubeEndpoint;
import javax.xml.ws.EndpointReference;
import org.gcube.common.clients.config.ProxyConfig;
import org.gcube.common.clients.delegates.ProxyDelegate;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
@ -13,7 +14,7 @@ import org.gcube.informationsystem.resourceregistry.client.proxy.ResourceRegistr
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class ResourceRegistryClientPlugin extends AbstractPlugin<GCubeEndpoint, ResourceRegistryClient>{
public class ResourceRegistryClientPlugin extends AbstractPlugin<EndpointReference, ResourceRegistryClient>{
public ResourceRegistryClientPlugin(){
super(ResourceRegistryClientPlugin.class.getSimpleName());
@ -39,15 +40,19 @@ public class ResourceRegistryClientPlugin extends AbstractPlugin<GCubeEndpoint,
}
@Override
public GCubeEndpoint resolve(GCubeEndpoint address, ProxyConfig<?, ?> config)
public EndpointReference resolve(EndpointReference address, ProxyConfig<?, ?> config)
throws Exception {
return null;
}
/* (non-Javadoc)
* @see org.gcube.common.clients.delegates.ProxyPlugin#newProxy(org.gcube.common.clients.delegates.ProxyDelegate)
*/
@Override
public ResourceRegistryClient newProxy(
ProxyDelegate<GCubeEndpoint> delegate) {
return new ResourceRegistryClient(delegate);
ProxyDelegate<EndpointReference> delegate) {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -11,10 +11,11 @@ import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import javax.xml.ws.EndpointReference;
import org.gcube.common.authorization.client.Constants;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.clients.Call;
import org.gcube.common.clients.GCubeEndpoint;
import org.gcube.common.clients.delegates.AsyncProxyDelegate;
import org.gcube.common.clients.delegates.ProxyDelegate;
import org.gcube.common.clients.exceptions.ServiceException;
@ -31,10 +32,10 @@ public class ResourceRegistryClient {
private static Logger logger = LoggerFactory
.getLogger(ResourceRegistryClient.class);
private final AsyncProxyDelegate<GCubeEndpoint> delegate;
private final AsyncProxyDelegate<EndpointReference> delegate;
public ResourceRegistryClient(ProxyDelegate<GCubeEndpoint> config) {
this.delegate = new AsyncProxyDelegate<GCubeEndpoint>(config);
public ResourceRegistryClient(ProxyDelegate<EndpointReference> config) {
this.delegate = new AsyncProxyDelegate<EndpointReference>(config);
}
protected HttpURLConnection makeRequest(URL url, String method,
@ -58,11 +59,11 @@ public class ResourceRegistryClient {
public String query(final String query, final String fetchPlan)
throws InvalidQueryException {
Call<GCubeEndpoint, String> call = new Call<GCubeEndpoint, String>() {
Call<EndpointReference, String> call = new Call<EndpointReference, String>() {
public String call(GCubeEndpoint endpoint) throws Exception {
public String call(EndpointReference endpoint) throws Exception {
StringBuilder callUrl = new StringBuilder(endpoint.getAddress());
StringBuilder callUrl = new StringBuilder(endpoint.toString());
callUrl.append("/").append(AccessPath.ACCESS_PATH_PART)
.append("/");