From ae73f7b80970efcf9d7164a04d7d01056e73a295 Mon Sep 17 00:00:00 2001 From: Andrea Manzi Date: Thu, 20 Mar 2008 16:37:41 +0000 Subject: [PATCH] git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@37 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../registry/impl/core/RegistryFactory.java | 35 ++++++++++++------- .../impl/core/RegistryFactoryResource.java | 22 ------------ 2 files changed, 22 insertions(+), 35 deletions(-) diff --git a/org/gcube/informationsystem/registry/impl/core/RegistryFactory.java b/org/gcube/informationsystem/registry/impl/core/RegistryFactory.java index 7b413d8..8a55238 100644 --- a/org/gcube/informationsystem/registry/impl/core/RegistryFactory.java +++ b/org/gcube/informationsystem/registry/impl/core/RegistryFactory.java @@ -7,8 +7,6 @@ import java.rmi.RemoteException; import java.util.ArrayList; import java.util.Calendar; -import javax.xml.rpc.ServiceException; - import org.gcube.common.core.contexts.GCUBEServiceContext; import org.gcube.common.core.contexts.GHNContext; import org.gcube.common.core.faults.GCUBEFault; @@ -40,7 +38,6 @@ import org.gcube.informationsystem.registry.stubs.UpdateScopeInProfileMessage; import org.gcube.informationsystem.registry.stubs.UpdateStateMessage; import org.gcube.informationsystem.registry.stubs.service.RegistryServiceAddressingLocator; import org.globus.wsrf.ResourceContext; -import org.globus.wsrf.ResourceException; import org.globus.wsrf.ResourceKey; import org.globus.wsrf.impl.SimpleResourceKey; import org.oasis.wsrf.lifetime.Destroy; @@ -59,10 +56,6 @@ public class RegistryFactory extends GCUBEStartupPortType{ * */ protected final GCUBELog logger = new GCUBELog(RegistryFactory.class); - /* * - */ - private RegistryConfiguration config = null; - /** * * @@ -274,8 +267,6 @@ public class RegistryFactory extends GCUBEStartupPortType{ String ID = inputMessage.getUniqueID(); - RegistryPortType instancePT = null; - if (ID == null || ID.compareTo("") ==0) { logger.debug("ID missing "); throw new RemoteException("Error, ID missing"); @@ -303,7 +294,6 @@ public class RegistryFactory extends GCUBEStartupPortType{ else { logger.debug("Try to remove the resource from the ISIC"); - GCUBEPublisher publisher = new GCUBEPublisher(); ProfileManager manager; try { manager = new GCUBEPublisher().getProfileManager(null, GHNContext.getContext().getDefaultScope()); @@ -419,14 +409,14 @@ public class RegistryFactory extends GCUBEStartupPortType{ property.setOperationType(operationType); property.setChangeTime(updateTime); //select the type of the resource to update - for (Method method :((RegistryFactoryResource)FactoryContext.getContext().getWSHome().find()).getClass().getDeclaredMethods()) { + for (Method method :this.getResource().getClass().getDeclaredMethods()) { if (method.getName().contains(resource.getType()) && method.getName().contains("set")) { - method.invoke((RegistryFactoryResource)FactoryContext.getContext().getWSHome().find(),property); + method.invoke(this.getResource(),property); break; } } - ((RegistryFactoryResource)FactoryContext.getContext().getWSHome().find()).getPersistenceDelegate().store(((RegistryFactoryResource)FactoryContext.getContext().getWSHome().find())); + this.getResource().getPersistenceDelegate().store(this.getResource()); /* String gLueType= prof.getGlueResourceType(); @@ -457,6 +447,25 @@ public class RegistryFactory extends GCUBEStartupPortType{ } + /** + * return the resource + * + * @return NotifierResource + * @throws RemoteException Exception + */ + private RegistryFactoryResource getResource() throws RemoteException { + Object resource = null; + try { + resource = FactoryContext.getContext().getWSHome().find(FactoryContext.getContext().makeKey("FactoryResource")); + //resource= ResourceContext.getResourceContext().getResource(); + } catch (Exception e) { + logger.error(" Unable to access resource", e); + } + + RegistryFactoryResource factoryResource = (RegistryFactoryResource) resource; + return factoryResource; + } + public String updateScopeInProfile(UpdateScopeInProfileMessage message)throws GCUBEFault{return null;} public String removeScopeInProfile(RemoveScopeInProfileMessage message)throws GCUBEFault{return null;} diff --git a/org/gcube/informationsystem/registry/impl/core/RegistryFactoryResource.java b/org/gcube/informationsystem/registry/impl/core/RegistryFactoryResource.java index 5499fab..00d22a7 100644 --- a/org/gcube/informationsystem/registry/impl/core/RegistryFactoryResource.java +++ b/org/gcube/informationsystem/registry/impl/core/RegistryFactoryResource.java @@ -4,14 +4,10 @@ import java.util.ArrayList; import javax.xml.namespace.QName; -import org.gcube.common.core.is.publisher.ISPublisher; -import org.gcube.common.core.contexts.GHNContext; import org.gcube.common.core.state.GCUBEWSResource; import org.gcube.informationsystem.registry.impl.util.RegistrationThread; import org.gcube.informationsystem.registry.stubs.RegistryProperty; import org.globus.wsrf.ResourceException; -import org.globus.wsrf.config.ContainerConfig; -import org.globus.wsrf.impl.SimpleResourceKey; /** * @@ -58,9 +54,6 @@ public class RegistryFactoryResource extends GCUBEWSResource { return RPNames; } - private SimpleResourceKey key =null; - - protected static String[] RPNames = {ExternalRunningInstanceRP, ServiceRP, CollectionRP, @@ -84,24 +77,12 @@ public class RegistryFactoryResource extends GCUBEWSResource { */ private ArrayList listQname; - /** - - * - */ - private static String fileBackup ="RegistryFactory"; - - - /** * * Initializes Resource Properties. * @throws Exception Exception */ protected void initialise(Object... o) throws ResourceException { - //set the resource ID - //this.setID(RegistryFactoryResourceHome.this.); - String baseDir = ContainerConfig.getBaseDirectory(); - logger.debug("Starting RegistryFactoryService"); /* Initialize the RP's */ @@ -111,9 +92,6 @@ public class RegistryFactoryResource extends GCUBEWSResource { listQname = new ArrayList(); for (String rpName : RPNames) listQname.add(new QName(this.getPorttypeContext().getNamespace(),rpName)); -// try registration - boolean check = false; - try { RegistrationThread thread = new RegistrationThread(listQname); Thread t = new Thread(thread);