Adding purgers for RI and gHN resources
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@36390 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9c271345c2
commit
0a42a72939
|
@ -16,6 +16,9 @@ import org.gcube.common.core.utils.events.GCUBEProducer;
|
|||
import org.gcube.common.core.utils.events.GCUBETopic;
|
||||
import org.gcube.common.core.utils.handlers.GCUBEScheduledHandler;
|
||||
import org.gcube.informationsystem.registry.impl.local.LocalProfileConsumerImpl;
|
||||
import org.gcube.informationsystem.registry.impl.purging.AvailablePurgers;
|
||||
import org.gcube.informationsystem.registry.impl.purging.GHNPurger;
|
||||
import org.gcube.informationsystem.registry.impl.purging.RIPurger;
|
||||
import org.gcube.informationsystem.registry.impl.resourcemanagement.EliminatePoolingThread;
|
||||
|
||||
|
||||
|
@ -105,18 +108,11 @@ public class ServiceContext extends GCUBEServiceContext {
|
|||
|
||||
//switch to the production mode if needed
|
||||
if (GHNContext.getContext().getMode() == Mode.ROOT)
|
||||
GHNContext.getContext().setMode(Mode.CONNECTED);
|
||||
|
||||
/*NotificationResourceScheduler scheduler = new NotificationResourceScheduler(20, GCUBEScheduledHandler.Mode.LAZY);
|
||||
|
||||
scheduler.setScheduled(new GCUBEHandler(){
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
RegistryFactory.initialize();
|
||||
}
|
||||
});
|
||||
scheduler.run();*/
|
||||
this.subscribeToLocalRegistrationEvents();
|
||||
|
||||
//register purgers for GCUBEResources
|
||||
AvailablePurgers.register(new GHNPurger());
|
||||
AvailablePurgers.register(new RIPurger());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package org.gcube.informationsystem.registry.impl.porttypes;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.informationsystem.publisher.ISResourcePublisher;
|
||||
import org.gcube.common.core.resources.GCUBEResource;
|
||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
import org.gcube.informationsystem.registry.impl.contexts.ServiceContext;
|
||||
import org.gcube.informationsystem.registry.impl.contexts.ServiceContext.RegistryTopic;
|
||||
import org.gcube.informationsystem.registry.impl.local.LocalNotifier;
|
||||
import org.gcube.informationsystem.registry.impl.purging.AvailablePurgers;
|
||||
import org.gcube.informationsystem.registry.impl.purging.Purger;
|
||||
import org.gcube.informationsystem.registry.impl.state.Definitions.OperationType;
|
||||
import org.gcube.informationsystem.registry.impl.state.Definitions.ResourceType;
|
||||
|
||||
public class LocalResourceRegistration {
|
||||
|
||||
protected final GCUBELog logger = new GCUBELog(ResourceRegistration.class);
|
||||
|
||||
public void create(GCUBEResource resource) throws Exception {
|
||||
ISResourcePublisher publisher = GHNContext.getImplementation(ISResourcePublisher.class);
|
||||
publisher.register(resource, ServiceContext.getContext().getScope(), ServiceContext.getContext());
|
||||
logger.debug("Resource " + resource.getID() + " successfully created");
|
||||
//let the notifiers know
|
||||
LocalNotifier.notifyEvent(resource, RegistryTopic.CREATE);
|
||||
StringWriter writer = new StringWriter();
|
||||
resource.store(writer);
|
||||
RegistryFactory.updateCounterInfo(resource.getID(), ResourceType.valueOf(
|
||||
resource.getType()), OperationType.create,
|
||||
Calendar.getInstance(), writer.toString());
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @throws Exception
|
||||
*/
|
||||
public void remove(String id, String type) throws Exception {
|
||||
ISResourcePublisher publisher = GHNContext.getImplementation(ISResourcePublisher.class);
|
||||
publisher.remove(id, type, ServiceContext.getContext().getScope(), ServiceContext.getContext());
|
||||
logger.debug("Resource " + id+ " successfully removed");
|
||||
// if there is a purger available, remove also the related RIs
|
||||
Purger<?> purger = AvailablePurgers.getPurger(ResourceType.valueOf(type).getResourceImplementation().getClass());
|
||||
if (purger != null)
|
||||
try {
|
||||
purger.purge(id, ServiceContext.getContext().getScope());
|
||||
} catch (Exception e) {
|
||||
logger.error("Error while removing the profiles related to the resource", e);
|
||||
}
|
||||
//let the notifiers know
|
||||
GCUBEResource resource = ResourceType.valueOf(type).getResourceImplementation();
|
||||
resource.setID(id);
|
||||
LocalNotifier.notifyEvent(resource, RegistryTopic.REMOVE);
|
||||
RegistryFactory.updateCounterInfo(id, ResourceType.valueOf(type),OperationType.destroy, Calendar.getInstance(), null);
|
||||
}
|
||||
|
||||
public void update(GCUBEResource resource) throws Exception {
|
||||
ISResourcePublisher publisher = GHNContext.getImplementation(ISResourcePublisher.class);
|
||||
publisher.register(resource, ServiceContext.getContext().getScope(), ServiceContext.getContext());
|
||||
logger.debug("Resource " + resource.getID() + " successfully updated");
|
||||
LocalNotifier.notifyEvent(resource, RegistryTopic.UPDATE);
|
||||
StringWriter writer = new StringWriter();
|
||||
resource.store(writer);
|
||||
RegistryFactory.updateCounterInfo(resource.getID(), ResourceType.valueOf(resource.getType()),
|
||||
OperationType.update, Calendar.getInstance(), writer.toString());
|
||||
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ import org.apache.axis.components.uuid.UUIDGen;
|
|||
import org.apache.axis.components.uuid.UUIDGenFactory;
|
||||
import org.gcube.common.core.contexts.GCUBEServiceContext;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.informationsystem.publisher.ISPublisherException;
|
||||
import org.gcube.common.core.informationsystem.publisher.ISResourcePublisher;
|
||||
import org.gcube.common.core.porttypes.GCUBEPortType;
|
||||
import org.gcube.common.core.resources.GCUBEHostingNode;
|
||||
|
@ -20,7 +21,9 @@ import org.gcube.informationsystem.registry.impl.contexts.ServiceContext.Registr
|
|||
import org.gcube.informationsystem.registry.impl.filters.FilterManager;
|
||||
import org.gcube.informationsystem.registry.impl.filters.FilterExecutor.InvalidFilterException;
|
||||
import org.gcube.informationsystem.registry.impl.local.LocalNotifier;
|
||||
import org.gcube.informationsystem.registry.impl.profilemanagement.GHN;
|
||||
import org.gcube.informationsystem.registry.impl.purging.AvailablePurgers;
|
||||
import org.gcube.informationsystem.registry.impl.purging.GHNPurger;
|
||||
import org.gcube.informationsystem.registry.impl.purging.Purger;
|
||||
import org.gcube.informationsystem.registry.impl.state.Definitions.OperationType;
|
||||
import org.gcube.informationsystem.registry.impl.state.Definitions.ResourceType;
|
||||
import org.gcube.informationsystem.registry.stubs.resourceregistration.CreateFault;
|
||||
|
@ -66,14 +69,7 @@ public class ResourceRegistration extends GCUBEPortType {
|
|||
this.applyFilters(resource);
|
||||
//create the new resource with the publisher
|
||||
try {
|
||||
ISResourcePublisher publisher = GHNContext.getImplementation(ISResourcePublisher.class);
|
||||
publisher.register(resource, ServiceContext.getContext().getScope(), ServiceContext.getContext());
|
||||
logger.debug("Resource " + resource.getID() + " successfully created");
|
||||
//let the notifiers know
|
||||
LocalNotifier.notifyEvent(resource, RegistryTopic.CREATE);
|
||||
RegistryFactory.updateCounterInfo(resource.getID(), ResourceType.valueOf(
|
||||
message.getType()), OperationType.create,
|
||||
Calendar.getInstance(), message.getProfile());
|
||||
new LocalResourceRegistration().create(resource);
|
||||
} catch (Exception e) {
|
||||
logger.error("Unable to register the resource", e);
|
||||
throw new CreateFault();
|
||||
|
@ -99,12 +95,7 @@ public class ResourceRegistration extends GCUBEPortType {
|
|||
this.applyFilters(resource);
|
||||
//update the resource with the publisher
|
||||
try {
|
||||
ISResourcePublisher publisher = GHNContext.getImplementation(ISResourcePublisher.class);
|
||||
publisher.register(resource, ServiceContext.getContext().getScope(), ServiceContext.getContext());
|
||||
logger.debug("Resource " + resource.getID() + " successfully updated");
|
||||
LocalNotifier.notifyEvent(resource, RegistryTopic.UPDATE);
|
||||
RegistryFactory.updateCounterInfo(resource.getID(), ResourceType.valueOf(message.getType()),
|
||||
OperationType.update, Calendar.getInstance(), message.getXmlProfile());
|
||||
new LocalResourceRegistration().update(resource);
|
||||
} catch (Exception e) {
|
||||
logger.error("Unable to update the resource", e);
|
||||
throw new UpdateFault();
|
||||
|
@ -114,11 +105,11 @@ public class ResourceRegistration extends GCUBEPortType {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param message
|
||||
* @return
|
||||
* @throws ResourceDoesNotExistFaultType
|
||||
* @throws RemoveFaultType
|
||||
* Removes a resource
|
||||
* @param message id and type of the resource to remove
|
||||
* @return an empty message
|
||||
* @throws ResourceDoesNotExistFaultType if the resource does not exist
|
||||
* @throws RemoveFaultType if an error occurs during the removal
|
||||
*/
|
||||
public RemoveResponse remove(RemoveMessage message) throws RemoveFault,RemoteException {
|
||||
String ID = message.getUniqueID();
|
||||
|
@ -129,34 +120,16 @@ public class ResourceRegistration extends GCUBEPortType {
|
|||
throw new RemoteException("Resource ID is missing, cannot manage the resource");
|
||||
}
|
||||
try {
|
||||
ISResourcePublisher publisher = GHNContext.getImplementation(ISResourcePublisher.class);
|
||||
publisher.remove(ID, type, ServiceContext.getContext().getScope(), ServiceContext.getContext());
|
||||
logger.debug("Resource " + ID+ " successfully removed");
|
||||
//let the notifiers know
|
||||
GCUBEResource resource = ResourceType.valueOf(type).getResourceClass();
|
||||
resource.setID(ID);
|
||||
LocalNotifier.notifyEvent(resource, RegistryTopic.REMOVE);
|
||||
RegistryFactory.updateCounterInfo(ID, ResourceType.valueOf(type),OperationType.destroy, Calendar.getInstance(), null);
|
||||
new LocalResourceRegistration().remove(ID, type);
|
||||
} catch (Exception e) {
|
||||
logger.error("Unable to remove the resource " + ID, e);
|
||||
throw new UpdateFault();
|
||||
}
|
||||
|
||||
// if the resource is a GHN, remove also the related RIs
|
||||
try {
|
||||
if (type.compareTo(GCUBEHostingNode.TYPE) == 0) {
|
||||
logger.debug("Removing the related RIs");
|
||||
GHN ghn = new GHN(ID);
|
||||
ghn.unregisterHostedRI();
|
||||
logger.debug("Related RIs removed");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Error while removing RI profiles related to the GHN", e);
|
||||
}
|
||||
|
||||
return new RemoveResponse();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads the {@link GCUBEResource} from its serialization
|
||||
* @param type the type of the resource to load
|
||||
|
@ -175,7 +148,7 @@ public class ResourceRegistration extends GCUBEPortType {
|
|||
}
|
||||
GCUBEResource resource;
|
||||
try {
|
||||
resource = ResourceType.valueOf(type).getResourceClass();
|
||||
resource = ResourceType.valueOf(type).getResourceImplementation();
|
||||
resource.load(new BufferedReader(new InputStreamReader( new ByteArrayInputStream(profile.getBytes("UTF-8")),"UTF-8")));
|
||||
//resource.addScope(ServiceContext.getContext().getScope());
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package org.gcube.informationsystem.registry.impl.purging;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class AvailablePurgers {
|
||||
|
||||
private static Map<Class<?>, Purger<?>> purgers = new HashMap<Class<?>, Purger<?>>();
|
||||
|
||||
public static void register(Purger<?> purger) {
|
||||
purgers.put(purger.getResourceClass(), purger);
|
||||
}
|
||||
|
||||
public static Purger<?> getPurger(Class<?> purgerClass) {
|
||||
return purgers.get(purgerClass);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
package org.gcube.informationsystem.registry.impl.profilemanagement;
|
||||
package org.gcube.informationsystem.registry.impl.purging;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.informationsystem.client.ISClient;
|
||||
|
@ -9,30 +11,26 @@ import org.gcube.common.core.informationsystem.client.QueryParameter;
|
|||
import org.gcube.common.core.informationsystem.client.XMLResult;
|
||||
import org.gcube.common.core.informationsystem.client.queries.GCUBEGenericQuery;
|
||||
import org.gcube.common.core.informationsystem.publisher.ISResourcePublisher;
|
||||
import org.gcube.common.core.resources.GCUBEHostingNode;
|
||||
import org.gcube.common.core.resources.GCUBEResource;
|
||||
import org.gcube.common.core.resources.GCUBERunningInstance;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
import org.gcube.informationsystem.registry.impl.porttypes.LocalResourceRegistration;
|
||||
import org.gcube.informationsystem.registry.impl.porttypes.RegistryFactory;
|
||||
import org.gcube.informationsystem.registry.impl.contexts.ServiceContext;
|
||||
import org.gcube.informationsystem.registry.stubs.RemoveResourceMessage;
|
||||
|
||||
/**
|
||||
*
|
||||
* GHN profile management
|
||||
* Purger for GHN resources
|
||||
*
|
||||
* @author Manuele Simi (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class GHN {
|
||||
public class GHNPurger implements Purger<GCUBEHostingNode> {
|
||||
|
||||
public static ISClient client = null;
|
||||
|
||||
protected static final GCUBELog logger = new GCUBELog(GHN.class);
|
||||
|
||||
private String id = null;
|
||||
|
||||
public GHN(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
protected static final GCUBELog logger = new GCUBELog(GHNPurger.class);
|
||||
|
||||
/**
|
||||
* Unregisters all the RIs hosted on the gHN
|
||||
|
@ -40,12 +38,11 @@ public class GHN {
|
|||
* @throws RemoteException
|
||||
* @deprecated
|
||||
*/
|
||||
public void unregisterHostedRIs(RegistryFactory service) throws Exception {
|
||||
if (client == null)
|
||||
client = GHNContext.getImplementation(ISClient.class);
|
||||
public void unregisterHostedRIs(RegistryFactory service, String ghnid) throws Exception {
|
||||
ISClient client = GHNContext.getImplementation(ISClient.class);
|
||||
RemoveResourceMessage message = null;
|
||||
GCUBEGenericQuery query = client.getQuery("RIOnGHN");
|
||||
query.addParameters(new QueryParameter("ID", this.id));
|
||||
query.addParameters(new QueryParameter("ID", ghnid));
|
||||
|
||||
// query to IS on order to retrieve the RI deployed on the GHN;
|
||||
List<XMLResult> resources = client.execute(query, ServiceContext.getContext().getScope());
|
||||
|
@ -65,27 +62,39 @@ public class GHN {
|
|||
}
|
||||
|
||||
public void unregisterHostedRI() throws Exception {
|
||||
if (client == null)
|
||||
client = GHNContext.getImplementation(ISClient.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> purge(String ghnid, GCUBEScope scope) throws Exception {
|
||||
ISClient client = GHNContext.getImplementation(ISClient.class);
|
||||
GCUBEGenericQuery query = client.getQuery("RIOnGHN");
|
||||
query.addParameters(new QueryParameter("ID", this.id));
|
||||
|
||||
query.addParameters(new QueryParameter("ID", ghnid));
|
||||
// query to IS on order to retrieve the RI deployed on the GHN;
|
||||
List<XMLResult> resources = client.execute(query, ServiceContext.getContext().getScope());
|
||||
|
||||
List<XMLResult> resources = client.execute(query, scope);
|
||||
Set<String> removed = new HashSet<String>();
|
||||
if (resources.size() != 0) {
|
||||
for (XMLResult resource : resources) {
|
||||
for (XMLResult ri : resources) {
|
||||
try {
|
||||
String id = resource.evaluate("/Resource/ID/text()").get(0);
|
||||
ISResourcePublisher publisher = GHNContext.getImplementation(ISResourcePublisher.class);
|
||||
publisher.remove(id, GCUBERunningInstance.TYPE, ServiceContext.getContext().getScope(), ServiceContext.getContext());
|
||||
logger.debug("Resource " + id+ " successfully removed");
|
||||
String id = ri.evaluate("/Resource/ID/text()").get(0);
|
||||
logger.debug("Removing Running Instance " + id );
|
||||
//ISResourcePublisher publisher = GHNContext.getImplementation(ISResourcePublisher.class);
|
||||
//publisher.remove(id, GCUBERunningInstance.TYPE, ServiceContext.getContext().getScope(), ServiceContext.getContext());
|
||||
new LocalResourceRegistration().remove(id, GCUBERunningInstance.TYPE);
|
||||
logger.debug("Resource " + id+ " successfully removed");
|
||||
removed.add(id);
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to remove a hosted RI from ghn " + this.id, e);
|
||||
logger.error("Failed to remove a hosted RI from ghn " + ghnid, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Class<GCUBEHostingNode> getResourceClass() {
|
||||
return GCUBEHostingNode.class;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package org.gcube.informationsystem.registry.impl.purging;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.common.core.resources.GCUBEResource;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
|
||||
/**
|
||||
* Base interface for purgers of {@link GCUBEResource}
|
||||
*
|
||||
* @param <RESOURCE>
|
||||
*
|
||||
* @author Manuele Simi (ISTI-CNR)
|
||||
*/
|
||||
public interface Purger<RESOURCE extends GCUBEResource> {
|
||||
|
||||
/**
|
||||
* Purges the RESOURCE
|
||||
* @param resourceId the resource identifier
|
||||
* @param scope the operational scope
|
||||
* @return the identifiers of the deleted resources
|
||||
* @throws Exception if the purging operation fails
|
||||
*/
|
||||
public Set<String> purge(String resourceId, GCUBEScope scope) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the actual type of RESOURCE
|
||||
* @return the type of RESOURCE
|
||||
*/
|
||||
public Class<RESOURCE> getResourceClass();
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package org.gcube.informationsystem.registry.impl.purging;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.informationsystem.client.ISClient;
|
||||
import org.gcube.common.core.informationsystem.client.XMLResult;
|
||||
import org.gcube.common.core.informationsystem.client.queries.GCUBEGenericQuery;
|
||||
import org.gcube.common.core.informationsystem.publisher.ISGenericPublisher;
|
||||
import org.gcube.common.core.informationsystem.publisher.ISResource;
|
||||
import org.gcube.common.core.informationsystem.publisher.ISResource.ISRESOURCETYPE;
|
||||
import org.gcube.common.core.resources.GCUBERunningInstance;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Manuele Simi (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class RIPurger implements Purger<GCUBERunningInstance> {
|
||||
|
||||
protected static final GCUBELog logger = new GCUBELog(GHNPurger.class);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Set<String> purge(String id, GCUBEScope scope) throws Exception {
|
||||
Set<String> ids = this.getWSResourceIDs(id, scope);
|
||||
Set<String> removed = new HashSet<String>();
|
||||
ISGenericPublisher publisher = GHNContext.getImplementation(ISGenericPublisher.class);
|
||||
ISResource resource = GHNContext.getImplementation(ISResource.class);
|
||||
resource.setType(ISRESOURCETYPE.RPD);
|
||||
resource.setCollection("Properties");
|
||||
for (String rpdoc : ids) {
|
||||
logger.debug("Removing WS-ResourceProperty document: " + rpdoc);
|
||||
try {
|
||||
resource.setID(rpdoc);
|
||||
publisher.remove(resource, scope);
|
||||
removed.add(rpdoc);
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to removeWS-ResourceProperty document: " + rpdoc, e);
|
||||
}
|
||||
}
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
private Set<String> getWSResourceIDs(String riid, GCUBEScope scope) throws Exception {
|
||||
ISClient client = GHNContext.getImplementation(ISClient.class);
|
||||
GCUBEGenericQuery query = client.getQuery(GCUBEGenericQuery.class);
|
||||
Set<String> ids = new HashSet<String>();
|
||||
query.setExpression(this.getAllRPIDsExpression(riid));
|
||||
for (XMLResult rpd : client.execute(query,scope))
|
||||
ids.add(rpd.toString().trim());
|
||||
return ids;
|
||||
}
|
||||
|
||||
private String getAllRPIDsExpression(String riid) {
|
||||
return "declare namespace is = 'http://gcube-system.org/namespaces/informationsystem/registry'; "
|
||||
+ "declare namespace gc = 'http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider'; "
|
||||
+ "for $outer in collection(\"/db/Properties\")//Document, $result in $outer/Data "
|
||||
+ "where ($result//gc:RI/string() eq \""+riid+"\") "
|
||||
+ "return $outer/ID/text()";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<GCUBERunningInstance> getResourceClass() {
|
||||
return GCUBERunningInstance.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -22,23 +22,21 @@ import org.gcube.common.core.resources.GCUBEService;
|
|||
public class Definitions {
|
||||
|
||||
|
||||
/** The Resource Type */
|
||||
/** The Resource Types */
|
||||
public static enum ResourceType {
|
||||
RunningInstance() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBERunningInstance.class);}},
|
||||
ExternalRunningInstance() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBEExternalRunningInstance.class);}},
|
||||
Service() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBEService.class);}},
|
||||
Collection() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBECollection.class);}},
|
||||
CS() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBECS.class);}},
|
||||
CSInstance() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBECSInstance.class);}},
|
||||
GHN() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBEHostingNode.class);}},
|
||||
gLiteSE() {public GCUBEResource getResourceClass() throws Exception {return null;}},
|
||||
gLiteCE() {public GCUBEResource getResourceClass() throws Exception {return null;}},
|
||||
gLiteSite() {public GCUBEResource getResourceClass()throws Exception {return null;}},
|
||||
gLiteService() {public GCUBEResource getResourceClass() throws Exception {return null;}},
|
||||
GenericResource() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBEGenericResource.class);}},
|
||||
MetadataCollection() {public GCUBEResource getResourceClass() throws Exception {return GHNContext.getImplementation(GCUBEMCollection.class);}};
|
||||
RunningInstance() {public GCUBEResource getResourceImplementation() throws Exception {return GHNContext.getImplementation(GCUBERunningInstance.class);}},
|
||||
ExternalRunningInstance() {public GCUBEResource getResourceImplementation() throws Exception {return GHNContext.getImplementation(GCUBEExternalRunningInstance.class);}},
|
||||
Service() {public GCUBEResource getResourceImplementation() throws Exception {return GHNContext.getImplementation(GCUBEService.class);}},
|
||||
Collection() {public GCUBEResource getResourceImplementation() throws Exception {return GHNContext.getImplementation(GCUBECollection.class);}},
|
||||
GHN() {public GCUBEResource getResourceImplementation() throws Exception {return GHNContext.getImplementation(GCUBEHostingNode.class);}},
|
||||
gLiteSE() {public GCUBEResource getResourceImplementation() throws Exception {return null;}},
|
||||
gLiteCE() {public GCUBEResource getResourceImplementation() throws Exception {return null;}},
|
||||
gLiteSite() {public GCUBEResource getResourceImplementation()throws Exception {return null;}},
|
||||
gLiteService() {public GCUBEResource getResourceImplementation() throws Exception {return null;}},
|
||||
GenericResource() {public GCUBEResource getResourceImplementation() throws Exception {return GHNContext.getImplementation(GCUBEGenericResource.class);}},
|
||||
MetadataCollection() {public GCUBEResource getResourceImplementation() throws Exception {return GHNContext.getImplementation(GCUBEMCollection.class);}};
|
||||
|
||||
abstract public GCUBEResource getResourceClass() throws Exception;
|
||||
abstract public GCUBEResource getResourceImplementation() throws Exception;
|
||||
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue