This commit is contained in:
Manuele Simi 2008-04-15 15:51:08 +00:00
parent e6b1a308a9
commit c18e4061b1
4 changed files with 31 additions and 20 deletions

View File

@ -11,7 +11,6 @@ import java.util.List;
import org.apache.axis.components.uuid.UUIDGen;
import org.apache.axis.components.uuid.UUIDGenFactory;
import org.apache.axis.utils.XMLUtils;
import org.gcube.common.core.contexts.GCUBEServiceContext;
import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.faults.GCUBEFault;
@ -125,6 +124,9 @@ public class RegistryFactory extends GCUBEStartupPortType{
public String createResource(CreateResourceMessage inputMessage) throws SchemaValidationFault,RemoteException,ProfileAlreadyRegisteredFault {
GCUBEResource resource = null;
logSecurityInfo("createResource");
logger.info("CreateResource operation invoked");
String profile = inputMessage.getProfile();
if (profile == null || profile.compareTo("") == 0) {
@ -150,39 +152,36 @@ public class RegistryFactory extends GCUBEStartupPortType{
}
catch (Exception ex)
{
logger.error("Error trying to load profile");
ex.printStackTrace();
logger.error("Error trying to load profile", ex);
throw new SchemaValidationFault();
}
//check if the Resource already Exist
if (isResourceCreated(resource.getID())) {
String msg ="A Resource with ID "+ resource.getID()+" is already registered";
logger.debug(msg);
//check if the Resource already exists
if (isResourceCreated(resource.getID())) {
logger.debug("A Resource with ID "+ resource.getID()+" is already registered");
throw new ProfileAlreadyRegisteredFault();
}
//try to create resource
try {
logger.debug("Creating the stateful resource for " + resource.getID());
ProfileContext.getContext().getWSHome().create(ProfileContext.getContext().makeKey(resource.getID()),resource);
}
catch (Exception ex) {
String msg = "Error creating Resource";
logger.error(msg,ex);
ex.printStackTrace();
logger.error(msg,ex);
throw new RemoteException(msg);
}
try {
updateCounterInfo (resource.getID(),inputMessage.getType(),operationType.create.name(),Calendar.getInstance());
} catch (Exception e) {
logger.error("Error updating Counting info for resource with ID " + resource.getID());
e.printStackTrace();
}
StringWriter writer = new StringWriter();
try {
logger.debug("Persisting the stateful resource for " + resource.getID());
resource.store(writer);
} catch (Exception e) {
e.printStackTrace();
logger.error("Persistence failed for " + resource.getID(), e);
}
return writer.toString();
}
@ -200,6 +199,7 @@ public class RegistryFactory extends GCUBEStartupPortType{
public UpdateResourceResponse updateResource(UpdateProfileMessage mess) throws RemoteException,SchemaValidationFault,GCUBEFault {
logSecurityInfo("updateResource");
logger.info("UpdateResource operation invoked");
String ID = mess.getUniqueID();
String xmlProfile = mess.getXmlProfile();
GCUBEResource resource = null;
@ -251,6 +251,7 @@ public class RegistryFactory extends GCUBEStartupPortType{
*/
public RemoveResourceResponse removeResource (RemoveResourceMessage inputMessage) throws RemoteException,GCUBEFault{
logSecurityInfo("removeResource");
logger.info("RemoveResource operation invoked");
String ID = inputMessage.getUniqueID();
String type = inputMessage.getType();
if (ID == null || ID.compareTo("") ==0) {

View File

@ -106,7 +106,7 @@ public class RegistryFactoryResource extends GCUBEWSResource {
e.printStackTrace();
logger.error("Error on Registration Thread",e);
}
GHNContext.getImplementation(ISPublisher.class).registerWSResource(this,GHNContext.getContext().getDefaultScope());
//GHNContext.getImplementation(ISPublisher.class).registerWSResource(this,GHNContext.getContext().getDefaultScope());
} catch (Exception e) {
logger.error("Error on Initialization of Resource",e);

View File

@ -62,6 +62,7 @@ public class ServiceContext extends GCUBEServiceContext {
//creates the single RegistryResource used to raise notifications about profiles' changes
logger.info("Creating IS-Registry notification resource...");
FactoryContext.getContext().getWSHome().create(
FactoryContext.getContext().makeKey(RegistryFactory.NOTIFICATOR_RESOURCE_KEY));
logger.info("IS-Registry notification resource registered");

View File

@ -2,9 +2,6 @@ package org.gcube.informationsystem.registry.impl.util;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import org.diligentproject.informationservice.disic.stubs.DISICServiceLocator;
import org.diligentproject.informationservice.disic.stubs.DISICServicePortType;
@ -14,10 +11,7 @@ import org.gcube.common.core.scope.GCUBEScopeNotSupportedException;
import org.gcube.common.core.scope.ServiceMap;
import org.gcube.common.core.scope.ServiceMap.ServiceType;
import org.gcube.common.core.utils.logging.GCUBELog;
import org.gcube.common.informationsystem.publisher.impl.GCUBEPublisherException;
import org.gcube.common.informationsystem.publisher.impl.ProfileManager.ResourceTypes;
import org.gcube.informationsystem.registry.impl.core.ServiceContext;
import org.gridforum.jgss.ExtendedGSSCredential;
import org.ietf.jgss.GSSCredential;
public class ProfileManager {
@ -29,6 +23,21 @@ public class ProfileManager {
protected URL isIcAddress;
protected String VOMapName;
public enum ResourceTypes {
Service,
CS,
CSInstance,
Collection,
RunningInstance,
ExternalRunningInstance,
DHN,
gLiteResource,
VDL,
TransformationProgram,
MetadataCollection,
GenericResource
}
public ProfileManager() throws Exception {