Add new filter in the query: status = ready. Anyway I get the last items, because when there are 2 endpoint the first is not good:

http://node3-d-d4s.d4science.org:80/sdi-service/gcube (usually it must be only one)

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-access/gcube-geoserver-connector@150790 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
pasquale.vitale 2017-07-05 14:55:36 +00:00
parent 4d2d46cd7d
commit 7d51b29770
1 changed files with 6 additions and 3 deletions

View File

@ -180,9 +180,11 @@ public class GeoServerConnectorRequestHandler extends RequestHandler {
AuthenticationUtils.SDI);
String serviceName = String.format("$resource/Profile/ServiceName/text() eq '%s'",
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<GCoreEndpoint> client = ICFactory.clientFor(GCoreEndpoint.class);
List<GCoreEndpoint> gCoreEndpoints = client.submit(query);
@ -190,6 +192,7 @@ public class GeoServerConnectorRequestHandler extends RequestHandler {
logger.warn("gCoreEndpoints size = " + size);
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();