This commit is contained in:
Andrea Manzi 2008-03-20 18:30:56 +00:00
parent 5d5418a940
commit e2374c479e
2 changed files with 6 additions and 5 deletions

View File

@ -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;
}

View File

@ -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);