git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@3299 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Lucio Lelii 2008-09-17 16:53:33 +00:00
parent fe1843f6d9
commit c516201fdd
1 changed files with 4 additions and 12 deletions

View File

@ -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<XMLResult> resources = client.execute(query, GHNContext.getContext().getDefaultScope());
List<XMLResult> resources = client.execute(query, ServiceContext.getContext().getScope());
if (resources.size() != 0){
for (XMLResult resource : resources) {