ticket #573 fix
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:
parent
fe1843f6d9
commit
c516201fdd
|
@ -3,8 +3,6 @@ package org.gcube.informationsystem.registry.impl.util;
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.xpath.XPathExpressionException;
|
|
||||||
|
|
||||||
import org.gcube.common.core.contexts.GHNContext;
|
import org.gcube.common.core.contexts.GHNContext;
|
||||||
import org.gcube.common.core.faults.GCUBEFault;
|
import org.gcube.common.core.faults.GCUBEFault;
|
||||||
import org.gcube.common.core.informationsystem.ISException;
|
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.QueryParameter;
|
||||||
import org.gcube.common.core.informationsystem.client.XMLResult;
|
import org.gcube.common.core.informationsystem.client.XMLResult;
|
||||||
import org.gcube.common.core.informationsystem.client.ISClient.ISMalformedQueryException;
|
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.informationsystem.client.queries.GCUBEGenericQuery;
|
||||||
import org.gcube.common.core.resources.GCUBERunningInstance;
|
import org.gcube.common.core.resources.GCUBERunningInstance;
|
||||||
import org.gcube.informationsystem.registry.impl.RegistryFactory;
|
import org.gcube.informationsystem.registry.impl.RegistryFactory;
|
||||||
|
import org.gcube.informationsystem.registry.impl.contexts.ServiceContext;
|
||||||
import org.gcube.informationsystem.registry.stubs.RemoveResourceMessage;
|
import org.gcube.informationsystem.registry.stubs.RemoveResourceMessage;
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,13 +28,6 @@ public class RegistryUtil {
|
||||||
|
|
||||||
public static ISClient client = null;
|
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
|
* Queries the IS to find a GCUBEResource given its ID
|
||||||
|
@ -73,12 +64,13 @@ public class RegistryUtil {
|
||||||
* @throws RemoteException
|
* @throws RemoteException
|
||||||
*/
|
*/
|
||||||
public static void unregisterRIRelatedToGHN(String id ,RegistryFactory service) throws Exception{
|
public static void unregisterRIRelatedToGHN(String id ,RegistryFactory service) throws Exception{
|
||||||
|
if (client==null) client = GHNContext.getImplementation(ISClient.class);
|
||||||
RemoveResourceMessage message = null;
|
RemoveResourceMessage message = null;
|
||||||
GCUBEGenericQuery query = client.getQuery("RIOnGHN");
|
GCUBEGenericQuery query = client.getQuery("RIOnGHN");
|
||||||
query.addParameters(new QueryParameter("ID", GHNContext.getContext().getGHNID()));
|
query.addParameters(new QueryParameter("ID", GHNContext.getContext().getGHNID()));
|
||||||
|
|
||||||
//query to IS on order to retrieve the RI deployed on the GHN;
|
//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){
|
if (resources.size() != 0){
|
||||||
for (XMLResult resource : resources) {
|
for (XMLResult resource : resources) {
|
||||||
|
|
Loading…
Reference in New Issue