diff --git a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/wsdl/registry/services/v4/NotificationListener.java b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/wsdl/registry/services/v4/NotificationListener.java
index 80ca7b3acf..70dee420aa 100644
--- a/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/wsdl/registry/services/v4/NotificationListener.java
+++ b/edexOsgi/com.raytheon.uf.common.registry.schemas.ebxml/src/oasis/names/tc/ebxml/regrep/wsdl/registry/services/v4/NotificationListener.java
@@ -23,12 +23,14 @@ package oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
+import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.xml.bind.annotation.XmlSeeAlso;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
+import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
import org.apache.cxf.annotations.GZIP;
@@ -43,6 +45,7 @@ import com.raytheon.uf.common.registry.EbxmlNamespaces;
* ------------ ---------- ----------- --------------------------
* 2012 bphillip Initial implementation
* 10/17/2013 1682 bphillip Added software history
+ * 10/20/2013 1682 bphillip Added synchronous notification delivery
*
*
* @author bphillip
@@ -72,4 +75,10 @@ public interface NotificationListener {
public void onNotification(
@WebParam(name = "Notification", targetNamespace = EbxmlNamespaces.RIM_URI, partName = "Notification") NotificationType notification);
+ @WebMethod(action = "SynchronousNotification")
+ @WebResult(name = "RegistryResponse", targetNamespace = EbxmlNamespaces.RS_URI, partName = "partRegistryResponse")
+ public RegistryResponseType synchronousNotification(
+ @WebParam(name = "Notification", targetNamespace = EbxmlNamespaces.RIM_URI, partName = "Notification") NotificationType notification)
+ throws MsgRegistryException;
+
}
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/WfoRegistryFederationManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/WfoRegistryFederationManager.java
index 0728456854..906c15c161 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/WfoRegistryFederationManager.java
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/WfoRegistryFederationManager.java
@@ -47,9 +47,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
-import com.raytheon.uf.common.registry.constants.Format;
-import com.raytheon.uf.common.registry.constants.Languages;
-import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
import com.raytheon.uf.common.registry.services.RegistryRESTServices;
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
import com.raytheon.uf.common.serialization.SerializationException;
@@ -58,6 +55,7 @@ import com.raytheon.uf.edex.database.RunnableWithTransaction;
import com.raytheon.uf.edex.datadelivery.registry.replication.RegistryReplicationManager;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.init.RegistryInitializedListener;
+import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
/**
*
@@ -71,6 +69,7 @@ import com.raytheon.uf.edex.registry.ebxml.init.RegistryInitializedListener;
* ------------ ---------- ----------- --------------------------
* 5/22/2013 1707 bphillip Initial implementation
* 7/29/2013 2191 bphillip Implemented registry sync for registries that have been down for an extended period of time
+ * 10/20/2013 1682 bphillip Fixed query invocation
*
*
* @author bphillip
@@ -187,17 +186,20 @@ public class WfoRegistryFederationManager extends RegistryFederationManager
protected FederationType getFederation() throws EbxmlRegistryException {
statusHandler
.info("Attempting to acquire federation object from NCF...");
- QueryType query = new QueryType(CanonicalQueryTypes.GET_OBJECT_BY_ID,
- new SlotType("id", new StringValueType(FEDERATION_ID)));
- QueryRequest queryRequest = new QueryRequest("Query for federation",
- "Query to get the status of the federation",
- new ResponseOptionType(QueryReturnTypes.REGISTRY_OBJECT, true),
- query, false, null, Format.EBRIM, Languages.EN_US, 0, 0, 0,
- false);
+ QueryType query = new QueryType();
+ query.setQueryDefinition(CanonicalQueryTypes.GET_OBJECT_BY_ID);
+ query.getSlot().add(
+ new SlotType(QueryConstants.ID, new StringValueType(
+ FEDERATION_ID)));
+ QueryRequest request = new QueryRequest();
+ request.setResponseOption(new ResponseOptionType(
+ ResponseOptionType.RETURN_TYPE.RegistryObject.toString(), true));
+ request.setId("Query For Federation");
+ request.setQuery(query);
QueryResponse response = null;
try {
response = RegistrySOAPServices.getQueryServiceForHost(ncfAddress)
- .executeQuery(queryRequest);
+ .executeQuery(request);
} catch (Exception e) {
throw new EbxmlRegistryException(
"Error getting Federation from NCF!", e);
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistryReplicationManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistryReplicationManager.java
index 66e5323a71..95600aa37d 100644
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistryReplicationManager.java
+++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistryReplicationManager.java
@@ -66,6 +66,7 @@ import com.raytheon.uf.common.registry.RegistryException;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
import com.raytheon.uf.common.registry.constants.DeliveryMethodTypes;
import com.raytheon.uf.common.registry.constants.NotificationOptionTypes;
+import com.raytheon.uf.common.registry.constants.QueryLanguages;
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
import com.raytheon.uf.common.registry.constants.StatusTypes;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
@@ -81,6 +82,7 @@ import com.raytheon.uf.edex.datadelivery.registry.availability.FederatedRegistry
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.exception.NoReplicationServersAvailableException;
+import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
/**
@@ -98,6 +100,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 7/29/2013 2191 bphillip Implemented registry sync for registries that have been down for an extended period of time
* 8/1/2013 1693 bphillip Switch to use rest service instead of query manager for federation synchronization
* 9/5/2013 1538 bphillip Changed when the registry availability monitor is started
+ * 10/20/2013 1682 bphillip Fixed query invocation
*
*
* @author bphillip
@@ -497,13 +500,24 @@ public class RegistryReplicationManager {
sub.setStartTime(EbxmlObjectUtil.getTimeAsXMLGregorianCalendar(0));
QueryType selectorQuery = new QueryType();
- selectorQuery.setQueryDefinition(CanonicalQueryTypes.BASIC_QUERY);
- SlotType slot = new SlotType();
- StringValueType valType = new StringValueType();
- valType.setValue(objectType);
- slot.setName("objectType");
- slot.setSlotValue(valType);
- selectorQuery.getSlot().add(slot);
+ selectorQuery.setQueryDefinition(CanonicalQueryTypes.ADHOC_QUERY);
+
+ SlotType expressionSlot = new SlotType();
+ StringValueType expressionValue = new StringValueType();
+ expressionValue
+ .setValue("FROM RegistryObjectType obj where obj.objectType='"
+ + objectType + "'");
+ expressionSlot.setName(QueryConstants.QUERY_EXPRESSION);
+ expressionSlot.setSlotValue(expressionValue);
+ selectorQuery.getSlot().add(expressionSlot);
+
+ SlotType languageSlot = new SlotType();
+ StringValueType languageValue = new StringValueType();
+ languageValue.setValue(QueryLanguages.HQL);
+ languageSlot.setName(QueryConstants.QUERY_LANGUAGE);
+ languageSlot.setSlotValue(languageValue);
+ selectorQuery.getSlot().add(languageSlot);
+
sub.setSelector(selectorQuery);
Duration notificationInterval = DatatypeFactory.newInstance()
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 698c43f842..907bb3c29f 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
@@ -20,7 +20,6 @@
class="com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationListenerImpl">
-
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerFactory.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerFactory.java
index e4c128f2ef..fb37c5f3e0 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerFactory.java
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerFactory.java
@@ -19,10 +19,17 @@
**/
package com.raytheon.uf.edex.registry.ebxml.services.notification;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+
+import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
+import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
import com.google.common.annotations.VisibleForTesting;
+import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.registry.constants.DeliveryMethodTypes;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@@ -40,6 +47,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.notification.listeners.WebSe
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 17, 2013 1672 djohnson Initial creation
+ * 10/20/2013 1682 bphillip Added synchronous notification delivery
*
*
*
@@ -73,6 +81,17 @@ public class NotificationListenerFactory implements
statusHandler.warn("Unsupported delivery type: " + endpointType
+ ". Notification will not be delivered!");
}
+
+ @Override
+ @WebMethod(action = "SynchronousNotification")
+ @WebResult(name = "RegistryResponse", targetNamespace = EbxmlNamespaces.RS_URI, partName = "partRegistryResponse")
+ public RegistryResponseType synchronousNotification(
+ @WebParam(name = "Notification", targetNamespace = EbxmlNamespaces.RIM_URI, partName = "Notification") NotificationType notification)
+ throws MsgRegistryException {
+ statusHandler.warn("Unsupported delivery type: " + endpointType
+ + ". Notification will not be delivered!");
+ return null;
+ }
}
private final EmailSender emailSender;
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 b185483703..36ab06197b 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
@@ -24,6 +24,9 @@ import java.util.Collection;
import java.util.List;
import javax.annotation.Resource;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
import javax.xml.ws.WebServiceContext;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
@@ -46,25 +49,27 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
+import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseStatus;
+import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
import org.springframework.transaction.annotation.Transactional;
+import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.registry.constants.ActionTypes;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
import com.raytheon.uf.common.registry.constants.DeletionScope;
-import com.raytheon.uf.common.registry.constants.Format;
-import com.raytheon.uf.common.registry.constants.Languages;
import com.raytheon.uf.common.registry.constants.QueryLanguages;
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.util.CollectionUtil;
-import com.raytheon.uf.edex.registry.ebxml.dao.ClassificationNodeDao;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryDao;
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.services.lifecycle.LifecycleManagerImpl;
+import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
+import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
/**
@@ -80,6 +85,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 4/9/2013 1802 bphillip Implemented notification handling
* 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
*
*
*
@@ -109,9 +115,6 @@ public class NotificationListenerImpl implements NotificationListener {
/** Data access object for getting RegistryType objects */
private RegistryDao registryDao;
- /** The classification node data access object */
- private ClassificationNodeDao classificationNodeDao;
-
@Override
public void onNotification(NotificationType notification) {
@@ -129,7 +132,8 @@ public class NotificationListenerImpl implements NotificationListener {
List events = notification.getEvent();
- // Process the received auditable events and add them to the appropriate
+ // Process the received auditable events and add them to the
+ // appropriate
// list based on the action performed
for (AuditableEventType event : events) {
@@ -138,13 +142,6 @@ public class NotificationListenerImpl implements NotificationListener {
String eventType = action.getEventType();
List objectIds = new ArrayList();
- // Verify this is a valid event type
- if (!classificationNodeDao.isValidNode(eventType)) {
- statusHandler.info("Unknown event type [" + eventType
- + "] received in notification");
- continue;
- }
-
if (action.getAffectedObjectRefs() != null) {
for (ObjectRefType ref : action.getAffectedObjectRefs()
.getObjectRef()) {
@@ -169,10 +166,10 @@ public class NotificationListenerImpl implements NotificationListener {
Mode.CREATE_OR_REPLACE);
lcm.submitObjects(submitRequest);
} catch (MsgRegistryException e) {
- statusHandler.error(
+ throw new RuntimeException(
"Error creating objects in registry!", e);
} catch (EbxmlRegistryException e) {
- statusHandler.error(
+ throw new RuntimeException(
"Error creating submit objects request!", e);
}
} else if (eventType.equals(ActionTypes.delete)) {
@@ -193,14 +190,33 @@ public class NotificationListenerImpl implements NotificationListener {
try {
lcm.removeObjects(request);
} catch (MsgRegistryException e) {
- statusHandler.error(
+ throw new RuntimeException(
"Error creating remove objects request!", e);
}
+ } else {
+ statusHandler.info("Unknown event type [" + eventType
+ + "] received in notification");
}
-
}
}
+ }
+ @Override
+ @WebMethod(action = "SynchronousNotification")
+ @WebResult(name = "RegistryResponse", targetNamespace = EbxmlNamespaces.RS_URI, partName = "partRegistryResponse")
+ public RegistryResponseType synchronousNotification(
+ @WebParam(name = "Notification", targetNamespace = EbxmlNamespaces.RIM_URI, partName = "Notification") NotificationType notification)
+ throws MsgRegistryException {
+ RegistryResponseType response = new RegistryResponseType();
+ response.setRequestId(notification.getId());
+ try {
+ onNotification(notification);
+ response.setStatus(RegistryResponseStatus.SUCCESS);
+ return response;
+ } catch (Throwable e) {
+ throw EbxmlExceptionUtil.createMsgRegistryException(
+ "Error processing notification.", e);
+ }
}
/**
@@ -288,21 +304,23 @@ public class NotificationListenerImpl implements NotificationListener {
}
queryExpression.append(")");
- ResponseOptionType responseOption = new ResponseOptionType();
- responseOption.setReturnComposedObjects(true);
- responseOption.setReturnType(QueryReturnTypes.REGISTRY_OBJECT);
+ SlotType queryLanguageSlot = new SlotType(
+ QueryConstants.QUERY_LANGUAGE, new StringValueType(
+ QueryLanguages.HQL));
+ SlotType queryExpressionSlot = new SlotType(
+ QueryConstants.QUERY_EXPRESSION, new StringValueType(
+ queryExpression.toString()));
+ QueryType query = new QueryType();
+ query.setQueryDefinition(CanonicalQueryTypes.ADHOC_QUERY);
+ query.getSlot().add(queryLanguageSlot);
+ query.getSlot().add(queryExpressionSlot);
- SlotType queryLanguageSlot = new SlotType("queryLanguage",
- new StringValueType(QueryLanguages.HQL));
- SlotType queryExpressionSlot = new SlotType("queryExpression",
- new StringValueType(queryExpression.toString()));
- QueryType selectorQuery = new QueryType(
- CanonicalQueryTypes.ADHOC_QUERY, queryLanguageSlot,
- queryExpressionSlot);
- return new QueryRequest("NotificationListener object update",
- "NotificationListener object Update", new ResponseOptionType(
- QueryReturnTypes.REGISTRY_OBJECT, true), selectorQuery,
- false, null, Format.EBRIM, Languages.EN_US, 0, 0, 0, false);
+ QueryRequest request = new QueryRequest();
+ request.setResponseOption(new ResponseOptionType(
+ QueryReturnTypes.REGISTRY_OBJECT, true));
+ request.setId("Notification Update Query");
+ request.setQuery(query);
+ return request;
}
public void setLcm(LifecycleManagerImpl lcm) {
@@ -313,13 +331,7 @@ public class NotificationListenerImpl implements NotificationListener {
this.registryObjectDao = registryObjectDao;
}
- public void setClassificationNodeDao(
- ClassificationNodeDao classificationNodeDao) {
- this.classificationNodeDao = classificationNodeDao;
- }
-
public void setRegistryDao(RegistryDao registryDao) {
this.registryDao = registryDao;
}
-
}
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImplWrapper.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImplWrapper.java
index fb9cf38d05..e6b55c457d 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImplWrapper.java
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/NotificationListenerImplWrapper.java
@@ -22,13 +22,18 @@ package com.raytheon.uf.edex.registry.ebxml.services.notification;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
+import javax.jws.WebResult;
+import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
+import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseStatus;
+import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.EbxmlNamespaces;
+import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
/**
*
@@ -42,6 +47,7 @@ import com.raytheon.uf.common.registry.EbxmlNamespaces;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 7/11/2013 1707 bphillip Initial implementation
+ * 10/20/2013 1682 bphillip Added synchronous notification delivery
*
*
* @author bphillip
@@ -69,4 +75,22 @@ public class NotificationListenerImplWrapper implements NotificationListener {
notificationListener.onNotification(notification);
}
+ @Override
+ @WebMethod(action = "SynchronousNotification")
+ @WebResult(name = "RegistryResponse", targetNamespace = EbxmlNamespaces.RS_URI, partName = "partRegistryResponse")
+ public RegistryResponseType synchronousNotification(
+ @WebParam(name = "Notification", targetNamespace = EbxmlNamespaces.RIM_URI, partName = "Notification") NotificationType notification)
+ throws MsgRegistryException {
+ RegistryResponseType response = new RegistryResponseType();
+ response.setRequestId(notification.getId());
+ try {
+ notificationListener.synchronousNotification(notification);
+ response.setStatus(RegistryResponseStatus.SUCCESS);
+ return response;
+ } catch (Throwable e) {
+ throw EbxmlExceptionUtil.createMsgRegistryException(
+ "Error processing notification.", e);
+ }
+ }
+
}
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 3155461699..226dc5f8bd 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
@@ -71,6 +71,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
* 9/11/2013 2354 bphillip Added logic to ensure delete events get included in notifications
* 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
*
*
* @author bphillip
@@ -176,13 +177,22 @@ public class RegistryNotificationManager {
* The notification to send
* @param address
* The address to send the notification to
+ * @throws MsgRegistryException
*/
protected void sendNotification(NotificationListenerWrapper listener,
- NotificationType notification, String address) {
+ NotificationType notification, String address)
+ throws MsgRegistryException {
statusHandler.info("Sending notification [" + notification.getId()
+ "] to address [" + address + "]");
- listener.notificationListener.onNotification(notification);
+
+ try {
+ listener.notificationListener.synchronousNotification(notification);
+ } catch (MsgRegistryException e) {
+ statusHandler.error("Notification [" + notification.getId()
+ + " failed to address [" + address + "]", e);
+ throw e;
+ }
statusHandler.info("Notification [" + notification.getId()
+ " successfully sent to address [" + address + "]");
@@ -223,30 +233,36 @@ public class RegistryNotificationManager {
/ notificationBatchSize;
int lastListSize = eventsOfInterest.size()
% notificationBatchSize;
- for (int i = 0; i < subListCount; i++) {
+ try {
+ for (int i = 0; i < subListCount; i++) {
- NotificationType notification = getNotification(
- subscription, listener.address, objectsOfInterest,
- eventsOfInterest.subList(notificationBatchSize * i,
- notificationBatchSize * i
- + notificationBatchSize));
- if (!notification.getEvent().isEmpty()) {
- sendNotification(listener, notification,
- listener.address);
+ NotificationType notification = getNotification(
+ subscription,
+ listener.address,
+ objectsOfInterest,
+ eventsOfInterest.subList(notificationBatchSize
+ * i, notificationBatchSize * i
+ + notificationBatchSize));
+ if (!notification.getEvent().isEmpty()) {
+ sendNotification(listener, notification,
+ listener.address);
+ }
}
- }
- if (lastListSize > 0) {
- NotificationType notification = getNotification(
- subscription,
- listener.address,
- objectsOfInterest,
- eventsOfInterest.subList(notificationBatchSize
- * subListCount, notificationBatchSize
- * subListCount + lastListSize));
- if (!notification.getEvent().isEmpty()) {
- sendNotification(listener, notification,
- listener.address);
+ if (lastListSize > 0) {
+ NotificationType notification = getNotification(
+ subscription,
+ listener.address,
+ objectsOfInterest,
+ eventsOfInterest.subList(notificationBatchSize
+ * subListCount, notificationBatchSize
+ * subListCount + lastListSize));
+ if (!notification.getEvent().isEmpty()) {
+ sendNotification(listener, notification,
+ listener.address);
+ }
}
+ } catch (MsgRegistryException e) {
+ statusHandler.error("Notification delivery failed!", e);
}
}
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/EmailNotificationListener.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/EmailNotificationListener.java
index 44a9637ebd..c22d836a46 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/EmailNotificationListener.java
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/EmailNotificationListener.java
@@ -19,15 +19,24 @@
**/
package com.raytheon.uf.edex.registry.ebxml.services.notification.listeners;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+
+import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ExtrinsicObjectType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
+import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseStatus;
+import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
+import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.services.notification.EmailSender;
import com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationDestination;
+import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
/**
* Email notification listener.
@@ -39,6 +48,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationDes
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 16, 2013 1672 djohnson Extracted from RegistryNotificationManager.
+ * 10/20/2013 1682 bphillip Added synchronous notification delivery
*
*
*
@@ -105,4 +115,22 @@ public class EmailNotificationListener implements NotificationListener {
}
}
+ @Override
+ @WebMethod(action = "SynchronousNotification")
+ @WebResult(name = "RegistryResponse", targetNamespace = EbxmlNamespaces.RS_URI, partName = "partRegistryResponse")
+ public RegistryResponseType synchronousNotification(
+ @WebParam(name = "Notification", targetNamespace = EbxmlNamespaces.RIM_URI, partName = "Notification") NotificationType notification)
+ throws MsgRegistryException {
+ RegistryResponseType response = new RegistryResponseType();
+ response.setRequestId(notification.getId());
+ try {
+ onNotification(notification);
+ response.setStatus(RegistryResponseStatus.SUCCESS);
+ return response;
+ } catch (Throwable e) {
+ throw EbxmlExceptionUtil.createMsgRegistryException(
+ "Error processing notification.", e);
+ }
+ }
+
}
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/SpringBeanNotificationListener.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/SpringBeanNotificationListener.java
index 9d9d19967b..3ca5c20cb5 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/SpringBeanNotificationListener.java
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/SpringBeanNotificationListener.java
@@ -19,14 +19,23 @@
**/
package com.raytheon.uf.edex.registry.ebxml.services.notification.listeners;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+
+import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
+import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseStatus;
+import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
+import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.core.EDEXUtil;
import com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationDestination;
+import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
/**
* Implements the plugin based notification listener of the EBXML specification.
@@ -38,6 +47,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationDes
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 17, 2013 1672 djohnson Initial creation
+ * 10/20/2013 1682 bphillip Added synchronous notification delivery
*
*
*
@@ -84,4 +94,22 @@ public class SpringBeanNotificationListener implements NotificationListener {
}
}
+ @Override
+ @WebMethod(action = "SynchronousNotification")
+ @WebResult(name = "RegistryResponse", targetNamespace = EbxmlNamespaces.RS_URI, partName = "partRegistryResponse")
+ public RegistryResponseType synchronousNotification(
+ @WebParam(name = "Notification", targetNamespace = EbxmlNamespaces.RIM_URI, partName = "Notification") NotificationType notification)
+ throws MsgRegistryException {
+ RegistryResponseType response = new RegistryResponseType();
+ response.setRequestId(notification.getId());
+ try {
+ onNotification(notification);
+ response.setStatus(RegistryResponseStatus.SUCCESS);
+ return response;
+ } catch (Throwable e) {
+ throw EbxmlExceptionUtil.createMsgRegistryException(
+ "Error processing notification.", e);
+ }
+ }
+
}
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/WebServiceNotificationListener.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/WebServiceNotificationListener.java
index d3a731f224..60d0742319 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/WebServiceNotificationListener.java
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/notification/listeners/WebServiceNotificationListener.java
@@ -19,14 +19,24 @@
**/
package com.raytheon.uf.edex.registry.ebxml.services.notification.listeners;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+
+import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
+import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseStatus;
+import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
+import com.raytheon.uf.common.registry.EbxmlNamespaces;
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
+import com.raytheon.uf.common.registry.services.RegistryServiceException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
import com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationDestination;
+import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
/**
* Notifies listeners via a web service.
@@ -39,6 +49,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationDes
* ------------ ---------- ----------- --------------------------
* Apr 16, 2013 1672 djohnson Extracted from RegistryNotificationManager.
* 8/28/2013 1538 bphillip Changed to catch a Throwable instead of just EbxmlRegistryException
+ * 10/20/2013 1682 bphillip Added synchronous notification delivery
*
*
*
@@ -74,6 +85,24 @@ public class WebServiceNotificationListener implements NotificationListener {
}
}
+ @Override
+ @WebMethod(action = "SynchronousNotification")
+ @WebResult(name = "RegistryResponse", targetNamespace = EbxmlNamespaces.RS_URI, partName = "partRegistryResponse")
+ public RegistryResponseType synchronousNotification(
+ @WebParam(name = "Notification", targetNamespace = EbxmlNamespaces.RIM_URI, partName = "Notification") NotificationType notification)
+ throws MsgRegistryException {
+ RegistryResponseType response = new RegistryResponseType();
+ response.setRequestId(notification.getId());
+ try {
+ onNotification(notification);
+ response.setStatus(RegistryResponseStatus.SUCCESS);
+ return response;
+ } catch (Throwable e) {
+ throw EbxmlExceptionUtil.createMsgRegistryException(
+ "Error processing notification.", e);
+ }
+ }
+
/**
* Sends the notification via SOAP
*
@@ -83,13 +112,16 @@ public class WebServiceNotificationListener implements NotificationListener {
* The address to send the notification to
* @throws EbxmlRegistryException
* If errors occur while sending the notification
+ * @throws MsgRegistryException
+ * @throws RegistryServiceException
*/
protected void sendNotificationViaSoap(NotificationType notification,
- String serviceAddress) throws EbxmlRegistryException {
+ String serviceAddress) throws EbxmlRegistryException,
+ RegistryServiceException, MsgRegistryException {
statusHandler.info("Sending notification [" + notification.getId()
+ "]");
RegistrySOAPServices.getNotificationListenerServiceForUrl(
- serviceAddress).onNotification(notification);
+ serviceAddress).synchronousNotification(notification);
statusHandler.info("Notification [" + notification.getId() + "] sent!");
}
}
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 bf428601a0..c3b7245218 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
@@ -70,8 +70,6 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
-import com.raytheon.uf.common.registry.constants.Format;
-import com.raytheon.uf.common.registry.constants.Languages;
import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
@@ -122,6 +120,7 @@ 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
*
*
*
@@ -729,13 +728,12 @@ public class QueryManagerImpl implements QueryManager, ApplicationContextAware {
QueryType query = new QueryType(
CanonicalQueryTypes.FIND_ASSOCIATED_OBJECTS,
associationTypeSlot, sourceObjectIdSlot);
- QueryRequest queryRequest = new QueryRequest(
- "Query for federation members",
- "Query to get the members of the federation",
- new ResponseOptionType(QueryReturnTypes.REGISTRY_OBJECT, true),
- query, false, null, Format.EBRIM, Languages.EN_US, 0, 0, 0,
- false);
- QueryResponse response = executeQuery(queryRequest);
+ QueryRequest request = new QueryRequest();
+ request.setResponseOption(new ResponseOptionType(
+ QueryReturnTypes.REGISTRY_OBJECT, true));
+ request.setId("Get Members of Federation Query");
+ request.setQuery(query);
+ QueryResponse response = executeQuery(request);
if (response.getRegistryObjectList() != null) {
List responseObjects = response
.getRegistryObjectList().getRegistryObject();
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/util/EbxmlExceptionUtil.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/util/EbxmlExceptionUtil.java
index bbf629fe9f..67d470cfb2 100644
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/util/EbxmlExceptionUtil.java
+++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/util/EbxmlExceptionUtil.java
@@ -54,6 +54,7 @@ import com.raytheon.uf.common.status.UFStatus;
* Jan 19, 2012 184 bphillip Initial creation
* Apr 23, 2013 1910 djohnson Add createUnresolvedReferenceException().
* 8/1/2013 1693 bphillip Added methods to create exceptions
+ * 10/20/2013 1682 bphillip createMsgRegistryException changed to accept throwable
*
*
*
@@ -102,7 +103,7 @@ public class EbxmlExceptionUtil {
* @return The MsgRegistryException
*/
public static MsgRegistryException createMsgRegistryException(
- String message, String detail, Exception exception) {
+ String message, String detail, Throwable exception) {
StringBuilder builder = new StringBuilder();
if (detail == null || detail.isEmpty()) {
builder.append("Exception Encountered");
@@ -144,7 +145,7 @@ public class EbxmlExceptionUtil {
* @return The MsgRegistryException
*/
public static MsgRegistryException createMsgRegistryException(
- String message, Exception exception) {
+ String message, Throwable exception) {
return createMsgRegistryException(message, null, exception);
}
diff --git a/tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/PluginSubscribedListener.java b/tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/PluginSubscribedListener.java
index be50e5f072..8dda4f8e6f 100644
--- a/tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/PluginSubscribedListener.java
+++ b/tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/PluginSubscribedListener.java
@@ -19,11 +19,19 @@
**/
package com.raytheon.uf.edex.registry.ebxml.dao;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+
+import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
+import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
import org.junit.Ignore;
+import com.raytheon.uf.common.registry.EbxmlNamespaces;
+
/**
* A plugin subscribed listener.
*
@@ -34,6 +42,7 @@ import org.junit.Ignore;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 17, 2013 1672 djohnson Initial creation
+ * 10/20/2013 1682 bphillip Added synchronous notification delivery
*
*
*
@@ -53,6 +62,16 @@ public class PluginSubscribedListener implements NotificationListener {
this.notified = true;
}
+ @Override
+ @WebMethod(action = "SynchronousNotification")
+ @WebResult(name = "RegistryResponse", targetNamespace = EbxmlNamespaces.RS_URI, partName = "partRegistryResponse")
+ public RegistryResponseType synchronousNotification(
+ @WebParam(name = "Notification", targetNamespace = EbxmlNamespaces.RIM_URI, partName = "Notification") NotificationType notification)
+ throws MsgRegistryException {
+ this.notified = true;
+ return null;
+ }
+
/**
* Check whether the listener was notified.
*