Issue #1538 Fixes/cleanup to registry. Changed auditable event type sent time to DateTime instead of integer
Change-Id: I2d22199f9e1e35b3425e294ce3884ebb9d2cc99f Former-commit-id: 18737abc6781a353b831d9c012cc293f60731f89
This commit is contained in:
parent
598c254561
commit
68eeb03630
16 changed files with 135 additions and 131 deletions
|
@ -1,2 +1,5 @@
|
|||
ebxml-http-receive-timeout=40000
|
||||
# Time limit in milliseconds that an established HTTP connection will wait for a
|
||||
# response before throwing a timeout exception
|
||||
ebxml-http-receive-timeout=120000
|
||||
# Time limit in milliseconds to wait to establish an HTTP connection to a remote server
|
||||
ebxml-http-connection-timeout=30000
|
|
@ -21,7 +21,6 @@
|
|||
package oasis.names.tc.ebxml.regrep.xsd.query.v4;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
@ -32,7 +31,6 @@ import javax.xml.bind.annotation.XmlSchemaType;
|
|||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
@ -75,6 +73,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 2012 bphillip Initial implementation
|
||||
* 10/17/2013 1682 bphillip Added software history
|
||||
* 10/23/2013 1538 bphillip Removed unused constructors
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -176,40 +175,11 @@ public class QueryRequest extends RegistryRequestType {
|
|||
|
||||
}
|
||||
|
||||
public QueryRequest(String id, String comment, Collection<SlotType> slots,
|
||||
ResponseOptionType responseOption, QueryType query,
|
||||
Boolean federated, String federation, String format, String lang,
|
||||
Integer startIndex, Integer maxResults, Integer depth,
|
||||
Boolean matchOlderVersions) {
|
||||
super(id, comment, slots);
|
||||
this.responseOption = responseOption;
|
||||
public QueryRequest(String id, QueryType query,
|
||||
ResponseOptionType responseOption) {
|
||||
this.id = id;
|
||||
this.query = query;
|
||||
this.federated = federated;
|
||||
this.federation = federation;
|
||||
this.format = format;
|
||||
this.lang = lang;
|
||||
this.startIndex = BigInteger.valueOf(startIndex.longValue());
|
||||
this.maxResults = BigInteger.valueOf(maxResults.longValue());
|
||||
this.depth = BigInteger.valueOf(depth.longValue());
|
||||
this.matchOlderVersions = matchOlderVersions;
|
||||
}
|
||||
|
||||
public QueryRequest(String id, String comment,
|
||||
ResponseOptionType responseOption, QueryType query,
|
||||
Boolean federated, String federation, String format, String lang,
|
||||
Integer startIndex, Integer maxResults, Integer depth,
|
||||
Boolean matchOlderVersions) {
|
||||
super(id, comment, null);
|
||||
this.responseOption = responseOption;
|
||||
this.query = query;
|
||||
this.federated = federated;
|
||||
this.federation = federation;
|
||||
this.format = format;
|
||||
this.lang = lang;
|
||||
this.startIndex = BigInteger.valueOf(startIndex.longValue());
|
||||
this.maxResults = BigInteger.valueOf(maxResults.longValue());
|
||||
this.depth = BigInteger.valueOf(depth.longValue());
|
||||
this.matchOlderVersions = matchOlderVersions;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -75,6 +75,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 2012 bphillip Initial implementation
|
||||
* 10/17/2013 1682 bphillip Added software history
|
||||
* 10/23/2013 1538 bphillip Added setTime method
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -107,15 +108,7 @@ public class DateTimeValueType extends ValueType {
|
|||
}
|
||||
|
||||
public DateTimeValueType(long time) {
|
||||
GregorianCalendar cal = new GregorianCalendar();
|
||||
cal.setTimeInMillis(time);
|
||||
try {
|
||||
this.dateTimeValue = DatatypeFactory.newInstance()
|
||||
.newXMLGregorianCalendar(cal);
|
||||
} catch (DatatypeConfigurationException e) {
|
||||
throw new RuntimeException("Error creating XMLGregorianCalendar!",
|
||||
e);
|
||||
}
|
||||
setTime(time);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -129,11 +122,24 @@ public class DateTimeValueType extends ValueType {
|
|||
* @return possible object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public XMLGregorianCalendar getValue() {
|
||||
return dateTimeValue;
|
||||
}
|
||||
|
||||
public void setTime(long time) {
|
||||
GregorianCalendar cal = new GregorianCalendar();
|
||||
cal.setTimeInMillis(time);
|
||||
try {
|
||||
this.dateTimeValue = DatatypeFactory.newInstance()
|
||||
.newXMLGregorianCalendar(cal);
|
||||
} catch (DatatypeConfigurationException e) {
|
||||
throw new RuntimeException("Error creating XMLGregorianCalendar!",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the value property.
|
||||
*
|
||||
|
|
|
@ -78,6 +78,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 2012 bphillip Initial implementation
|
||||
* 10/17/2013 1682 bphillip Added software history
|
||||
* 10/23/2013 1538 bphillip Changed Hibernate cascade type on objectRef field
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -102,7 +103,7 @@ public class ObjectRefListType {
|
|||
@XmlElement(name = "ObjectRef")
|
||||
@DynamicSerializeElement
|
||||
@ManyToMany
|
||||
@Cascade({ CascadeType.SAVE_UPDATE })
|
||||
@Cascade({ CascadeType.ALL })
|
||||
@JoinTable(schema = RegrepUtil.EBXML_SCHEMA)
|
||||
protected List<ObjectRefType> objectRef;
|
||||
|
||||
|
|
|
@ -21,15 +21,18 @@
|
|||
package oasis.names.tc.ebxml.regrep.xsd.rim.v4;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
|
@ -70,6 +73,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 2012 bphillip Initial implementation
|
||||
* 10/17/2013 1682 bphillip Added software history
|
||||
* 10/23/2013 1538 bphillip Added sequence generator and unique key so refs will not be shared
|
||||
* amond multiple ref lists
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -88,6 +93,12 @@ public class ObjectRefType extends ExtensibleObjectType implements
|
|||
IPersistableDataObject<String> {
|
||||
|
||||
@Id
|
||||
@SequenceGenerator(name = "ObjectRefTypeGenerator", schema = RegrepUtil.EBXML_SCHEMA, sequenceName = RegrepUtil.EBXML_SCHEMA
|
||||
+ ".ObjectRef_sequence")
|
||||
@GeneratedValue(generator = "ObjectRefTypeGenerator")
|
||||
@XmlTransient
|
||||
private Integer key;
|
||||
|
||||
@XmlAttribute(required = true)
|
||||
@DynamicSerializeElement
|
||||
protected String id;
|
||||
|
@ -126,4 +137,12 @@ public class ObjectRefType extends ExtensibleObjectType implements
|
|||
return getId();
|
||||
}
|
||||
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(Integer key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
<camelContext id="ebxml-notification" xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
<endpoint id="processReplicationSubscriptions"
|
||||
uri="clusteredquartz://registry/processSubscriptions/?cron=${ebxml-subscription-process.cron}" />
|
||||
uri="quartz://registry/processSubscriptions/?cron=${ebxml-subscription-process.cron}" />
|
||||
<route id="processSubscriptionsFromQuartz">
|
||||
<from uri="processReplicationSubscriptions" />
|
||||
<bean ref="RegistrySubscriptionManager" method="processSubscriptions" />
|
||||
<to uri="vm:processSubscriptions"/>
|
||||
</route>
|
||||
<route id="processSubscriptionsFromVM">
|
||||
<from uri="vm:processSubscriptions?concurrentConsumers=2" />
|
||||
|
|
|
@ -118,7 +118,6 @@
|
|||
<bean id="AuditableEventService"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.AuditableEventService">
|
||||
<constructor-arg ref="AuditableEventTypeDao" />
|
||||
<constructor-arg ref="registrySubscriptionManagerInvoker" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -1,5 +1,5 @@
|
|||
# The period which registry subscriptions are processed
|
||||
ebxml-subscription-process.cron=0+0/1+*+*+*+?
|
||||
ebxml-subscription-process.cron=0/20+*+*+*+*+?
|
||||
# The period which the registry runs the garbage collection
|
||||
ebxml-garbage-collect-process.cron=0/10+*+*+*+*+?
|
||||
# The period which adhoc subscriptions are cleaned, every 20 mins
|
||||
|
@ -9,4 +9,6 @@ adhocsubscription-process.cron=0+0/20+*+*+*+?
|
|||
ebxml-federation-sync-threads=3
|
||||
# Master switch enabling email transmission
|
||||
ebxml-email.enabled=false
|
||||
ebxml-notification-batch-size=100
|
||||
# The maximum number of events that will be batched and send
|
||||
# in a registry replication notification
|
||||
ebxml-notification-batch-size=50
|
|
@ -90,6 +90,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* Oct 01, 2012 1187 djohnson Commented out code throwing {@link ClassCastException}s.
|
||||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection
|
||||
* 4/9/2013 1802 bphillip Added additional object checking
|
||||
* 10/23/2013 1538 bphillip Changed constructor call for QueryRequest
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -304,8 +305,9 @@ public class XACMLContextHandler {
|
|||
ResponseOptionType responseOption = EbxmlObjectUtil.queryObjectFactory
|
||||
.createResponseOptionType();
|
||||
responseOption.setReturnType(QueryReturnTypes.REGISTRY_OBJECT);
|
||||
QueryResponse queryResponse = queryManager.executeQuery(responseOption,
|
||||
query);
|
||||
QueryRequest queryRequest = new QueryRequest("XACML evaluation query",
|
||||
query, responseOption);
|
||||
QueryResponse queryResponse = queryManager.executeQuery(queryRequest);
|
||||
if (queryResponse.getStatus().equals(RegistryResponseStatus.SUCCESS)
|
||||
|| queryResponse.getStatus().equals(
|
||||
RegistryResponseStatus.PARTIAL_SUCCESS)) {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
package com.raytheon.uf.edex.registry.ebxml.dao;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
@ -28,7 +27,9 @@ import java.util.List;
|
|||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AuditableEventType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.DateTimeValueType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -55,6 +56,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* 7/29/2013 2191 bphillip Changed method to get expired events
|
||||
* 8/1/2013 1693 bphillip Moved creation of auditable events to the auditable event service class
|
||||
* 9/11/2013 2354 bphillip Modified queries to find deleted objects
|
||||
* 10/23/2013 1538 bphillip Changed send time slot to be DateTimeValue instead of integer
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -162,7 +164,8 @@ public class AuditableEventTypeDao extends
|
|||
buf.append("'").append(objectsOfInterest.get(i).getId())
|
||||
.append("'");
|
||||
}
|
||||
query = FIND_EVENTS_OF_INTEREST_QUERY.replaceAll(IDS, buf.toString());
|
||||
query = FIND_EVENTS_OF_INTEREST_QUERY.replaceAll(IDS,
|
||||
buf.toString());
|
||||
|
||||
if (endTime == null) {
|
||||
query += ORDER_CLAUSE;
|
||||
|
@ -188,10 +191,20 @@ public class AuditableEventTypeDao extends
|
|||
* to the auditable event
|
||||
*/
|
||||
public void persistSendDate(List<AuditableEventType> auditableEvents,
|
||||
String subscriptionId, String deliveryAddress) {
|
||||
String subscriptionId, String deliveryAddress, long sentTime) {
|
||||
String slotName = subscriptionId + deliveryAddress;
|
||||
for (AuditableEventType auditableEvent : auditableEvents) {
|
||||
auditableEvent.updateSlot(subscriptionId + deliveryAddress,
|
||||
(int) TimeUtil.currentTimeMillis());
|
||||
SlotType slot = auditableEvent.getSlotByName(subscriptionId
|
||||
+ deliveryAddress);
|
||||
if (slot == null) {
|
||||
SlotType sentTimeSlot = new SlotType(slotName,
|
||||
new DateTimeValueType(sentTime));
|
||||
auditableEvent.getSlot().add(sentTimeSlot);
|
||||
} else {
|
||||
DateTimeValueType dateValue = (DateTimeValueType) slot
|
||||
.getSlotValue();
|
||||
dateValue.setTime(sentTime);
|
||||
}
|
||||
this.createOrUpdate(auditableEvent);
|
||||
}
|
||||
}
|
||||
|
@ -208,9 +221,17 @@ public class AuditableEventTypeDao extends
|
|||
* The delivery address to check
|
||||
* @return The last sent date in millis
|
||||
*/
|
||||
public BigInteger getSendTime(AuditableEventType auditableEvent,
|
||||
public Long getSendTime(AuditableEventType auditableEvent,
|
||||
String subscriptionId, String deliveryAddress) {
|
||||
return auditableEvent.getSlotValue(subscriptionId + deliveryAddress);
|
||||
SlotType slot = auditableEvent.getSlotByName(subscriptionId
|
||||
+ deliveryAddress);
|
||||
if (slot == null) {
|
||||
return 0l;
|
||||
} else {
|
||||
DateTimeValueType dateValue = (DateTimeValueType) slot
|
||||
.getSlotValue();
|
||||
return dateValue.getValue().toGregorianCalendar().getTimeInMillis();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,8 +32,6 @@ import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType;
|
|||
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
|
||||
import com.raytheon.uf.common.registry.constants.StatusTypes;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.AuditableEventTypeDao;
|
||||
|
@ -52,6 +50,8 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* May 02, 2013 1910 djohnson Extracted subscription notification from the dao.
|
||||
* 8/1/2013 1692 bphillip Refactored auditable event creation
|
||||
* 9/11/2013 2254 bphillip Cleaned up creation of auditable events
|
||||
* 10/23/2013 1538 bphillip Removed call to subscription manager. Subscriptions will now
|
||||
* only be run on a quartz timer
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -61,16 +61,9 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
|
||||
public class AuditableEventService {
|
||||
|
||||
/** The logger */
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AuditableEventService.class);
|
||||
|
||||
/** Data access object for accessing auditable events */
|
||||
private final AuditableEventTypeDao auditDao;
|
||||
|
||||
/** The subscription manager */
|
||||
private final IRegistrySubscriptionManager subscriptionManager;
|
||||
|
||||
/**
|
||||
* Creates a new AuditableEventService
|
||||
*
|
||||
|
@ -79,10 +72,8 @@ public class AuditableEventService {
|
|||
* @param subscriptionManager
|
||||
* The subscription manager
|
||||
*/
|
||||
public AuditableEventService(AuditableEventTypeDao auditDao,
|
||||
IRegistrySubscriptionManager subscriptionManager) {
|
||||
public AuditableEventService(AuditableEventTypeDao auditDao) {
|
||||
this.auditDao = auditDao;
|
||||
this.subscriptionManager = subscriptionManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,8 +95,7 @@ public class AuditableEventService {
|
|||
AuditableEventType event = createEvent(request,
|
||||
TimeUtil.currentTimeMillis());
|
||||
addRegistryObjectActionToEvent(event, actionType, objectsAffected);
|
||||
auditDao.create(event);
|
||||
notifySubscriptionManager();
|
||||
auditDao.createOrUpdate(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,8 +141,7 @@ public class AuditableEventService {
|
|||
AuditableEventType event = createEvent(request,
|
||||
TimeUtil.currentTimeMillis());
|
||||
addObjectRefActionToEvent(event, actionType, objectsAffected);
|
||||
auditDao.create(event);
|
||||
notifySubscriptionManager();
|
||||
auditDao.createOrUpdate(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,21 +197,5 @@ public class AuditableEventService {
|
|||
event.addSlot(EbxmlObjectUtil.HOME_SLOT_NAME, notificationFrom);
|
||||
}
|
||||
return event;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the subscription manager that events have occurred and they must
|
||||
* be propagated to the federation
|
||||
*/
|
||||
private void notifySubscriptionManager() {
|
||||
// Notify the subscription monitor that a new event has occurred
|
||||
try {
|
||||
subscriptionManager.processSubscriptions();
|
||||
} catch (Throwable t) {
|
||||
statusHandler
|
||||
.error("Unexpected error ecountered while processing subscriptions!",
|
||||
t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.RemoveObjectsRequest;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.UpdateActionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.UpdateObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.ResponseOptionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
|
||||
|
@ -101,6 +102,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.xpath.RegistryXPathProcessor;
|
|||
* Jun 24, 2013 2106 djohnson Requires a transaction to already be open.
|
||||
* 8/1/2013 1693 bphillip Added check references and refactored submit objects to conform to EBXML 4.0 spec
|
||||
* 9/11/2013 2254 bphillip Cleaned up creation of auditable events
|
||||
* 10/23/2013 1538 bphillip Changed QueryRequest constructor call
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -208,8 +210,11 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
if (query != null) {
|
||||
ResponseOptionType responseOption = new ResponseOptionType(
|
||||
QueryReturnTypes.REGISTRY_OBJECT, true);
|
||||
QueryResponse queryResponse = queryManager.executeQuery(
|
||||
responseOption, query);
|
||||
QueryRequest queryRequest = new QueryRequest(
|
||||
"Remove objects query for request id[" + request.getId()
|
||||
+ "]", query, responseOption);
|
||||
QueryResponse queryResponse = queryManager
|
||||
.executeQuery(queryRequest);
|
||||
if (queryResponse.getStatus()
|
||||
.equals(RegistryResponseStatus.SUCCESS)) {
|
||||
statusHandler.info("Remove objects query successful");
|
||||
|
@ -676,8 +681,11 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
if (query != null) {
|
||||
ResponseOptionType responseOption = new ResponseOptionType(
|
||||
QueryReturnTypes.REGISTRY_OBJECT, true);
|
||||
QueryResponse queryResponse = queryManager.executeQuery(
|
||||
responseOption, query);
|
||||
QueryRequest queryRequest = new QueryRequest(
|
||||
"Update objects query for request[" + request.getId() + "]",
|
||||
query, responseOption);
|
||||
QueryResponse queryResponse = queryManager
|
||||
.executeQuery(queryRequest);
|
||||
if (queryResponse.getStatus()
|
||||
.equals(RegistryResponseStatus.SUCCESS)) {
|
||||
statusHandler.info("Update objects query successful");
|
||||
|
|
|
@ -63,6 +63,7 @@ import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
|
|||
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
|
||||
|
@ -86,6 +87,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* 5/21/2013 2022 bphillip Reworked how notifications are handled
|
||||
* 9/11/2013 2254 bphillip Cleaned up handling of notifications and removed unneccessary code
|
||||
* 10/20/2013 1682 bphillip Added synchronous notification delivery
|
||||
* 10/23/2013 1538 bphillip Added log message denoting when processing is complete and time duration
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -117,6 +119,7 @@ public class NotificationListenerImpl implements NotificationListener {
|
|||
|
||||
@Override
|
||||
public void onNotification(NotificationType notification) {
|
||||
long startTime = TimeUtil.currentTimeMillis();
|
||||
|
||||
String clientBaseURL = EbxmlObjectUtil.getClientHost(wsContext);
|
||||
RegistryType sourceRegistry = registryDao
|
||||
|
@ -127,7 +130,10 @@ public class NotificationListenerImpl implements NotificationListener {
|
|||
} else {
|
||||
statusHandler
|
||||
.info("Received notification from Registry Federation member at ["
|
||||
+ sourceRegistry.getId() + "]");
|
||||
+ sourceRegistry.getId()
|
||||
+ "("
|
||||
+ clientBaseURL
|
||||
+ ")]");
|
||||
}
|
||||
|
||||
List<AuditableEventType> events = notification.getEvent();
|
||||
|
@ -199,6 +205,9 @@ public class NotificationListenerImpl implements NotificationListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
statusHandler.info("Processing notification id ["
|
||||
+ notification.getId() + "] completed in "
|
||||
+ (TimeUtil.currentTimeMillis() - startTime) + " ms");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,20 +20,18 @@
|
|||
|
||||
package com.raytheon.uf.edex.registry.ebxml.services.notification;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.ResponseOptionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ActionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AuditableEventType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
|
||||
|
||||
|
@ -47,6 +45,7 @@ import com.raytheon.uf.common.registry.constants.StatusTypes;
|
|||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.AuditableEventTypeDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.notification.RegistrySubscriptionManager.NotificationListenerWrapper;
|
||||
|
@ -72,6 +71,8 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* 9/30/2013 2191 bphillip Fixing federated replication
|
||||
* 10/8/2013 1682 bphillip Moved get objects of interest from RegistrySubscriptionManager and javadoc
|
||||
* 10/20/2013 1682 bphillip Added synchronous notification delivery
|
||||
* 10/23/2013 1538 bphillip Adding log messages and changed methods to handle DateTime value on
|
||||
* AuditableEvents instead of integer
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -114,13 +115,13 @@ public class RegistryNotificationManager {
|
|||
public List<ObjectRefType> getObjectsOfInterest(
|
||||
SubscriptionType subscription) throws MsgRegistryException {
|
||||
// Get objects that match selector query
|
||||
QueryType selectorQuery = subscription.getSelector();
|
||||
ResponseOptionType responseOption = EbxmlObjectUtil.queryObjectFactory
|
||||
.createResponseOptionType();
|
||||
responseOption.setReturnType(QueryReturnTypes.OBJECT_REF);
|
||||
QueryResponse queryResponse = queryManager.executeQuery(responseOption,
|
||||
selectorQuery);
|
||||
return queryResponse.getObjectRefList().getObjectRef();
|
||||
return queryManager
|
||||
.executeQuery(
|
||||
new QueryRequest("Objects of Interest Query for ["
|
||||
+ subscription.getId() + "]", subscription
|
||||
.getSelector(), new ResponseOptionType(
|
||||
QueryReturnTypes.OBJECT_REF, false)))
|
||||
.getObjectRefList().getObjectRef();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,12 +187,17 @@ public class RegistryNotificationManager {
|
|||
statusHandler.info("Sending notification [" + notification.getId()
|
||||
+ "] to address [" + address + "]");
|
||||
|
||||
long sentTime = TimeUtil.currentTimeMillis();
|
||||
try {
|
||||
listener.notificationListener.synchronousNotification(notification);
|
||||
} catch (MsgRegistryException e) {
|
||||
statusHandler.error("Notification [" + notification.getId()
|
||||
+ " failed to address [" + address + "]", e);
|
||||
throw e;
|
||||
} finally {
|
||||
statusHandler.info("Notification [" + notification.getId()
|
||||
+ "] transmission took ["
|
||||
+ (TimeUtil.currentTimeMillis() - sentTime) + "] ms");
|
||||
}
|
||||
statusHandler.info("Notification [" + notification.getId()
|
||||
+ " successfully sent to address [" + address + "]");
|
||||
|
@ -199,7 +205,7 @@ public class RegistryNotificationManager {
|
|||
// Keep a record of when the auditable event was sent to
|
||||
// the target
|
||||
auditableEventDao.persistSendDate(notification.getEvent(),
|
||||
notification.getSubscription(), address);
|
||||
notification.getSubscription(), address, sentTime);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -298,9 +304,9 @@ public class RegistryNotificationManager {
|
|||
}
|
||||
|
||||
// Checks to see if this event was already sent to this destination
|
||||
BigInteger sentDate = auditableEventDao.getSendTime(event,
|
||||
Long sentDate = auditableEventDao.getSendTime(event,
|
||||
notification.getSubscription(), serviceAddress);
|
||||
if (sentDate == null) {
|
||||
if (sentDate == 0) {
|
||||
/*
|
||||
* The sent date was not found. This event has not yet been sent
|
||||
* to this destination. Iterate through the actions and make
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.ArrayList;
|
|||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
@ -87,6 +86,8 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* 9/11/2013 2354 bphillip Added handling of deleted objects
|
||||
* 9/30/2013 2191 bphillip Fixing federated replication
|
||||
* 10/8/2013 1682 bphillip Moved getObjectsOfInterest into RegistryNotificationManager
|
||||
* 10/23/2013 1538 bphillip Removed debug code and added a change to properly update subscription run time
|
||||
* to not create duplicate slots on objects
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -171,8 +172,6 @@ public class RegistrySubscriptionManager implements
|
|||
public RegistrySubscriptionManager(boolean subscriptionProcessingEnabled)
|
||||
throws JAXBException {
|
||||
this.subscriptionProcessingEnabled = subscriptionProcessingEnabled;
|
||||
Properties props = System.getProperties();
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -393,7 +392,9 @@ public class RegistrySubscriptionManager implements
|
|||
new DateTimeValueType(time));
|
||||
subscription.getSlot().add(lastRunTimeSlot);
|
||||
} else {
|
||||
lastRunTimeSlot.setSlotValue(new DateTimeValueType(time));
|
||||
DateTimeValueType dateTime = (DateTimeValueType) lastRunTimeSlot
|
||||
.getSlotValue();
|
||||
dateTime.setTime(time);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new EbxmlRegistryException(
|
||||
|
|
|
@ -120,7 +120,8 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* Jun 24, 2013 2106 djohnson Transaction must already be open.
|
||||
* 9/5/2013 1538 bphillip Removed log message
|
||||
* 10/8/2013 1682 bphillip Refactored querying
|
||||
* 10/201 1682 bphillip Fixed federated query invocation
|
||||
* 10/2013 1682 bphillip Fixed federated query invocation
|
||||
* 10/23/2013 1538 bphillip Remove extra executeQuery method
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -800,23 +801,6 @@ public class QueryManagerImpl implements QueryManager, ApplicationContextAware {
|
|||
}
|
||||
}
|
||||
|
||||
public QueryResponse executeQuery(ResponseOptionType responseOption,
|
||||
QueryType queryType) throws MsgRegistryException {
|
||||
statusHandler
|
||||
.info("Received internal request for query using default values");
|
||||
QueryRequest queryRequest = EbxmlObjectUtil.queryObjectFactory
|
||||
.createQueryRequest();
|
||||
queryRequest.setResponseOption(responseOption);
|
||||
queryRequest.setQuery(queryType);
|
||||
queryRequest.setDepth(QueryRequest.DEFAULT_DEPTH);
|
||||
queryRequest
|
||||
.setMatchOlderVersions(QueryRequest.DEFAULT_MATCH_OLDER_VERSIONS);
|
||||
queryRequest.setMaxResults(QueryRequest.DEFAULT_MAX_RESULTS);
|
||||
queryRequest.setStartIndex(QueryRequest.DEFAULT_START_INDEX);
|
||||
QueryResponse queryResponse = executeQuery(queryRequest);
|
||||
return queryResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to ensure that the specified query contains all the required
|
||||
* parameters
|
||||
|
|
Loading…
Add table
Reference in a new issue