Bug fixing (remove related RIonGHN), internal event for agent
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/gCubeIS/Registry@3766 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3539ca8717
commit
120f604dcd
|
@ -10,11 +10,14 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import org.apache.axis.components.uuid.UUIDGen;
|
||||
import org.apache.axis.components.uuid.UUIDGenFactory;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.faults.GCUBEFault;
|
||||
import org.gcube.common.core.resources.GCUBEHostingNode;
|
||||
import org.gcube.common.core.resources.GCUBEResource;
|
||||
import org.gcube.common.core.resources.impl.kxml.GCUBEResourceImpl;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.state.GCUBEWSResourceKey;
|
||||
import org.gcube.common.core.utils.events.GCUBEEvent;
|
||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
import org.gcube.informationsystem.registry.impl.contexts.FactoryContext;
|
||||
import org.gcube.informationsystem.registry.impl.contexts.ProfileContext;
|
||||
|
@ -167,6 +170,9 @@ public class RegistryFactory{
|
|||
throw new RemoteException(msg);
|
||||
}
|
||||
try {
|
||||
GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource> event = new GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource>();
|
||||
event.setPayload(resource);
|
||||
ServiceContext.getContext().getTopicProducer().notify(ServiceContext.RegistryTopic.CREATE, event);
|
||||
updateCounterInfo (resource.getID(), ResourceType.valueOf(mess.getType()), OperationType.create, Calendar.getInstance());
|
||||
} catch (Exception e) {
|
||||
logger.warn("Error updating Counting info for resource with ID " + resource.getID(), e);
|
||||
|
@ -193,6 +199,7 @@ public class RegistryFactory{
|
|||
* @throws RemoteException Exception
|
||||
* @throws SchemaValidationException Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public UpdateResourceResponse updateResource(UpdateResourceMessage mess) throws RemoteException,SchemaValidationFault,GCUBEFault {
|
||||
|
||||
logSecurityInfo("updateResource");
|
||||
|
@ -230,6 +237,9 @@ public class RegistryFactory{
|
|||
|
||||
try {
|
||||
updateCounterInfo (ID,ResourceType.valueOf(mess.getType()),OperationType.update, Calendar.getInstance());
|
||||
GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource> event = new GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource>();
|
||||
event.setPayload(resource);
|
||||
ServiceContext.getContext().getTopicProducer().notify(ServiceContext.RegistryTopic.UPDATE, event);
|
||||
} catch (Exception e) {
|
||||
logger.warn("Error updating counting info for resource with ID " + resource.getID(), e);
|
||||
}
|
||||
|
@ -294,6 +304,13 @@ public class RegistryFactory{
|
|||
throw new RemoteException();
|
||||
}
|
||||
try {
|
||||
|
||||
GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource> event = new GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource>();
|
||||
GCUBEResource resource =GHNContext.getImplementation(GCUBEResource.class);
|
||||
resource.setID(ID);
|
||||
event.setPayload(resource);
|
||||
ServiceContext.getContext().getTopicProducer().notify(ServiceContext.RegistryTopic.REMOVE, event);
|
||||
|
||||
updateCounterInfo(ID, ResourceType.valueOf(type), OperationType.destroy, Calendar.getInstance());
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
package org.gcube.informationsystem.registry.impl.contexts;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import org.apache.axis.encoding.TypeMappingRegistry;
|
||||
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
|
||||
import org.apache.axis.encoding.ser.BeanSerializerFactory;
|
||||
import java.util.List;
|
||||
import org.gcube.common.core.contexts.GCUBEServiceContext;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import static org.gcube.common.core.contexts.GHNContext.Mode;
|
||||
|
||||
import org.gcube.common.core.informationsystem.client.AtomicCondition;
|
||||
import org.gcube.common.core.informationsystem.client.ISClient;
|
||||
import org.gcube.common.core.informationsystem.client.queries.GCUBEGHNQuery;
|
||||
|
@ -21,18 +15,14 @@ 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.scope.GCUBEScope;
|
||||
import org.gcube.common.core.state.GCUBETopicList;
|
||||
import org.gcube.common.core.utils.events.GCUBEProducer;
|
||||
import org.gcube.common.core.utils.events.GCUBETopic;
|
||||
import org.gcube.common.core.utils.handlers.GCUBEHandler;
|
||||
import org.gcube.common.core.utils.handlers.GCUBEScheduledHandler;
|
||||
import org.gcube.common.vremanagement.ghnmanager.impl.GHNManager;
|
||||
import org.gcube.informationsystem.registry.impl.RegistryFactory;
|
||||
import org.gcube.informationsystem.registry.impl.core.RegistryConfiguration.ROOT_SERVICES;
|
||||
import org.gcube.informationsystem.registry.impl.state.RegistryFactoryResource;
|
||||
import org.globus.mds.aggregator.types.AggregatorContent;
|
||||
import org.globus.mds.servicegroup.client.ServiceGroupRegistrationParameters;
|
||||
import org.globus.wsrf.config.ContainerConfig;
|
||||
import org.globus.wsrf.encoding.ObjectDeserializer;
|
||||
import org.globus.wsrf.utils.XmlUtils;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -51,12 +41,14 @@ public class ServiceContext extends GCUBEServiceContext {
|
|||
|
||||
protected GCUBERIQuery queryRI = null;
|
||||
|
||||
public static enum RegistryTopic implements GCUBETopic{CREATE,UPDATE, REMOVE};
|
||||
//protected GCUBEResourceXPathQuery queryGHN = null;
|
||||
|
||||
protected boolean isNotifierCodeployed = false;
|
||||
|
||||
protected boolean isICCodeployed = false;
|
||||
|
||||
protected GCUBEProducer<RegistryTopic, GCUBEResource> topicProducer;
|
||||
|
||||
protected class NotificationResourceScheduler extends GCUBEScheduledHandler {
|
||||
|
||||
|
@ -93,6 +85,10 @@ public class ServiceContext extends GCUBEServiceContext {
|
|||
return JNDI_NAME;
|
||||
}
|
||||
|
||||
public GCUBEProducer<RegistryTopic, GCUBEResource> getTopicProducer(){
|
||||
return topicProducer;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onReady() throws Exception {
|
||||
|
||||
|
@ -160,9 +156,13 @@ public class ServiceContext extends GCUBEServiceContext {
|
|||
//this.queryRI = this.client.getQuery(GCUBERIQuery.class);
|
||||
//this.queryGHN = this.client.getQuery(GCUBEResourceXPathQuery.class);
|
||||
this.client = GHNContext.getImplementation(ISClient.class);
|
||||
|
||||
|
||||
topicProducer= new GCUBEProducer<RegistryTopic, GCUBEResource>();
|
||||
topicProducer.registerTopics(RegistryTopic.CREATE, RegistryTopic.UPDATE, RegistryTopic.REMOVE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Register the Profile
|
||||
*
|
||||
|
|
|
@ -8,6 +8,7 @@ import javax.xml.namespace.QName;
|
|||
import org.gcube.common.core.informationsystem.notifier.ISNotifier;
|
||||
import org.gcube.common.core.informationsystem.publisher.ISPublisher;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
import org.gcube.informationsystem.registry.impl.contexts.FactoryContext;
|
||||
import org.gcube.informationsystem.registry.impl.contexts.ServiceContext;
|
||||
|
@ -54,8 +55,9 @@ public class RegistrationThread implements Runnable{
|
|||
catch(InterruptedException e){
|
||||
}
|
||||
try {
|
||||
|
||||
ISNotifier notifier = GHNContext.getImplementation(ISNotifier.class);
|
||||
notifier.registerISNotification(FactoryContext.getContext().getEPR(),topics, ServiceContext.getContext());
|
||||
notifier.registerISNotification(FactoryContext.getContext().getEPR(),topics, ServiceContext.getContext(), ServiceContext.getContext().getInstance().getScopes().values().toArray(new GCUBEScope[0]));
|
||||
return;
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -77,7 +77,7 @@ public class RegistryUtil {
|
|||
try {
|
||||
message = new RemoveResourceMessage();
|
||||
message.setType(GCUBERunningInstance.TYPE);
|
||||
message.setUniqueID(resource.evaluate("/ID/text()").get(0));
|
||||
message.setUniqueID(resource.evaluate("/Resource/ID/text()").get(0));
|
||||
service.removeResource(message);
|
||||
} catch (RemoteException rme) {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue