Merge branch 'development' into development_on_RHEL6
Conflicts: rpms/awips2.core/Installer.cli/scripts/profile.d/awips2CLI.csh rpms/awips2.core/Installer.cli/scripts/profile.d/awips2CLI.sh rpms/awips2.core/Installer.tools/component.spec rpms/awips2.core/Installer.tools/scripts/profile.d/awips2HDF5Tools.csh rpms/awips2.core/Installer.tools/scripts/profile.d/awips2HDF5Tools.sh Former-commit-id:d73aaf9753
[formerly4bad21e6cd
] [formerly3255bf3861
[formerly 4ad10d4cc3b189c65352f0c205fe8664a52bf407]] Former-commit-id:3255bf3861
Former-commit-id:76726372e5
This commit is contained in:
commit
400b4a1328
101 changed files with 1966 additions and 1928 deletions
|
@ -121,13 +121,6 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="gov.noaa.nws.ncep.common.dataplugin.ncccfp"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="gov.noaa.nws.ncep.common.dataplugin.ncscat"
|
||||
download-size="0"
|
||||
|
|
11
deltaScripts/14.2.1/dropNcccfp.sh
Normal file
11
deltaScripts/14.2.1/dropNcccfp.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
# DR #2485 remove ncccfp from the database
|
||||
|
||||
PSQL="/awips2/psql/bin/psql"
|
||||
|
||||
SQL_COMMAND="
|
||||
delete from plugin_info where name = 'ncccfp';
|
||||
drop table if exists ncccfp;
|
||||
drop sequence if exists ncccfpseq;
|
||||
"
|
||||
${PSQL} -U awips -d metadata -c "${SQL_COMMAND}"
|
|
@ -31,6 +31,6 @@ if [ ${RC} -ne 0 ]; then
|
|||
echo "Unable To Continue ... Terminating."
|
||||
fi
|
||||
|
||||
JAVA_INSTALL=`rpm -q --queryformat '%{INSTALLPREFIX}' awips2-java`
|
||||
JAVA_INSTALL=`rpm -q --queryformat '%{INSTPREFIXES}' awips2-java`
|
||||
|
||||
${JAVA_INSTALL}/bin/java -classpath $awips_home/edex/lib/plugins/plugin-warning.jar:$awips_home/edex/lib/dependencies/org.geotools/jts-1.9.jar com.raytheon.edex.plugin.warning.tools.DamInfoTranslator $@
|
||||
|
|
|
@ -53,6 +53,30 @@
|
|||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- data delivery Notification log -->
|
||||
<appender name="NotificationLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${edex.home}/logs/edex-${edex.run.mode}-notification-%d{yyyyMMdd}.log</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<encoder>
|
||||
<pattern>%-5p %d [%t] %c{0}: %m%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- data delivery Retrieval log -->
|
||||
<appender name="RetrievalLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${edex.home}/logs/edex-${edex.run.mode}-retrieval-%d{yyyyMMdd}.log</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
||||
<encoder>
|
||||
<pattern>%-5p %d [%t] %c{0}: %m%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Purge log -->
|
||||
<appender name="PurgeLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
|
@ -132,12 +156,61 @@
|
|||
<appender-ref ref="DataDeliveryLog"/>
|
||||
</logger>
|
||||
|
||||
<!-- Registry events to go to main registry log -->
|
||||
<logger name="com.raytheon.uf.edex.datadelivery.service" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="DataDeliveryLog"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.edex.datadelivery.request" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="DataDeliveryLog"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.common.datadelivery.event" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="NotificationLog"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.edex.datadelivery.event" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="NotificationLog"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.edex.registry.ebxml.services.notification" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="NotificationLog"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.edex.datadelivery.registry.federation" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="NotificationLog"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.edex.datadelivery.registry.replication" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="NotificationLog"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.common.datadelivery.retrieval" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="RetrievalLog"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.edex.datadelivery.retrieval" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="RetrievalLog"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.common.datadelivery.registry" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="console"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.edex.datadelivery.registry" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="console"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.common.datadelivery.bandwidth" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="BandwidthManagerLog"/>
|
||||
|
|
|
@ -88,7 +88,6 @@
|
|||
<includeMode>excludeDpaAndOgc</includeMode>
|
||||
<!-- ncep excludes until tested -->
|
||||
<exclude>aww-ingest.xml</exclude>
|
||||
<exclude>ncccfp-ingest.xml</exclude>
|
||||
<exclude>ncep-util-on-edex-ingest</exclude>
|
||||
<exclude>ncep-util-on-edex-ingestGrib</exclude>
|
||||
<exclude>ncscd-ingest.xml</exclude>
|
||||
|
|
|
@ -73,7 +73,7 @@ public class DefaultGeometryData implements IGeometryData {
|
|||
|
||||
protected String locationName;
|
||||
|
||||
protected Map<String, Object> attributes;
|
||||
protected Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
|
||||
@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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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<String> 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();
|
||||
|
||||
}
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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,10 +190,12 @@ IDataRequest request) {
|
|||
// add any additional database columns the user has specified as
|
||||
// parameters
|
||||
// for additional information, refer to: http://tinyurl.com/arnayco
|
||||
if (request.getParameters() != null) {
|
||||
for (String parameter : request.getParameters()) {
|
||||
columns.add(parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<String> constraints = new ArrayList<String>();
|
||||
// add location constraint (ifdef)
|
||||
if ((request.getLocationNames() == null) == false
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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())
|
|
@ -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]
|
||||
|
|
|
@ -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}
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 5/3/2013 1948 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @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);
|
||||
}
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 5/3/2013 1948 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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<String, IRegistryObjectsRestService> registryObjectServiceMap = CacheBuilder
|
||||
private LoadingCache<String, IRegistryObjectsRestService> registryObjectServiceMap = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<String, IRegistryObjectsRestService>() {
|
||||
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<String, IRepositoryItemsRestService> repositoryItemServiceMap = CacheBuilder
|
||||
private LoadingCache<String, IRepositoryItemsRestService> repositoryItemServiceMap = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<String, IRepositoryItemsRestService>() {
|
||||
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<String, IRegistryAvailableRestService> registryAvailabilityServiceMap = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<String, IRegistryAvailableRestService>() {
|
||||
public IRegistryAvailableRestService load(String url) {
|
||||
return getPort(url, IRegistryAvailableRestService.class);
|
||||
}
|
||||
});
|
||||
private RegistryJaxbManager jaxbManager;
|
||||
|
||||
/** Map of known registry data access services */
|
||||
private static LoadingCache<String, IRegistryDataAccessService> registryDataAccessServiceMap = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<String, IRegistryDataAccessService>() {
|
||||
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 {
|
||||
public RegistryRESTServices() throws JAXBException {
|
||||
jaxbManager = new RegistryJaxbManager(new RegistryNamespaceMapper());
|
||||
} catch (JAXBException e) {
|
||||
statusHandler.error("Error creating Registry jaxb manager!", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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 extends RegistryObjectType> T getRegistryObject(
|
||||
public <T extends RegistryObjectType> T getRegistryObject(
|
||||
Class<T> 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 extends Object> T getPort(String url,
|
||||
Class<T> serviceClass) {
|
||||
protected <T extends Object> T getPort(String url, Class<T> serviceClass) {
|
||||
T service = JAXRSClientFactory.create(url, serviceClass);
|
||||
Client client = (Client) Proxy.getInvocationHandler((Proxy) service);
|
||||
// Create HTTP header containing the calling registry
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -143,7 +144,7 @@ public class RegistrySOAPServices {
|
|||
}
|
||||
|
||||
/** Cache of known notification services */
|
||||
private static LoadingCache<String, NotificationListener> notificationManagerServices = CacheBuilder
|
||||
private LoadingCache<String, NotificationListener> notificationManagerServices = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<String, NotificationListener>() {
|
||||
public NotificationListener load(String key) {
|
||||
|
@ -152,7 +153,7 @@ public class RegistrySOAPServices {
|
|||
});
|
||||
|
||||
/** Cache of known lifecycle manager services */
|
||||
private static LoadingCache<String, LifecycleManager> lifecycleManagerServices = CacheBuilder
|
||||
private LoadingCache<String, LifecycleManager> lifecycleManagerServices = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<String, LifecycleManager>() {
|
||||
public LifecycleManager load(String key) {
|
||||
|
@ -161,7 +162,7 @@ public class RegistrySOAPServices {
|
|||
});
|
||||
|
||||
/** Cache of known cataloger services */
|
||||
private static LoadingCache<String, Cataloger> catalogerServices = CacheBuilder
|
||||
private LoadingCache<String, Cataloger> catalogerServices = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<String, Cataloger>() {
|
||||
public Cataloger load(String key) {
|
||||
|
@ -170,7 +171,7 @@ public class RegistrySOAPServices {
|
|||
});
|
||||
|
||||
/** Cache of known query services */
|
||||
private static LoadingCache<String, QueryManager> queryServices = CacheBuilder
|
||||
private LoadingCache<String, QueryManager> queryServices = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<String, QueryManager>() {
|
||||
public QueryManager load(String key) {
|
||||
|
@ -179,7 +180,7 @@ public class RegistrySOAPServices {
|
|||
});
|
||||
|
||||
/** Cache of known validator services */
|
||||
private static LoadingCache<String, Validator> validatorServices = CacheBuilder
|
||||
private LoadingCache<String, Validator> validatorServices = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<String, Validator>() {
|
||||
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 extends Object> T getPort(String serviceUrl,
|
||||
private <T extends Object> T getPort(String serviceUrl,
|
||||
Class<?> serviceInterface) throws RegistryServiceException {
|
||||
W3CEndpointReferenceBuilder endpointBuilder = new W3CEndpointReferenceBuilder();
|
||||
endpointBuilder.wsdlDocumentLocation(serviceUrl.toString() + WSDL);
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Path("/rest/search")
|
||||
@Path("/search")
|
||||
public interface IQueryProtocolRestService {
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Path("/rest/registryObjects/{objectId}")
|
||||
@Path("/registryObjects/{objectId}")
|
||||
public interface IRegistryObjectsRestService {
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Path("/rest/repositoryItems/{repositoryItemId}")
|
||||
@Path("/repositoryItems/{repositoryItemId}")
|
||||
public interface IRepositoryItemsRestService {
|
||||
|
||||
@GET
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -325,6 +327,7 @@ public class BandwidthDaoUtil<T extends Time, C extends Coverage> {
|
|||
* @return the adhoc subscription, or null if no matching metadata could be
|
||||
* found
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public AdhocSubscription<T,C> setAdhocMostRecentUrlAndTime(
|
||||
AdhocSubscription<T,C> adhoc, boolean mostRecent) {
|
||||
AdhocSubscription<T,C> retVal = null;
|
||||
|
@ -344,8 +347,19 @@ public class BandwidthDaoUtil<T extends Time, C extends Coverage> {
|
|||
}
|
||||
|
||||
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<PointTime> selectedDataSet = dataSetMetaDatas.get(0);
|
||||
Date checkDate = selectedDataSet.getDate();
|
||||
|
||||
for (DataSetMetaData<PointTime> dsmd: dataSetMetaDatas) {
|
||||
if (dsmd.getDate().after(checkDate)) {
|
||||
checkDate = dsmd.getDate();
|
||||
selectedDataSet = dsmd;
|
||||
}
|
||||
}
|
||||
|
||||
adhoc.setUrl(selectedDataSet.getUrl());
|
||||
retVal = adhoc;
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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">
|
||||
|
||||
<bean name="replicationConfigFileName" class="java.lang.String">
|
||||
<constructor-arg value="ebxml/notification/notificationServers_NCF.xml" />
|
||||
</bean>
|
||||
<bean id="dataDeliveryRestClient" class="com.raytheon.uf.edex.datadelivery.registry.web.DataDeliveryRESTServices"/>
|
||||
|
||||
</beans>
|
|
@ -11,5 +11,6 @@
|
|||
<constructor-arg ref="RegistryReplicationManager"/>
|
||||
<property name="registryObjectDao" ref="registryObjectDao"/>
|
||||
<property name="registryDao" ref="registryDao"/>
|
||||
<property name="registrySoapServices" ref="registryWebServiceClient"/>
|
||||
</bean>
|
||||
</beans>
|
|
@ -9,9 +9,10 @@
|
|||
<constructor-arg ref="lcmServiceImpl" />
|
||||
<constructor-arg value="ebxml/federation/federationConfig.xml"/>
|
||||
<constructor-arg ref="RegistryReplicationManager"/>
|
||||
<constructor-arg value="${NCF_ADDRESS}" />
|
||||
<property name="registryObjectDao" ref="registryObjectDao"/>
|
||||
<property name="registryDao" ref="registryDao"/>
|
||||
<property name="txTemplate" ref="metadataTxTemplate"/>
|
||||
<property name="dataDeliveryRestClient" ref="dataDeliveryRestClient"/>
|
||||
<property name="registrySoapServices" ref="registryWebServiceClient"/>
|
||||
</bean>
|
||||
</beans>
|
|
@ -1,9 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
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
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean name="replicationConfigFileName" class="java.lang.String">
|
||||
<constructor-arg value="ebxml/notification/notificationServers_WFO.xml" />
|
||||
</bean>
|
||||
</beans>
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
<bean id="RegistryReplicationManager" class="com.raytheon.uf.edex.datadelivery.registry.replication.RegistryReplicationManager">
|
||||
<constructor-arg ref="ebxmlSubscriptionsEnabled"/>
|
||||
<constructor-arg ref="replicationConfigFileName"/>
|
||||
<constructor-arg ref="registryObjectDao"/>
|
||||
<constructor-arg ref="FederatedRegistryMonitor"/>
|
||||
<constructor-arg ref="metadataTxTemplate"/>
|
||||
<constructor-arg value="${ebxml-federation-sync-threads}"/>
|
||||
<property name="dataDeliveryRestClient" ref="dataDeliveryRestClient"/>
|
||||
<property name="registrySoapClient" ref="registryWebServiceClient"/>
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
|
||||
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://cxf.apache.org/jaxws
|
||||
http://cxf.apache.org/schemas/jaxws.xsd
|
||||
http://cxf.apache.org/jaxrs
|
||||
http://cxf.apache.org/schemas/jaxrs.xsd">
|
||||
|
||||
<import resource="classpath:META-INF/cxf/cxf.xml" />
|
||||
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
|
||||
|
||||
<import resource="classpath:res/spring/registry-datadelivery.xml" />
|
||||
<import resource="classpath:res/spring/registry-replication-datadelivery.xml"/>
|
||||
|
||||
<bean id="registryDataAccessService"
|
||||
class="com.raytheon.uf.edex.datadelivery.registry.web.RegistryDataAccessService">
|
||||
<property name="registryObjectDao" ref="registryObjectDao" />
|
||||
<property name="lcm" ref="lcmServiceImpl" />
|
||||
<property name="queryDefinitionDao" ref="queryDefinitionDao" />
|
||||
</bean>
|
||||
|
||||
<bean id="registryAvailabilityService"
|
||||
class="com.raytheon.uf.edex.datadelivery.registry.web.RegistryAvailableRestService" />
|
||||
|
||||
<bean id="registryStatus" class="com.raytheon.uf.edex.datadelivery.registry.web.RegistryFederationStatus">
|
||||
<property name="registryDao" ref="registryDao"/>
|
||||
<property name="subscriptionDao" ref="subscriptionTypeDao"/>
|
||||
<property name="replicationManager" ref="RegistryReplicationManager"/>
|
||||
<property name="dataDeliveryRestClient" ref="dataDeliveryRestClient"/>
|
||||
<property name="registrySoapServices" ref="registryWebServiceClient"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- REST Service Definitions -->
|
||||
<jaxrs:server id="dataDeliveryRestServices" address="/dataDelivery">
|
||||
<jaxrs:inInterceptors>
|
||||
<ref bean="webServiceInInterceptor" />
|
||||
</jaxrs:inInterceptors>
|
||||
<jaxrs:serviceBeans>
|
||||
<ref bean="registryDataAccessService" />
|
||||
<ref bean="registryAvailabilityService" />
|
||||
<ref bean="registryStatus"/>
|
||||
</jaxrs:serviceBeans>
|
||||
</jaxrs:server>
|
||||
</beans>
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -124,6 +129,21 @@ public class NcfRegistryFederationManager extends RegistryFederationManager
|
|||
}
|
||||
}
|
||||
|
||||
protected void submitObjects(List<RegistryObjectType> 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);
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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<RegistryObjectType> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -55,6 +57,9 @@ public class NotificationServers {
|
|||
private List<NotificationHostConfiguration> registryReplicationServers;
|
||||
|
||||
public List<NotificationHostConfiguration> getRegistryReplicationServers() {
|
||||
if (registryReplicationServers == null) {
|
||||
registryReplicationServers = new ArrayList<NotificationHostConfiguration>();
|
||||
}
|
||||
return registryReplicationServers;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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,7 +313,8 @@ public class RegistryReplicationManager {
|
|||
statusHandler
|
||||
.info("Checking availability of registry at: "
|
||||
+ config.getRegistryBaseURL());
|
||||
if (RegistryRESTServices.isRegistryAvailable(config
|
||||
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<String> remoteIds = new HashSet<String>();
|
||||
statusHandler
|
||||
.info("Getting registry object Ids from local registry...");
|
||||
Collection<String> response = RegistryRESTServices
|
||||
Collection<String> 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,7 +718,8 @@ public class RegistryReplicationManager {
|
|||
statusHandler
|
||||
.info("Registry shutting down. Removing subscriptions from: ["
|
||||
+ remoteRegistryBaseURL + "]");
|
||||
RegistryRESTServices.getRegistryDataAccessService(
|
||||
dataDeliveryRestClient
|
||||
.getRegistryDataAccessService(
|
||||
remoteRegistryBaseURL)
|
||||
.removeSubscriptionsForSite(
|
||||
registry.getOwner());
|
||||
|
@ -647,7 +736,10 @@ public class RegistryReplicationManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -60,20 +61,24 @@ 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,
|
||||
RegistryObjectType objectToSubmit = restClient.getRegistryObject(
|
||||
RegistryObjectType.class, remoteURL,
|
||||
escapeObjectId(objectId));
|
||||
|
||||
if (objectToSubmit.getSlotByName(EbxmlObjectUtil.HOME_SLOT_NAME) == null) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
*
|
||||
* Set of Data Delivery specific REST services
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 10/30/2013 1538 bphillip Initial Creation
|
||||
* </pre>
|
||||
*
|
||||
* @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<String, IRegistryAvailableRestService> registryAvailabilityServiceMap = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<String, IRegistryAvailableRestService>() {
|
||||
public IRegistryAvailableRestService load(String url) {
|
||||
return getPort(url + DATA_DELIVERY_REST_SERVICE_PATH,
|
||||
IRegistryAvailableRestService.class);
|
||||
}
|
||||
});
|
||||
|
||||
/** Map of known registry data access services */
|
||||
private LoadingCache<String, IRegistryDataAccessService> registryDataAccessServiceMap = CacheBuilder
|
||||
.newBuilder().expireAfterAccess(5, TimeUnit.MINUTES)
|
||||
.build(new CacheLoader<String, IRegistryDataAccessService>() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Path("/rest/registryAvailable")
|
||||
@Path(IRegistryAvailableRestService.REGISTRY_AVAILABILITY_PATH_PREFIX)
|
||||
@Service
|
||||
@Transactional
|
||||
public class RegistryAvailableRestService implements
|
|
@ -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 <br>
|
||||
* TODO: This class really needs to be moved to a data delivery specific plugin
|
||||
* Implementation of the registry data access service interface
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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<String> 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<String> 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<SubscriptionType> 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<RegistryObjectType> 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()) {
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 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
|
||||
* </pre>
|
||||
*
|
||||
* @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<RegistryObjectType> REGISTRY_COMPARATOR = new Comparator<RegistryObjectType>() {
|
||||
@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<RegistryObjectType> 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<RegistryObjectType> registries = new ArrayList<RegistryObjectType>();
|
||||
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<RegistryObjectType> registries = new ArrayList<RegistryObjectType>();
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -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,
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<property name="registryObjectDao" ref="registryObjectDao"/>
|
||||
<property name="dynamicRefDao" ref="dynamicObjectRefDao"/>
|
||||
<property name="queryManager" ref="queryServiceImpl"/>
|
||||
<property name="registryRestClient" ref="registryRestClient"/>
|
||||
</bean>
|
||||
|
||||
<bean id="registryXpathProcessor" class="com.raytheon.uf.edex.registry.ebxml.util.xpath.RegistryXPathProcessor">
|
||||
|
|
|
@ -139,6 +139,7 @@
|
|||
value="urn:oasis:names:tc:ebxml-regrep:query:GetReferencedObject" />
|
||||
<property name="classificationNodeDao" ref="classificationNodeDao" />
|
||||
<property name="referenceResolver" ref="objectReferenceResolver" />
|
||||
<property name="registrySoapClient" ref="registryWebServiceClient"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -5,6 +5,7 @@
|
|||
<bean id="notificationListenerFactory"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationListenerFactory">
|
||||
<constructor-arg ref="EmailSender" />
|
||||
<constructor-arg ref="registryWebServiceClient"/>
|
||||
</bean>
|
||||
|
||||
<bean name="EmailSender"
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
<property name="threadPool">
|
||||
<bean id="ThreadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
|
||||
<property name="minThreads" value="2" />
|
||||
<property name="maxThreads" value="5" />
|
||||
<property name="minThreads" value="${ebxml-webserver-min-threads}" />
|
||||
<property name="maxThreads" value="${ebxml-webserver-max-threads}" />
|
||||
</bean>
|
||||
</property>
|
||||
|
||||
|
|
|
@ -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">
|
||||
|
||||
<bean id="registryRestClient" class="com.raytheon.uf.common.registry.services.RegistryRESTServices"/>
|
||||
<bean id="registryWebServiceClient" class="com.raytheon.uf.common.registry.services.RegistrySOAPServices"/>
|
||||
|
||||
<bean id="webServiceInInterceptor"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.RegistryServiceInInterceptor" />
|
||||
|
||||
<!-- QUERY -->
|
||||
<!-- Define concrete implementation of the service -->
|
||||
<bean id="queryServiceImpl"
|
||||
|
@ -12,6 +18,7 @@
|
|||
<property name="classificationNodeDao" ref="classificationNodeDao"/>
|
||||
<property name="registryObjectDao" ref="registryObjectDao"/>
|
||||
<property name="sessionFactory" ref="metadataSessionFactory"/>
|
||||
<property name="registrySoapClient" ref="registryWebServiceClient"/>
|
||||
</bean>
|
||||
|
||||
<!-- NOTIFICATION LISTENER -->
|
||||
|
@ -21,6 +28,7 @@
|
|||
<property name="lcm" ref="lcmServiceImpl" />
|
||||
<property name="registryObjectDao" ref="registryObjectDao" />
|
||||
<property name="registryDao" ref="registryDao" />
|
||||
<property name="registrySoapClient" ref="registryWebServiceClient"/>
|
||||
</bean>
|
||||
|
||||
|
||||
|
@ -75,15 +83,6 @@
|
|||
<property name="webUtil" ref="RegistryWebUtil" />
|
||||
</bean>
|
||||
|
||||
<bean id="registryDataAccessService" class="com.raytheon.uf.edex.registry.ebxml.services.rest.RegistryDataAccessService">
|
||||
<property name="registryObjectDao" ref="registryObjectDao"/>
|
||||
<property name="lcm" ref="lcmServiceImpl"/>
|
||||
<property name="queryDefinitionDao" ref="queryDefinitionDao"/>
|
||||
</bean>
|
||||
|
||||
<bean id="registryAvailabilityService"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.rest.RegistryAvailableRestService" />
|
||||
|
||||
<bean id="registryObjectsRestService"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.rest.RegistryObjectsRestService">
|
||||
<property name="registryObjectDao" ref="registryObjectDao" />
|
||||
|
|
|
@ -12,3 +12,6 @@ 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
|
||||
# Configuration of thread pool used to handle web service requests
|
||||
ebxml-webserver-min-threads=2
|
||||
ebxml-webserver-max-threads=10
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @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));
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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<Class<?>, List<String>> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<String> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Path("/rest/search")
|
||||
@Path("/search")
|
||||
@Service
|
||||
@Transactional
|
||||
public class QueryProtocolRestService implements IQueryProtocolRestService {
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Path("/rest/registryObjects/{objectId}")
|
||||
@Path("/registryObjects/{objectId}")
|
||||
@Service
|
||||
@Transactional
|
||||
public class RegistryObjectsRestService implements IRegistryObjectsRestService {
|
||||
|
|
|
@ -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
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
@Path("/rest/repositoryItems/{repositoryItemId}")
|
||||
@Path("/repositoryItems/{repositoryItemId}")
|
||||
@Service
|
||||
@Transactional
|
||||
public class RepositoryItemsRestService implements IRepositoryItemsRestService {
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
</context-param>
|
||||
|
||||
<listener>
|
||||
<listener-class>
|
||||
org.springframework.web.context.ContextLoaderListener
|
||||
</listener-class>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<filter>
|
||||
|
@ -50,12 +48,16 @@
|
|||
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>static-welcome-file</param-name>
|
||||
<param-value>/RegistryUserMenu.html</param-value>
|
||||
<param-value>/registry/RegistryInterface.html</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>static-resources-list</param-name>
|
||||
<param-value>.*\.html .*\.js .*\.css</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>disable-address-updates</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -917,4 +930,3 @@ Array.prototype.contains = function(item){
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -51,13 +51,14 @@ Date Ticket# Engineer Description
|
|||
</style>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<script type="text/javascript" src='/registry/registryUtil.js'></script>
|
||||
<script type="text/javascript" src='/registry/services/query/queryUtil.js'></script>
|
||||
<title>EDEX EBXML Registry Interface</title>
|
||||
</head>
|
||||
|
||||
<FRAMESET cols="15%, 85%">
|
||||
<FRAME id="navFram" name="navFrame" src=navigation.html>
|
||||
<FRAME id="actionFrame" name="actionFrame" src="services/query/Query.html">
|
||||
<FRAME id="navFram" name="navFrame" src=/registry/navigation.html>
|
||||
<FRAME id="actionFrame" name="actionFrame" src="/registry/services/query/Query.html">
|
||||
</FRAMESET>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,207 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<style type="text/css">
|
||||
span {font-weight:bold;}
|
||||
a {font-weight:bold;}
|
||||
td {width:200px; background: #A9A9A9;}
|
||||
th {width:200px; background: #A9A9A9;}
|
||||
button {width:190px;}
|
||||
input{width:300px;}
|
||||
table {border:0;}
|
||||
select {width:200px;}
|
||||
body { font-family: Helvetica;
|
||||
margin-left: 75px;
|
||||
margin-right: 75px;
|
||||
background: #D3D3D3;}
|
||||
</style>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<script type="text/javascript" src='/registry/registryUtil.js'></script>
|
||||
<script type="text/javascript" src='/dataDeliveryUtil.js'></script>
|
||||
<title>Federation Status</title>
|
||||
</head>
|
||||
|
||||
<body onload="populate()">
|
||||
<h3>Federation Status</h3>
|
||||
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Federated:</td>
|
||||
<td><span id="federatedSpan">[Unknown]</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Processing Subscriptions:</td>
|
||||
<td><span id="processSubscriptionsSpan">[Unknown]</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>My Registry ID:</td>
|
||||
<td><span id="myRegistryIdSpan">[Unknown]</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br><br>
|
||||
|
||||
<table border ="1">
|
||||
<tr>
|
||||
<td>Resubmit Subscriptions To:</td>
|
||||
<td><select id="resubmitSubsToRegistrySelect"></select></td>
|
||||
<td style='width:90px'><button type="button" style='width:90px' onclick='resubmitSubs()'>Resubmit</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Synchronize with Registry:</td>
|
||||
<td><select id="syncWithRegistrySelect"></select></td>
|
||||
<td style='width:90px'><button type="button" style='width:90px' onclick="sync()">Sync</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Subscribe To Registry:</td>
|
||||
<td><select id="subscribeToRegistrySelect"></select></td>
|
||||
<td style='width:90px'><button type="button" style='width:90px' onclick="subscribe()">Subscribe</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Unsubscribe From Registry:</td>
|
||||
<td><select id="unsubscribeFromRegistrySelect"></select></td>
|
||||
<td style='width:90px'><button type="button" style='width:90px' onclick="unsubscribe()">Unsubscribe</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
<b>My Registry is Subscribed To:</b>
|
||||
<span id="subscribedToRegistriesSpan"></span>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
<b>Registries Subscribing to My Registry:</b>
|
||||
<span id="subscribedToRegistries"></span>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<b>Federation Members:<b>
|
||||
<span id="federationMembersSpan"></span>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<b>Object Types Currently Replicated:</b>
|
||||
<span id="replicatedObjectListSpan"></span>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
</body>
|
||||
|
||||
<script language="JavaScript">
|
||||
|
||||
function subscribe(){
|
||||
var registryId = getComboValue("subscribeToRegistrySelect")
|
||||
callRestService("dataDelivery/status/subscribeToRegistry",registryId);
|
||||
location.reload(false)
|
||||
}
|
||||
|
||||
function resubmitSubs(){
|
||||
var registryId = getComboValue("resubmitSubsToRegistrySelect")
|
||||
callRestService("dataDelivery/status/subscribeToRegistry",registryId);
|
||||
}
|
||||
|
||||
function unsubscribe(){
|
||||
var registryId = getComboValue("unsubscribeFromRegistrySelect")
|
||||
callRestService("dataDelivery/status/unsubscribeFromRegistry",registryId);
|
||||
location.reload(false)
|
||||
}
|
||||
|
||||
function sync(){
|
||||
var registryId = getComboValue("syncWithRegistrySelect")
|
||||
callRestService("dataDelivery/status/syncWithRegistry",registryId);
|
||||
}
|
||||
|
||||
function populate(){
|
||||
var isFederated = callRestService("dataDelivery/status/isFederated")
|
||||
document.getElementById("federatedSpan").innerHTML=isFederated
|
||||
document.getElementById("processSubscriptionsSpan").innerHTML=callRestService("dataDelivery/status/isProcessingSubscriptions")
|
||||
if(isFederated == "true"){
|
||||
var myRegistryId=callRestService("dataDelivery/status/getMyRegistryInfo").split("\n")[0].split(",")[0]
|
||||
document.getElementById("myRegistryIdSpan").innerHTML=myRegistryId
|
||||
var subscriptionCandidates = new Array();
|
||||
var memberHTML = "<table border='1'><tr><th>Site</th><th>Base URL</th><th>Conformance Profile</th><th>Specification Version</th></tr>"
|
||||
var registries = callRestService("dataDelivery/status/getFederationMembers").split("\n")
|
||||
var federationMembers = new Array()
|
||||
var subscribedTo=new Array()
|
||||
var subscribedFrom=new Array()
|
||||
for(var i = 0; i < registries.length-1;i++){
|
||||
var tokens = registries[i].split(",")
|
||||
memberHTML+="<tr>"
|
||||
memberHTML+="<td>"+tokens[0]+"</td>"
|
||||
memberHTML+="<td>"+tokens[1]+"</td>"
|
||||
memberHTML+="<td>"+tokens[2]+"</td>"
|
||||
memberHTML+="<td>"+tokens[3]+"</td>"
|
||||
memberHTML+="</tr>"
|
||||
federationMembers[i]=tokens[0]
|
||||
}
|
||||
memberHTML+="</table>"
|
||||
document.getElementById("federationMembersSpan").innerHTML=memberHTML
|
||||
|
||||
memberHTML = "<table border='1'><tr><th>Site</th><th>Base URL</th><th>Conformance Profile</th><th>Specification Version</th></tr>"
|
||||
registries = callRestService("dataDelivery/status/getRegistriesSubscribedTo").split("\n")
|
||||
for(var i = 0; i < registries.length-1;i++){
|
||||
var tokens = registries[i].split(",")
|
||||
memberHTML+="<tr>"
|
||||
memberHTML+="<td>"+tokens[0]+"</td>"
|
||||
memberHTML+="<td>"+tokens[1]+"</td>"
|
||||
memberHTML+="<td>"+tokens[2]+"</td>"
|
||||
memberHTML+="<td>"+tokens[3]+"</td>"
|
||||
memberHTML+="</tr>"
|
||||
subscribedTo[i] = tokens[0]
|
||||
}
|
||||
memberHTML+="</table>"
|
||||
document.getElementById("subscribedToRegistriesSpan").innerHTML=memberHTML
|
||||
|
||||
memberHTML = "<table border='1'><tr><th>Site</th><th>Base URL</th><th>Conformance Profile</th><th>Specification Version</th></tr>"
|
||||
registries = callRestService("dataDelivery/status/getRegistrySubscribing").split("\n")
|
||||
for(var i = 0; i < registries.length-1;i++){
|
||||
var tokens = registries[i].split(",")
|
||||
memberHTML+="<tr>"
|
||||
memberHTML+="<td>"+tokens[0]+"</td>"
|
||||
memberHTML+="<td>"+tokens[1]+"</td>"
|
||||
memberHTML+="<td>"+tokens[2]+"</td>"
|
||||
memberHTML+="<td>"+tokens[3]+"</td>"
|
||||
memberHTML+="</tr>"
|
||||
subscribedFrom[i]=tokens[0]
|
||||
}
|
||||
memberHTML+="</table>"
|
||||
document.getElementById("subscribedToRegistries").innerHTML=memberHTML
|
||||
|
||||
var objectTypes = callRestService("dataDelivery/status/getObjectTypesReplicated").split("\n")
|
||||
var objectTypeHTML = "<table border='1'><tr><th style='width:30px;'></th><th>Object Type</th></tr>"
|
||||
for(var i = 0; i < objectTypes.length-1;i++){
|
||||
objectTypeHTML+="<tr>"
|
||||
objectTypeHTML+="<td style='width:30px;'>"+(i+1)+"</td>"
|
||||
objectTypeHTML+="<td>"+objectTypes[i]+"</td>"
|
||||
objectTypeHTML+="</tr>"
|
||||
}
|
||||
|
||||
for(var i = 0; i < federationMembers.length;i++){
|
||||
var member=federationMembers[i]
|
||||
if(subscribedTo.indexOf(member)== -1 && member!=myRegistryId){
|
||||
addOptionToList("subscribeToRegistrySelect",member,member)
|
||||
}
|
||||
if(member!=myRegistryId){
|
||||
addOptionToList("syncWithRegistrySelect",member,member)
|
||||
}
|
||||
if(subscribedTo.indexOf(member) != -1){
|
||||
addOptionToList("unsubscribeFromRegistrySelect",member,member)
|
||||
addOptionToList("resubmitSubsToRegistrySelect",member,member)
|
||||
}
|
||||
}
|
||||
objectTypeHTML+="</table>";
|
||||
document.getElementById("replicatedObjectListSpan").innerHTML=objectTypeHTML
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</html>
|
|
@ -48,14 +48,17 @@ Date Ticket# Engineer Description
|
|||
</style>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<script type="text/javascript" src='/registry/registryUtil.js'></script>
|
||||
<script type="text/javascript" src='/registry/services/query/queryUtil.js'></script>
|
||||
<title>NAVIGATION LINKS</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a href="services/query/Query.html" target="actionFrame">Query Interface</a>
|
||||
<a href="/registry/services/query/Query.html" target="actionFrame">Query Interface</a>
|
||||
<br>
|
||||
<a href="../RegistrySubscriptionBackup.html" target="actionFrame">Subscription Backup</a>
|
||||
<a href="/RegistrySubscriptionBackup.html" target="actionFrame">Subscription Backup</a>
|
||||
<br>
|
||||
<a href="/registry/federation/status.html" target="actionFrame">Federation Status</a>
|
||||
|
||||
</body>
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -48,6 +48,7 @@ Date Ticket# Engineer Description
|
|||
</style>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<script type="text/javascript" src='/registry/registryUtil.js'></script>
|
||||
<script type="text/javascript" src='/registry/services/query/queryUtil.js'></script>
|
||||
<title>Registry Query Interface</title>
|
||||
</head>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* @version 1
|
||||
*/
|
||||
function getValidQueryTypes(){
|
||||
var tokens = callDataAccessService("getQueries","").split("\n")
|
||||
var tokens = callDataAccessService("getQueries").split("\n")
|
||||
var selectBox = document.getElementById("queryTypeInput")
|
||||
for(var i=0;i<tokens.length;i++){
|
||||
if(tokens[i].length != 0){
|
||||
|
@ -52,7 +52,7 @@
|
|||
function getQueryParameters(){
|
||||
var selectBox = document.getElementById("queryTypeInput")
|
||||
var value = selectBox.options[selectBox.selectedIndex].value
|
||||
var responseTokens = callDataAccessService("getParametersForQuery",value).split("\n")
|
||||
var responseTokens = callDataAccessServiceWithArg("getParametersForQuery",value).split("\n")
|
||||
|
||||
var gen = "<table>"
|
||||
var paramType=""
|
||||
|
@ -84,21 +84,3 @@
|
|||
gen+="</table><br><input type=\"submit\" value=\"Submit\"/>"
|
||||
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
|
||||
}
|
|
@ -8,10 +8,12 @@
|
|||
http://cxf.apache.org/jaxrs
|
||||
http://cxf.apache.org/schemas/jaxrs.xsd">
|
||||
|
||||
<import resource="classpath:META-INF/cxf/cxf.xml" />
|
||||
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
|
||||
|
||||
<import resource="file:///${edex.home}/conf/spring/edex-db.xml" />
|
||||
<import resource="classpath:res/spring/eventbus-common.xml" />
|
||||
<import resource="classpath:res/spring/ebxml.xml" />
|
||||
<import resource="classpath:res/spring/ebxml-webservices.xml" />
|
||||
<import resource="classpath:res/spring/ebxml-validator-plugins.xml" />
|
||||
<import resource="classpath:res/spring/ebxml-querytypes.xml" />
|
||||
<import resource="classpath:res/spring/ebxml-registry-dao.xml" />
|
||||
|
@ -20,12 +22,9 @@
|
|||
<import resource="classpath:res/spring/ebxml-thrift-client.xml" />
|
||||
<import resource="classpath:res/spring/ebxml-xacml.xml" />
|
||||
<import resource="classpath:res/spring/ebxml-impl.xml" />
|
||||
|
||||
<import resource="classpath:META-INF/cxf/cxf.xml" />
|
||||
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
|
||||
|
||||
<bean id="webServiceInInterceptor"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.RegistryServiceInInterceptor" />
|
||||
<import resource="classpath*:res/spring/ebxml-customQueryPlugin.xml"/>
|
||||
<import resource="classpath:res/spring/ebxml-webservices.xml" />
|
||||
<import resource="classpath*:res/spring/webservices.xml"/>
|
||||
|
||||
<bean id="QueryServiceWrapper"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImplWrapper">
|
||||
|
@ -48,17 +47,6 @@
|
|||
<constructor-arg ref="catalogerServiceImpl" />
|
||||
</bean>
|
||||
|
||||
<jaxws:server id="RegistryRequest"
|
||||
serviceClass="com.raytheon.uf.common.registry.IRegistryRequestService"
|
||||
address="/registryRequest">
|
||||
<jaxws:inInterceptors>
|
||||
<ref bean="webServiceInInterceptor" />
|
||||
</jaxws:inInterceptors>
|
||||
<jaxws:serviceBean>
|
||||
<ref bean="routeWrapper" />
|
||||
</jaxws:serviceBean>
|
||||
</jaxws:server>
|
||||
|
||||
<!-- SOAP Service definitions -->
|
||||
<jaxws:server id="QueryService" address="/queryManager">
|
||||
<jaxws:inInterceptors>
|
||||
|
@ -107,13 +95,11 @@
|
|||
<!-- End Soap Service Definitions -->
|
||||
|
||||
<!-- REST Service Definitions -->
|
||||
<jaxrs:server id="registryRestServices" address="/">
|
||||
<jaxrs:server id="registryRestServices" address="/rest">
|
||||
<jaxrs:inInterceptors>
|
||||
<ref bean="webServiceInInterceptor" />
|
||||
</jaxrs:inInterceptors>
|
||||
<jaxrs:serviceBeans>
|
||||
<ref bean="registryDataAccessService" />
|
||||
<ref bean="registryAvailabilityService" />
|
||||
<ref bean="registryObjectsRestService" />
|
||||
<ref bean="repositoryObjectsRestService" />
|
||||
<ref bean="queryProtocolRestService" />
|
||||
|
@ -123,5 +109,4 @@
|
|||
</jaxrs:serviceBeans>
|
||||
</jaxrs:server>
|
||||
<!-- End REST Endpoint definitions -->
|
||||
|
||||
</beans>
|
|
@ -73,13 +73,6 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="gov.noaa.nws.ncep.common.dataplugin.ncccfp"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="gov.noaa.nws.ncep.common.dataplugin.ncscat"
|
||||
download-size="0"
|
||||
|
@ -185,13 +178,6 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="gov.noaa.nws.ncep.edex.plugin.ncccfp"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="gov.noaa.nws.ncep.edex.plugin.ncgrib"
|
||||
download-size="0"
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>gov.noaa.nws.ncep.common.dataplugin.ncccfp</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -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
|
|
@ -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
|
|
@ -1 +0,0 @@
|
|||
gov.noaa.nws.ncep.common.dataplugin.ncccfp.NcccfpRecord
|
|
@ -1,4 +0,0 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
* 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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
}
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
* 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
|
||||
* </pre>
|
||||
*
|
||||
* @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";
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
/**
|
||||
* Set of DAO methods for NCCCFP data.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* 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)
|
||||
* </pre>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>gov.noaa.nws.ncep.edex.plugin.ncccfp</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -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
|
|
@ -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
|
|
@ -1,2 +0,0 @@
|
|||
gov.noaa.nws.ncep.common.dataplugin.ncccfp.NcccfpRecord
|
||||
gov.noaa.nws.ncep.common.dataplugin.ncccfp.NcccfpLocation
|
|
@ -1,5 +0,0 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
res/
|
|
@ -1,23 +0,0 @@
|
|||
<beans
|
||||
xmlns="http://www.springframework.org/schema/beans"
|
||||
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">
|
||||
|
||||
|
||||
<bean id="ncccfpPluginName" class="java.lang.String">
|
||||
<constructor-arg type="java.lang.String" value="ncccfp" />
|
||||
</bean>
|
||||
|
||||
<bean id="ncccfpProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
|
||||
<property name="pluginName" ref="ncccfpPluginName" />
|
||||
<property name="pluginFQN" value="gov.noaa.nws.ncep.common.dataplugin.ncccfp" />
|
||||
<property name="dao" value="gov.noaa.nws.ncep.common.dataplugin.ncccfp.dao.NcccfpDao" />
|
||||
<property name="record" value="gov.noaa.nws.ncep.common.dataplugin.ncccfp.NcccfpRecord" />
|
||||
</bean>
|
||||
|
||||
<bean factory-bean="pluginRegistry" factory-method="register">
|
||||
<constructor-arg ref="ncccfpPluginName"/>
|
||||
<constructor-arg ref="ncccfpProperties"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -1,68 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
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
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean id="ncccfpDecoder" class="gov.noaa.nws.ncep.edex.plugin.ncccfp.decoder.NcccfpDecoder">
|
||||
<constructor-arg ref="ncccfpPluginName"/>
|
||||
</bean>
|
||||
<bean id="ncccfpSeparator" class="gov.noaa.nws.ncep.edex.plugin.ncccfp.decoder.NcccfpSeparator" />
|
||||
|
||||
<bean id="ncccfpDistRegistry" factory-bean="distributionSrv"
|
||||
factory-method="register">
|
||||
<constructor-arg value="ncccfp" />
|
||||
<constructor-arg value="jms-dist:queue:Ingest.ncccfp" />
|
||||
</bean>
|
||||
|
||||
<bean id="ncccfpCamelRegistered" factory-bean="contextManager"
|
||||
factory-method="register" depends-on="persistCamelRegistered">
|
||||
<constructor-arg ref="ncccfp-camel"/>
|
||||
</bean>
|
||||
|
||||
<camelContext id="ncccfp-camel"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler"
|
||||
autoStartup="false">
|
||||
|
||||
<endpoint id="ncccfpFileEndpoint" uri="file:${edex.home}/data/sbn/ncccfp?noop=true&idempotent=false" />
|
||||
|
||||
<route id="ncccfpFileConsumerRoute">
|
||||
<from ref="ncccfpFileEndpoint" />
|
||||
<bean ref="fileToString" />
|
||||
<setHeader headerName="pluginName">
|
||||
<constant>ncccfp</constant>
|
||||
</setHeader>
|
||||
<to uri="jms-durable:queue:Ingest.ncccfp" />
|
||||
</route>
|
||||
|
||||
<!-- Begin Ncccfp routes -->
|
||||
<route id="ncccfpIngestRoute">
|
||||
<from uri="jms-durable:queue:Ingest.ncccfp" />
|
||||
<setHeader headerName="pluginName">
|
||||
<constant>ncccfp</constant>
|
||||
</setHeader>
|
||||
<doTry>
|
||||
<pipeline>
|
||||
<bean ref="stringToFile" />
|
||||
<split streaming="true">
|
||||
<method bean="ncccfpSeparator" method="separate" />
|
||||
<doTry>
|
||||
<pipeline>
|
||||
<bean ref="ncccfpDecoder" method="decode" />
|
||||
<to uri="direct-vm:indexAlert" />
|
||||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:ncccfp?level=ERROR" />
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</split>
|
||||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:ncccfp?level=ERROR" />
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
</camelContext>
|
||||
</beans>
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
* 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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @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];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -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
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 09/03/2009 155 F. J. Yen From Raytheon's CCFP; modify for NCCCFP
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @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<String> splitAreas;
|
||||
|
||||
/** List of records contained in file */
|
||||
private List<String> bodyRecords;
|
||||
|
||||
/** List of records contained in file */
|
||||
private List<String> records;
|
||||
|
||||
private Iterator<String> 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<String>();
|
||||
records = new ArrayList<String>();
|
||||
}
|
||||
|
||||
@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<String> splitRecord(String obs) {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<purgeRuleSet>
|
||||
<defaultRule>
|
||||
<period>02-00:00:00</period>
|
||||
</defaultRule>
|
||||
</purgeRuleSet>
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<requestPatterns xmlns:ns2="group">
|
||||
<regex>^FAUS2[789] KKCI.*</regex>
|
||||
</requestPatterns>
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -6,7 +6,10 @@ set RC="$?"
|
|||
|
||||
#if installed, set the variable
|
||||
if ( "${RC}" == "0" ) then
|
||||
set CLI_INSTALL=/awips2/fxa
|
||||
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
|
||||
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<bean id="notificationListenerFactory"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.notification.MockNotificationListenerFactory">
|
||||
<constructor-arg ref="EmailSender" />
|
||||
<constructor-arg ref="registryWebServiceClient"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue