This commit is contained in:
Andrea Manzi 2008-03-20 16:37:41 +00:00
parent 2fb2656be7
commit ae73f7b809
2 changed files with 22 additions and 35 deletions

View File

@ -7,8 +7,6 @@ import java.rmi.RemoteException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import javax.xml.rpc.ServiceException;
import org.gcube.common.core.contexts.GCUBEServiceContext; import org.gcube.common.core.contexts.GCUBEServiceContext;
import org.gcube.common.core.contexts.GHNContext; import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.faults.GCUBEFault; 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.UpdateStateMessage;
import org.gcube.informationsystem.registry.stubs.service.RegistryServiceAddressingLocator; import org.gcube.informationsystem.registry.stubs.service.RegistryServiceAddressingLocator;
import org.globus.wsrf.ResourceContext; import org.globus.wsrf.ResourceContext;
import org.globus.wsrf.ResourceException;
import org.globus.wsrf.ResourceKey; import org.globus.wsrf.ResourceKey;
import org.globus.wsrf.impl.SimpleResourceKey; import org.globus.wsrf.impl.SimpleResourceKey;
import org.oasis.wsrf.lifetime.Destroy; import org.oasis.wsrf.lifetime.Destroy;
@ -59,10 +56,6 @@ public class RegistryFactory extends GCUBEStartupPortType{
* */ * */
protected final GCUBELog logger = new GCUBELog(RegistryFactory.class); 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(); String ID = inputMessage.getUniqueID();
RegistryPortType instancePT = null;
if (ID == null || ID.compareTo("") ==0) { if (ID == null || ID.compareTo("") ==0) {
logger.debug("ID missing "); logger.debug("ID missing ");
throw new RemoteException("Error, ID missing"); throw new RemoteException("Error, ID missing");
@ -303,7 +294,6 @@ public class RegistryFactory extends GCUBEStartupPortType{
else { else {
logger.debug("Try to remove the resource from the ISIC"); logger.debug("Try to remove the resource from the ISIC");
GCUBEPublisher publisher = new GCUBEPublisher();
ProfileManager manager; ProfileManager manager;
try { try {
manager = new GCUBEPublisher().getProfileManager(null, GHNContext.getContext().getDefaultScope()); manager = new GCUBEPublisher().getProfileManager(null, GHNContext.getContext().getDefaultScope());
@ -419,14 +409,14 @@ public class RegistryFactory extends GCUBEStartupPortType{
property.setOperationType(operationType); property.setOperationType(operationType);
property.setChangeTime(updateTime); property.setChangeTime(updateTime);
//select the type of the resource to update //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")) { if (method.getName().contains(resource.getType()) && method.getName().contains("set")) {
method.invoke((RegistryFactoryResource)FactoryContext.getContext().getWSHome().find(),property); method.invoke(this.getResource(),property);
break; break;
} }
} }
((RegistryFactoryResource)FactoryContext.getContext().getWSHome().find()).getPersistenceDelegate().store(((RegistryFactoryResource)FactoryContext.getContext().getWSHome().find())); this.getResource().getPersistenceDelegate().store(this.getResource());
/* String gLueType= prof.getGlueResourceType(); /* 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 updateScopeInProfile(UpdateScopeInProfileMessage message)throws GCUBEFault{return null;}
public String removeScopeInProfile(RemoveScopeInProfileMessage message)throws GCUBEFault{return null;} public String removeScopeInProfile(RemoveScopeInProfileMessage message)throws GCUBEFault{return null;}

View File

@ -4,14 +4,10 @@ import java.util.ArrayList;
import javax.xml.namespace.QName; 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.common.core.state.GCUBEWSResource;
import org.gcube.informationsystem.registry.impl.util.RegistrationThread; import org.gcube.informationsystem.registry.impl.util.RegistrationThread;
import org.gcube.informationsystem.registry.stubs.RegistryProperty; import org.gcube.informationsystem.registry.stubs.RegistryProperty;
import org.globus.wsrf.ResourceException; 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; return RPNames;
} }
private SimpleResourceKey key =null;
protected static String[] RPNames = {ExternalRunningInstanceRP, protected static String[] RPNames = {ExternalRunningInstanceRP,
ServiceRP, ServiceRP,
CollectionRP, CollectionRP,
@ -84,24 +77,12 @@ public class RegistryFactoryResource extends GCUBEWSResource {
*/ */
private ArrayList<QName> listQname; private ArrayList<QName> listQname;
/**
*
*/
private static String fileBackup ="RegistryFactory";
/** /**
* *
* Initializes Resource Properties. * Initializes Resource Properties.
* @throws Exception Exception * @throws Exception Exception
*/ */
protected void initialise(Object... o) throws ResourceException { protected void initialise(Object... o) throws ResourceException {
//set the resource ID
//this.setID(RegistryFactoryResourceHome.this.);
String baseDir = ContainerConfig.getBaseDirectory();
logger.debug("Starting RegistryFactoryService"); logger.debug("Starting RegistryFactoryService");
/* Initialize the RP's */ /* Initialize the RP's */
@ -111,9 +92,6 @@ public class RegistryFactoryResource extends GCUBEWSResource {
listQname = new ArrayList<QName>(); listQname = new ArrayList<QName>();
for (String rpName : RPNames) for (String rpName : RPNames)
listQname.add(new QName(this.getPorttypeContext().getNamespace(),rpName)); listQname.add(new QName(this.getPorttypeContext().getNamespace(),rpName));
// try registration
boolean check = false;
try { try {
RegistrationThread thread = new RegistrationThread(listQname); RegistrationThread thread = new RegistrationThread(listQname);
Thread t = new Thread(thread); Thread t = new Thread(thread);