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

View File

@ -3,7 +3,8 @@
*/ */
package org.gcube.informationsystem.resourceregistry.client.plugin; 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.config.ProxyConfig;
import org.gcube.common.clients.delegates.ProxyDelegate; import org.gcube.common.clients.delegates.ProxyDelegate;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; 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/ * @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(){ public ResourceRegistryClientPlugin(){
super(ResourceRegistryClientPlugin.class.getSimpleName()); super(ResourceRegistryClientPlugin.class.getSimpleName());
@ -39,15 +40,19 @@ public class ResourceRegistryClientPlugin extends AbstractPlugin<GCubeEndpoint,
} }
@Override @Override
public GCubeEndpoint resolve(GCubeEndpoint address, ProxyConfig<?, ?> config) public EndpointReference resolve(EndpointReference address, ProxyConfig<?, ?> config)
throws Exception { throws Exception {
return null; return null;
} }
/* (non-Javadoc)
* @see org.gcube.common.clients.delegates.ProxyPlugin#newProxy(org.gcube.common.clients.delegates.ProxyDelegate)
*/
@Override @Override
public ResourceRegistryClient newProxy( public ResourceRegistryClient newProxy(
ProxyDelegate<GCubeEndpoint> delegate) { ProxyDelegate<EndpointReference> delegate) {
return new ResourceRegistryClient(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.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import javax.xml.ws.EndpointReference;
import org.gcube.common.authorization.client.Constants; import org.gcube.common.authorization.client.Constants;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.clients.Call; 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.AsyncProxyDelegate;
import org.gcube.common.clients.delegates.ProxyDelegate; import org.gcube.common.clients.delegates.ProxyDelegate;
import org.gcube.common.clients.exceptions.ServiceException; import org.gcube.common.clients.exceptions.ServiceException;
@ -31,10 +32,10 @@ public class ResourceRegistryClient {
private static Logger logger = LoggerFactory private static Logger logger = LoggerFactory
.getLogger(ResourceRegistryClient.class); .getLogger(ResourceRegistryClient.class);
private final AsyncProxyDelegate<GCubeEndpoint> delegate; private final AsyncProxyDelegate<EndpointReference> delegate;
public ResourceRegistryClient(ProxyDelegate<GCubeEndpoint> config) { public ResourceRegistryClient(ProxyDelegate<EndpointReference> config) {
this.delegate = new AsyncProxyDelegate<GCubeEndpoint>(config); this.delegate = new AsyncProxyDelegate<EndpointReference>(config);
} }
protected HttpURLConnection makeRequest(URL url, String method, protected HttpURLConnection makeRequest(URL url, String method,
@ -58,11 +59,11 @@ public class ResourceRegistryClient {
public String query(final String query, final String fetchPlan) public String query(final String query, final String fetchPlan)
throws InvalidQueryException { 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) callUrl.append("/").append(AccessPath.ACCESS_PATH_PART)
.append("/"); .append("/");