diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 8107733..dd7b8bb 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -7,6 +7,9 @@ uses + + uses + diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcoreEndpointReader.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcoreEndpointReader.java index dbe694c..d41bcda 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcoreEndpointReader.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcoreEndpointReader.java @@ -29,9 +29,7 @@ public class GcoreEndpointReader implements Serializable{ private static final String ckanResource = "org.gcube.data.access.ckanconnector.CkanConnector"; private static final String serviceName = "CkanConnector"; private static final String serviceClass = "DataAccess"; - private static final Log logger = LogFactoryUtil.getLog(GcoreEndpointReader.class); - //private static Logger logger = LoggerFactory.getLogger(GcoreEndpointReader.class); private String ckanResourceEntyName; /** @@ -52,14 +50,17 @@ public class GcoreEndpointReader implements Serializable{ query.addCondition(String.format("$resource/Profile/ServiceClass/text() eq '%s'",serviceClass)); query.addCondition("$resource/Profile/DeploymentData/Status/text() eq 'ready'"); query.addCondition(String.format("$resource/Profile/ServiceName/text() eq '%s'",serviceName)); + query.addCondition(String.format("$resource/Scopes/Scope/text()[.='%s']", scope)); // i.e. check the resource contains among the scopes this one query.setResult("$resource/Profile/AccessPoint/RunningInstanceInterfaces//Endpoint[@EntryName/string() eq \""+ckanResource+"\"]/text()"); logger.debug("submitting quey "+query.toString()); DiscoveryClient client = client(); List endpoints = client.submit(query); - if (endpoints == null || endpoints.isEmpty()) throw new Exception("Cannot retrieve the GCoreEndpoint serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope); + if (endpoints == null || endpoints.isEmpty()) + throw new Exception("Cannot retrieve the GCoreEndpoint serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope); + logger.debug("Found " + endpoints.size() + " matching resources"); this.ckanResourceEntyName = endpoints.get(0); if(ckanResourceEntyName==null) @@ -67,15 +68,6 @@ public class GcoreEndpointReader implements Serializable{ logger.info("found entyname "+ckanResourceEntyName+" for ckanResource: "+ckanResource); - /*Group accessPoints = se.profile().endpoints(); - if(accessPoints.size()==0) throw new Exception("Endpoint in serviceName serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope +" not found"); - - Endpoint ep = accessPoints.iterator().next(); - - String epName = ep.name(); - - System.out.println(epName);*/ - }catch(Exception e){ String error = "An error occurred during GCoreEndpoint discovery, serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope +"."; logger.error(error, e); @@ -93,4 +85,5 @@ public class GcoreEndpointReader implements Serializable{ return ckanResourceEntyName; } + }