This commit is contained in:
Lucio Lelii 2010-05-13 16:25:40 +00:00
parent ee357f7018
commit 6e71f45970
3 changed files with 10 additions and 7 deletions

View File

@ -109,7 +109,7 @@
<!--
<resource name="publicationProfile" type="org.gcube.common.core.state.GCUBEPublicationProfile"> <resource name="publicationProfile" type="org.gcube.common.core.state.GCUBEPublicationProfile">
<resourceParams> <resourceParams>
<parameter> <parameter>
@ -125,7 +125,7 @@
<value>registrationFactory.xml</value> <value>registrationFactory.xml</value>
</parameter> </parameter>
</resourceParams> </resourceParams>
</resource> </resource> -->
<resource name="home" type="org.gcube.informationsystem.registry.impl.state.RegistryFactoryResourceHome"> <resource name="home" type="org.gcube.informationsystem.registry.impl.state.RegistryFactoryResourceHome">
<resourceParams> <resourceParams>

View File

@ -82,6 +82,7 @@
<xsd:complexType name="RegistryProperty"> <xsd:complexType name="RegistryProperty">
<xsd:sequence> <xsd:sequence>
<xsd:element name="uniqueID" type="xsd:string" nillable="true"/> <xsd:element name="uniqueID" type="xsd:string" nillable="true"/>
<xsd:element name="profile" type="xsd:string" nillable="true"/>
<xsd:element name="operationType" type="xsd:string" nillable="true"/> <xsd:element name="operationType" type="xsd:string" nillable="true"/>
<xsd:element name="changeTime" type="xsd:dateTime" nillable="true"/> <xsd:element name="changeTime" type="xsd:dateTime" nillable="true"/>
</xsd:sequence> </xsd:sequence>

View File

@ -172,7 +172,8 @@ public class RegistryFactory extends GCUBEPortType {
throw new RemoteException(msg); throw new RemoteException(msg);
} }
try { try {
updateCounterInfo(resource.getID(), ResourceType.valueOf(mess.getType()), OperationType.create, Calendar.getInstance()); updateCounterInfo(resource.getID(), ResourceType.valueOf(mess.getType()), OperationType.create, Calendar.getInstance(), mess.getProfile());
GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource> event = new GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource>(); GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource> event = new GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource>();
event.setPayload(resource); event.setPayload(resource);
ServiceContext.getContext().getTopicProducer().notify( ServiceContext.getContext().getTopicProducer().notify(
@ -284,7 +285,7 @@ public class RegistryFactory extends GCUBEPortType {
} }
try { try {
this.updateCounterInfo(ID, ResourceType.valueOf(mess.getType()), OperationType.update, Calendar.getInstance()); this.updateCounterInfo(ID, ResourceType.valueOf(mess.getType()), OperationType.update, Calendar.getInstance(), xmlProfile);
GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource> event = new GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource>(); GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource> event = new GCUBEEvent<ServiceContext.RegistryTopic, GCUBEResource>();
event.setPayload(resource); event.setPayload(resource);
ServiceContext.getContext().getTopicProducer().notify(ServiceContext.RegistryTopic.UPDATE, event); ServiceContext.getContext().getTopicProducer().notify(ServiceContext.RegistryTopic.UPDATE, event);
@ -350,7 +351,7 @@ public class RegistryFactory extends GCUBEPortType {
resource.setID(ID); resource.setID(ID);
event.setPayload(resource); event.setPayload(resource);
ServiceContext.getContext().getTopicProducer().notify(ServiceContext.RegistryTopic.REMOVE, event); ServiceContext.getContext().getTopicProducer().notify(ServiceContext.RegistryTopic.REMOVE, event);
updateCounterInfo(ID, ResourceType.valueOf(type),OperationType.destroy, Calendar.getInstance()); updateCounterInfo(ID, ResourceType.valueOf(type),OperationType.destroy, Calendar.getInstance(),null);
} catch (Exception e) { } catch (Exception e) {
logger.warn("Error updating counting info for resource with ID " + ID, e); logger.warn("Error updating counting info for resource with ID " + ID, e);
} }
@ -409,11 +410,12 @@ public class RegistryFactory extends GCUBEPortType {
*/ */
private synchronized void updateCounterInfo(String ID, private synchronized void updateCounterInfo(String ID,
ResourceType resType, OperationType opType, Calendar updateTime) ResourceType resType, OperationType opType, Calendar updateTime, String profile)
throws Exception { throws Exception {
RegistryProperty property = new RegistryProperty(); RegistryProperty property = new RegistryProperty();
property.setUniqueID(ID); property.setUniqueID(ID);
property.setProfile(profile);
property.setOperationType(opType.name()); property.setOperationType(opType.name());
property.setChangeTime(updateTime); property.setChangeTime(updateTime);
// select the type of the resource to update // select the type of the resource to update