diff --git a/org/gcube/informationsystem/registry/impl/core/ProfileResource.java b/org/gcube/informationsystem/registry/impl/core/ProfileResource.java index a3995e0..5ce10dd 100644 --- a/org/gcube/informationsystem/registry/impl/core/ProfileResource.java +++ b/org/gcube/informationsystem/registry/impl/core/ProfileResource.java @@ -12,6 +12,7 @@ import org.gcube.common.core.contexts.GHNContext; 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.resources.GCUBEService; import org.gcube.common.core.state.GCUBEWSResource; import org.gcube.common.core.utils.logging.GCUBELog; import org.globus.wsrf.ResourceException; @@ -55,8 +56,6 @@ public class ProfileResource extends GCUBEWSResource { public void initialise(Object... params) throws ResourceException { GCUBEResource resource = (GCUBEResource) params[0]; - //Setting the key - this.setID(ProfileContext.getContext().makeKey(resource.getID())); StringWriter writer =new StringWriter(); try { resource.store(writer); @@ -127,7 +126,9 @@ public class ProfileResource extends GCUBEWSResource { * return true/false */ private boolean hasToLive(GCUBEResource resource) { - if (resource.getType().compareTo(GCUBERunningInstance.TYPE)==0 || resource.getType().compareTo(GCUBEHostingNode.TYPE)==0) return true; + if (resource.getType().compareTo(GCUBERunningInstance.TYPE)==0 || + resource.getType().compareTo(GCUBEHostingNode.TYPE)==0 || + resource.getType().compareTo(GCUBEService.TYPE)==0) return true; else return false; } diff --git a/org/gcube/informationsystem/registry/impl/core/RegistryFactory.java b/org/gcube/informationsystem/registry/impl/core/RegistryFactory.java index 875acc0..fbc8112 100644 --- a/org/gcube/informationsystem/registry/impl/core/RegistryFactory.java +++ b/org/gcube/informationsystem/registry/impl/core/RegistryFactory.java @@ -163,7 +163,7 @@ public class RegistryFactory extends GCUBEStartupPortType{ //try to create resource try { - ProfileContext.getContext().getWSHome().create(resource); + ProfileContext.getContext().getWSHome().create(ProfileContext.getContext().makeKey(resource.getID()),resource); } catch (Exception ex) { String msg = "Error creating Resource"; @@ -384,7 +384,7 @@ public class RegistryFactory extends GCUBEStartupPortType{ protected synchronized ProfileResource getProfileResource(String id ){ ProfileResource resource = null; - ResourceKey key = new SimpleResourceKey(ProfileContext.getContext().getWSHome().getKeyTypeName(), id); + ResourceKey key = ProfileContext.getContext().makeKey( id); try { resource = (ProfileResource) ProfileContext.getContext().getWSHome().find(key);