diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/resources/com.raytheon.uf.common.registry.ebxml.properties b/edexOsgi/com.raytheon.uf.common.registry.ebxml/resources/com.raytheon.uf.common.registry.ebxml.properties index 5876a0679e..2b2f3e1e14 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/resources/com.raytheon.uf.common.registry.ebxml.properties +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/resources/com.raytheon.uf.common.registry.ebxml.properties @@ -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 \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/query/v4/QueryRequest.java b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/query/v4/QueryRequest.java index ca6291f4cb..57eff062d6 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/query/v4/QueryRequest.java +++ b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/query/v4/QueryRequest.java @@ -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 * * * @author bphillip @@ -176,40 +175,11 @@ public class QueryRequest extends RegistryRequestType { } - public QueryRequest(String id, String comment, Collection 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 diff --git a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/DateTimeValueType.java b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/DateTimeValueType.java index 8f1f7d5c5c..ef6abfb351 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/DateTimeValueType.java +++ b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/DateTimeValueType.java @@ -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 * * * @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. * diff --git a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefListType.java b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefListType.java index 280ccd3102..c8cc77f77e 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefListType.java +++ b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefListType.java @@ -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 * * * @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 objectRef; diff --git a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefType.java b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefType.java index 7f3998f40b..612fbb5006 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefType.java +++ b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/xsd/rim/v4/ObjectRefType.java @@ -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 * * * @author bphillip @@ -88,6 +93,12 @@ public class ObjectRefType extends ExtensibleObjectType implements IPersistableDataObject { @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; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-subscription-edex-impl.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-subscription-edex-impl.xml index 9cb82f9aa9..aa0566cecc 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-subscription-edex-impl.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-subscription-edex-impl.xml @@ -12,10 +12,10 @@ + uri="quartz://registry/processSubscriptions/?cron=${ebxml-subscription-process.cron}" /> - + diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-webservices.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-webservices.xml index 907bb3c29f..9b2254dc37 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-webservices.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-webservices.xml @@ -118,7 +118,6 @@ - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/resources/com.raytheon.uf.edex.registry.ebxml.properties b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/resources/com.raytheon.uf.edex.registry.ebxml.properties index bd36c16587..54063de7cc 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/resources/com.raytheon.uf.edex.registry.ebxml.properties +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/resources/com.raytheon.uf.edex.registry.ebxml.properties @@ -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 \ No newline at end of file +# The maximum number of events that will be batched and send +# in a registry replication notification +ebxml-notification-batch-size=50 \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/acp/xacml/XACMLContextHandler.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/acp/xacml/XACMLContextHandler.java index 8b6c764863..880924c72b 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/acp/xacml/XACMLContextHandler.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/acp/xacml/XACMLContextHandler.java @@ -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 * * * @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)) { diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/AuditableEventTypeDao.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/AuditableEventTypeDao.java index 579afc239b..0c331cf4eb 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/AuditableEventTypeDao.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/AuditableEventTypeDao.java @@ -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 * * * @@ -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 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 diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/AuditableEventService.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/AuditableEventService.java index 8e35a1ddcd..760a22f040 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/AuditableEventService.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/AuditableEventService.java @@ -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 * * * @@ -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); - } } } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java index 95ae234c12..98bbec64b1 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/LifecycleManagerImpl.java @@ -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 * * * @@ -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"); diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java index 36ab06197b..c42891d8eb 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImpl.java @@ -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 * * * @@ -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 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 diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistryNotificationManager.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistryNotificationManager.java index 226dc5f8bd..9797115949 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistryNotificationManager.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistryNotificationManager.java @@ -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 * * * @author bphillip @@ -114,13 +115,13 @@ public class RegistryNotificationManager { public List 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 diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistrySubscriptionManager.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistrySubscriptionManager.java index 5042b408b5..3c9b898b96 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistrySubscriptionManager.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/RegistrySubscriptionManager.java @@ -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 * * * @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( diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/QueryManagerImpl.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/QueryManagerImpl.java index c3b7245218..a171a8e307 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/QueryManagerImpl.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/QueryManagerImpl.java @@ -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 * * * @@ -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