diff --git a/src/org/gcube/informationsystem/registry/impl/util/RegistryUtil.java b/src/org/gcube/informationsystem/registry/impl/util/RegistryUtil.java index d3cf297..5d6ae8f 100644 --- a/src/org/gcube/informationsystem/registry/impl/util/RegistryUtil.java +++ b/src/org/gcube/informationsystem/registry/impl/util/RegistryUtil.java @@ -3,8 +3,6 @@ package org.gcube.informationsystem.registry.impl.util; import java.rmi.RemoteException; import java.util.List; -import javax.xml.xpath.XPathExpressionException; - import org.gcube.common.core.contexts.GHNContext; import org.gcube.common.core.faults.GCUBEFault; import org.gcube.common.core.informationsystem.ISException; @@ -12,10 +10,10 @@ import org.gcube.common.core.informationsystem.client.ISClient; import org.gcube.common.core.informationsystem.client.QueryParameter; import org.gcube.common.core.informationsystem.client.XMLResult; import org.gcube.common.core.informationsystem.client.ISClient.ISMalformedQueryException; -import org.gcube.common.core.informationsystem.client.XMLResult.ISResultEvaluationException; import org.gcube.common.core.informationsystem.client.queries.GCUBEGenericQuery; import org.gcube.common.core.resources.GCUBERunningInstance; import org.gcube.informationsystem.registry.impl.RegistryFactory; +import org.gcube.informationsystem.registry.impl.contexts.ServiceContext; import org.gcube.informationsystem.registry.stubs.RemoveResourceMessage; @@ -30,14 +28,7 @@ public class RegistryUtil { public static ISClient client = null; - public RegistryUtil () { - try { - client = GHNContext.getImplementation(ISClient.class); - } catch (Exception e) { - e.printStackTrace(); - } - } - + /** * Queries the IS to find a GCUBEResource given its ID * @@ -73,12 +64,13 @@ public class RegistryUtil { * @throws RemoteException */ public static void unregisterRIRelatedToGHN(String id ,RegistryFactory service) throws Exception{ + if (client==null) client = GHNContext.getImplementation(ISClient.class); RemoveResourceMessage message = null; GCUBEGenericQuery query = client.getQuery("RIOnGHN"); query.addParameters(new QueryParameter("ID", GHNContext.getContext().getGHNID())); //query to IS on order to retrieve the RI deployed on the GHN; - List resources = client.execute(query, GHNContext.getContext().getDefaultScope()); + List resources = client.execute(query, ServiceContext.getContext().getScope()); if (resources.size() != 0){ for (XMLResult resource : resources) {