diff --git a/src/main/java/org/gcube/data/access/connector/GeoServerConnectorRequestHandler.java b/src/main/java/org/gcube/data/access/connector/GeoServerConnectorRequestHandler.java index 93d15e3..ea54aeb 100644 --- a/src/main/java/org/gcube/data/access/connector/GeoServerConnectorRequestHandler.java +++ b/src/main/java/org/gcube/data/access/connector/GeoServerConnectorRequestHandler.java @@ -179,17 +179,20 @@ public class GeoServerConnectorRequestHandler extends RequestHandler { String serviceClass = String.format("$resource/Profile/ServiceClass/text() eq '%s'", AuthenticationUtils.SDI); String serviceName = String.format("$resource/Profile/ServiceName/text() eq '%s'", - AuthenticationUtils.SDI_SERVICE); + AuthenticationUtils.SDI_SERVICE); + String status = String.format("$resource/Profile/DeploymentData/Status/text() eq '%s'", + AuthenticationUtils.READY); SimpleQuery query = ICFactory.queryFor(GCoreEndpoint.class).addCondition(serviceClass) - .addCondition(serviceName); + .addCondition(serviceName).addCondition(status); DiscoveryClient client = ICFactory.clientFor(GCoreEndpoint.class); List gCoreEndpoints = client.submit(query); int size = gCoreEndpoints.size(); logger.warn("gCoreEndpoints size = " + size); - if (size > 0) { + if (size > 0) { + //TODO I get the last because when there are 2 endpoint the first is not good! Usually it's only one GCoreEndpoint gCoreEndpoint = gCoreEndpoints.get(size-1); return gCoreEndpoint.profile().endpointMap().get("org.gcube.spatial.data.sdi.SDIService").uri() .toString();