diff --git a/cave/com.raytheon.uf.viz.ncep.dataplugins.feature/feature.xml b/cave/com.raytheon.uf.viz.ncep.dataplugins.feature/feature.xml index 8e72775764..9a259e2ea3 100644 --- a/cave/com.raytheon.uf.viz.ncep.dataplugins.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.ncep.dataplugins.feature/feature.xml @@ -121,13 +121,6 @@ version="0.0.0" unpack="false"/> - - %-5p %d [%t] %c{0}: %m%n + + + + + ${edex.home}/logs/edex-${edex.run.mode}-notification-%d{yyyyMMdd}.log + 30 + + + + %-5p %d [%t] %c{0}: %m%n + + + + + + + ${edex.home}/logs/edex-${edex.run.mode}-retrieval-%d{yyyyMMdd}.log + 30 + + + + %-5p %d [%t] %c{0}: %m%n + + @@ -131,12 +155,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + diff --git a/edexOsgi/build.edex/esb/conf/modes.xml b/edexOsgi/build.edex/esb/conf/modes.xml index b78be04e4c..ebcf64e368 100644 --- a/edexOsgi/build.edex/esb/conf/modes.xml +++ b/edexOsgi/build.edex/esb/conf/modes.xml @@ -88,7 +88,6 @@ excludeDpaAndOgc aww-ingest.xml - ncccfp-ingest.xml ncep-util-on-edex-ingest ncep-util-on-edex-ingestGrib ncscd-ingest.xml diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultGeometryData.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultGeometryData.java index 74ce85cc70..2bde0a4673 100644 --- a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultGeometryData.java +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/DefaultGeometryData.java @@ -73,7 +73,7 @@ public class DefaultGeometryData implements IGeometryData { protected String locationName; - protected Map attributes; + protected Map attributes = new HashMap(); @Override public Object getAttribute(String key) { @@ -277,6 +277,10 @@ public class DefaultGeometryData implements IGeometryData { this.dataMap.put(parameter, data); } + public void addAttribute(String key, Object value) { + attributes.put(key, value); + } + public void setGeometry(Geometry geom) { this.geometry = geom; } diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/META-INF/MANIFEST.MF index e9f65cb151..5249d58877 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/META-INF/MANIFEST.MF @@ -24,9 +24,11 @@ Require-Bundle: com.raytheon.uf.common.registry.schemas.ebxml;bundle-version="1. com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", javax.measure;bundle-version="1.0.0", com.raytheon.uf.common.datadelivery.request;bundle-version="1.0.0", - org.apache.commons.codec;bundle-version="1.4.0" + org.apache.commons.codec;bundle-version="1.4.0", + org.apache.commons.cxf;bundle-version="1.0.0" Export-Package: com.raytheon.uf.common.datadelivery.registry, com.raytheon.uf.common.datadelivery.registry.ebxml, - com.raytheon.uf.common.datadelivery.registry.handlers + com.raytheon.uf.common.datadelivery.registry.handlers, + com.raytheon.uf.common.datadelivery.registry.web diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryAvailableRestService.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/web/IRegistryAvailableRestService.java similarity index 82% rename from edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryAvailableRestService.java rename to edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/web/IRegistryAvailableRestService.java index ea17639d56..cc4dde94be 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryAvailableRestService.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/web/IRegistryAvailableRestService.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.registry.services.rest; +package com.raytheon.uf.common.datadelivery.registry.web; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -34,14 +34,17 @@ import javax.ws.rs.Produces; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 5/21/2013 2022 bphillip Initial implementation + * 10/30/2013 1538 bphillip Moved data delivery specific servics out of registry plugin * * * @author bphillip * @version 1 */ -@Path("/rest/registryAvailable") +@Path(IRegistryAvailableRestService.REGISTRY_AVAILABILITY_PATH_PREFIX) public interface IRegistryAvailableRestService { + public static final String REGISTRY_AVAILABILITY_PATH_PREFIX = "/registryAvailable"; + /** * Method that simply returns a string. This method is called to see if * registry services are available for a registry diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryDataAccessService.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/web/IRegistryDataAccessService.java similarity index 84% rename from edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryDataAccessService.java rename to edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/web/IRegistryDataAccessService.java index 8234045d26..2b7f9ef988 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryDataAccessService.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/web/IRegistryDataAccessService.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.common.registry.services.rest; +package com.raytheon.uf.common.datadelivery.registry.web; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -40,14 +40,17 @@ import com.raytheon.uf.common.registry.services.rest.response.RestCollectionResp * 9/20/2013 2385 bphillip Added subscription backup functions * 10/8/2013 1682 bphillip Added rest functions for use with the query web interface * 10/23/2013 2385 bphillip restoreSubscriptions throws JAXBException + * 10/30/2013 1538 bphillip Moved data delivery specific servics out of registry plugin * * * @author bphillip * @version 1 */ +@Path(IRegistryDataAccessService.DATA_ACCESS_PATH_PREFIX) public interface IRegistryDataAccessService { - public static final String DATA_ACCESS_PATH_PREFIX = "/rest/dataAccess/"; + /** Root path to this set of services */ + public static final String DATA_ACCESS_PATH_PREFIX = "/dataAccess"; /** * Gets the ids of registry objects of the given object type @@ -57,7 +60,7 @@ public interface IRegistryDataAccessService { * @return List of ids for registry objects of the given type */ @GET - @Path(DATA_ACCESS_PATH_PREFIX + "getRegistryObjectIds/{objectType}") + @Path("getRegistryObjectIds/{objectType}") public RestCollectionResponse getRegistryObjectIdsOfType( @PathParam("objectType") String objectType); @@ -67,7 +70,7 @@ public interface IRegistryDataAccessService { * @return The query definitions currently contained in the registry */ @GET - @Path(DATA_ACCESS_PATH_PREFIX + "getQueries") + @Path("getQueries") public String getValidQueries(); /** @@ -78,7 +81,7 @@ public interface IRegistryDataAccessService { * @return The parameters for a given query definition */ @GET - @Path(DATA_ACCESS_PATH_PREFIX + "getParametersForQuery/{queryId}") + @Path("getParametersForQuery/{queryId}") public String getParametersForQuery(@PathParam("queryId") String queryId); /** @@ -90,7 +93,7 @@ public interface IRegistryDataAccessService { * If errors occur while removing the subscriptions */ @GET - @Path(DATA_ACCESS_PATH_PREFIX + "removeSubscriptionsFor/{siteId}") + @Path("removeSubscriptionsFor/{siteId}") public void removeSubscriptionsForSite(@PathParam("siteId") String siteId) throws RegistryException; @@ -101,7 +104,7 @@ public interface IRegistryDataAccessService { * @return The page containing the subscriptions */ @GET - @Path(DATA_ACCESS_PATH_PREFIX + "getSubscriptions") + @Path("getSubscriptions") public String getSubscriptions(); /** @@ -113,7 +116,7 @@ public interface IRegistryDataAccessService { * @return Status message about whether the backup was successful */ @GET - @Path(DATA_ACCESS_PATH_PREFIX + "backupSubscription/{subscriptionName}") + @Path("backupSubscription/{subscriptionName}") public String backupSubscription( @PathParam("subscriptionName") String subscriptionName); @@ -123,7 +126,7 @@ public interface IRegistryDataAccessService { * @return Status message about whether the backup was successful */ @GET - @Path(DATA_ACCESS_PATH_PREFIX + "backupAllSubscriptions/") + @Path("backupAllSubscriptions/") public String backupAllSubscriptions(); /** @@ -134,7 +137,7 @@ public interface IRegistryDataAccessService { * @return Status message about whether the backup was successful */ @GET - @Path(DATA_ACCESS_PATH_PREFIX + "restoreSubscription/{subscriptionName}") + @Path("restoreSubscription/{subscriptionName}") public String restoreSubscription( @PathParam("subscriptionName") String subscriptionName); @@ -144,7 +147,7 @@ public interface IRegistryDataAccessService { * @return Status messages relating to the success or failure of the restore */ @GET - @Path(DATA_ACCESS_PATH_PREFIX + "restoreSubscriptions/") + @Path("restoreSubscriptions/") public String restoreSubscriptions(); /** @@ -153,7 +156,7 @@ public interface IRegistryDataAccessService { * @return Status message */ @GET - @Path(DATA_ACCESS_PATH_PREFIX + "clearSubscriptionBackupFiles/") + @Path("clearSubscriptionBackupFiles/") public String clearSubscriptionBackupFiles(); } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.maps/src/com/raytheon/uf/common/dataplugin/maps/dataaccess/MapsQueryAssembler.java b/edexOsgi/com.raytheon.uf.common.dataplugin.maps/src/com/raytheon/uf/common/dataplugin/maps/dataaccess/MapsQueryAssembler.java index 06daebae34..8ca1910e19 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.maps/src/com/raytheon/uf/common/dataplugin/maps/dataaccess/MapsQueryAssembler.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.maps/src/com/raytheon/uf/common/dataplugin/maps/dataaccess/MapsQueryAssembler.java @@ -43,6 +43,7 @@ import com.vividsolutions.jts.geom.Envelope; * Jan 28, 2013 bkowal Initial creation * Feb 14, 2013 1614 bsteffen Refactor data access framework to use * single request. + * Oct 30, 2013 mnash Allow for no parameters to be set. * * * @@ -152,8 +153,7 @@ public class MapsQueryAssembler { * the original request that we are processing * @return the query */ - public static String assembleGetAvailableLocationNames( -IDataRequest request) { + public static String assembleGetAvailableLocationNames(IDataRequest request) { return assembleQuery(request, Boolean.TRUE); } @@ -190,8 +190,10 @@ IDataRequest request) { // add any additional database columns the user has specified as // parameters // for additional information, refer to: http://tinyurl.com/arnayco - for (String parameter : request.getParameters()) { - columns.add(parameter); + if (request.getParameters() != null) { + for (String parameter : request.getParameters()) { + columns.add(parameter); + } } } List constraints = new ArrayList(); diff --git a/edexOsgi/com.raytheon.uf.common.python/src/com/raytheon/uf/common/python/PyJavaUtil.java b/edexOsgi/com.raytheon.uf.common.python/src/com/raytheon/uf/common/python/PyJavaUtil.java index 735518ec3e..99e5c16f0c 100644 --- a/edexOsgi/com.raytheon.uf.common.python/src/com/raytheon/uf/common/python/PyJavaUtil.java +++ b/edexOsgi/com.raytheon.uf.common.python/src/com/raytheon/uf/common/python/PyJavaUtil.java @@ -30,6 +30,7 @@ package com.raytheon.uf.common.python; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Aug 22, 2013 mnash Initial creation + * Oct 30, 2013 mnash Add method for searching for subclasses * * * @@ -42,4 +43,8 @@ public class PyJavaUtil { public static boolean isArray(Object obj) { return obj.getClass().isArray(); } + + public static boolean isSubclass(Object obj, Class clazz) { + return clazz.isAssignableFrom(obj.getClass()); + } } diff --git a/edexOsgi/com.raytheon.uf.common.python/utility/common_static/base/python/GeometryHandler.py b/edexOsgi/com.raytheon.uf.common.python/utility/common_static/base/python/GeometryHandler.py new file mode 100644 index 0000000000..5e39ba413a --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.python/utility/common_static/base/python/GeometryHandler.py @@ -0,0 +1,56 @@ +# # +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +# # + + +from com.vividsolutions.jts.io import WKTReader +from com.vividsolutions.jts.geom import Geometry +from shapely.geometry.base import BaseGeometry +from shapely import wkt + +from com.raytheon.uf.common.python import PyJavaUtil + +# +# Handler for geometries from Python to Java and back. +# +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 10/14/13 2250 mnash Initial creation of JUtil handler +# +# + +def shapelyToJTS(val): + valtype = type(val) + if issubclass(valtype, BaseGeometry): + reader = WKTReader() + retObj = reader.read(val.to_wkt()) + return True, retObj + return False, val + +def jtsToShapely(obj, customConverter=None): + if PyJavaUtil.isSubclass(obj, Geometry): + return True, _toShapely(obj) + return False, obj + +def _toShapely(obj): + return wkt.loads(obj.toText()) diff --git a/edexOsgi/com.raytheon.uf.common.python/utility/common_static/base/python/JUtil.py b/edexOsgi/com.raytheon.uf.common.python/utility/common_static/base/python/JUtil.py index 926dbb11ab..c71c85b0e3 100644 --- a/edexOsgi/com.raytheon.uf.common.python/utility/common_static/base/python/JUtil.py +++ b/edexOsgi/com.raytheon.uf.common.python/utility/common_static/base/python/JUtil.py @@ -18,25 +18,29 @@ # further licensing information. # # - -from java.lang import Integer, Float, Long, Boolean, String, Object, Double -from java.util import HashMap, LinkedHashMap, ArrayList -from java.util import Collections -from java.util import Date -from java.lang.reflect import Array from collections import OrderedDict - -from shapely.geometry.base import BaseGeometry -from shapely import wkt - -import jep -import datetime -from com.raytheon.uf.common.python import PyJavaUtil +from java.util import HashMap, LinkedHashMap, ArrayList +from java.lang import String # # Provides convenience methods for Java-Python bridging # +# For utilization of the basics, doing the following will work just fine : # +# import JUtil +# JUtil.pyValToJavaObj(val) +# +# However, to do more advanced conversion, you can register a handler and it will then be +# available to do the necessary conversion. +# +# For example, Geometry objects are not currently handled. The GeometryHandler module will +# handle them however. Code would be written as follows : +# +# import JUtil +# from GeometryHandler import jtsToShapely, shapelyToJTS +# JUtil.registerJavaToPython(jtsToShapely) +# JUtil.registerPythonToJava(shapelyToJTS) +# JUtil.pyValToJavaObj(val) # # SOFTWARE HISTORY # @@ -46,12 +50,58 @@ from com.raytheon.uf.common.python import PyJavaUtil # 03/12/13 1759 dgilling Extend Java List types handled # by javaObjToPyVal(). # 08/20/13 2250 mnash Handle Dates, doubles, and arrays +# 10/15/13 mnash Refactor to reduce dependencies and clean up # # -JEP_ARRAY_TYPE = type(jep.jarray(0,Object)) + + +def registerPythonToJava(method): + ''' + We want to register new handlers per PythonInterpreter. + This allows us to utilize different conversions that may not + be needed for some PythonInterpreters, but to use them in others + where they are required. + ''' + pythonHandlers.append(method) + +def registerJavaToPython(method): + javaHandlers.append(method) + +def pyValToJavaObj(val): + ''' + The main method for Python to Java conversion in JUtil. If no conversion + method can be found, a string representation of the python value will be + returned as we do not want to crash the JVM. + ''' + retVal = val + if retVal is not None : + for handleMethod in pythonHandlers: + success, obj = handleMethod(val) + if success: + retVal = obj + break + return retVal + +def javaObjToPyVal(obj, customConverter=None): + ''' + The main method for Java to Python conversion in JUtil. If no conversion + method can be found, the PyJObject will be returned and may still be able + to be used that way from within Python. + ''' + retVal = obj + if retVal is not None : + for handleMethod in javaHandlers: + success, val = handleMethod(obj, customConverter) + if success: + retVal = val + break + return retVal def javaStringListToPylist(jlist): + ''' + Going forward should use javaObjToPyVal instead. + ''' pylist = [] size = jlist.size() for i in range(size): @@ -59,30 +109,19 @@ def javaStringListToPylist(jlist): return pylist def pylistToJavaStringList(pylist): + ''' + Going forward should use pyValToJavaObj instead. + ''' jlist = ArrayList(); for i in pylist: jlist.add(String(i)) return jlist -def javaStringMapToPyDict(javaMap): - keys = javaMap.keySet() - itr = keys.iterator() - pyDict = {} - while itr.hasNext(): - key = itr.next() - val = javaMap.get(key) - fval = str(val) - if fval.find('[') > -1: - exec "fval = " + fval - else: - try: - fval = float(fval) - except: - pass - pyDict[str(key)] = fval - return pyDict def javaMapToPyDict(javaMap, customConverter=None): + ''' + Going forward should use javaObjToPyVal instead. + ''' keys = javaMap.keySet() itr = keys.iterator() if javaMap.jclassname == "java.util.LinkedHashMap": @@ -96,6 +135,9 @@ def javaMapToPyDict(javaMap, customConverter=None): return pyDict def pyDictToJavaMap(pyDict): + ''' + Going forward should use pyValToJavaObj instead. + ''' if pyDict is None : return None @@ -108,98 +150,13 @@ def pyDictToJavaMap(pyDict): jmap.put(pyValToJavaObj(key), pyValToJavaObj(pyDict[key])) return jmap -def pyValToJavaObj(val): - retObj = val - valtype = type(val) - # since Python on 64 bit has larger ints, we need to do a check - # for compatibility with Java Integers - if valtype is int and val <= Integer.MAX_VALUE and val >= Integer.MIN_VALUE : - retObj = Integer(val) - elif valtype is float: - retObj = Float(val) - elif valtype is long or valtype is int: - retObj = Long(val) - elif valtype is bool: - retObj = Boolean(val) - elif valtype is list: - retObj = ArrayList() - for i in val: - retObj.add(pyValToJavaObj(i)) - elif valtype is tuple: - tempList = ArrayList() - for i in val: - tempList.add(pyValToJavaObj(i)) - retObj = Collections.unmodifiableList(tempList) - elif valtype is datetime.datetime: - epoch = datetime.datetime.utcfromtimestamp(0) - delta = val - epoch - retObj = Date(long(delta.total_seconds()) * 1000) - elif issubclass(valtype, dict): - retObj = pyDictToJavaMap(val) - elif issubclass(valtype, JavaWrapperClass): - retObj = val.toJavaObj() - elif issubclass(valtype, BaseGeometry): - from com.vividsolutions.jts.io import WKTReader - reader = WKTReader() - retObj = reader.read(val.to_wkt()) - return retObj - -def javaObjToPyVal(obj, customConverter=None): - retVal = None - if obj is None: - return retVal - # handle pyjobjects - if hasattr(obj, 'jclassname'): - objtype = obj.jclassname - if objtype == "java.lang.Integer": - retVal = obj.intValue() - elif objtype == "java.lang.Float": - retVal = obj.floatValue() - elif objtype == "java.lang.Long": - retVal = obj.longValue() - elif objtype == "java.lang.Boolean": - retVal = bool(obj.booleanValue()) - elif objtype == "java.lang.Double": - retVal = obj.doubleValue() - elif objtype == "java.util.Date": - retVal = datetime.datetime.fromtimestamp(obj.getTime() / 1000) - elif objtype in ["com.vividsolutions.jts.geom.Geometry", "com.vividsolutions.jts.geom.GeometryCollection", - "com.vividsolutions.jts.geom.Polygon", "com.vividsolutions.jts.geom.MultiPolygon", - "com.vividsolutions.jts.geom.LineString", "com.vividsolutions.jts.geom.MultiLineString", - "com.vividsolutions.jts.geom.Point", "com.vividsolutions.jts.geom.MultiPoint", - "com.vividsolutions.jts.geom.LinearRing"] : - retVal = wkt.loads(obj.toText()) - elif objtype in ["java.util.ArrayList", "java.util.Arrays$ArrayList"]: - retVal = [] - size = obj.size() - for i in range(size): - retVal.append(javaObjToPyVal(obj.get(i), customConverter)) - elif objtype == "java.util.Collections$UnmodifiableRandomAccessList": - tempList = [] - size = obj.size() - for i in range(size): - tempList.append(javaObjToPyVal(obj.get(i), customConverter)) - retVal = tuple(tempList) - elif objtype == "java.util.HashMap": - retVal = javaMapToPyDict(obj, customConverter) - elif PyJavaUtil.isArray(obj): - retVal = [] - size = Array.getLength(obj) - for i in range(size): - retVal.append(javaObjToPyVal(Array.get(obj, i), customConverter)) - elif customConverter is not None: - retVal = customConverter(obj) - if retVal is None: - retVal = str(obj) - # test for jep array type - elif isinstance(obj, JEP_ARRAY_TYPE): - retVal = [] - size = len(obj) - for i in range(size): - retVal.append(javaObjToPyVal(obj[i], customConverter)) - return retVal - class JavaWrapperClass(object): def toJavaObj(self): raise NotImplementedError, "Subclasses must override this method." +# this initializes the basic handlers for Java->Python conversion and Python->Java conversion + +from JUtilHandler import javaBasicsToPyBasics, pyBasicsToJavaBasics, javaCollectionToPyCollection, pyCollectionToJavaCollection, javaClassToPyClass, pyClassToJavaClass + +pythonHandlers = [pyBasicsToJavaBasics, pyCollectionToJavaCollection, pyClassToJavaClass] +javaHandlers = [javaBasicsToPyBasics, javaCollectionToPyCollection, javaClassToPyClass] diff --git a/edexOsgi/com.raytheon.uf.common.python/utility/common_static/base/python/JUtilHandler.py b/edexOsgi/com.raytheon.uf.common.python/utility/common_static/base/python/JUtilHandler.py new file mode 100644 index 0000000000..7034112f22 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.python/utility/common_static/base/python/JUtilHandler.py @@ -0,0 +1,362 @@ +# # +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +# # + +import JUtil + +# +# Basic handler for Python to Java and back (this handles all the main things +# that JUtil needs to do, but none of the special ones that should and can be +# added if the code wants to be more powerful. +# +# Note : All methods that convert from Java to Python should take a custom converter, even if it is not used. +# +# +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 10/14/13 2250 mnash Initial creation of JUtil handler +# +# + + +from java.lang import Integer, Float, Long, Boolean, String, Double, Number +from java.util import Date +from com.raytheon.uf.common.python import PyJavaUtil +import datetime + +# Java -> Python conversion + +def javaBasicsToPyBasics(obj, customConverter=None): + ''' + Determines the correct method to call out of the dict to convert Java basic + objects to Python + ''' + if hasattr(obj, 'jclassname'): + classname = obj.jclassname + if classname in javaBasics : + return True, javaBasics[classname](obj) + else : + for javaClass in fallbackBasics : + if PyJavaUtil.isSubclass(obj, javaClass) : + return True, fallbackBasics[javaClass](obj, customConverter) + return False, obj + +def _toPythonInt(obj, customConverter=None): + ''' + Turns a Java Integer to a Python int + ''' + return obj.intValue() + +def _toPythonLong(obj, customConverter=None): + ''' + Turns a Java Long to a Python long, or int, + depending on the architecture + ''' + return obj.longValue() + +def _toPythonFloat(obj, customConverter=None): + ''' + Turns a Java Float to a Python float + ''' + return obj.floatValue() + +def _toPythonDouble(obj, customConverter=None): + ''' + Turns a Java Double to a Python float + ''' + return obj.doubleValue() + +def _toPythonBool(obj, customConverter=None): + ''' + Turns a Java Boolean to a Python bool + ''' + return bool(obj.booleanValue()) + +def _toPythonString(obj, customConverter=None): + ''' + Turns a Java String to a Python str + ''' + return obj.toString() + +def _toPythonDatetime(obj, customConverter=None): + ''' + Turns a Java Date to a Python datetime + ''' + return datetime.datetime.fromtimestamp(obj.getTime() / 1000) + +# Python -> Java conversion + +def pyBasicsToJavaBasics(val): + ''' + Method registered with JUtil to figure out any conversion of Python to Java. + Returns a default of String of that value if nothing else can be found. + ''' + valtype = type(val) + if valtype in pythonBasics : + return True, pythonBasics[valtype](val) + return False, str(val) + +def _toJavaInt(val): + ''' + Turns a Python int to a Java Integer, or a Long, depending the range + of the value. + ''' + # since Python on 64 bit has larger ints, we need to do a check + # for compatibility with Java Integers + if val <= Integer.MAX_VALUE and val >= Integer.MIN_VALUE : + return Integer(val) + # outside the Java bounds for Integer, so make it a Java Long + return Long(val) + +def _toJavaFloat(val): + ''' + Turns a Python float to a Java Float + ''' + return Float(val) + +def _toJavaLong(val): + ''' + Turns a Python long to a Java Long + ''' + return Long(val) + +def _toJavaBoolean(val): + ''' + Turns a Python bool to a Java Boolean + ''' + return Boolean(val) + +def _toJavaString(val): + ''' + Turns a Python str to a Java String + ''' + return String(str(val)) + +def _toJavaDate(val): + ''' + Turns a Python datetime to a Java Date + ''' + epoch = datetime.datetime.utcfromtimestamp(0) + delta = val - epoch + return Date(long(delta.total_seconds()) * 1000) + +# the dict that registers the Python data type to the method for conversion +pythonBasics = {int:_toJavaInt, float:_toJavaFloat, long:_toJavaLong, bool:_toJavaBoolean, str:_toJavaString, unicode:_toJavaString, datetime.datetime:_toJavaDate} +# the dict that registers the Java String of type to the method for conversion +javaBasics = {'java.lang.Integer':_toPythonInt, 'java.lang.Float':_toPythonFloat, 'java.lang.Double':_toPythonDouble, 'java.lang.Long':_toPythonLong, 'java.lang.Boolean':_toPythonBool, 'java.lang.String':_toPythonString, 'java.util.Date':_toPythonDatetime} +fallbackBasics = {Number:_toPythonFloat} +''' +The following methods will handle Python and Java collection conversion. +''' +from java.lang import Object +from java.util import Collections, HashMap, LinkedHashMap, ArrayList +from java.util import Date +from java.lang.reflect import Array +from java.util import List, Set, Map + +from collections import OrderedDict +import jep + +# make a jarray to find out if we have that +JEP_ARRAY_TYPE = type(jep.jarray(0, Object)) + +# Java -> Python conversion + +def javaCollectionToPyCollection(obj, customConverter=None): + ''' + Main method to register with JUtil for conversion of Java + collections to Python collections. + ''' + if hasattr(obj, 'jclassname'): + classname = obj.jclassname + if classname in javaCollections : + return True, javaCollections[classname](obj, customConverter) + elif PyJavaUtil.isArray(obj): + return True, _fromJavaArray(obj, customConverter) + else : + # we have some fallback capability, if we don't specifically handle a class, we + # want to try some of the more common types and see if those are available for + # conversion + for javaClass in fallbackCollections : + if PyJavaUtil.isSubclass(obj, javaClass): + return True, fallbackCollections[javaClass](obj, customConverter) + elif isinstance(obj, JEP_ARRAY_TYPE): + return True, _fromJepArray(obj, customConverter) + return False, obj + + +def _toPythonList(obj, customConverter=None): + ''' + Converts to a Python list. + ''' + retVal = [] + size = obj.size() + for i in range(size): + retVal.append(JUtil.javaObjToPyVal(obj.get(i), customConverter)) + return retVal + +def _toPythonTuple(obj, customConverter=None): + ''' + Converts to a Python tuple. + ''' + return tuple(_toPythonList(obj, customConverter)) + +def _toPythonDict(obj, customConverter=None): + ''' + Converts to a Python dict. + ''' + return __toPythonDict(obj, {}, customConverter) + +def _toPythonSet(obj, customConverter=None): + ''' + Converts to a Python set. + ''' + retVal = set() + size = obj.size() + for i in range(size): + retVal.add(JUtil.javaObjToPyVal(obj.get(i), customConverter)) + return retVal + +def _toPythonOrderedDict(obj, customConverter=None): + ''' + Converts to a Python OrderedDict. + ''' + return __toPythonDict(obj, OrderedDict(), customConverter) + +def _fromJavaArray(obj, customConverter=None): + ''' + Converts from a Java array to a Python list. + ''' + retVal = [] + for i in range(size): + retVal.append(JUtil.javaObjToPyVal(Array.get(obj, i), customConverter)) + return retVal + +def _fromJepArray(obj, customConverter=None): + ''' + Converts from a Jep array to a Python list. + ''' + retVal = [] + size = len(obj) + for i in range(size): + retVal.append(JUtil.javaObjToPyVal(obj[i], customConverter)) + return retVal + +def __toPythonDict(javaMap, pyDict, customConverter=None): + ''' + Converts to a Python dict. Passed in the dict type, and then handles the key conversion. + ''' + keys = javaMap.keySet() + itr = keys.iterator() + while itr.hasNext() : + key = itr.next() + obj = javaMap.get(key) + pyDict[JUtil.javaObjToPyVal(key)] = JUtil.javaObjToPyVal(obj, customConverter) + return pyDict + +# Python -> Java conversion + +def pyCollectionToJavaCollection(val): + ''' + Main method registered with JUtil for conversion of collections in Python + to Java collections. + ''' + valtype = type(val) + if valtype in pythonCollections : + return True, pythonCollections[valtype](val) + # not directly in the dict, so lets check whether they are subclasses + for pytype in pythonCollections : + if issubclass(pytype, valtype): + return True, pythonCollections[valtype](val) + return False, str(val) + +def _toJavaList(val): + ''' + Turns a Python list to a Java List + ''' + retObj = ArrayList() + for i in val : + retObj.add(JUtil.pyValToJavaObj(i)) + return retObj + +def _toJavaUnmodifiableList(val): + ''' + Turns a Python tuple to a Java UnmodifiableList + ''' + return Collections.unmodifiableList(_toJavaList(val)) + +def _toJavaLinkedMap(val): + ''' + Turns a Python OrderedDict to a Java LinkedHashMap + ''' + return __toJavaMap(val, LinkedHashMap()) + +def _toJavaMap(val): + ''' + Turns a Python dict to a Java HashMap + ''' + return __toJavaMap(val, HashMap()) + +def __toJavaMap(pyDict, jmap): + ''' + Does the actual conversion of the elements inside of the dict to Map + ''' + for key in pyDict: + jmap.put(JUtil.pyValToJavaObj(key), JUtil.pyValToJavaObj(pyDict[key])) + return jmap + +javaCollections = {'java.util.ArrayList':_toPythonList, 'java.util.Arrays$ArrayList':_toPythonList, 'java.util.Collections$UnmodifiableRandomAccessList':_toPythonTuple, 'java.util.HashMap':_toPythonDict, 'java.util.LinkedHashMap':_toPythonOrderedDict} +pythonCollections = { list:_toJavaList, tuple:_toJavaUnmodifiableList, OrderedDict:_toJavaLinkedMap, dict:_toJavaMap } +fallbackCollections = { List:_toPythonList, Map:_toPythonDict, Set:_toPythonSet } + +''' +Handles other types of Java to Python conversion and back. +''' + +def javaClassToPyClass(obj, customConverter=None): + ''' + Main method to convert Java classes to Python classes that aren't already defined above. + Registers with JUtil + ''' + if customConverter is not None : + return True, customConverter(obj) + return False, obj + +def pyClassToJavaClass(val): + ''' + Main method that registers with JUtil to convert Python classes to Java classes. + ''' + valtype = type(val) + for pyType in pythonClasses : + if issubclass(valtype, pyType): + return True, pythonClasses[pyType](val) + return False, str(val) + +def _toJavaClass(val): + ''' + Utilizes the JUtil.JavaWrapperClass object and its corresponding + toJavaObj() method that returns a Java object. + ''' + return val.toJavaObj() + +# registers the data type for conversion to a Java class. +pythonClasses = {JUtil.JavaWrapperClass:_toJavaClass} diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/IRegistryRequestService.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/IRegistryRequestService.java deleted file mode 100644 index ed767bb84e..0000000000 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/IRegistryRequestService.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.common.registry; - -import javax.jws.WebMethod; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.jws.soap.SOAPBinding.Style; - -/** - * - * Web service interface accessible to process Thrift serialized server requests - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * 5/3/2013     1948        bphillip    Initial implementation
- * 
- * - * @author bphillip - * @version 1 - */ -@WebService(serviceName = "RegistryRequestService") -@SOAPBinding(style = Style.RPC) -public interface IRegistryRequestService { - - /** - * Process the Thrift serialized request and return the Thrift serialized - * response - * - * @param data - * The Thrift serialized request - * @return The Thrift serialized response - */ - @WebMethod - public byte[] request(byte[] data); -} diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryRequestService.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryRequestService.java deleted file mode 100644 index dcb395fb3e..0000000000 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/RegistryRequestService.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.common.registry; - -import java.net.MalformedURLException; -import java.net.URL; - -import javax.xml.namespace.QName; -import javax.xml.ws.Service; - -/** - * - * - * Service class for submitting registry requests to the EDEX ebxml registry via - * JAX-WS - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * 5/3/2013     1948        bphillip    Initial implementation
- * 
- * - * @author bphillip - * @version 1 - */ -public class RegistryRequestService extends Service { - - /** The service name */ - private static final QName SERVICE_NAME = new QName( - "http://registry.common.uf.raytheon.com/", "RegistryRequestService"); - - /** The location of the wsdl */ - private static final String WSDL_LOCATION = "/registryRequest?wsdl"; - - /** - * Creates a new RegistryRequestService service residing on the given server - * on the given port - * - * @param server - * The server - * @param port - * The port number - * @throws MalformedURLException - * If errors occur constructing the service URL - */ - public RegistryRequestService(String server, String port) - throws MalformedURLException { - super(new URL("http://" + server + ":" + port + WSDL_LOCATION), - SERVICE_NAME); - } - - /** - * Gets the IRegistryRequestService port - * - * @return The IRegistryRequestService port - */ - public IRegistryRequestService getService() { - return super.getPort(IRegistryRequestService.class); - } -} diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistryRESTServices.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistryRESTServices.java index 4821f57b46..268758471d 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistryRESTServices.java +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistryRESTServices.java @@ -30,7 +30,6 @@ import javax.xml.bind.JAXBException; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; -import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.cxf.jaxrs.client.Client; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; @@ -40,14 +39,9 @@ import com.google.common.cache.LoadingCache; import com.google.common.io.Resources; import com.raytheon.uf.common.registry.RegistryJaxbManager; import com.raytheon.uf.common.registry.RegistryNamespaceMapper; -import com.raytheon.uf.common.registry.constants.RegistryAvailability; import com.raytheon.uf.common.registry.ebxml.RegistryUtil; -import com.raytheon.uf.common.registry.services.rest.IRegistryAvailableRestService; -import com.raytheon.uf.common.registry.services.rest.IRegistryDataAccessService; import com.raytheon.uf.common.registry.services.rest.IRegistryObjectsRestService; import com.raytheon.uf.common.registry.services.rest.IRepositoryItemsRestService; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; /** * @@ -63,6 +57,7 @@ import com.raytheon.uf.common.status.UFStatus; * 7/29/2013 2191 bphillip Implemented registry data access service * 8/1/2013 1693 bphillip Modified getregistry objects method to correctly handle response * 9/5/2013 1538 bphillip Changed cache expiration timeout and added http header + * 10/30/2013 1538 bphillip Moved data delivery services out of registry plugin * * * @author bphillip @@ -70,56 +65,32 @@ import com.raytheon.uf.common.status.UFStatus; */ public class RegistryRESTServices { + private static final String REGISTRY_REST_SERVICE_PATH = "/rest"; + /** Map of known registry object request services */ - private static LoadingCache registryObjectServiceMap = CacheBuilder + private LoadingCache registryObjectServiceMap = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { public IRegistryObjectsRestService load(String url) { - return getPort(url, IRegistryObjectsRestService.class); + return getPort(url + REGISTRY_REST_SERVICE_PATH, + IRegistryObjectsRestService.class); } }); /** Map of known repository item request services */ - private static LoadingCache repositoryItemServiceMap = CacheBuilder + private LoadingCache repositoryItemServiceMap = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { public IRepositoryItemsRestService load(String url) { - return getPort(url, IRepositoryItemsRestService.class); + return getPort(url + REGISTRY_REST_SERVICE_PATH, + IRepositoryItemsRestService.class); } }); - /** Map of known registry availability services */ - private static LoadingCache registryAvailabilityServiceMap = CacheBuilder - .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) - .build(new CacheLoader() { - public IRegistryAvailableRestService load(String url) { - return getPort(url, IRegistryAvailableRestService.class); - } - }); + private RegistryJaxbManager jaxbManager; - /** Map of known registry data access services */ - private static LoadingCache registryDataAccessServiceMap = CacheBuilder - .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) - .build(new CacheLoader() { - public IRegistryDataAccessService load(String url) { - return getPort(url, IRegistryDataAccessService.class); - } - }); - - /** - * The logger - */ - private static final IUFStatusHandler statusHandler = UFStatus - .getHandler(RegistryRESTServices.class); - - private static RegistryJaxbManager jaxbManager; - - static { - try { - jaxbManager = new RegistryJaxbManager(new RegistryNamespaceMapper()); - } catch (JAXBException e) { - statusHandler.error("Error creating Registry jaxb manager!", e); - } + public RegistryRESTServices() throws JAXBException { + jaxbManager = new RegistryJaxbManager(new RegistryNamespaceMapper()); } /** @@ -129,8 +100,7 @@ public class RegistryRESTServices { * The base URL of the registry * @return The service implementation */ - public static IRegistryObjectsRestService getRegistryObjectService( - String baseURL) { + public IRegistryObjectsRestService getRegistryObjectService(String baseURL) { try { return registryObjectServiceMap.get(baseURL); } catch (ExecutionException e) { @@ -153,7 +123,7 @@ public class RegistryRESTServices { * If errors occur while serializing the object */ @SuppressWarnings("unchecked") - public static T getRegistryObject( + public T getRegistryObject( Class expectedType, String baseURL, String objectId) throws JAXBException, RegistryServiceException { String objStr = getRegistryObjectService(baseURL).getRegistryObject( @@ -172,8 +142,7 @@ public class RegistryRESTServices { * The base URL of the registry * @return The service implementation */ - public static IRepositoryItemsRestService getRepositoryItemService( - String baseURL) { + public IRepositoryItemsRestService getRepositoryItemService(String baseURL) { try { return repositoryItemServiceMap.get(baseURL); } catch (ExecutionException e) { @@ -191,75 +160,11 @@ public class RegistryRESTServices { * The id of the object * @return The repository item */ - public static byte[] getRepositoryItem(String baseURL, - String repositoryItemId) { + public byte[] getRepositoryItem(String baseURL, String repositoryItemId) { return getRepositoryItemService(baseURL).getRepositoryItem( repositoryItemId); } - /** - * Gets the registry available service implementation - * - * @param baseURL - * The base URL of the registry - * @return THe registry available service implementation - */ - public static IRegistryAvailableRestService getRegistryAvailableService( - String baseURL) { - try { - return registryAvailabilityServiceMap.get(baseURL); - } catch (ExecutionException e) { - throw new RegistryServiceException( - "Error getting Registry Availability Rest Service", e); - } - } - - /** - * Check if the registry at the given URL is available - * - * @param baseURL - * The base URL of the registry - * @return True if the registry services are available - */ - public static boolean isRegistryAvailable(String baseURL) { - String response = null; - try { - response = getRegistryAvailableService(baseURL) - .isRegistryAvailable(); - if (RegistryAvailability.AVAILABLE.equals(response)) { - return true; - } else { - statusHandler.info("Registry at [" + baseURL - + "] not available: " + response); - } - return RegistryAvailability.AVAILABLE.equals(response); - } catch (Throwable t) { - if (response == null) { - response = ExceptionUtils.getRootCauseMessage(t); - } - statusHandler.error("Registry at [" + baseURL + "] not available: " - + response); - return false; - } - } - - /** - * Gets the data access service for the specified registry URL - * - * @param baseURL - * The baseURL of the registry - * @return The data access service for the specified registry URL - */ - public static IRegistryDataAccessService getRegistryDataAccessService( - String baseURL) { - try { - return registryDataAccessServiceMap.get(baseURL); - } catch (ExecutionException e) { - throw new RegistryServiceException( - "Error getting Registry Availability Rest Service", e); - } - } - /** * Accesses a rest service at the provided URL. This method is primarily * used for resolving remote object references which use a REST service @@ -268,7 +173,7 @@ public class RegistryRESTServices { * The URL of the rest service * @return */ - public static Object accessXMLRestService(String url) { + public Object accessXMLRestService(String url) { String response = null; try { response = Resources @@ -286,8 +191,7 @@ public class RegistryRESTServices { } } - private static T getPort(String url, - Class serviceClass) { + protected T getPort(String url, Class serviceClass) { T service = JAXRSClientFactory.create(url, serviceClass); Client client = (Client) Proxy.getInvocationHandler((Proxy) service); // Create HTTP header containing the calling registry diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistrySOAPServices.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistrySOAPServices.java index e8128662f7..36afcfcbc3 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistrySOAPServices.java +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/RegistrySOAPServices.java @@ -75,6 +75,7 @@ import com.raytheon.uf.common.status.UFStatus; * Apr 24, 2013 1910 djohnson RegistryResponseStatus is now an enum. * 8/28/2013 1538 bphillip Removed caches, add http client preferences * 9/5/2013 1538 bphillip Add HTTP header information + * 10/30/2013 1538 bphillip Made methods in this class non-static * * * @@ -143,7 +144,7 @@ public class RegistrySOAPServices { } /** Cache of known notification services */ - private static LoadingCache notificationManagerServices = CacheBuilder + private LoadingCache notificationManagerServices = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { public NotificationListener load(String key) { @@ -152,7 +153,7 @@ public class RegistrySOAPServices { }); /** Cache of known lifecycle manager services */ - private static LoadingCache lifecycleManagerServices = CacheBuilder + private LoadingCache lifecycleManagerServices = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { public LifecycleManager load(String key) { @@ -161,7 +162,7 @@ public class RegistrySOAPServices { }); /** Cache of known cataloger services */ - private static LoadingCache catalogerServices = CacheBuilder + private LoadingCache catalogerServices = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { public Cataloger load(String key) { @@ -170,7 +171,7 @@ public class RegistrySOAPServices { }); /** Cache of known query services */ - private static LoadingCache queryServices = CacheBuilder + private LoadingCache queryServices = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { public QueryManager load(String key) { @@ -179,7 +180,7 @@ public class RegistrySOAPServices { }); /** Cache of known validator services */ - private static LoadingCache validatorServices = CacheBuilder + private LoadingCache validatorServices = CacheBuilder .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) .build(new CacheLoader() { public Validator load(String key) { @@ -196,7 +197,7 @@ public class RegistrySOAPServices { * @throws MalformedURLException * If errors occur creating the URL object */ - public static String getNotificationListenerServiceUrl(final String baseURL) + public String getNotificationListenerServiceUrl(final String baseURL) throws MalformedURLException { return new URL(baseURL + PATH_SEPARATOR + NOTIFICATION_SERVICE_NAME) .toString(); @@ -211,7 +212,7 @@ public class RegistrySOAPServices { * @throws RegistryServiceException * If errors occur creating the URL object */ - public static NotificationListener getNotificationListenerServiceForHost( + public NotificationListener getNotificationListenerServiceForHost( final String host) throws RegistryServiceException { return getNotificationListenerServiceForUrl(host + PATH_SEPARATOR + NOTIFICATION_SERVICE_NAME); @@ -226,7 +227,7 @@ public class RegistrySOAPServices { * @throws RegistryServiceException * If errors occur creating the URL object */ - public static NotificationListener getNotificationListenerServiceForUrl( + public NotificationListener getNotificationListenerServiceForUrl( final String url) throws RegistryServiceException { try { return notificationManagerServices.get(url); @@ -245,8 +246,8 @@ public class RegistrySOAPServices { * @throws RegistryServiceException * If errors occur creating the URL object */ - public static LifecycleManager getLifecycleManagerServiceForHost( - final String host) throws RegistryServiceException { + public LifecycleManager getLifecycleManagerServiceForHost(final String host) + throws RegistryServiceException { return getLifecycleManagerServiceForUrl(host + PATH_SEPARATOR + LIFECYCLE_MANAGER_SERVICE_NAME); } @@ -260,8 +261,8 @@ public class RegistrySOAPServices { * @throws RegistryServiceException * If errors occur creating the URL object */ - public static LifecycleManager getLifecycleManagerServiceForUrl( - final String url) throws RegistryServiceException { + public LifecycleManager getLifecycleManagerServiceForUrl(final String url) + throws RegistryServiceException { try { return lifecycleManagerServices.get(url); } catch (ExecutionException e) { @@ -279,7 +280,7 @@ public class RegistrySOAPServices { * @throws RegistryServiceException * If errors occur creating the URL object */ - public static Cataloger getCatalogerServiceForHost(final String host) + public Cataloger getCatalogerServiceForHost(final String host) throws RegistryServiceException { return getCatalogerServiceForUrl(host + PATH_SEPARATOR + CATALOGER_SERVICE_NAME); @@ -294,7 +295,7 @@ public class RegistrySOAPServices { * @throws RegistryServiceException * If errors occur creating the URL object */ - public static Cataloger getCatalogerServiceForUrl(final String url) + public Cataloger getCatalogerServiceForUrl(final String url) throws RegistryServiceException { try { return catalogerServices.get(url); @@ -313,7 +314,7 @@ public class RegistrySOAPServices { * @throws RegistryServiceException * If errors occur creating the URL object */ - public static QueryManager getQueryServiceForHost(final String host) + public QueryManager getQueryServiceForHost(final String host) throws RegistryServiceException { return getQueryServiceForUrl(host + PATH_SEPARATOR + QUERY_SERVICE_NAME); } @@ -327,7 +328,7 @@ public class RegistrySOAPServices { * @throws RegistryServiceException * If errors occur creating the URL object */ - public static QueryManager getQueryServiceForUrl(final String url) + public QueryManager getQueryServiceForUrl(final String url) throws RegistryServiceException { try { return queryServices.get(url); @@ -346,7 +347,7 @@ public class RegistrySOAPServices { * @throws RegistryServiceException * If errors occur creating the URL object */ - public static Validator getValidatorServiceForHost(final String host) + public Validator getValidatorServiceForHost(final String host) throws RegistryServiceException { return getValidatorServiceForUrl(host + PATH_SEPARATOR + VALIDATOR_SERVICE_NAME); @@ -361,7 +362,7 @@ public class RegistrySOAPServices { * @throws RegistryServiceException * If errors occur creating the URL object */ - public static Validator getValidatorServiceForUrl(final String url) + public Validator getValidatorServiceForUrl(final String url) throws RegistryServiceException { try { return validatorServices.get(url); @@ -383,7 +384,7 @@ public class RegistrySOAPServices { * @throws RegistryServiceException * If errors occur during request submission */ - public static void sendSubmitObjectsRequest(SubmitObjectsRequest request, + public void sendSubmitObjectsRequest(SubmitObjectsRequest request, String host) throws RegistryServiceException { LifecycleManager lcm; @@ -423,7 +424,7 @@ public class RegistrySOAPServices { } @SuppressWarnings("unchecked") - private static T getPort(String serviceUrl, + private T getPort(String serviceUrl, Class serviceInterface) throws RegistryServiceException { W3CEndpointReferenceBuilder endpointBuilder = new W3CEndpointReferenceBuilder(); endpointBuilder.wsdlDocumentLocation(serviceUrl.toString() + WSDL); diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IQueryProtocolRestService.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IQueryProtocolRestService.java index 8c60278f57..3443e3f95e 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IQueryProtocolRestService.java +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IQueryProtocolRestService.java @@ -39,12 +39,13 @@ import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryExceptio * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 5/21/2013 2022 bphillip Initial implementation + * 10/30/2013 1538 bphillip Changed REST path * * * @author bphillip * @version 1 */ -@Path("/rest/search") +@Path("/search") public interface IQueryProtocolRestService { /** diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryObjectsRestService.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryObjectsRestService.java index 6a68f42c39..62c14177e1 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryObjectsRestService.java +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRegistryObjectsRestService.java @@ -36,12 +36,13 @@ import javax.xml.bind.JAXBException; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 5/21/2013 2022 bphillip Initial implementation + * 10/30/2013 1538 bphillip Changed REST service paths * * * @author bphillip * @version 1 */ -@Path("/rest/registryObjects/{objectId}") +@Path("/registryObjects/{objectId}") public interface IRegistryObjectsRestService { /** diff --git a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRepositoryItemsRestService.java b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRepositoryItemsRestService.java index 9df46cb6bd..d379df5d19 100644 --- a/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRepositoryItemsRestService.java +++ b/edexOsgi/com.raytheon.uf.common.registry.ebxml/src/com/raytheon/uf/common/registry/services/rest/IRepositoryItemsRestService.java @@ -35,12 +35,13 @@ import javax.ws.rs.Produces; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 5/21/2013 2022 bphillip Initial implementation + * 10/30/2013 1538 bphillip Changed REST service paths * * * @author bphillip * @version 1 */ -@Path("/rest/repositoryItems/{repositoryItemId}") +@Path("/repositoryItems/{repositoryItemId}") public interface IRepositoryItemsRestService { @GET diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/util/BandwidthDaoUtil.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/util/BandwidthDaoUtil.java index 6a4c722543..59e370e62d 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/util/BandwidthDaoUtil.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/util/BandwidthDaoUtil.java @@ -33,6 +33,7 @@ import com.raytheon.uf.common.datadelivery.registry.Coverage; import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData; import com.raytheon.uf.common.datadelivery.registry.DataType; import com.raytheon.uf.common.datadelivery.registry.GriddedTime; +import com.raytheon.uf.common.datadelivery.registry.PointTime; import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Time; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; @@ -70,6 +71,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus; * Sept 24, 2013 1797 dhladky separated time from GriddedTime * Oct 10, 2013 1797 bgonzale Refactored registry Time objects. * Oct 30, 2013 2448 dhladky Fixed pulling data before and after activePeriod starting and ending. + * Nov 5, 2013 2521 dhladky Fixed DataSetMetaData update failures for URL's in pointdata. * * * @@ -325,6 +327,7 @@ public class BandwidthDaoUtil { * @return the adhoc subscription, or null if no matching metadata could be * found */ + @SuppressWarnings("rawtypes") public AdhocSubscription setAdhocMostRecentUrlAndTime( AdhocSubscription adhoc, boolean mostRecent) { AdhocSubscription retVal = null; @@ -344,8 +347,19 @@ public class BandwidthDaoUtil { } if (dataSetMetaDatas != null && !dataSetMetaDatas.isEmpty()) { - // just grab the most recent one, all we need is the URL - adhoc.setUrl(dataSetMetaDatas.get(0).getUrl()); + // No guarantee on ordering, have to find most recent time + @SuppressWarnings("unchecked") + DataSetMetaData selectedDataSet = dataSetMetaDatas.get(0); + Date checkDate = selectedDataSet.getDate(); + + for (DataSetMetaData dsmd: dataSetMetaDatas) { + if (dsmd.getDate().after(checkDate)) { + checkDate = dsmd.getDate(); + selectedDataSet = dsmd; + } + } + + adhoc.setUrl(selectedDataSet.getUrl()); retVal = adhoc; } diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/META-INF/MANIFEST.MF index d0af5e773b..a226668242 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/META-INF/MANIFEST.MF @@ -17,4 +17,8 @@ Require-Bundle: com.raytheon.uf.common.registry.schemas.ebxml;bundle-version="1. org.springframework;bundle-version="2.5.6", com.raytheon.uf.common.time;bundle-version="1.12.1174", com.raytheon.uf.edex.core;bundle-version="1.12.1174", - com.google.guava;bundle-version="1.0.0" + com.google.guava;bundle-version="1.0.0", + org.apache.commons.cxf;bundle-version="1.0.0", + org.reflections;bundle-version="0.9.9", + com.raytheon.uf.common.datadelivery.registry;bundle-version="1.0.0", + org.apache.commons.lang;bundle-version="2.3.0" diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery-ncf.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-datadelivery.xml similarity index 69% rename from edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery-ncf.xml rename to edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-datadelivery.xml index 93389743c6..ff513c5867 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery-ncf.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-datadelivery.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - - - + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-ncf.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-ncf.xml index c1aa4e7067..68f42faeba 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-ncf.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-ncf.xml @@ -11,5 +11,6 @@ + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-wfo.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-wfo.xml index 735a7eef05..b1f0c5a143 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-wfo.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-federation-datadelivery-wfo.xml @@ -9,9 +9,10 @@ - + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery-wfo.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery-wfo.xml deleted file mode 100644 index 7dcfc5add5..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery-wfo.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery.xml index 91c76aa249..d873ff99c7 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/registry-replication-datadelivery.xml @@ -10,11 +10,11 @@ - - + + diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/webservices.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/webservices.xml new file mode 100644 index 0000000000..da959022fa --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/res/spring/webservices.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/NcfRegistryFederationManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/NcfRegistryFederationManager.java index 62da08541f..e08a3c036b 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/NcfRegistryFederationManager.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/NcfRegistryFederationManager.java @@ -26,10 +26,14 @@ import java.util.List; import javax.xml.bind.JAXBException; import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager; +import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException; +import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode; +import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.FederationType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.OrganizationType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PersonType; +import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryType; @@ -54,6 +58,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/30/2013 1538 bphillip Override submitObjects method * * * @author bphillip @@ -124,6 +129,21 @@ public class NcfRegistryFederationManager extends RegistryFederationManager } } + protected void submitObjects(List objects) + throws EbxmlRegistryException { + SubmitObjectsRequest submitObjectsRequest2 = new SubmitObjectsRequest( + "Federation Objects submission", + "Submitting federation related objects", null, + new RegistryObjectListType(objects), false, + Mode.CREATE_OR_REPLACE); + try { + lcm.submitObjects(submitObjectsRequest2); + } catch (MsgRegistryException e) { + throw new EbxmlRegistryException( + "Error submitting federation objects to registry", e); + } + } + protected FederationType getFederation() throws EbxmlRegistryException { FederationType federation = new FederationType(); federation.setId(FEDERATION_ID); diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java index 237ced6002..a610f00deb 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/federation/RegistryFederationManager.java @@ -44,6 +44,7 @@ import com.raytheon.uf.common.registry.constants.AssociationTypes; 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.registry.services.RegistrySOAPServices; import com.raytheon.uf.common.serialization.JAXBManager; import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.status.IUFStatusHandler; @@ -66,6 +67,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; * ------------ ---------- ----------- -------------------------- * 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/30/2013 1538 bphillip Changed submitObjects method to submit objects to NCF by default * * * @author bphillip @@ -79,6 +81,9 @@ public abstract class RegistryFederationManager { protected static final IUFStatusHandler statusHandler = UFStatus .getHandler(RegistryFederationManager.class); + /** The address of the NCF */ + protected String ncfAddress = System.getenv("NCF_ADDRESS"); + /** * The scheduler service used for registering this registry with the * federation @@ -109,6 +114,9 @@ public abstract class RegistryFederationManager { /** Data Access object for RegistryType objects */ protected RegistryDao registryDao; + /** Registry SOAP Service Client */ + protected RegistrySOAPServices registrySoapServices; + /** * Gets the federation object for this federation * @@ -195,6 +203,16 @@ public abstract class RegistryFederationManager { return association; } + /** + * Submits objects necessary for the registry/federation to operate properly + * to the registry. This method first submits it locally, then submits the + * objects to the NCF + * + * @param objects + * The objects to submit + * @throws EbxmlRegistryException + * If object submission fails + */ protected void submitObjects(List objects) throws EbxmlRegistryException { SubmitObjectsRequest submitObjectsRequest2 = new SubmitObjectsRequest( @@ -209,6 +227,14 @@ public abstract class RegistryFederationManager { "Error submitting federation objects to registry", e); } + try { + registrySoapServices.getLifecycleManagerServiceForHost(ncfAddress) + .submitObjects(submitObjectsRequest2); + } catch (MsgRegistryException e) { + throw new EbxmlRegistryException( + "Error submitting federation objects to registry", e); + } + } public void setRegistryObjectDao(RegistryObjectDao registryObjectDao) { @@ -219,4 +245,9 @@ public abstract class RegistryFederationManager { this.registryDao = registryDao; } + public void setRegistrySoapServices( + RegistrySOAPServices registrySoapServices) { + this.registrySoapServices = registrySoapServices; + } + } 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 906c15c161..7c611ddfae 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,12 +47,11 @@ 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.services.RegistryRESTServices; -import com.raytheon.uf.common.registry.services.RegistrySOAPServices; import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.edex.database.RunnableWithTransaction; import com.raytheon.uf.edex.datadelivery.registry.replication.RegistryReplicationManager; +import com.raytheon.uf.edex.datadelivery.registry.web.DataDeliveryRESTServices; 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; @@ -70,6 +69,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants; * 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 + * 10/30/2013 1538 bphillip This class now uses non-static rest/soap clients * * * @author bphillip @@ -80,12 +80,12 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants; public class WfoRegistryFederationManager extends RegistryFederationManager implements RegistryInitializedListener { - /** The address of the NCF */ - private String ncfAddress; - /** The transaction template used to manually handle transactions */ private TransactionTemplate txTemplate; + /** Data Delivery rest client services */ + private DataDeliveryRESTServices dataDeliveryRestClient; + /** * Creates a new WfoRegistryFederationManager */ @@ -112,11 +112,10 @@ public class WfoRegistryFederationManager extends RegistryFederationManager */ protected WfoRegistryFederationManager(boolean federationEnabled, LifecycleManager lcm, String federationPropertiesFileName, - RegistryReplicationManager replicationManager, String ncfAddress) + RegistryReplicationManager replicationManager) throws JAXBException, IOException, SerializationException { super(federationEnabled, lcm, federationPropertiesFileName, replicationManager); - this.ncfAddress = ncfAddress; if (this.replicationManager.getServers() == null || CollectionUtil.isNullOrEmpty(replicationManager.getServers() .getRegistryReplicationServers())) { @@ -198,7 +197,7 @@ public class WfoRegistryFederationManager extends RegistryFederationManager request.setQuery(query); QueryResponse response = null; try { - response = RegistrySOAPServices.getQueryServiceForHost(ncfAddress) + response = registrySoapServices.getQueryServiceForHost(ncfAddress) .executeQuery(request); } catch (Exception e) { throw new EbxmlRegistryException( @@ -253,7 +252,7 @@ public class WfoRegistryFederationManager extends RegistryFederationManager if (!success) { try { try { - if (RegistryRESTServices + if (dataDeliveryRestClient .isRegistryAvailable(ncfAddress)) { statusHandler .info("NCF Registry is available. Attempting to join federation..."); @@ -285,4 +284,9 @@ public class WfoRegistryFederationManager extends RegistryFederationManager this.txTemplate = txTemplate; } + public void setDataDeliveryRestClient( + DataDeliveryRESTServices dataDeliveryRestClient) { + this.dataDeliveryRestClient = dataDeliveryRestClient; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/NotificationServers.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/NotificationServers.java index 846b1c9887..8a59f0d943 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/NotificationServers.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/NotificationServers.java @@ -19,6 +19,7 @@ **/ package com.raytheon.uf.edex.datadelivery.registry.replication; +import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; @@ -41,6 +42,7 @@ import javax.xml.bind.annotation.XmlRootElement; * 4/9/2013 1802 bphillip Initial implementation * 5/21/2013 1707 bphillip Removed unused fields * 6/4/2013 1707 bphillip Renamed and changed fields for clarity + * 10/30/2013 1538 bphillip getRegistryReplicationServers returns empty list if no servers are specified * * * @author bphillip @@ -55,6 +57,9 @@ public class NotificationServers { private List registryReplicationServers; public List getRegistryReplicationServers() { + if (registryReplicationServers == null) { + registryReplicationServers = new ArrayList(); + } return registryReplicationServers; } 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 95600aa37d..31035cd435 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 @@ -23,6 +23,7 @@ import java.io.File; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.List; @@ -41,7 +42,6 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.ws.wsaddressing.W3CEndpointReference; import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder; -import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException; import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode; import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.DeliveryInfoType; @@ -60,7 +60,13 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import com.raytheon.uf.common.localization.IPathManager; +import com.raytheon.uf.common.localization.LocalizationContext; +import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; +import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; +import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.PathManagerFactory; +import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException; import com.raytheon.uf.common.registry.EbxmlNamespaces; import com.raytheon.uf.common.registry.RegistryException; import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes; @@ -70,15 +76,16 @@ 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; -import com.raytheon.uf.common.registry.services.RegistryRESTServices; import com.raytheon.uf.common.registry.services.RegistrySOAPServices; import com.raytheon.uf.common.serialization.JAXBManager; import com.raytheon.uf.common.serialization.SerializationException; 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.common.time.util.TimeUtil; import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.edex.datadelivery.registry.availability.FederatedRegistryMonitor; +import com.raytheon.uf.edex.datadelivery.registry.web.DataDeliveryRESTServices; 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; @@ -101,6 +108,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; * 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 + * 10/30/2013 1538 bphillip Changed method visibility, added add/remove/save notification servers and updated to use non-static rest/soap clients * * * @author bphillip @@ -147,12 +155,19 @@ public class RegistryReplicationManager { /** * When a federation sync is necessary, this is the number of threads that * will be used for synchronization. Configurable in the - * com.raytheon.uf.edex.registry.ebxml.properties file. Default is 25 + * com.raytheon.uf.edex.registry.ebxml.properties file. Default is 5 */ private int registrySyncThreads = 5; + /** Maximum times this registry will try to sync data before failure */ private int maxSyncRetries = 3; + /** Data Delivery REST services client */ + private DataDeliveryRESTServices dataDeliveryRestClient; + + /** REgistry Soap client */ + private RegistrySOAPServices registrySoapClient; + /** * Creates a new RegistryReplicationManager * @@ -166,16 +181,23 @@ public class RegistryReplicationManager { * @throws MalformedURLException */ public RegistryReplicationManager(boolean subscriptionProcessingEnabled, - String notificationServerConfigFileName, RegistryObjectDao dao, + RegistryObjectDao dao, FederatedRegistryMonitor availabilityMonitor, - TransactionTemplate txTemplate, int registrySyncThreads) - throws JAXBException, SerializationException, MalformedURLException { + TransactionTemplate txTemplate) throws JAXBException, + SerializationException, MalformedURLException { this.subscriptionProcessingEnabled = subscriptionProcessingEnabled; - this.replicationConfigFileName = notificationServerConfigFileName; + if (System.getProperty("edex.run.mode").equals("centralRegistry")) { + this.replicationConfigFileName = "ebxml/notification/notificationServers_NCF.xml"; + } else { + this.replicationConfigFileName = "ebxml/notification/notificationServers_WFO.xml"; + } this.dao = dao; this.txTemplate = txTemplate; this.federatedRegistryMonitor = availabilityMonitor; - this.registrySyncThreads = registrySyncThreads; + if (System.getProperty("ebxml-federation-sync-threads") != null) { + registrySyncThreads = Integer.valueOf(System + .getProperty("ebxml-federation-sync-threads")); + } jaxbManager = new JAXBManager(NotificationServers.class, SubscriptionType.class); File notificationServerConfigFile = PathManagerFactory.getPathManager() @@ -187,11 +209,68 @@ public class RegistryReplicationManager { this.subscriptionProcessingEnabled = false; return; } - servers = (NotificationServers) jaxbManager - .unmarshalFromXmlFile(notificationServerConfigFile); + servers = jaxbManager.unmarshalFromXmlFile(NotificationServers.class, + notificationServerConfigFile); scheduler = Executors.newSingleThreadScheduledExecutor(); } + /** + * Removes a notificationServer based on the URL. + * + * @param baseURL + * The URL of the server to be removed + */ + public void removeNotificationServer(String baseURL) { + NotificationHostConfiguration toRemove = null; + for (NotificationHostConfiguration hostConfig : this.servers + .getRegistryReplicationServers()) { + if (hostConfig.getRegistryBaseURL().equals(baseURL)) { + toRemove = hostConfig; + } + } + if (toRemove != null) { + this.servers.getRegistryReplicationServers().remove(toRemove); + } + } + + /** + * Adds a notification server to the list. + * + * @param host + * The host to be added + */ + public void addNotificationServer(NotificationHostConfiguration host) { + for (NotificationHostConfiguration hostConfig : this.servers + .getRegistryReplicationServers()) { + if (hostConfig.getRegistryBaseURL().equals( + host.getRegistryBaseURL())) { + return; + } + } + this.servers.getRegistryReplicationServers().add(host); + } + + /** + * Persists the list of notification servers to the localized file + */ + public void saveNotificationServers() { + IPathManager pm = PathManagerFactory.getPathManager(); + LocalizationContext lc = pm.getContext(LocalizationType.EDEX_STATIC, + LocalizationLevel.CONFIGURED); + LocalizationFile lf = pm.getLocalizationFile(lc, + this.replicationConfigFileName); + File file = lf.getFile(); + + try { + jaxbManager.marshalToXmlFile(this.servers, file.getAbsolutePath()); + lf.save(); + } catch (SerializationException e) { + statusHandler.error("Unable to update replication server file!", e); + } catch (LocalizationOpFailedException e) { + statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e); + } + } + /** * Checks how long a registry has been down. If the registry has been down * for over 2 days, the registry is synchronized with one of the federation @@ -234,8 +313,9 @@ public class RegistryReplicationManager { statusHandler .info("Checking availability of registry at: " + config.getRegistryBaseURL()); - if (RegistryRESTServices.isRegistryAvailable(config - .getRegistryBaseURL())) { + if (dataDeliveryRestClient + .isRegistryAvailable(config + .getRegistryBaseURL())) { registryToSyncFrom = config; break; } @@ -281,8 +361,16 @@ public class RegistryReplicationManager { TimeUnit.MINUTES); } - private void synchronizeRegistryWithFederation(String remoteRegistryUrl) - throws MsgRegistryException, EbxmlRegistryException { + /** + * Synchronizes this registry's data with the registry at the specified URL + * + * @param remoteRegistryUrl + * The URL of the registry to sync with + * @throws EbxmlRegistryException + * If the thread executor fails to shut down properly + */ + public void synchronizeRegistryWithFederation(String remoteRegistryUrl) + throws EbxmlRegistryException { ExecutorService executor = Executors .newFixedThreadPool(this.registrySyncThreads); for (String objectType : objectTypes) { @@ -290,7 +378,7 @@ public class RegistryReplicationManager { Set remoteIds = new HashSet(); statusHandler .info("Getting registry object Ids from local registry..."); - Collection response = RegistryRESTServices + Collection response = dataDeliveryRestClient .getRegistryDataAccessService( RegistryUtil.LOCAL_REGISTRY_ADDRESS) .getRegistryObjectIdsOfType(objectType).getPayload(); @@ -301,7 +389,7 @@ public class RegistryReplicationManager { + objectType + " present in local registry."); statusHandler.info("Getting registry object Ids from " + remoteRegistryUrl + "..."); - response = RegistryRESTServices + response = dataDeliveryRestClient .getRegistryDataAccessService(remoteRegistryUrl) .getRegistryObjectIdsOfType(objectType).getPayload(); if (response != null) { @@ -321,7 +409,7 @@ public class RegistryReplicationManager { for (String localId : localIds) { if (remoteIds.contains(localId)) { executor.submit(new RegistrySubmitTask(txTemplate, dao, - localId, remoteRegistryUrl)); + localId, remoteRegistryUrl, dataDeliveryRestClient)); } else { RegistryRemoveTask removeTask = new RegistryRemoveTask( txTemplate, dao, localId); @@ -337,7 +425,7 @@ public class RegistryReplicationManager { for (String remoteId : remoteIds) { if (!localIds.contains(remoteId)) { executor.submit(new RegistrySubmitTask(txTemplate, dao, - remoteId, remoteRegistryUrl)); + remoteId, remoteRegistryUrl, dataDeliveryRestClient)); } } } @@ -438,8 +526,8 @@ public class RegistryReplicationManager { * The object describing the destination server to make registry * replication subscriptions to */ - private void submitSubscriptionsToHost( - NotificationHostConfiguration config, RegistryType localRegistry) { + public void submitSubscriptionsToHost(NotificationHostConfiguration config, + RegistryType localRegistry) { statusHandler .info("Generating registry replication subscriptions for registry at [" + config.getRegistrySiteName() @@ -462,7 +550,7 @@ public class RegistryReplicationManager { "Subscription Submission", "Subscription Submission", null, new RegistryObjectListType(subscriptions), false, Mode.CREATE_OR_REPLACE); - RegistrySOAPServices.sendSubmitObjectsRequest(request, + registrySoapClient.sendSubmitObjectsRequest(request, config.getRegistryBaseURL()); } @@ -526,7 +614,7 @@ public class RegistryReplicationManager { String endpointType = DeliveryMethodTypes.SOAP; W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder(); - builder.address(RegistrySOAPServices.getNotificationListenerServiceUrl( + builder.address(registrySoapClient.getNotificationListenerServiceUrl( registry.getBaseURL()).toString()); W3CEndpointReference ref = builder.build(); DOMResult dom = new DOMResult(); @@ -603,7 +691,7 @@ public class RegistryReplicationManager { statusHandler.info("Checking if remote registry at [" + remoteRegistryBaseURL + "] is available..."); - if (RegistryRESTServices + if (dataDeliveryRestClient .isRegistryAvailable(remoteRegistryBaseURL)) { statusHandler.info("Registry at [" + remoteRegistryBaseURL + "] is available!"); @@ -616,7 +704,7 @@ public class RegistryReplicationManager { try { statusHandler .info("Removing remote subscriptions prior to submission of new subscriptions"); - RegistryRESTServices.getRegistryDataAccessService( + dataDeliveryRestClient.getRegistryDataAccessService( config.getRegistryBaseURL()) .removeSubscriptionsForSite(registry.getOwner()); submitSubscriptionsToHost(config, registry); @@ -630,8 +718,9 @@ public class RegistryReplicationManager { statusHandler .info("Registry shutting down. Removing subscriptions from: [" + remoteRegistryBaseURL + "]"); - RegistryRESTServices.getRegistryDataAccessService( - remoteRegistryBaseURL) + dataDeliveryRestClient + .getRegistryDataAccessService( + remoteRegistryBaseURL) .removeSubscriptionsForSite( registry.getOwner()); statusHandler.info("Subscriptions removed from: [" @@ -647,7 +736,10 @@ public class RegistryReplicationManager { } } } + } + public static List getObjectTypes() { + return Collections.unmodifiableList(objectTypes); } public void setSubscriptionProcessingEnabled( @@ -659,4 +751,13 @@ public class RegistryReplicationManager { return servers; } + public void setDataDeliveryRestClient( + DataDeliveryRESTServices dataDeliveryRestClient) { + this.dataDeliveryRestClient = dataDeliveryRestClient; + } + + public void setRegistrySoapClient(RegistrySOAPServices registrySoapClient) { + this.registrySoapClient = registrySoapClient; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistrySubmitTask.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistrySubmitTask.java index 383de1a25f..4e61335fbb 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistrySubmitTask.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/replication/RegistrySubmitTask.java @@ -23,10 +23,10 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; import org.springframework.transaction.support.TransactionTemplate; -import com.raytheon.uf.common.registry.services.RegistryRESTServices; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.edex.database.RunnableWithTransaction; +import com.raytheon.uf.edex.datadelivery.registry.web.DataDeliveryRESTServices; import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao; import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; @@ -41,6 +41,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 7/29/2013 2191 bphillip Initial implementation + * 10/30/2013 1538 bphillip Updated to use non-static rest client * * * @author bphillip @@ -60,21 +61,25 @@ public class RegistrySubmitTask extends RunnableWithTransaction { /** The URL of the remote server to get the object from */ private String remoteURL; + private DataDeliveryRESTServices restClient; + public RegistrySubmitTask(TransactionTemplate txTemplate, - RegistryObjectDao dao, String objectId, String remoteURL) { + RegistryObjectDao dao, String objectId, String remoteURL, + DataDeliveryRESTServices restClient) { super(txTemplate); this.dao = dao; this.objectId = objectId; this.remoteURL = remoteURL; + this.restClient = restClient; } @Override public void runWithTransaction() { try { - RegistryObjectType objectToSubmit = RegistryRESTServices - .getRegistryObject(RegistryObjectType.class, remoteURL, - escapeObjectId(objectId)); + RegistryObjectType objectToSubmit = restClient.getRegistryObject( + RegistryObjectType.class, remoteURL, + escapeObjectId(objectId)); if (objectToSubmit.getSlotByName(EbxmlObjectUtil.HOME_SLOT_NAME) == null) { objectToSubmit.addSlot(EbxmlObjectUtil.HOME_SLOT_NAME, diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/DataDeliveryRESTServices.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/DataDeliveryRESTServices.java new file mode 100644 index 0000000000..6afa47f548 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/DataDeliveryRESTServices.java @@ -0,0 +1,152 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.edex.datadelivery.registry.web; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; + +import javax.xml.bind.JAXBException; + +import org.apache.commons.lang.exception.ExceptionUtils; + +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.raytheon.uf.common.datadelivery.registry.web.IRegistryAvailableRestService; +import com.raytheon.uf.common.datadelivery.registry.web.IRegistryDataAccessService; +import com.raytheon.uf.common.registry.constants.RegistryAvailability; +import com.raytheon.uf.common.registry.services.RegistryRESTServices; +import com.raytheon.uf.common.registry.services.RegistryServiceException; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; + +/** + *
+ * 
+ * Set of Data Delivery specific REST services
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#     Engineer    Description
+ * ------------ ----------  ----------- --------------------------
+ * 10/30/2013    1538       bphillip    Initial Creation
+ * 
+ * + * @author bphillip + * @version 1 + **/ +public class DataDeliveryRESTServices extends RegistryRESTServices { + + /** Path to these services */ + private static final String DATA_DELIVERY_REST_SERVICE_PATH = "/dataDelivery"; + + /** + * The logger + */ + private static final IUFStatusHandler statusHandler = UFStatus + .getHandler(RegistryRESTServices.class); + + /** Map of known registry availability services */ + private LoadingCache registryAvailabilityServiceMap = CacheBuilder + .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) + .build(new CacheLoader() { + public IRegistryAvailableRestService load(String url) { + return getPort(url + DATA_DELIVERY_REST_SERVICE_PATH, + IRegistryAvailableRestService.class); + } + }); + + /** Map of known registry data access services */ + private LoadingCache registryDataAccessServiceMap = CacheBuilder + .newBuilder().expireAfterAccess(5, TimeUnit.MINUTES) + .build(new CacheLoader() { + public IRegistryDataAccessService load(String url) { + return getPort(url + DATA_DELIVERY_REST_SERVICE_PATH, + IRegistryDataAccessService.class); + } + }); + + public DataDeliveryRESTServices() throws JAXBException { + super(); + } + + /** + * Gets the registry available service implementation + * + * @param baseURL + * The base URL of the registry + * @return THe registry available service implementation + */ + public IRegistryAvailableRestService getRegistryAvailableService( + String baseURL) { + try { + return registryAvailabilityServiceMap.get(baseURL); + } catch (ExecutionException e) { + throw new RegistryServiceException( + "Error getting Registry Availability Rest Service", e); + } + } + + /** + * Check if the registry at the given URL is available + * + * @param baseURL + * The base URL of the registry + * @return True if the registry services are available + */ + public boolean isRegistryAvailable(String baseURL) { + String response = null; + try { + response = getRegistryAvailableService(baseURL) + .isRegistryAvailable(); + if (RegistryAvailability.AVAILABLE.equals(response)) { + return true; + } else { + statusHandler.info("Registry at [" + baseURL + + "] not available: " + response); + } + return RegistryAvailability.AVAILABLE.equals(response); + } catch (Throwable t) { + if (response == null) { + response = ExceptionUtils.getRootCauseMessage(t); + } + statusHandler.error("Registry at [" + baseURL + "] not available: " + + response); + return false; + } + } + + /** + * Gets the data access service for the specified registry URL + * + * @param baseURL + * The baseURL of the registry + * @return The data access service for the specified registry URL + */ + public IRegistryDataAccessService getRegistryDataAccessService( + String baseURL) { + try { + return registryDataAccessServiceMap.get(baseURL); + } catch (ExecutionException e) { + throw new RegistryServiceException( + "Error getting Registry Availability Rest Service", e); + } + } +} diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryAvailableRestService.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryAvailableRestService.java similarity index 86% rename from edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryAvailableRestService.java rename to edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryAvailableRestService.java index 5037e79fd8..a6f0674c2d 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryAvailableRestService.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryAvailableRestService.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.edex.registry.ebxml.services.rest; +package com.raytheon.uf.edex.datadelivery.registry.web; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -26,8 +26,8 @@ import javax.ws.rs.Produces; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.raytheon.uf.common.datadelivery.registry.web.IRegistryAvailableRestService; import com.raytheon.uf.common.registry.constants.RegistryAvailability; -import com.raytheon.uf.common.registry.services.rest.IRegistryAvailableRestService; import com.raytheon.uf.edex.registry.ebxml.dao.DbInit; /** @@ -42,12 +42,13 @@ import com.raytheon.uf.edex.registry.ebxml.dao.DbInit; * ------------ ---------- ----------- -------------------------- * 5/21/2013 2022 bphillip Initial implementation * 9/5/2013 1538 bphillip Removed log message + * 10/30/2013 1538 bphillip Moved data delivery specific services out of registry plugin * * * @author bphillip * @version 1 */ -@Path("/rest/registryAvailable") +@Path(IRegistryAvailableRestService.REGISTRY_AVAILABILITY_PATH_PREFIX) @Service @Transactional public class RegistryAvailableRestService implements diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryDataAccessService.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryDataAccessService.java similarity index 94% rename from edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryDataAccessService.java rename to edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryDataAccessService.java index 09ffd01fb7..facfc8c8ca 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryDataAccessService.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryDataAccessService.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.edex.registry.ebxml.services.rest; +package com.raytheon.uf.edex.datadelivery.registry.web; import java.io.File; import java.util.List; @@ -48,8 +48,8 @@ import org.reflections.util.ClasspathHelper; import org.reflections.util.ConfigurationBuilder; import org.springframework.transaction.annotation.Transactional; +import com.raytheon.uf.common.datadelivery.registry.web.IRegistryDataAccessService; import com.raytheon.uf.common.registry.RegistryException; -import com.raytheon.uf.common.registry.services.rest.IRegistryDataAccessService; import com.raytheon.uf.common.registry.services.rest.response.RestCollectionResponse; import com.raytheon.uf.common.serialization.JAXBManager; import com.raytheon.uf.common.status.IUFStatusHandler; @@ -63,8 +63,7 @@ import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao; /** * - * Implementation of the registry data access service interface
- * TODO: This class really needs to be moved to a data delivery specific plugin + * Implementation of the registry data access service interface * *
  * 
@@ -76,13 +75,13 @@ import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
  * 9/20/2013    2385        bphillip    Added subscription backup functions
  * 10/2/2013    2385        bphillip    Fixed subscription backup queries
  * 10/8/2013    1682        bphillip    Added query queries
- * 10/23/2013   2385        bphillip    Restored subscriptions are now scheduled in the bandwidth manager
  * 
* * @author bphillip * @version 1 */ @Transactional +@Path(IRegistryDataAccessService.DATA_ACCESS_PATH_PREFIX) public class RegistryDataAccessService implements IRegistryDataAccessService { /** The logger */ @@ -113,6 +112,10 @@ public class RegistryDataAccessService implements IRegistryDataAccessService { /** Lifecyclemanager */ private LifecycleManager lcm; + public RegistryDataAccessService() { + + } + /** * @see * com.raytheon.uf.common.registry.services.rest.IRegistryDataAccessService @@ -120,7 +123,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService { */ @Override @GET - @Path(DATA_ACCESS_PATH_PREFIX + "getRegistryObjectIds/{objectType}") + @Path("getRegistryObjectIds/{objectType}") public RestCollectionResponse getRegistryObjectIdsOfType( @PathParam("objectType") String objectType) { statusHandler.info("Getting registry object ids of type [" + objectType @@ -133,7 +136,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService { @Override @GET - @Path(DATA_ACCESS_PATH_PREFIX + "getQueries") + @Path("getQueries") public String getValidQueries() { statusHandler.debug("Getting valid queries..."); List ids = queryDefinitionDao.getQueryIds(); @@ -146,7 +149,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService { @Override @GET - @Path(DATA_ACCESS_PATH_PREFIX + "getParametersForQuery/{queryId}") + @Path("getParametersForQuery/{queryId}") public String getParametersForQuery(@PathParam("queryId") String queryId) { statusHandler.debug("Getting query parameters for query: " + queryId + "..."); @@ -168,7 +171,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService { */ @Override @GET - @Path(DATA_ACCESS_PATH_PREFIX + "removeSubscriptionsFor/{siteId}") + @Path("removeSubscriptionsFor/{siteId}") public void removeSubscriptionsForSite(@PathParam("siteId") String siteId) { statusHandler.info("Removing subscriptions for: " + siteId); List subscriptions = registryObjectDao @@ -205,7 +208,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService { */ @Override @GET - @Path(DATA_ACCESS_PATH_PREFIX + "getSubscriptions") + @Path("getSubscriptions") public String getSubscriptions() { String[] slotNames = new String[] { "name", "owner", "dataSetName", "provider", "dataSetType", "route", "active", "groupName", @@ -245,7 +248,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService { */ @Override @GET - @Path(DATA_ACCESS_PATH_PREFIX + "backupSubscription/{subscriptionName}") + @Path("backupSubscription/{subscriptionName}") public String backupSubscription( @PathParam("subscriptionName") String subscriptionName) { StringBuilder response = new StringBuilder(); @@ -288,7 +291,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService { */ @Override @GET - @Path(DATA_ACCESS_PATH_PREFIX + "backupAllSubscriptions/") + @Path("backupAllSubscriptions/") public String backupAllSubscriptions() { StringBuilder response = new StringBuilder(); List subs = registryObjectDao @@ -310,7 +313,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService { */ @Override @GET - @Path(DATA_ACCESS_PATH_PREFIX + "restoreSubscription/{subscriptionName}") + @Path("restoreSubscription/{subscriptionName}") public String restoreSubscription( @PathParam("subscriptionName") String subscriptionName) { StringBuilder response = new StringBuilder(); @@ -367,7 +370,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService { */ @Override @GET - @Path(DATA_ACCESS_PATH_PREFIX + "restoreSubscriptions/") + @Path("restoreSubscriptions/") public String restoreSubscriptions() { StringBuilder response = new StringBuilder(); if (SUBSCRIPTION_BACKUP_DIR.exists()) { @@ -391,7 +394,7 @@ public class RegistryDataAccessService implements IRegistryDataAccessService { * .clearSubscriptionBackupFiles() */ @GET - @Path(DATA_ACCESS_PATH_PREFIX + "clearSubscriptionBackupFiles/") + @Path("clearSubscriptionBackupFiles/") public String clearSubscriptionBackupFiles() { StringBuilder response = new StringBuilder(); if (SUBSCRIPTION_BACKUP_DIR.exists()) { diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryFederationStatus.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryFederationStatus.java new file mode 100644 index 0000000000..4643169c6a --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.registry/src/com/raytheon/uf/edex/datadelivery/registry/web/RegistryFederationStatus.java @@ -0,0 +1,446 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.edex.datadelivery.registry.web; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.xml.transform.dom.DOMResult; +import javax.xml.ws.wsaddressing.W3CEndpointReference; + +import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException; +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.DeliveryInfoType; +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.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.rim.v4.SubscriptionType; + +import org.springframework.transaction.annotation.Transactional; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import com.raytheon.uf.common.registry.EbxmlNamespaces; +import com.raytheon.uf.common.registry.constants.AssociationTypes; +import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes; +import com.raytheon.uf.common.registry.constants.DeliveryMethodTypes; +import com.raytheon.uf.common.registry.constants.QueryLanguages; +import com.raytheon.uf.common.registry.constants.QueryReturnTypes; +import com.raytheon.uf.common.registry.ebxml.RegistryUtil; +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.common.util.StringUtil; +import com.raytheon.uf.edex.datadelivery.registry.federation.RegistryFederationManager; +import com.raytheon.uf.edex.datadelivery.registry.replication.NotificationHostConfiguration; +import com.raytheon.uf.edex.datadelivery.registry.replication.RegistryReplicationManager; +import com.raytheon.uf.edex.registry.ebxml.dao.RegistryDao; +import com.raytheon.uf.edex.registry.ebxml.dao.SubscriptionDao; +import com.raytheon.uf.edex.registry.ebxml.services.notification.RegistrySubscriptionManager; +import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants; + +/** + *
+ * Set of services used by the federation status web interface to modify federation associations
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#     Engineer    Description
+ * ------------ ----------  ----------- --------------------------
+ * 10/30/2013    1538       bphillip    Initial Creation
+ * 
+ * + * @author bphillip + * @version 1 + **/ +@Path(RegistryFederationStatus.REGISTRY_FEDERATION_STATUS_PATH) +@Transactional +public class RegistryFederationStatus { + + /** The path to these set of services */ + protected static final String REGISTRY_FEDERATION_STATUS_PATH = "/status/"; + + /** The logger instance */ + private static final IUFStatusHandler statusHandler = UFStatus + .getHandler(RegistryFederationStatus.class); + + /** Comparator to sort registry instances */ + private static final Comparator REGISTRY_COMPARATOR = new Comparator() { + @Override + public int compare(RegistryObjectType o1, RegistryObjectType o2) { + return o1.getId().compareTo(o2.getId()); + } + }; + + /** Data Access object for registry objects */ + private RegistryDao registryDao; + + /** Data Access object for registry subscription objects */ + private SubscriptionDao subscriptionDao; + + /** The registry replication manager */ + private RegistryReplicationManager replicationManager; + + /** Data Delivery rest services client */ + private DataDeliveryRESTServices dataDeliveryRestClient; + + /** Registry soap services client */ + private RegistrySOAPServices registrySoapServices; + + /** + * The address to the NCF registry loaded from the NCF_ADDRESS item in + * setup.env + */ + private String ncfAddress = System.getenv("NCF_ADDRESS"); + + /** + * Gets if this registry is participating in the federation + * + * @return The value of the EBXML_REGISTRY_FEDERATION_ENABLED environment + * variable + */ + @GET + @Path("isFederated") + public String isFederated() { + return System.getenv("EBXML_REGISTRY_FEDERATION_ENABLED"); + } + + /** + * Gets if this registry is processing registry replication subscriptions + * + * @return The value of the EBXML_REGISTRY_SUBSCRIPTIONS_ENABLED environment + * variable + */ + @GET + @Path("isProcessingSubscriptions") + public String isProcessingSubscriptions() { + return System.getenv("EBXML_REGISTRY_SUBSCRIPTIONS_ENABLED"); + } + + /** + * Gets information about this registry + * + * @return Information pertaining to the local registry + */ + @GET + @Path("getMyRegistryInfo") + public String getMyRegistryInfo() { + StringBuilder builder = new StringBuilder(); + RegistryType myRegistry = registryDao + .getRegistryByBaseURL(RegistryUtil.LOCAL_REGISTRY_ADDRESS); + appendRegistryInfo(myRegistry, builder); + return builder.toString(); + + } + + /** + * Queries the NCF registry to get a list of registries in the federation + * + * @return The list of registries in the federation + * @throws MsgRegistryException + * If an error occurs while querying the NCF registry + */ + @GET + @Path("getFederationMembers") + public String getFederationMembers() throws MsgRegistryException { + StringBuilder builder = new StringBuilder(); + QueryType query = new QueryType( + CanonicalQueryTypes.FIND_ASSOCIATED_OBJECTS); + query.getSlot().add( + new SlotType(QueryConstants.ASSOCIATION_TYPE, + new StringValueType( + AssociationTypes.HAS_FEDERATION_MEMBER))); + query.getSlot().add( + new SlotType(QueryConstants.SOURCE_OBJECT_ID, + new StringValueType( + RegistryFederationManager.FEDERATION_ID))); + + QueryRequest queryRequest = new QueryRequest("Get Federation Members", + query, new ResponseOptionType(QueryReturnTypes.REGISTRY_OBJECT, + true)); + List federationMembers = registrySoapServices + .getQueryServiceForHost(ncfAddress).executeQuery(queryRequest) + .getRegistryObjects(); + Collections.sort(federationMembers, REGISTRY_COMPARATOR); + for (RegistryObjectType obj : federationMembers) { + if (obj instanceof RegistryType) { + RegistryType registry = (RegistryType) obj; + appendRegistryInfo(registry, builder); + } + } + + return builder.toString(); + } + + /** + * Gets the list of registry that the local registry is subscribed to + * + * @return The list of registries that the local registry is subscribed to + */ + @GET + @Path("getRegistriesSubscribedTo") + public String getRegistriesSubscribedTo() { + StringBuilder builder = new StringBuilder(); + if (this.replicationManager.getServers() != null + && !CollectionUtil.isNullOrEmpty(this.replicationManager + .getServers().getRegistryReplicationServers())) { + List registries = new ArrayList(); + for (NotificationHostConfiguration hostConfig : this.replicationManager + .getServers().getRegistryReplicationServers()) { + + SlotType queryLanguageSlot = new SlotType( + QueryConstants.QUERY_LANGUAGE, new StringValueType( + QueryLanguages.HQL)); + SlotType queryExpressionSlot = new SlotType( + QueryConstants.QUERY_EXPRESSION, new StringValueType( + "FROM SubscriptionType sub where sub.id like 'Replication Subscription for%" + + RegistryUtil.LOCAL_REGISTRY_ADDRESS + + "%'")); + QueryType query = new QueryType(); + query.setQueryDefinition(CanonicalQueryTypes.ADHOC_QUERY); + query.getSlot().add(queryLanguageSlot); + query.getSlot().add(queryExpressionSlot); + + QueryRequest request = new QueryRequest(); + request.setResponseOption(new ResponseOptionType( + QueryReturnTypes.REGISTRY_OBJECT, true)); + request.setId("Replication Subscription Verification Query"); + request.setQuery(query); + try { + if (!registrySoapServices + .getQueryServiceForHost( + hostConfig.getRegistryBaseURL()) + .executeQuery(request).getRegistryObjects() + .isEmpty()) { + RegistryType registry = registryDao + .getRegistryByBaseURL(hostConfig + .getRegistryBaseURL()); + if (registry != null) { + registries.add(registry); + } + } + } catch (Exception e) { + statusHandler.error("Error querying remote registry", e); + } + + } + Collections.sort(registries, REGISTRY_COMPARATOR); + for (RegistryObjectType reg : registries) { + appendRegistryInfo((RegistryType) reg, builder); + } + } + return builder.toString(); + } + + /** + * Gets a list of registries that are subscribing to the local registry + * + * @return The list of registries that are subscribing to the local registry + */ + @GET + @Path("getRegistrySubscribing") + public String getRegistrySubscribing() { + StringBuilder builder = new StringBuilder(); + List registries = new ArrayList(); + for (SubscriptionType sub : subscriptionDao.getAll()) { + DeliveryInfoType deliveryInfo = sub.getDeliveryInfo().get(0); + W3CEndpointReference endpointReference = deliveryInfo.getNotifyTo(); + DOMResult dom = new DOMResult(); + endpointReference.writeTo(dom); + Document doc = (Document) dom.getNode(); + NodeList nodes = doc.getElementsByTagNameNS( + EbxmlNamespaces.ADDRESSING_URI, + RegistrySubscriptionManager.ADDRESS_TAG); + Node addressNode = nodes.item(0); + String serviceAddress = addressNode.getTextContent().trim(); + String endpointType = addressNode + .getAttributes() + .getNamedItemNS(EbxmlNamespaces.RIM_URI, + RegistrySubscriptionManager.ENDPOINT_TAG) + .getNodeValue(); + if (endpointType.equals(DeliveryMethodTypes.SOAP)) { + RegistryType registry = registryDao + .getRegistryByBaseURL(serviceAddress.replace( + "/notificationListener", "")); + if (registry != null && !registries.contains(registry)) { + registries.add(registry); + } + + } + } + Collections.sort(registries, REGISTRY_COMPARATOR); + for (RegistryObjectType reg : registries) { + appendRegistryInfo((RegistryType) reg, builder); + } + return builder.toString(); + } + + /** + * Gets the list of object types that are currently being replicated + * + * @return The object list + */ + @GET + @Path("getObjectTypesReplicated") + public String getObjectTypesReplicated() { + StringBuilder builder = new StringBuilder(); + for (String objectType : RegistryReplicationManager.getObjectTypes()) { + builder.append(objectType).append(StringUtil.NEWLINE); + } + return builder.toString(); + } + + /** + * Kicks of a full registry sync with the specified registry + * + * @param registryId + * The registry ID to sync with + * @return status message + */ + @GET + @Path("syncWithRegistry/{registryId}") + public String syncWithRegistry(@PathParam("registryId") String registryId) { + StringBuilder builder = new StringBuilder(); + RegistryType registry = registryDao.getById(registryId); + if (registry == null) { + builder.append("Registry [" + registryId + + "] not in federation. Unable to synchronize."); + } else { + try { + replicationManager.synchronizeRegistryWithFederation(registry + .getBaseURL()); + } catch (Exception e) { + statusHandler.error("Error synchronizing registry!", e); + builder.append("Error synchronizing registry [" + registryId + + "]: " + e.getLocalizedMessage()); + } + } + return builder.toString(); + } + + /** + * Subscribes to replication notifications from the specified registry + * + * @param registryId + * The ID of the registry to subscribe to + * @return Status message + */ + @GET + @Path("subscribeToRegistry/{registryId}") + public String subscribeToRegistry(@PathParam("registryId") String registryId) { + StringBuilder builder = new StringBuilder(); + RegistryType registry = registryDao.getById(registryId); + if (registry == null) { + builder.append("Registry [" + registryId + + "] not in federation. Unable to submit subscriptions."); + } else { + RegistryType localRegistry = registryDao + .getRegistryByBaseURL(RegistryUtil.LOCAL_REGISTRY_ADDRESS); + + NotificationHostConfiguration config = new NotificationHostConfiguration( + registry.getId(), registry.getId(), registry.getBaseURL()); + replicationManager.submitSubscriptionsToHost(config, localRegistry); + builder.append("Successfully subscribed to registry [" + registryId + + "]"); + this.replicationManager.addNotificationServer(config); + replicationManager.saveNotificationServers(); + } + return builder.toString(); + } + + /** + * Unsubscribes from the specified registry + * + * @param registryId + * The ID of the registry to unsubscribe from + * @return The status message + */ + @GET + @Path("unsubscribeFromRegistry/{registryId}") + public String unsubscribeFromRegistry( + @PathParam("registryId") String registryId) { + StringBuilder builder = new StringBuilder(); + RegistryType registry = registryDao.getById(registryId); + if (registry == null) { + builder.append("Registry [" + registryId + + "] not in federation. Unable to unsubscribe."); + } else { + RegistryType localRegistry = registryDao + .getRegistryByBaseURL(RegistryUtil.LOCAL_REGISTRY_ADDRESS); + dataDeliveryRestClient.getRegistryDataAccessService( + registry.getBaseURL()).removeSubscriptionsForSite( + localRegistry.getOwner()); + builder.append("Successfully unsubscribed from registry [" + + registryId + "]"); + replicationManager.removeNotificationServer(registry.getBaseURL()); + replicationManager.saveNotificationServers(); + } + return builder.toString(); + } + + /** + * Appends registry information to the stringbuilder + * + * @param registry + * The registry to get information for + * @param builder + * The string builder to append to + */ + private void appendRegistryInfo(RegistryType registry, StringBuilder builder) { + builder.append(registry).append(","); + builder.append(registry.getBaseURL()).append(","); + builder.append(registry.getConformanceProfile()).append(","); + builder.append(registry.getSpecificationVersion()); + builder.append(StringUtil.NEWLINE); + } + + public void setReplicationManager( + RegistryReplicationManager replicationManager) { + this.replicationManager = replicationManager; + } + + public void setRegistryDao(RegistryDao registryDao) { + this.registryDao = registryDao; + } + + public void setSubscriptionDao(SubscriptionDao subscriptionDao) { + this.subscriptionDao = subscriptionDao; + } + + public void setDataDeliveryRestClient( + DataDeliveryRESTServices dataDeliveryRestClient) { + this.dataDeliveryRestClient = dataDeliveryRestClient; + } + + public void setRegistrySoapServices( + RegistrySOAPServices registrySoapServices) { + this.registrySoapServices = registrySoapServices; + } +} diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/META-INF/MANIFEST.MF index 1a9b10b1ff..41475792dd 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/META-INF/MANIFEST.MF @@ -34,8 +34,7 @@ Require-Bundle: com.raytheon.uf.common.registry.schemas.ebxml;bundle-version="1. com.raytheon.uf.common.datadelivery.request;bundle-version="1.0.0", javax.mail;bundle-version="1.0.0", org.apache.commons.validator;bundle-version="1.2.0", - com.sun.xml.bind;bundle-version="1.0.0", - org.reflections;bundle-version="0.9.9" + com.sun.xml.bind;bundle-version="1.0.0" Export-Package: com.raytheon.uf.edex.registry.ebxml.acp, com.raytheon.uf.edex.registry.ebxml.dao, com.raytheon.uf.edex.registry.ebxml.exception, @@ -45,6 +44,7 @@ Export-Package: com.raytheon.uf.edex.registry.ebxml.acp, com.raytheon.uf.edex.registry.ebxml.services.lifecycle, com.raytheon.uf.edex.registry.ebxml.services.notification, com.raytheon.uf.edex.registry.ebxml.services.query, + com.raytheon.uf.edex.registry.ebxml.services.query.plugins, com.raytheon.uf.edex.registry.ebxml.services.validator, com.raytheon.uf.edex.registry.ebxml.services.validator.types, com.raytheon.uf.edex.registry.ebxml.util, diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml index 204a44b0b3..d8d09cac58 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-impl.xml @@ -44,6 +44,7 @@ +
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-querytypes.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-querytypes.xml index fbdbdfd0d8..1637b27e5e 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-querytypes.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-querytypes.xml @@ -139,6 +139,7 @@ value="urn:oasis:names:tc:ebxml-regrep:query:GetReferencedObject" /> + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-subscription.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-subscription.xml index e8d76be31f..d0d5c6c7ef 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-subscription.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-subscription.xml @@ -5,6 +5,7 @@ + - - + +
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 9b2254dc37..de004cce8e 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 @@ -2,6 +2,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> + + + + + + @@ -21,6 +28,7 @@ + @@ -74,15 +82,6 @@ - - - - - - - - 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 54063de7cc..bac6c8310d 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 @@ -11,4 +11,7 @@ ebxml-federation-sync-threads=3 ebxml-email.enabled=false # 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 +ebxml-notification-batch-size=50 +# Configuration of thread pool used to handle web service requests +ebxml-webserver-min-threads=2 +ebxml-webserver-max-threads=10 \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/RegistryRemoteRequestWrapper.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/RegistryRemoteRequestWrapper.java index 9b82aaf745..2dc99b9112 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/RegistryRemoteRequestWrapper.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/RegistryRemoteRequestWrapper.java @@ -21,9 +21,6 @@ package com.raytheon.uf.edex.registry.ebxml; import java.io.ByteArrayInputStream; -import javax.jws.WebService; - -import com.raytheon.uf.common.registry.IRegistryRequestService; import com.raytheon.uf.edex.auth.RemoteRequestRouteWrapper; /** @@ -37,18 +34,16 @@ import com.raytheon.uf.edex.auth.RemoteRequestRouteWrapper; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 5/3/2013 1948 bphillip Initial implementation - * 7/26/2031 2232 mpduff Don't override executeThrift. + * 7/26/2013 2232 mpduff Don't override executeThrift. + * 10/30/2013 1538 bphillip Removed unused IRegistryRequestService interface * * * * @author bphillip * @version 1 */ -@WebService(endpointInterface = "com.raytheon.uf.common.registry.IRegistryRequestService") -public class RegistryRemoteRequestWrapper extends RemoteRequestRouteWrapper - implements IRegistryRequestService { +public class RegistryRemoteRequestWrapper extends RemoteRequestRouteWrapper { - @Override public byte[] request(byte[] data) { return executeThrift(new ByteArrayInputStream(data)); } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/ObjectReferenceResolver.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/ObjectReferenceResolver.java index 7c8d94568d..10b7ab92d4 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/ObjectReferenceResolver.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/lifecycle/ObjectReferenceResolver.java @@ -63,6 +63,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil; * ------------ ---------- ----------- -------------------------- * 8/5/2013 2191 bphillip Initial implementation * 10/8/2013 1682 bphillip Added getReferenced objects methods + * 10/30/2013 1538 bphillip Changed to use non-static rest/soap clients * * * @author bphillip @@ -86,6 +87,8 @@ public class ObjectReferenceResolver { /** Validator for validating REST endpoint addresses */ private UrlValidator urlValidator = new UrlValidator(); + private RegistryRESTServices registryRestClient; + /** Cache holding the fields in each class that are object references */ private static LoadingCache, List> OBJECT_REFERENCE_FIELD_CACHE = CacheBuilder .newBuilder().expireAfterAccess(1, TimeUnit.MINUTES) @@ -386,8 +389,7 @@ public class ObjectReferenceResolver { RegistryObjectType retVal = null; if (urlValidator.isValid(ref)) { - Object restResponse = RegistryRESTServices - .accessXMLRestService(ref); + Object restResponse = registryRestClient.accessXMLRestService(ref); if (restResponse instanceof QueryResponse) { QueryResponse queryResponse = (QueryResponse) restResponse; if (responseOk(queryResponse)) { @@ -459,4 +461,8 @@ public class ObjectReferenceResolver { this.queryManager = queryManager; } + public void setRegistryRestClient(RegistryRESTServices registryRestClient) { + this.registryRestClient = registryRestClient; + } + } 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 fb37c5f3e0..a6bfad0cc8 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 @@ -31,6 +31,7 @@ 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.registry.services.RegistrySOAPServices; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.edex.registry.ebxml.services.notification.listeners.EmailNotificationListener; @@ -48,6 +49,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.notification.listeners.WebSe * ------------ ---------- ----------- -------------------------- * Apr 17, 2013 1672 djohnson Initial creation * 10/20/2013 1682 bphillip Added synchronous notification delivery + * 10/30/2013 1538 bphillip Changed to use non-static web service clients * * * @@ -94,16 +96,22 @@ public class NotificationListenerFactory implements } } + /** Email sender */ private final EmailSender emailSender; + /** Registry soap service client */ + private final RegistrySOAPServices registrySoapClient; + /** * Constructor. * * @param emailSender * the email sender */ - public NotificationListenerFactory(EmailSender emailSender) { + public NotificationListenerFactory(EmailSender emailSender, + RegistrySOAPServices registrySoapClient) { this.emailSender = emailSender; + this.registrySoapClient = registrySoapClient; } /** @@ -134,7 +142,8 @@ public class NotificationListenerFactory implements @VisibleForTesting NotificationListener getWebServiceNotificationListener( final NotificationDestination destination) { - return new WebServiceNotificationListener(destination); + return new WebServiceNotificationListener(destination, + registrySoapClient); } /** 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 c42891d8eb..3b8e8e736c 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 @@ -88,6 +88,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; * 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 + * 10/30/2013 1538 bphillip Changed to use non-static registry soap service client * * * @@ -117,6 +118,9 @@ public class NotificationListenerImpl implements NotificationListener { /** Data access object for getting RegistryType objects */ private RegistryDao registryDao; + /** Registry soap service client */ + private RegistrySOAPServices registrySoapClient; + @Override public void onNotification(NotificationType notification) { long startTime = TimeUtil.currentTimeMillis(); @@ -250,7 +254,7 @@ public class NotificationListenerImpl implements NotificationListener { Collection objIds, Mode mode) throws EbxmlRegistryException { try { // Get a the remote query service - QueryManager queryManager = RegistrySOAPServices + QueryManager queryManager = registrySoapClient .getQueryServiceForHost(clientBaseURL); // Create a query to get the current state of the affected objects QueryRequest queryRequest = createGetCurrentStateQuery( @@ -343,4 +347,9 @@ public class NotificationListenerImpl implements NotificationListener { public void setRegistryDao(RegistryDao registryDao) { this.registryDao = registryDao; } + + public void setRegistrySoapClient(RegistrySOAPServices registrySoapClient) { + this.registrySoapClient = registrySoapClient; + } + } 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 60d0742319..f97e9e3d00 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 @@ -50,6 +50,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil; * 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 + * 10/30/2013 1538 bphillip Changed to use non-static soap service client * * * @@ -63,13 +64,19 @@ public class WebServiceNotificationListener implements NotificationListener { private static final IUFStatusHandler statusHandler = UFStatus .getHandler(WebServiceNotificationListener.class); + /** The destination of notifications sent via this listener */ private final String destination; + /** Registry soap service client */ + private RegistrySOAPServices registrySoapClient; + /** * @param destination */ - public WebServiceNotificationListener(NotificationDestination destination) { + public WebServiceNotificationListener(NotificationDestination destination, + RegistrySOAPServices registrySoapClient) { this.destination = destination.getDestination(); + this.registrySoapClient = registrySoapClient; } /** @@ -120,8 +127,8 @@ public class WebServiceNotificationListener implements NotificationListener { RegistryServiceException, MsgRegistryException { statusHandler.info("Sending notification [" + notification.getId() + "]"); - RegistrySOAPServices.getNotificationListenerServiceForUrl( - serviceAddress).synchronousNotification(notification); + registrySoapClient.getNotificationListenerServiceForUrl(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 a171a8e307..4af077512e 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 @@ -122,6 +122,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; * 10/8/2013 1682 bphillip Refactored querying * 10/2013 1682 bphillip Fixed federated query invocation * 10/23/2013 1538 bphillip Remove extra executeQuery method + * 10/30/2013 1538 bphillip Changed to use non-static soap service client * * * @@ -192,6 +193,8 @@ public class QueryManagerImpl implements QueryManager, ApplicationContextAware { */ private ObjectReferenceResolver referenceResolver; + private RegistrySOAPServices registrySoapClient; + /** * Creates a new QueryManagerImpl */ @@ -795,7 +798,7 @@ public class QueryManagerImpl implements QueryManager, ApplicationContextAware { statusHandler.info("Submitting federated query to [" + registryToQuery.getId() + "] at [" + registryToQuery.getBaseURL() + "]..."); - return RegistrySOAPServices.getQueryServiceForHost( + return registrySoapClient.getQueryServiceForHost( registryToQuery.getBaseURL()).executeQuery(queryRequest); } @@ -859,4 +862,8 @@ public class QueryManagerImpl implements QueryManager, ApplicationContextAware { this.sessionFactory = sessionFactory; } + public void setRegistrySoapClient(RegistrySOAPServices registrySoapClient) { + this.registrySoapClient = registrySoapClient; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetReferencedObject.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetReferencedObject.java index c9c0175b84..60ba241641 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetReferencedObject.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/query/plugins/GetReferencedObject.java @@ -57,6 +57,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil; * ------------ ---------- ----------- -------------------------- * 9/18/2013 1705 bphillip Initial implementation * 10/8/2013 1682 bphillip Refactored querying + * 10/30/2013 1538 bphillip Changed to use non-static soap service client * * * @author bphillip @@ -67,6 +68,9 @@ public class GetReferencedObject extends RegistryQueryPlugin { /** Object used to resolve object references */ private ObjectReferenceResolver referenceResolver; + /** Registry soap service client */ + private RegistrySOAPServices registrySoapClient; + @Override @WebMethod(action = EXECUTE_QUERY_ACTION) @WebResult(name = "QueryResponse", targetNamespace = EbxmlNamespaces.QUERY_URI, partName = "partQueryResponse") @@ -108,7 +112,7 @@ public class GetReferencedObject extends RegistryQueryPlugin { query.setQuery(queryObj); query.setResponseOption(new ResponseOptionType( QueryReturnTypes.REGISTRY_OBJECT, true)); - QueryManager remoteQueryManager = RegistrySOAPServices + QueryManager remoteQueryManager = registrySoapClient .getQueryServiceForHost(remoteAddress); QueryResponse remoteResponse = remoteQueryManager @@ -130,4 +134,8 @@ public class GetReferencedObject extends RegistryQueryPlugin { this.referenceResolver = referenceResolver; } + public void setRegistrySoapClient(RegistrySOAPServices registrySoapClient) { + this.registrySoapClient = registrySoapClient; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/QueryProtocolRestService.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/QueryProtocolRestService.java index cb97c2c478..df1981b448 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/QueryProtocolRestService.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/QueryProtocolRestService.java @@ -66,12 +66,13 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil; * 4/19/2013 1931 bphillip Initial implementation * 5/21/2013 2022 bphillip Added interface and moved constants * 10/8/2013 1682 bphillip Refactored to use parameter definitions from the registry + * 10/30/2013 1538 bphillip Changed root REST service path * * * @author bphillip * @version 1 */ -@Path("/rest/search") +@Path("/search") @Service @Transactional public class QueryProtocolRestService implements IQueryProtocolRestService { diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryObjectsRestService.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryObjectsRestService.java index 96bd37b01c..a8fa407dc4 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryObjectsRestService.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RegistryObjectsRestService.java @@ -73,12 +73,13 @@ import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao; * ------------ ---------- ----------- -------------------------- * 4/19/2013 1931 bphillip Initial implementation * 5/21/2013 2022 bphillip Added interface + * 10/30/2013 1538 bphillip Changed root REST service path * * * @author bphillip * @version 1 */ -@Path("/rest/registryObjects/{objectId}") +@Path("/registryObjects/{objectId}") @Service @Transactional public class RegistryObjectsRestService implements IRegistryObjectsRestService { diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RepositoryItemsRestService.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RepositoryItemsRestService.java index 9bc3a88b3b..aa1ea5c5d3 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RepositoryItemsRestService.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/rest/RepositoryItemsRestService.java @@ -46,12 +46,13 @@ import com.raytheon.uf.edex.registry.ebxml.dao.ExtrinsicObjectDao; * ------------ ---------- ----------- -------------------------- * 4/19/2013 1931 bphillip Initial implementation * 5/21/2013 2022 bphillip Added interface and changed method name + * 10/30/2013 1538 bphillip Changed root REST service path * * * @author bphillip * @version 1 */ -@Path("/rest/repositoryItems/{repositoryItemId}") +@Path("/repositoryItems/{repositoryItemId}") @Service @Transactional public class RepositoryItemsRestService implements IRepositoryItemsRestService { diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/RegistrySubscriptionBackup.html b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/RegistrySubscriptionBackup.html index 9c6bb8c14d..c9b88c4a72 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/RegistrySubscriptionBackup.html +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/RegistrySubscriptionBackup.html @@ -119,7 +119,7 @@ } function callRESTService(func){ - var url = "http://"+window.location.host+"/rest/dataAccess/"+func; + var url = "http://"+window.location.host+"/dataDelivery/dataAccess/"+func; var client = new XMLHttpRequest(); client.open("GET", url, false); client.setRequestHeader("Content-Type", "text/plain"); diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/WEB-INF/web.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/WEB-INF/web.xml index 8d6af6a551..906d5501e8 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/WEB-INF/web.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/WEB-INF/web.xml @@ -11,21 +11,19 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> Data Delivery Web Services - - - webAppRootKey - registryEbxml - - + + + webAppRootKey + registryEbxml + + contextConfigLocation /webServiceBeans.xml - - org.springframework.web.context.ContextLoaderListener - + org.springframework.web.context.ContextLoaderListener @@ -50,12 +48,16 @@ org.apache.cxf.transport.servlet.CXFServlet static-welcome-file - /RegistryUserMenu.html + /registry/RegistryInterface.html static-resources-list .*\.html .*\.js .*\.css + + disable-address-updates + true + 1 diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/dataDeliveryUtil.js b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/dataDeliveryUtil.js index 5cb554ea33..99a72fc2bf 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/dataDeliveryUtil.js +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/dataDeliveryUtil.js @@ -261,7 +261,7 @@ function enableElement(elemName){ */ function splitArray(data){ if (data == null){ - return new Array(); + return new Array(); }else{ var tokens = String(data).split(",") return tokens @@ -271,7 +271,7 @@ function splitArray(data){ /* * Adds an entry into the select box with the provided name */ -function addOptionToList(selectBoxName,text,value){ +function addOptionToList(selectBoxName,text,value){ var selectBox = document.getElementById(selectBoxName) var optn = document.createElement("OPTION"); optn.text = text; @@ -279,6 +279,19 @@ function addOptionToList(selectBoxName,text,value){ selectBox.options.add(optn); } +/* + * Removes an entry from the select box with the provided name + */ +function removeOptionFromList(selectBoxName,value){ + var selectBox = document.getElementById(selectBoxName) + for(var i = 0; i < selectBox.options.length;i++){ + if(selectBox.options[i].value == value){ + selectBox.options.remove(selectBox.options[i]) + break; + } + } +} + /* * Sets the currently selected index of a select box element with * the given name @@ -916,5 +929,4 @@ Array.prototype.contains = function(item){ return this.indexOf(item)!=-1 } - - + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/RegistryInterface.html b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/RegistryInterface.html index e5774bfc69..1337ef3cc2 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/RegistryInterface.html +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/RegistryInterface.html @@ -51,13 +51,14 @@ Date Ticket# Engineer Description + EDEX EBXML Registry Interface - - + + diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/federation/status.html b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/federation/status.html new file mode 100644 index 0000000000..f061c21e30 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/federation/status.html @@ -0,0 +1,207 @@ + + + + + + + + + Federation Status + + + +

Federation Status

+ + + + + + + + + + + + + + + +
Federated:[Unknown]
Processing Subscriptions:[Unknown]
My Registry ID:[Unknown]
+ +

+ + + + + + + + + + + + + + + + + + + + + + +
Resubmit Subscriptions To:
Synchronize with Registry:
Subscribe To Registry:
Unsubscribe From Registry:
+
+ +My Registry is Subscribed To: + + +
+
+ + + +Registries Subscribing to My Registry: + +
+
+ +Federation Members: + + +
+
+ +Object Types Currently Replicated: + +
+
+ + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/navigation.html b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/navigation.html index 6037bbe008..b6c188b673 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/navigation.html +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/navigation.html @@ -10,11 +10,11 @@ an export license or other authorization. Contractor Name: Raytheon Company Contractor Address: 6825 Pine Street, Suite 340 - Mail Stop B8 + Mail Stop B8 Omaha, NE 68106 402.291.0100 -See the AWIPS II Master Rights File ("Master Rights File.pdf") for +See the AWIPS II Master Rights File ("Master Rights File.pdf") for further licensing information. --> @@ -35,7 +35,7 @@ Date Ticket# Engineer Description - + NAVIGATION LINKS - Query Interface + Query Interface
- Subscription Backup + Subscription Backup +
+ Federation Status - + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/registryUtil.js b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/registryUtil.js new file mode 100644 index 0000000000..d18e21c681 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/registryUtil.js @@ -0,0 +1,21 @@ + + + function callRestService(url,arg){ + var url = "http://"+window.location.host+"/"+url + if(arg != null){ + url+="/"+arg; + } + var client = new XMLHttpRequest(); + client.open("GET", url, false); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + return client.responseText + } + + function callDataAccessServiceWithArg(func,arg){ + return callRestService("dataDelivery/dataAccess/"+func+"/"+arg); + } + + function callDataAccessService(func){ + return callRestService("dataDelivery/dataAccess/"+func); + } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/QueryInterface.html b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/QueryInterface.html index a5a4c33b5f..45a09d5de2 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/QueryInterface.html +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/QueryInterface.html @@ -48,6 +48,7 @@ Date Ticket# Engineer Description + Registry Query Interface diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/queryUtil.js b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/queryUtil.js index 890456d2b3..3ab0d37301 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/queryUtil.js +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/queryUtil.js @@ -9,7 +9,7 @@ * an export license or other authorization. * * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 + * Contractor Address: 6825 Pine Street, Suite 340 * Mail Stop B8 * Omaha, NE 68106 * 402.291.0100 @@ -34,12 +34,12 @@ * @author bphillip * @version 1 */ - function getValidQueryTypes(){ - var tokens = callDataAccessService("getQueries","").split("\n") - var selectBox = document.getElementById("queryTypeInput") + function getValidQueryTypes(){ + var tokens = callDataAccessService("getQueries").split("\n") + var selectBox = document.getElementById("queryTypeInput") for(var i=0;i" document.getElementById("querySpecificSpan").innerHTML = gen - } - - function callRestService(url,arg){ - var url = "http://"+url+"/"+arg; - var client = new XMLHttpRequest(); - client.open("GET", url, false); - client.setRequestHeader("Content-Type", "text/plain"); - client.send(); - return client.responseText - } - - function callDataAccessService(func,arg){ - var url = "http://"+window.location.host+"/rest/dataAccess/"+func+"/"+arg; - var client = new XMLHttpRequest(); - client.open("GET", url, false); - client.setRequestHeader("Content-Type", "text/plain"); - client.send(); - return client.responseText - } \ No newline at end of file + } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/webServiceBeans.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/webServiceBeans.xml index 0c64d45399..d5d7010ca0 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/webServiceBeans.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/webServiceBeans.xml @@ -8,10 +8,12 @@ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> + + + - @@ -20,12 +22,9 @@ - - - - - + + + @@ -48,17 +47,6 @@ - - - - - - - - - @@ -107,13 +95,11 @@ - + - - @@ -123,5 +109,4 @@ - \ No newline at end of file diff --git a/ncep/com.raytheon.uf.edex.ncep.feature/feature.xml b/ncep/com.raytheon.uf.edex.ncep.feature/feature.xml index d95b82fb34..8a3f2f725c 100644 --- a/ncep/com.raytheon.uf.edex.ncep.feature/feature.xml +++ b/ncep/com.raytheon.uf.edex.ncep.feature/feature.xml @@ -73,13 +73,6 @@ version="0.0.0" unpack="false"/> - - - - - - - - - - diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/.project b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/.project deleted file mode 100644 index d26c8cd089..0000000000 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - gov.noaa.nws.ncep.common.dataplugin.ncccfp - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/.settings/org.eclipse.jdt.core.prefs b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2bbac2102c..0000000000 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Wed May 26 11:01:26 EDT 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/META-INF/MANIFEST.MF deleted file mode 100644 index c862929350..0000000000 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,16 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Ncccfp Plug-in -Bundle-SymbolicName: gov.noaa.nws.ncep.common.dataplugin.ncccfp -Bundle-Version: 1.0.0.qualifier -Bundle-Vendor: NOAA/NWS/NCEP/NCO/SIB -Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: com.raytheon.edex.common;bundle-version="1.11.31", - javax.persistence;bundle-version="1.0.0", - gov.noaa.nws.ncep.common;bundle-version="1.0.0" -Import-Package: com.vividsolutions.jts.geom, - gov.noaa.nws.ncep.edex.common.dao, - org.opengis.referencing.crs -Export-Package: gov.noaa.nws.ncep.common.dataplugin.ncccfp, - gov.noaa.nws.ncep.common.dataplugin.ncccfp.dao diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject deleted file mode 100644 index 64de6eff6f..0000000000 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ /dev/null @@ -1 +0,0 @@ -gov.noaa.nws.ncep.common.dataplugin.ncccfp.NcccfpRecord \ No newline at end of file diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/build.properties b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/build.properties deleted file mode 100644 index 34d2e4d2da..0000000000 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - . diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/gov.noaa.nws.ncep.common.dataplugin.ncccfp.ecl b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/gov.noaa.nws.ncep.common.dataplugin.ncccfp.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/src/gov/noaa/nws/ncep/common/dataplugin/ncccfp/NcccfpLocation.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/src/gov/noaa/nws/ncep/common/dataplugin/ncccfp/NcccfpLocation.java deleted file mode 100644 index ee3ab941be..0000000000 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/src/gov/noaa/nws/ncep/common/dataplugin/ncccfp/NcccfpLocation.java +++ /dev/null @@ -1,117 +0,0 @@ - -package gov.noaa.nws.ncep.common.dataplugin.ncccfp; - -import javax.persistence.Column; -import javax.persistence.Embeddable; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import org.hibernate.annotations.Type; -import org.opengis.referencing.crs.CoordinateReferenceSystem; - -import com.raytheon.uf.common.dataplugin.annotations.DataURI; -import com.raytheon.uf.common.geospatial.ISpatialObject; -import com.raytheon.uf.common.serialization.adapters.GeometryAdapter; -import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; -import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; -import com.vividsolutions.jts.geom.Geometry; - -/** - * - * NCCCFP Location - * - *
- * SOFTWARE HISTORY
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * 10/05/09     155         F. J. Yen   From Raytheon's CCFP; mod for NCCCFP.  Fix for LINESTRING:
- * 										Change type of geometry from Polygon to Geometry.
- * 12/14/09		155			F. J. Yen	Updated from to11d3 to to11d6 (changed import of
- *                                      IspatialObject package to ...geospatial.ISpatialObject)
- * 05/26/10		155			F. J. Yen	Refactored from plugin for migration to to11dr11
- * 07/16/13     2181        bsteffen    Convert geometry types to use hibernate-spatial
- * 
- * 
- * - * @author fjyen - * @version 1 - */ -@Embeddable -@XmlAccessorType(XmlAccessType.NONE) -@DynamicSerialize -public class NcccfpLocation implements ISpatialObject { - - private static final long serialVersionUID = 8890315829188793187L; - - @DataURI(position=0) - @Column(name = "location") - @Type(type = "org.hibernatespatial.GeometryUserType") - @XmlJavaTypeAdapter(value = GeometryAdapter.class) - @DynamicSerializeElement - private Geometry geometry; - - @Column(length=600) - @DynamicSerializeElement - @XmlElement - private String locationAll; - - @Column - @DynamicSerializeElement - @XmlElement - private double boxLat; - - @Column - @DynamicSerializeElement - @XmlElement - private double boxLong; - - @Override - public CoordinateReferenceSystem getCrs() { - return null; - } - - @Override - public Geometry getGeometry() { - return geometry; - } - - @Override - public Integer getNx() { - return 0; - } - - @Override - public Integer getNy() { - return 0; - } - - public double getBoxLat() { - return boxLat; - } - - public void setBoxLat(double boxLat) { - this.boxLat = boxLat; - } - - public double getBoxLong() { - return boxLong; - } - - public void setBoxLong(double boxLong) { - this.boxLong = boxLong; - } - - public void setGeometry(Geometry geometry) { - this.geometry = geometry; - } - - public void setLocationAll (String locationAll) { - this.locationAll = locationAll; - } - - public String getLocationAll () { - return locationAll; - } -} diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/src/gov/noaa/nws/ncep/common/dataplugin/ncccfp/NcccfpRecord.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/src/gov/noaa/nws/ncep/common/dataplugin/ncccfp/NcccfpRecord.java deleted file mode 100644 index b1d0dc5817..0000000000 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/src/gov/noaa/nws/ncep/common/dataplugin/ncccfp/NcccfpRecord.java +++ /dev/null @@ -1,347 +0,0 @@ -package gov.noaa.nws.ncep.common.dataplugin.ncccfp; - -import java.util.Calendar; - -import javax.persistence.Access; -import javax.persistence.AccessType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; -import javax.persistence.UniqueConstraint; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import org.hibernate.annotations.Index; - -import com.raytheon.uf.common.dataplugin.IDecoderGettable; -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.annotations.DataURI; -import com.raytheon.uf.common.geospatial.ISpatialEnabled; -import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; -import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; - -/** - * - * NC_CCFP Record - * - *
- * SOFTWARE HISTORY
- * Date         Ticket#  Engineer    Description
- * ------------ -------- ----------- --------------------------
- * Oct 05, 2009 155      F. J. Yen   From Raytheon's CCFP; mod for NC_CCFP
- * May 26, 2010 155      F. J. Yen   Refactored to dataplugin for
- *                                   migration to to11dr11
- * Apr 04, 2013 1846      bkowal     Added an index on refTime and forecastTime
- * Apr 12, 2013 1857      bgonzale   Added SequenceGenerator annotation.
- * May 07, 2013 1869      bsteffen   Remove dataURI column from
- *                                   PluginDataObject.
- * Aug 30, 2013 2298      rjpeter    Make getPluginName abstract
- * 
- * - * @author F. J. Yen - * @version 1 - */ -@Entity -@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "ncccfpseq") -@Table(name = "ncccfp", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) -/* - * Both refTime and forecastTime are included in the refTimeIndex since - * forecastTime is unlikely to be used. - */ -@org.hibernate.annotations.Table(appliesTo = "ncccfp", indexes = { @Index(name = "ncccfp_refTimeIndex", columnNames = { - "refTime", "forecastTime" }) }) -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) -@DynamicSerialize -public class NcccfpRecord extends PluginDataObject implements ISpatialEnabled { - - private static final long serialVersionUID = 1L; - - @DataURI(position = 2) - @Column - @XmlAttribute - @DynamicSerializeElement - private Calendar issuetime; - - @DataURI(position = 1) - @Column - @XmlAttribute - @DynamicSerializeElement - private Calendar validtime; - - @Column(length = 8) - @XmlAttribute - @DynamicSerializeElement - private String producttype; - - @Column - @XmlAttribute - @DynamicSerializeElement - private Integer coverage; - - @Column - @XmlAttribute - @DynamicSerializeElement - private Integer conf; - - @Column - @XmlAttribute - @DynamicSerializeElement - private Integer growth; - - @Column - @XmlAttribute - @DynamicSerializeElement - private Integer tops; - - @Column - @XmlAttribute - @DynamicSerializeElement - private Integer speed; - - @Column - @XmlAttribute - @DynamicSerializeElement - private Integer direction; - - @DataURI(position = 3) - @Column - @XmlAttribute - @DynamicSerializeElement - private Integer numPts; - - @Column - @DynamicSerializeElement - @XmlElement - private Boolean canadaflag; - - /* - * locationUri contains up to the first seven coordinates. This is for - * making the dataURI unique. (It was suggested that it was highly unlikely - * that 7 coordinates would not be unique enough. The number of coordinates - * was reduced due to the limited length of the string dataURI) - */ - @DataURI(position = 4) - @Column(length = 150) - @XmlElement - @DynamicSerializeElement - private String locationUri; - - private NcccfpLocation location; - - /** - * Default Constructor - */ - public NcccfpRecord() { - } - - // /** - // * Constructor. - // * - // * @param message - // * The text of the message - // */ - // public NcccfpRecord(String message) { - // super(message); - // } - - /** - * Constructs an ncccfp record from a dataURI - * - * @param uri - * The dataURI - * @param tableDef - * The table definition associated with this class - */ - public NcccfpRecord(String uri) { - super(uri); - } - - @Override - public IDecoderGettable getDecoderGettable() { - // TODO Auto-generated method stub - return null; - } - - public java.util.Calendar getIssuetime() { - return issuetime; - } - - public void setIssuetime(java.util.Calendar issuetime) { - this.issuetime = issuetime; - } - - public java.util.Calendar getValidtime() { - return validtime; - } - - public void setValidtime(java.util.Calendar validtime) { - this.validtime = validtime; - } - - public java.lang.String getProducttype() { - return producttype; - } - - public void setProducttype(java.lang.String producttype) { - this.producttype = producttype; - } - - public double getBoxLat() { - return location.getBoxLat(); - } - - public double getBoxLong() { - return location.getBoxLong(); - } - - public Boolean getCanadaflag() { - return canadaflag; - } - - public void setCanadaflag(Boolean canadaflag) { - this.canadaflag = canadaflag; - } - - /** - * @return the coverage - */ - public Integer getCoverage() { - return coverage; - } - - /** - * @param coverage - * the coverage to set - */ - public void setCoverage(Integer coverage) { - this.coverage = coverage; - } - - /** - * @return the conf - */ - public Integer getConf() { - return conf; - } - - /** - * @param conf - * the conf to set - */ - public void setConf(Integer conf) { - this.conf = conf; - } - - /** - * @return the growth - */ - public Integer getGrowth() { - return growth; - } - - /** - * @param growth - * the growth to set - */ - public void setGrowth(Integer growth) { - this.growth = growth; - } - - /** - * @return the tops - */ - public Integer getTops() { - return tops; - } - - /** - * @param tops - * the tops to set - */ - public void setTops(Integer tops) { - this.tops = tops; - } - - /** - * @return the speed - */ - public Integer getSpeed() { - return speed; - } - - /** - * @param speed - * the speed to set - */ - public void setSpeed(Integer speed) { - this.speed = speed; - } - - /** - * @return the direction - */ - public Integer getDirection() { - return direction; - } - - /** - * @param direction - * the direction to set - */ - public void setDirection(Integer direction) { - this.direction = direction; - } - - /** - * @return the number of points - */ - public Integer getNumPts() { - return numPts; - } - - /** - * @param numPts - * the number of points - */ - public void setNumPts(Integer numPts) { - this.numPts = numPts; - } - - @Override - public NcccfpLocation getSpatialObject() { - return location; - } - - public String getLocationUri() { - return locationUri; - } - - public void setLocationUri(String locationUri) { - this.locationUri = locationUri; - } - - public NcccfpLocation getLocation() { - return location; - } - - public void setLocation(NcccfpLocation location) { - this.location = location; - } - - @Override - @Column - @Access(AccessType.PROPERTY) - public String getDataURI() { - return super.getDataURI(); - } - - @Override - public String getPluginName() { - return "ncccfp"; - } -} diff --git a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/src/gov/noaa/nws/ncep/common/dataplugin/ncccfp/dao/NcccfpDao.java b/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/src/gov/noaa/nws/ncep/common/dataplugin/ncccfp/dao/NcccfpDao.java deleted file mode 100644 index d222125aea..0000000000 --- a/ncep/gov.noaa.nws.ncep.common.dataplugin.ncccfp/src/gov/noaa/nws/ncep/common/dataplugin/ncccfp/dao/NcccfpDao.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Set of DAO methods for NCCCFP data. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date			Ticket#		Engineer	Description
- * ------------ -----------	----------- --------------------------
- * 26/05/10		155		F. J. Yen	Initial Coding for to11dr11 (Following one of RTN's DAO to refactor)
- * 
- * - * @author fjyen - * @version 1.0 - **/ -package gov.noaa.nws.ncep.common.dataplugin.ncccfp.dao; - -import java.util.List; - -import gov.noaa.nws.ncep.common.dataplugin.ncccfp.NcccfpRecord; -import gov.noaa.nws.ncep.edex.common.dao.NcepDefaultPluginDao; - -import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.edex.database.DataAccessLayerException; - -public class NcccfpDao extends NcepDefaultPluginDao { - - - /** - * Creates a new ReccoDao - * @throws PluginException - */ - public NcccfpDao(String pluginName) throws PluginException { - super(pluginName); - } - - /** - * Retrieves a NCCCFP report using the datauri . - * - * @param dataURI - * The dataURI to match against. - * @return The report record if it exists. - */ - public NcccfpRecord queryByDataURI(String dataURI) { - NcccfpRecord report = null; - List obs = null; - try { - obs = queryBySingleCriteria("dataURI", dataURI); - } catch (DataAccessLayerException e) { - e.printStackTrace(); - } - if((obs != null)&&(obs.size() > 0)) { - report = (NcccfpRecord) obs.get(0); - } - return report; - } - - /** - * Queries for to determine if a given data uri exists on the NCCCFP table. - * - * @param dataUri - * The DataURI to find. - * @return An array of objects. If not null, there should only be a single - * element. - */ - public Object[] queryDataUriColumn(final String dataUri) { - - String sql = "select datauri from awips.ncccfp where datauri='" - + dataUri + "';"; - - Object[] results = executeSQLQuery(sql); - - return results; - } -} diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/.classpath b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/.classpath deleted file mode 100644 index ad32c83a78..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/.project b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/.project deleted file mode 100644 index a3aefe4b79..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - gov.noaa.nws.ncep.edex.plugin.ncccfp - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/.settings/org.eclipse.jdt.core.prefs b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 1d360e2043..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Thu Mar 26 10:17:30 CDT 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/META-INF/MANIFEST.MF deleted file mode 100644 index 2b680b80d5..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,18 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Nc_ccfp Plug-in -Bundle-SymbolicName: gov.noaa.nws.ncep.edex.plugin.ncccfp -Bundle-Version: 1.11.7.qualifier -Bundle-Vendor: AWIPS II Migration -Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization, com.raytheon.edex.common -Require-Bundle: com.raytheon.edex.common, - com.raytheon.uf.edex.decodertools;bundle-version="1.0.0", - org.geotools, - javax.persistence, - com.raytheon.uf.common.localization;bundle-version="1.11.7", - gov.noaa.nws.ncep.common.dataplugin.ncccfp;bundle-version="1.0.0", - gov.noaa.nws.ncep.edex.common;bundle-version="1.0.0", - gov.noaa.nws.ncep.common;bundle-version="1.0.0" -Export-Package: gov.noaa.nws.ncep.edex.plugin.ncccfp.decoder -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Import-Package: org.apache.commons.logging diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject deleted file mode 100644 index 3579cfc97d..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ /dev/null @@ -1,2 +0,0 @@ -gov.noaa.nws.ncep.common.dataplugin.ncccfp.NcccfpRecord -gov.noaa.nws.ncep.common.dataplugin.ncccfp.NcccfpLocation \ No newline at end of file diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/build.properties b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/build.properties deleted file mode 100644 index 51425237fd..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - res/ diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/gov.noaa.nws.ncep.edex.plugin.ncccfp.ecl b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/gov.noaa.nws.ncep.edex.plugin.ncccfp.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/res/spring/ncccfp-common.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/res/spring/ncccfp-common.xml deleted file mode 100644 index b775f04404..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/res/spring/ncccfp-common.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/res/spring/ncccfp-ingest.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/res/spring/ncccfp-ingest.xml deleted file mode 100644 index d6d31142c0..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/res/spring/ncccfp-ingest.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - ncccfp - - - - - - - - - ncccfp - - - - - - - - - - - - - java.lang.Throwable - - - - - - - java.lang.Throwable - - - - - - \ No newline at end of file diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/src/gov/noaa/nws/ncep/edex/plugin/ncccfp/decoder/NcccfpDecoder.java b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/src/gov/noaa/nws/ncep/edex/plugin/ncccfp/decoder/NcccfpDecoder.java deleted file mode 100644 index 5c42efd533..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/src/gov/noaa/nws/ncep/edex/plugin/ncccfp/decoder/NcccfpDecoder.java +++ /dev/null @@ -1,314 +0,0 @@ -package gov.noaa.nws.ncep.edex.plugin.ncccfp.decoder; - -import gov.noaa.nws.ncep.common.dataplugin.ncccfp.NcccfpLocation; -import gov.noaa.nws.ncep.common.dataplugin.ncccfp.NcccfpRecord; - -import java.util.Calendar; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import com.raytheon.edex.exception.DecoderException; -import com.raytheon.edex.plugin.AbstractDecoder; -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.common.time.TimeRange; -import com.raytheon.uf.edex.decodertools.time.TimeTools; -import com.vividsolutions.jts.io.WKTReader; - -/** - * - * NCCCFP Decoder - * - *
- * SOFTWARE HISTORY
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * Oct 05, 2009 155         F. J. Yen   From Raytheon's CCFP.  Fix AREA.  Store
- *                                      1 instead of 14-15 decimal  places for
- *                                      lat/lon values and limit to 7 points in
- *                                      dataURI (length 255)  to conserve space
- *                                      and to fit into field.  Add number of
- *                                      points to dataURI.  Modify for LINE to
- *                                      be decoded.  Make decode synchronized.
- * May 27, 2010 155         F. J. Yen   Refactored for dataplugin for migration
- *                                      to to11dr11
- * Aug 30, 2013 2298        rjpeter     Make getPluginName abstract
- * 
- * 
- * - * @author F. J. Yen - * @version 1 - */ - -public class NcccfpDecoder extends AbstractDecoder { - private static String pluginName; - - private static final String PLUGIN_NAME = "ncccfp"; - - /** Record used for returning values */ - NcccfpRecord record; - - /** Pattern object for regex search */ - Pattern pattern; - - /** Regex matcher */ - private Matcher matcher; - - /** Match the product returned from separator */ - private static final String PARSE_STRING = "[A-Z]{4}[0-9]{1,2} [A-Z]{4} [0-9]{6}(?: [A-Z]{3})?\n" - + "CFP[\\p{Alnum} ]{3}\n" // awips header - + "CCFP (\\d{4})(\\d{2})(\\d{2})_(\\d{2})\\d{2} (\\d{4})(\\d{2})(\\d{2})_(\\d{2})\\d{2}\n" // start/valid - // times - + "(AREA|LINE).*\n" // SKIP AREA and LINE parsing - + "(CANADA ON|CANADA OFF)"; - - /** Parse an AREA line */ - private static final String PARSE_AREA = "AREA (\\d+) (\\d+) (\\d+) (\\d+) (\\d+) (\\d+) (\\d+) (.*) (\\d+) (\\d+)"; - - /** Parse a LINE line */ - private static final String PARSE_LINE = "LINE (\\d+) (.*)"; - - /** - * Constructor - * - * @throws DecoderException - */ - public NcccfpDecoder() throws DecoderException { - } - - public NcccfpDecoder(String name) throws DecoderException { - pluginName = name; - } - - public synchronized PluginDataObject[] decode(String msg) - throws DecoderException, PluginException { - record = new NcccfpRecord(); - record.setMessageData(msg); - NcccfpLocation location = new NcccfpLocation(); - - pattern = Pattern.compile(PARSE_STRING); - matcher = pattern.matcher(msg); - - try { - WKTReader wktReader = new WKTReader(); - if (matcher.find()) { - Calendar start = TimeTools.getBaseCalendar( - Integer.parseInt(matcher.group(1)), - Integer.parseInt(matcher.group(2)), - Integer.parseInt(matcher.group(3))); - start.set(Calendar.HOUR_OF_DAY, - Integer.parseInt(matcher.group(4))); - record.setIssuetime(start); - Calendar valid = TimeTools.getBaseCalendar( - Integer.parseInt(matcher.group(5)), - Integer.parseInt(matcher.group(6)), - Integer.parseInt(matcher.group(7))); - valid.set(Calendar.HOUR_OF_DAY, - Integer.parseInt(matcher.group(8))); - record.setValidtime(valid); - TimeRange range = new TimeRange(record.getIssuetime(), - record.getValidtime()); - record.setDataTime(new DataTime(record.getIssuetime(), range)); - record.setProducttype(matcher.group(9)); - if (matcher.group(10).equals("CANADA ON")) { - record.setCanadaflag(Boolean.TRUE); - } else { - record.setCanadaflag(Boolean.FALSE); - } - record.setInsertTime(TimeTools.getSystemCalendar()); - } - if (record.getProducttype().equals("AREA")) { - pattern = Pattern.compile(PARSE_AREA); - matcher = pattern.matcher(msg); - if (matcher.find()) { - record.setCoverage(Integer.parseInt(matcher.group(1))); - record.setConf(Integer.parseInt(matcher.group(2))); - record.setGrowth(Integer.parseInt(matcher.group(3))); - record.setTops(Integer.parseInt(matcher.group(4))); - record.setSpeed(Integer.parseInt(matcher.group(5))); - record.setDirection(Integer.parseInt(matcher.group(6))); - record.setNumPts(Integer.parseInt(matcher.group(7))); - location.setBoxLat(Double.parseDouble(matcher.group(9)) * 0.1); - location.setBoxLong(Double.parseDouble(matcher.group(10)) - * -0.1); - String templatlonpairs = matcher.group(8); - pattern = Pattern.compile("(\\d+) (\\d+)"); - matcher = pattern.matcher(templatlonpairs); - StringBuffer wtk = new StringBuffer(); - wtk.append("POLYGON(("); - StringBuffer wtka = new StringBuffer(); - wtka.append("POLYGON(("); - int i7CntPts = 0; - StringBuffer wtk7 = new StringBuffer(); - wtk7.append("POLYGONU(("); - - if (matcher.find()) { - wtk.append(Double.toString(Integer.parseInt(matcher - .group(1)) * 0.1) + " "); - wtk.append(Double.toString(Integer.parseInt(matcher - .group(2)) * -0.1)); - /* - * Reduce from 14-15 decimal places to 1 for dataURI - */ - int len = matcher.group(1).length(); - String lat1deg = matcher.group(1).substring(0, len - 1); - String lat1tenth = matcher.group(1).substring(len - 1); - len = matcher.group(2).length(); - String lon1deg = matcher.group(2).substring(0, len - 1); - if (!matcher.group(2).substring(0, 0).equals("-")) { - lon1deg = "-" + lon1deg; - } - String lon1tenth = matcher.group(2).substring(len - 1); - i7CntPts++; - wtk7.append(lat1deg + "." + lat1tenth + " " + lon1deg - + "." + lon1tenth); - wtka.append(lat1deg + "." + lat1tenth + " " + lon1deg - + "." + lon1tenth); - } - while (matcher.find()) { - wtk.append(", " - + Double.toString(Integer.parseInt(matcher - .group(1)) * 0.1) + " "); - wtk.append(Double.toString(Integer.parseInt(matcher - .group(2)) * -0.1)); - /* - * Reduce from 14-15 decimal places to 1 for dataURI - */ - int len = matcher.group(1).length(); - String latdeg = matcher.group(1).substring(0, len - 1); - String lat10 = matcher.group(1).substring(len - 1); - len = matcher.group(2).length(); - String londeg = matcher.group(2).substring(0, len - 1); - if (!matcher.group(2).substring(0, 0).equals("-")) { - londeg = "-" + londeg; - } - String lon10 = matcher.group(2).substring(len - 1); - if (i7CntPts < 7) { - /* - * Truncate the number of coordinates to 7 for - * dataURI - */ - i7CntPts++; - wtk7.append("," + latdeg + "." + lat10 + " " - + londeg + "." + lon10); - } - wtka.append("," + latdeg + "." + lat10 + " " + londeg - + "." + lon10); - } - wtk.append("))"); - wtk7.append("))"); - wtka.append("))"); - location.setGeometry(wktReader.read(wtk.toString())); - record.setLocation(location); - /* - * Column LocationAll contains all the coordinates with 1 - * decimal place. Column locationUri is locationAll - * truncated to 7 coordinates (or less). - */ - record.setLocationUri(wtk7.toString()); - location.setLocationAll(wtka.toString()); - } - } else if (record.getProducttype().equals("LINE")) { - pattern = Pattern.compile(PARSE_LINE); - matcher = pattern.matcher(msg); - if (matcher.find()) { - record.setCoverage(null); - record.setConf(null); - record.setGrowth(null); - record.setTops(null); - record.setSpeed(null); - record.setDirection(null); - location.setBoxLat(0); - location.setBoxLong(0); - record.setNumPts(Integer.parseInt(matcher.group(1))); - // String templatlonpairs = matcher.group(1); - String templatlonpairs = matcher.group(2); - pattern = Pattern.compile("(\\d+) (\\d+)"); - matcher = pattern.matcher(templatlonpairs); - - StringBuffer wtk = new StringBuffer(); - wtk.append("LINESTRING("); - StringBuffer wtka = new StringBuffer(); - wtka.append("LINESTRING("); - int i7CntPts = 0; - StringBuffer wtk7 = new StringBuffer(); - wtk7.append("LINESTRINGU("); - if (matcher.find()) { - wtk.append(Double.toString(Integer.parseInt(matcher - .group(1)) * 0.1) + " "); - wtk.append(Double.toString(Integer.parseInt(matcher - .group(2)) * -0.1)); - /* - * Reduce from 14-15 decimal places to 1 for dataURI - */ - int len = matcher.group(1).length(); - String lat1deg = matcher.group(1).substring(0, len - 1); - String lat1tenth = matcher.group(1).substring(len - 1); - len = matcher.group(2).length(); - String lon1deg = matcher.group(2).substring(0, len - 1); - if (!matcher.group(2).substring(0, 0).equals("-")) { - lon1deg = "-" + lon1deg; - } - String lon1tenth = matcher.group(2).substring(len - 1); - i7CntPts++; - wtk7.append(lat1deg + "." + lat1tenth + " " + lon1deg - + "." + lon1tenth); - wtka.append(lat1deg + "." + lat1tenth + " " + lon1deg - + "." + lon1tenth); - } - while (matcher.find()) { - wtk.append(", " - + Double.toString(Integer.parseInt(matcher - .group(1)) * 0.1) + " "); - wtk.append(Double.toString(Integer.parseInt(matcher - .group(2)) * -0.1)); - /* - * Reduce from 14-15 decimal places to 1 for dataURI - */ - int len = matcher.group(1).length(); - String latdeg = matcher.group(1).substring(0, len - 1); - String lat10 = matcher.group(1).substring(len - 1); - len = matcher.group(2).length(); - String londeg = matcher.group(2).substring(0, len - 1); - if (!matcher.group(2).substring(0, 0).equals("-")) { - londeg = "-" + londeg; - } - String lon10 = matcher.group(2).substring(len - 1); - /* - * Truncate the number of coordinates to 7 for dataURI - */ - if (i7CntPts < 7) { - i7CntPts++; - wtk7.append("," + latdeg + "." + lat10 + " " - + londeg + "." + lon10); - } - wtka.append("," + latdeg + "." + lat10 + " " + londeg - + "." + lon10); - } - wtk.append(")"); - wtk7.append(")"); - wtka.append(")"); - location.setGeometry(wktReader.read(wtk.toString())); - record.setLocation(location); - /* - * Column locationAll contains all the coordinates with 1 - * decimal place. Column locationUri is locationAll - * truncated to 7 coordinates (or less). - */ - record.setLocationUri(wtk7.toString()); - location.setLocationAll(wtka.toString()); - } - } - } catch (Exception e) { - throw new DecoderException("Unable to decode NCCCFP", e); - } - if (record != null) { - record.constructDataURI(); - return new PluginDataObject[] { record }; - } else { - return new PluginDataObject[0]; - } - - } -} diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/src/gov/noaa/nws/ncep/edex/plugin/ncccfp/decoder/NcccfpSeparator.java b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/src/gov/noaa/nws/ncep/edex/plugin/ncccfp/decoder/NcccfpSeparator.java deleted file mode 100644 index 711bd55382..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/src/gov/noaa/nws/ncep/edex/plugin/ncccfp/decoder/NcccfpSeparator.java +++ /dev/null @@ -1,206 +0,0 @@ -package gov.noaa.nws.ncep.edex.plugin.ncccfp.decoder; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.raytheon.edex.esb.Headers; -import com.raytheon.edex.plugin.AbstractRecordSeparator; -import com.raytheon.uf.common.util.StringUtil; - -/** - * - * NCCCFP Separator - * - *
- * SOFTWARE HISTORY
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * 09/03/2009   155         F. J. Yen   From Raytheon's CCFP; modify for NCCCFP
- * 
- * 
- * - * @author F. J. Yen - * @version 1 - */ - -public class NcccfpSeparator extends AbstractRecordSeparator { - - private final Log theLogger = LogFactory.getLog(getClass()); - - /** Regex used for separating multi-record files */ - private static final String DATASET = "CCFP \\d{8}_\\d{4} \\d{8}_\\d{4}([\\r\\n]+(AREA|LINE).*)*"; - - /** Regex to pull AWIPS Header */ - private static final String AWIPSHEADER = "[\\r\\n]+(TAF|MTR|CFP)([\\p{Alnum} ]{3})[\\r\\n]+"; - - /** Regex used for extracting the header */ - private static final String HEADERREGEX = "[A-Z]{4}[0-9]{1,2} [A-Z]{4} [0-9]{6}(?: [A-Z]{3})?"; - - /** Regex used for extracting a line */ - private static final String TIMEREGEX = "CCFP \\d{8}_\\d{4} \\d{8}_\\d{4}"; - - /** Regex used for extracting a line */ - private static final String LINEREGEX = "AREA.*|LINE.*"; - - private static final String CANADA_FLAG = "CANADA ON|CANADA OFF"; - - /** Pattern object for regex search */ - Pattern pattern; - - /** Regex matcher */ - private Matcher matcher; - - /** The WMO header */ - private String header; - - /** The AWIPS header */ - private String awipsheader; - - private String canadaflag; - - /** List of individual areas in file */ - private List splitAreas; - - /** List of records contained in file */ - private List bodyRecords; - - /** List of records contained in file */ - private List records; - - private Iterator iterator = null; - - public static NcccfpSeparator separate(byte[] data, Headers headers) { - NcccfpSeparator sep = new NcccfpSeparator(); - sep.setData(data, headers); - return sep; - } - - public NcccfpSeparator() { - bodyRecords = new ArrayList(); - records = new ArrayList(); - } - - @Override - public String next() { - try { - String temp = iterator.next(); - if (StringUtil.isEmptyString(temp)) { - return ""; - } else { - return temp; - } - } catch (NoSuchElementException e) { - return ""; - } - } - - @Override - public boolean hasNext() { - if (iterator == null) { - return false; - } else { - return iterator.hasNext(); - } - } - - @Override - public void setData(byte[] data, Headers headers) { - this.separate(new String(data)); - iterator = records.iterator(); - } - - /** - * - * @param message - */ - private void separate(String message) { - message = message.replaceAll("=", ""); - - try { - // Extracts the header - pattern = Pattern.compile(HEADERREGEX); - matcher = pattern.matcher(message); - - if (matcher.find()) { - header = matcher.group(); - } - - // Extracts the AWIPS header - pattern = Pattern.compile(AWIPSHEADER); - matcher = pattern.matcher(message); - - if (matcher.find()) { - awipsheader = matcher.group(1) + matcher.group(2); - } - - pattern = Pattern.compile(CANADA_FLAG); - matcher = pattern.matcher(message); - if (matcher.find()) { - canadaflag = matcher.group(); - } - - pattern = Pattern.compile(DATASET); - matcher = pattern.matcher(message); - - // Extracts all the matches out of the message. Looks for ICAO/date - // pairs. Does not allow duplicate entries. - while (matcher.find()) { - if (!bodyRecords.contains(matcher.group())) { - bodyRecords.add(matcher.group()); - } - } - - // Assigns records - for (int i = 0; i < bodyRecords.size(); i++) { - String observation = null; - if (i < bodyRecords.size() - 1) { - observation = message - .substring(message.indexOf(bodyRecords.get(i)), - message.indexOf(bodyRecords.get(i + 1))) - .trim().replaceAll("\\r\\r\\n", "\n"); - ; - } else { - observation = bodyRecords.get(i).trim() - .replaceAll("\\r\\r\\n", "\n"); - } - splitAreas = splitRecord(observation); - for (int j = 0; j < splitAreas.size(); j++) { - String record = header + "\n" + awipsheader + "\n" - + splitAreas.get(j) + "\n" + canadaflag; - records.add(record); - } - } - } catch (Exception e) { - e.printStackTrace(); - theLogger.warn("No valid NCCCFP records found."); - } - return; - } - - private List splitRecord(String obs) { - List rval = new ArrayList(); - String timeline = null; - - pattern = Pattern.compile(TIMEREGEX); - matcher = pattern.matcher(obs); - if (matcher.find()) { - timeline = matcher.group(); - } - - pattern = Pattern.compile(LINEREGEX); - matcher = pattern.matcher(obs); - while (matcher.find()) { - rval.add(timeline + "\n" + matcher.group()); - } - - return rval; - } - -} diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/utility/common_static/base/purge/ncccfpPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/utility/common_static/base/purge/ncccfpPurgeRules.xml deleted file mode 100644 index 8ec526365d..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/utility/common_static/base/purge/ncccfpPurgeRules.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - 02-00:00:00 - - diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/utility/edex_static/base/distribution/ncccfp.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/utility/edex_static/base/distribution/ncccfp.xml deleted file mode 100644 index 41ba4aec47..0000000000 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/utility/edex_static/base/distribution/ncccfp.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - ^FAUS2[789] KKCI.* - diff --git a/rpms/awips2.core/Installer.ant/component.spec b/rpms/awips2.core/Installer.ant/component.spec index 1d1ed8fe86..5ad20d89f7 100644 --- a/rpms/awips2.core/Installer.ant/component.spec +++ b/rpms/awips2.core/Installer.ant/component.spec @@ -5,7 +5,7 @@ Name: awips2-ant Summary: AWIPS II Ant Distribution Version: 1.7.1 -Release: 2 +Release: 3 Group: AWIPSII BuildRoot: %{_build_root} BuildArch: noarch @@ -131,4 +131,4 @@ rm -rf ${RPM_BUILD_ROOT} /awips2/ant/licenses %doc /awips2/ant/NOTICE %doc /awips2/ant/README -%doc /awips2/ant/WHATSNEW \ No newline at end of file +%doc /awips2/ant/WHATSNEW diff --git a/rpms/awips2.core/Installer.ant/scripts/profile.d/awips2Ant.csh b/rpms/awips2.core/Installer.ant/scripts/profile.d/awips2Ant.csh index b0d5da3f7d..77fded2b94 100644 --- a/rpms/awips2.core/Installer.ant/scripts/profile.d/awips2Ant.csh +++ b/rpms/awips2.core/Installer.ant/scripts/profile.d/awips2Ant.csh @@ -1,7 +1,7 @@ #!/bin/csh # Determine where ant has been installed. -set ANT_INSTALL=`rpm -q --queryformat '%{INSTALLPREFIX}' awips2-ant` +set ANT_INSTALL=`rpm -q --queryformat '%{INSTPREFIXES}' awips2-ant` setenv ANT_HOME "${ANT_INSTALL}" if $?PATH then diff --git a/rpms/awips2.core/Installer.ant/scripts/profile.d/awips2Ant.sh b/rpms/awips2.core/Installer.ant/scripts/profile.d/awips2Ant.sh index d3ba27f5c3..e4f87f6538 100644 --- a/rpms/awips2.core/Installer.ant/scripts/profile.d/awips2Ant.sh +++ b/rpms/awips2.core/Installer.ant/scripts/profile.d/awips2Ant.sh @@ -8,7 +8,7 @@ if [ ${RC} -ne 0 ]; then fi # Determine Where Ant Has Been Installed. -ANT_INSTALL=`rpm -q --queryformat '%{INSTALLPREFIX}' awips2-ant` +ANT_INSTALL=`rpm -q --queryformat '%{INSTPREFIXES}' awips2-ant` if [ "${ANT_INSTALL}" = "" ]; then return fi diff --git a/rpms/awips2.core/Installer.cli/scripts/profile.d/awips2CLI.csh b/rpms/awips2.core/Installer.cli/scripts/profile.d/awips2CLI.csh index 0adcb4c2fc..3d33971265 100644 --- a/rpms/awips2.core/Installer.cli/scripts/profile.d/awips2CLI.csh +++ b/rpms/awips2.core/Installer.cli/scripts/profile.d/awips2CLI.csh @@ -6,7 +6,10 @@ set RC="$?" #if installed, set the variable if ( "${RC}" == "0" ) then - set CLI_INSTALL=/awips2/fxa - setenv PATH ${CLI_INSTALL}/bin:${PATH} + set CLI_INSTALL=`rpm -q --queryformat '%{INSTPREFIXES}' awips2-cli` + #if check CLI_INSTALL is set, set it in the path + if ( "${CLI_INSTALL}" != "" ) then + setenv PATH ${CLI_INSTALL}/bin:${PATH} + endif endif diff --git a/rpms/awips2.core/Installer.cli/scripts/profile.d/awips2CLI.sh b/rpms/awips2.core/Installer.cli/scripts/profile.d/awips2CLI.sh index 8af9f57e5c..6ec6bfa870 100644 --- a/rpms/awips2.core/Installer.cli/scripts/profile.d/awips2CLI.sh +++ b/rpms/awips2.core/Installer.cli/scripts/profile.d/awips2CLI.sh @@ -9,5 +9,9 @@ if [ ! "${RC}" = "0" ]; then fi # Determine where awips2-cli has been installed. -CLI_INSTALL=/awips2/fxa +CLI_INSTALL=`rpm -q --queryformat '%{INSTPREFIXES}\n' awips2-cli` +if [ "${CLI_INSTALL}" = "" ]; then + return +fi + export PATH=${CLI_INSTALL}/bin:${PATH} diff --git a/rpms/awips2.core/Installer.tools/component.spec b/rpms/awips2.core/Installer.tools/component.spec index f5c5a5134d..9b07b8514c 100644 --- a/rpms/awips2.core/Installer.tools/component.spec +++ b/rpms/awips2.core/Installer.tools/component.spec @@ -8,7 +8,7 @@ Name: awips2-tools Summary: AWIPS II Tools Distribution Version: 1.8.4 -Release: 1.el6 +Release: 2.el6 Group: AWIPSII BuildRequires: awips2-python-h5py BuildRoot: /tmp diff --git a/rpms/awips2.core/Installer.tools/scripts/profile.d/awips2HDF5Tools.csh b/rpms/awips2.core/Installer.tools/scripts/profile.d/awips2HDF5Tools.csh index 3d59842cba..6510b5a4d1 100644 --- a/rpms/awips2.core/Installer.tools/scripts/profile.d/awips2HDF5Tools.csh +++ b/rpms/awips2.core/Installer.tools/scripts/profile.d/awips2HDF5Tools.csh @@ -1,6 +1,6 @@ #!/bin/csh -set HDF5_TOOLS_INSTALL=/awips2/tools +set HDF5_TOOLS_INSTALL=`rpm -q --queryformat '%{INSTPREFIXES}' awips2-tools` if $?PATH then setenv PATH ${HDF5_TOOLS_INSTALL}/bin:$PATH diff --git a/rpms/awips2.core/Installer.tools/scripts/profile.d/awips2HDF5Tools.sh b/rpms/awips2.core/Installer.tools/scripts/profile.d/awips2HDF5Tools.sh index 1b824dab18..1001cca2e6 100644 --- a/rpms/awips2.core/Installer.tools/scripts/profile.d/awips2HDF5Tools.sh +++ b/rpms/awips2.core/Installer.tools/scripts/profile.d/awips2HDF5Tools.sh @@ -8,7 +8,10 @@ if [ ${RC} -ne 0 ]; then fi # Determine Where awips2-tools Has Been Installed. -HDF5_TOOLS_INSTALL=/awips2/tools +HDF5_TOOLS_INSTALL=`rpm -q --queryformat '%{INSTPREFIXES}' awips2-tools` +if [ "${HDF5_TOOLS_INSTALL}" = "" ]; then + return +fi # Update The Environment. # Determine If awips2-tools Is Already Part Of The Path. diff --git a/tests/integration/com/raytheon/uf/edex/registry/ebxml/services/query/types/canonical/GetNotificationTest.java b/tests/integration/com/raytheon/uf/edex/registry/ebxml/services/query/types/canonical/GetNotificationTest.java index 1c63ab5475..88f96d26ae 100644 --- a/tests/integration/com/raytheon/uf/edex/registry/ebxml/services/query/types/canonical/GetNotificationTest.java +++ b/tests/integration/com/raytheon/uf/edex/registry/ebxml/services/query/types/canonical/GetNotificationTest.java @@ -82,6 +82,9 @@ public class GetNotificationTest extends QueryTest { @Autowired private GetNotification getNotification; + @Autowired + private RegistrySOAPServices registrySoapClient; + @Before public void createSubscription() throws Exception { // Set normal registry object fields @@ -112,7 +115,7 @@ public class GetNotificationTest extends QueryTest { String endpointType = DeliveryMethodTypes.SOAP; W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder(); - builder.address(RegistrySOAPServices.getNotificationListenerServiceUrl( + builder.address(registrySoapClient.getNotificationListenerServiceUrl( "http://someaddress.com").toString()); W3CEndpointReference ref = builder.build(); DOMResult dom = new DOMResult(); diff --git a/tests/resources/ebxml/unit-test-ebxml-replication-beans.xml b/tests/resources/ebxml/unit-test-ebxml-replication-beans.xml index 2ee9c7da85..63b93c59ad 100644 --- a/tests/resources/ebxml/unit-test-ebxml-replication-beans.xml +++ b/tests/resources/ebxml/unit-test-ebxml-replication-beans.xml @@ -6,6 +6,7 @@ + \ No newline at end of file diff --git a/tests/unit/com/raytheon/uf/edex/registry/ebxml/services/notification/MockNotificationListenerFactory.java b/tests/unit/com/raytheon/uf/edex/registry/ebxml/services/notification/MockNotificationListenerFactory.java index 5ce2477af0..d276c690b9 100644 --- a/tests/unit/com/raytheon/uf/edex/registry/ebxml/services/notification/MockNotificationListenerFactory.java +++ b/tests/unit/com/raytheon/uf/edex/registry/ebxml/services/notification/MockNotificationListenerFactory.java @@ -26,9 +26,7 @@ import java.util.Map; import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener; -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.services.notification.NotificationListenerFactory; +import com.raytheon.uf.common.registry.services.RegistrySOAPServices; import com.raytheon.uf.edex.registry.ebxml.services.notification.listeners.WebServiceNotificationListener; /** @@ -57,8 +55,9 @@ public class MockNotificationListenerFactory extends * * @param emailSender */ - public MockNotificationListenerFactory(EmailSender emailSender) { - super(emailSender); + public MockNotificationListenerFactory(EmailSender emailSender, + RegistrySOAPServices registrySoapClient) { + super(emailSender, registrySoapClient); } private final Map mockListeners = new HashMap();