Omaha #2536 merge autobldsrv into text plugins
Change-Id: I4a149b9f16dcc868274bca7e2f4de3d4dad78e52 Former-commit-id: 5ae9b617dfeb4ff809916706ac1e849f762bd5a2
This commit is contained in:
parent
e945207c1d
commit
5d0eaf02ab
41 changed files with 474 additions and 600 deletions
75
deltaScripts/14.4.1/DR2536/moveSubscriptions.sh
Executable file
75
deltaScripts/14.4.1/DR2536/moveSubscriptions.sh
Executable file
|
@ -0,0 +1,75 @@
|
|||
#!/bin/bash
|
||||
|
||||
# moves subscriptions tables from metadata db to fxatext db
|
||||
|
||||
function rowcount {
|
||||
psql -U awips -d $1 -c "select count(*) from $2"
|
||||
}
|
||||
|
||||
function getSeqStart {
|
||||
CURR_ID=$(psql -U awips metadata -Aqzt0 -c "select max(id) from $1")
|
||||
if [[ -z $CURR_ID ]]
|
||||
then
|
||||
echo 1
|
||||
else
|
||||
echo $(( $CURR_ID + 1 ))
|
||||
fi
|
||||
}
|
||||
|
||||
BACKUPFILE=sub_dump.bak
|
||||
MODIFIED_BACKUP=sub_modified.bak
|
||||
|
||||
echo "Moving subscriptions tables from metadata to fxatext"
|
||||
|
||||
OLD_SUB_COUNT=$(rowcount metadata subscription.subscriptions)
|
||||
OLD_REP_COUNT=$(rowcount metadata subscription.replacements)
|
||||
|
||||
SUB_SEQ_START=$(getSeqStart subscription.subscriptions)
|
||||
REQ_SEQ_START=$(getSeqStart subscription.replacements)
|
||||
|
||||
pg_dump -U awips -t subscription.subscriptions -t subscription.replacements metadata > $BACKUPFILE
|
||||
if [[ $? != 0 ]]
|
||||
then
|
||||
echo "subscription tables backup failed, aborting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed 's/\(\(TABLE\s\+\)\|\(Schema:\s\+\)\|=\s\+\)subscription\([^s]\)/\1public\4/' $BACKUPFILE > $MODIFIED_BACKUP
|
||||
if [[ $? != 0 ]]
|
||||
then
|
||||
echo "subscription tables backup editing failed, aborting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
psql -U awips fxatext < $MODIFIED_BACKUP
|
||||
if [[ $? != 0 ]]
|
||||
then
|
||||
echo "Subscription tables restore failed, backup located at $BACKUPFILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NEW_SUB_COUNT=$(rowcount fxatext public.subscriptions)
|
||||
NEW_REP_COUNT=$(rowcount fxatext public.replacements)
|
||||
|
||||
if [[ $OLD_SUB_COUNT != $NEW_SUB_COUNT || $OLD_REP_COUNT != $NEW_REP_COUNT ]]
|
||||
then
|
||||
echo "Row counts do not match before and after table move"
|
||||
echo "Subscriptions before: \n$OLD_SUB_COUNT"
|
||||
echo "Subscriptions after: \n$NEW_SUB_COUNT"
|
||||
echo "Replacements before: \n$OLD_REP_COUNT"
|
||||
echo "Replacements after: \n$NEW_REP_COUNT"
|
||||
echo "skipping old table cleanup, backup exists at $BACKUPFILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Creating sequences"
|
||||
psql -U awips -d fxatext -c "CREATE SEQUENCE subscriptionseq START WITH $SUB_SEQ_START"
|
||||
psql -U awips -d fxatext -c "CREATE SEQUENCE replacementseq START WITH $REQ_SEQ_START"
|
||||
|
||||
echo "Cleaning up old tables"
|
||||
psql -U awips -d metadata -c 'DROP SCHEMA subscription CASCADE'
|
||||
psql -U awips -d metadata -c "DELETE from awips.plugin_info WHERE name = 'com.raytheon.edex.autobldsrv'"
|
||||
|
||||
rm $MODIFIED_BACKUP
|
||||
rm $BACKUPFILE
|
||||
echo "Done moving subscription tables"
|
|
@ -1,33 +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.
|
||||
**/
|
||||
-- Contains SQL/DDL statements to create the tables used by the subscription service
|
||||
--
|
||||
-- Database: metadata
|
||||
-- Schema: subscription
|
||||
-- Tables: subscriptions
|
||||
-- replacements
|
||||
--
|
||||
-- File History:
|
||||
-- 08Dec2008 1709 MW Fegan replaced existing DDL with DDL for new
|
||||
-- subscription tables.
|
||||
|
||||
-- Create the SUBSCRIPTION schema
|
||||
create schema subscription authorization awips;
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<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>com.raytheon.edex.autobldsrv</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:09:13 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,20 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Autobldsrv Plug-in
|
||||
Bundle-SymbolicName: com.raytheon.edex.autobldsrv
|
||||
Bundle-Version: 1.12.1174.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Export-Package: com.raytheon.edex.services
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Import-Package: com.raytheon.edex.uengine.runners,
|
||||
com.raytheon.edex.util,
|
||||
org.apache.commons.logging
|
||||
Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.message;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.util;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.edex.core;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.status;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.edex.database;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.dataquery;bundle-version="1.0.0",
|
||||
org.quartz;bundle-version="1.8.6"
|
|
@ -1,2 +0,0 @@
|
|||
com.raytheon.edex.autobldsrv.data.ReplacementRecord
|
||||
com.raytheon.edex.autobldsrv.data.SubscriptionRecord
|
|
@ -1,6 +0,0 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
res/,\
|
||||
resources/
|
|
@ -1,51 +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="subscriptionDao" class="com.raytheon.edex.subscription.dao.SubscriptionDAO">
|
||||
<property name="subscriptionNotifyURI" value="jms-generic:topic:subscription.notify"/>
|
||||
</bean>
|
||||
|
||||
<!-- define the bean that handles ldad watch/warn script handling -->
|
||||
<bean id="ldadScriptRunner" class="com.raytheon.edex.services.ScriptRunner">
|
||||
<property name="type" value="ldad" />
|
||||
</bean>
|
||||
<bean id="subscriptionDbPluginProperties" class="com.raytheon.uf.edex.database.DatabasePluginProperties">
|
||||
<property name="pluginFQN" value="com.raytheon.edex.autobldsrv" />
|
||||
<property name="database" value="metadata" />
|
||||
</bean>
|
||||
<bean id="subscriptionDbRegistered" factory-bean="dbPluginRegistry" factory-method="register"
|
||||
depends-on="metadataTxManager">
|
||||
<constructor-arg value="com.raytheon.edex.autobldsrv"/>
|
||||
<constructor-arg ref="subscriptionDbPluginProperties"/>
|
||||
</bean>
|
||||
<camelContext id="subscription-common-camel"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
<route id="subscriptionNotify">
|
||||
<from uri="jms-generic:topic:subscription.notify"/>
|
||||
<doTry>
|
||||
<bean ref="subscriptionDao" method="updateCache" />
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:subscription?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
<!-- LDAD (watch/warn) triggered script runner, internal use only -->
|
||||
<route id="ldadWatchWarnDirect">
|
||||
<from uri="direct-vm:ldadWatchWarnDirect"/>
|
||||
<doTry>
|
||||
<bean ref="ldadScriptRunner" method="runScripts" />
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:subscription?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
</camelContext>
|
||||
</beans>
|
|
@ -1,21 +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="subscription" class="com.raytheon.edex.services.SubscribeManager"/>
|
||||
<camelContext id="subscription-camel"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
<endpoint id="subscriptionHTTP_from"
|
||||
uri="jetty:http://0.0.0.0:${HTTP_PORT}/services/subscribe?disableStreamCache=true" />
|
||||
|
||||
<!-- SubscriptionSrv routes -->
|
||||
<route id="subscriptionHTTP">
|
||||
<from uri="ref:subscriptionHTTP_from" />
|
||||
<bean ref="subscription" method="processRequest"/>
|
||||
<bean ref="serializationUtil" method="marshalToXml" />
|
||||
</route>
|
||||
</camelContext>
|
||||
</beans>
|
|
@ -1,63 +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">
|
||||
|
||||
<!-- define the bean that handles Quartz scheduled script running -->
|
||||
<bean id="timerScriptRunner" class="com.raytheon.edex.services.ScriptRunner" >
|
||||
<property name="type" value="timer" />
|
||||
</bean>
|
||||
|
||||
<!-- define the bean that handles data arrival script running -->
|
||||
<!--
|
||||
<bean id="dataScriptRunner" class="com.raytheon.edex.services.ScriptRunner">
|
||||
<property name="type" value="data" />
|
||||
</bean>
|
||||
-->
|
||||
<camelContext id="subscription-camel"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
|
||||
<!-- Refer to edex.xml for name/location of properties file -->
|
||||
<endpoint id="runnerCron" uri="quartz://runner/runnerScheduled/?cron=${subscription.cron}"/>
|
||||
|
||||
<!-- Quartz Timer triggered script runner -->
|
||||
<route id="runnerScheduled">
|
||||
<from uri="runnerCron" />
|
||||
<doTry>
|
||||
<bean ref="timerScriptRunner" method="runScripts" />
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:subscription?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
<!-- Data Arrival triggered script runner -->
|
||||
<!--
|
||||
<route id="dataArrival">
|
||||
<from uri="jms-generic:queue:subscriptions" />
|
||||
<doTry>
|
||||
<bean ref="dataScriptRunner" method="runScripts" />
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:subscription?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
-->
|
||||
|
||||
<!-- LDAD (watch/warn) triggered script runner -->
|
||||
<route id="ldadWatchWarn">
|
||||
<from uri="jms-durable:queue:watchwarn"/>
|
||||
<doTry>
|
||||
<bean ref="ldadScriptRunner" method="runScripts" />
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:subscription?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
</camelContext>
|
||||
</beans>
|
|
@ -1,24 +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.
|
||||
**/
|
||||
/**
|
||||
* Contains classes mapped to tables in the subscription database
|
||||
* schema.
|
||||
*/
|
||||
package com.raytheon.edex.autobldsrv.data;
|
|
@ -1,24 +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.
|
||||
**/
|
||||
/**
|
||||
* Contains classes providing access to the subscription database schema.
|
||||
*
|
||||
*/
|
||||
package com.raytheon.edex.subscription.dao;
|
|
@ -1,25 +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.
|
||||
**/
|
||||
/**
|
||||
* Contains classes implementing subscription service actions.
|
||||
* Includes the interfaces and abstract base classes and a factory
|
||||
* class for generating the appropriate actions.
|
||||
*/
|
||||
package com.raytheon.edex.subscription.runners;
|
|
@ -1,23 +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.
|
||||
**/
|
||||
/**
|
||||
* Contains utility classes supporting the subscription service.
|
||||
*/
|
||||
package com.raytheon.edex.subscription.util;
|
|
@ -13,4 +13,6 @@ com.raytheon.uf.common.dataplugin.text.db.StdTextProductId
|
|||
com.raytheon.uf.common.dataplugin.text.db.TextProductInfo
|
||||
com.raytheon.uf.common.dataplugin.text.db.TextProductInfoPK
|
||||
com.raytheon.uf.common.dataplugin.text.db.WatchWarn
|
||||
com.raytheon.uf.common.dataplugin.text.db.WatchWarnPK
|
||||
com.raytheon.uf.common.dataplugin.text.db.WatchWarnPK
|
||||
com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord
|
||||
com.raytheon.uf.common.dataplugin.text.db.ReplacementRecord
|
|
@ -17,14 +17,16 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.autobldsrv.data;
|
||||
package com.raytheon.uf.common.dataplugin.text.db;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
@ -36,7 +38,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Data object for subscription record substitution attribute
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -44,7 +46,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
*
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to common.dataplugin.text
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -53,7 +55,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name = "replacements", schema = "subscription")
|
||||
@SequenceGenerator(initialValue = 1, name = ReplacementRecord.SEQ_GEN_NAME, sequenceName = "replacementseq")
|
||||
@Table(name = "replacements")
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
|
@ -61,10 +64,12 @@ public class ReplacementRecord extends PersistableDataObject {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final String SEQ_GEN_NAME = "REPLACEMENT_GENERATOR";
|
||||
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = SEQ_GEN_NAME)
|
||||
private long id;
|
||||
|
||||
@ManyToOne
|
|
@ -17,9 +17,8 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.autobldsrv.data;
|
||||
package com.raytheon.uf.common.dataplugin.text.db;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
@ -30,8 +29,10 @@ import javax.persistence.Column;
|
|||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@ -40,8 +41,6 @@ import javax.xml.bind.annotation.XmlAttribute;
|
|||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.quartz.CronExpression;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
@ -58,6 +57,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 18Nov2008 1709 MW Fegan Initial creation
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to common.dataplugin.text
|
||||
* moved matchesTrigger() to TriggerMatcher class
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,7 +66,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* @version 1.0
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "subscriptions", schema = "subscription", uniqueConstraints = @UniqueConstraint(columnNames = {
|
||||
@SequenceGenerator(initialValue = 1, name = SubscriptionRecord.SEQ_GEN_NAME, sequenceName = "subscriptionseq")
|
||||
@Table(name = "subscriptions", uniqueConstraints = @UniqueConstraint(columnNames = {
|
||||
"type", "trigger", "runner", "script", "filepath", "arguments" }))
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
|
@ -75,10 +77,12 @@ public class SubscriptionRecord extends PersistableDataObject implements
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final String SEQ_GEN_NAME = "SUBSCRIPTION_GENERATOR";
|
||||
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = SEQ_GEN_NAME)
|
||||
private long id;
|
||||
|
||||
@XmlAttribute
|
||||
|
@ -273,58 +277,6 @@ public class SubscriptionRecord extends PersistableDataObject implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the specified trigger value matches the trigger value of
|
||||
* this SubscriptionRecord.
|
||||
*
|
||||
* @param trigger
|
||||
* the trigger value to compare
|
||||
*
|
||||
* @return true if the trigger matches, false otherwise
|
||||
*/
|
||||
public boolean matchesTrigger(String trigger) {
|
||||
boolean retVal = false;
|
||||
if ("timer".equalsIgnoreCase(this.type)) {
|
||||
try {
|
||||
long date = Long.parseLong(trigger);
|
||||
CronExpression cexp = new CronExpression(this.trigger);
|
||||
retVal = cexp.isSatisfiedBy(new Date(date));
|
||||
} catch (Exception e) {
|
||||
retVal = false;
|
||||
}
|
||||
} else if ("ldad".equalsIgnoreCase(this.type)) {
|
||||
/*
|
||||
* Legacy code has these patterns: TextString patterns[] = {
|
||||
* productId, productId.left(6) + "XXX", "CCC" + productId.mid(3,3)
|
||||
* + "XXX", productId.left(3) + "NNNXXX", productId.left(3) + "NNN"
|
||||
* + productId.right(productId.length() - 6) };
|
||||
*/
|
||||
// System.out.println("matching trigger=" + trigger +
|
||||
// " -- this.trigger="+ this.trigger +
|
||||
// " -- trigger.substr(0,6)+\"XXX\"="+trigger.substring(0,6)+"XXX" +
|
||||
// " -- \"CCC\"+trigger.substring(3,6)+\"XXX\"="+"CCC"+trigger.substring(3,
|
||||
// 6)+"XXX" +
|
||||
// " -- trigger.substring(0,3)+\"NNNXXX\"=" + trigger.substring(0,
|
||||
// 3)+"NNNXXX" +
|
||||
// " -- trigger.substring(0, 3)+\"NNN\"+trigger.substring(6)="+trigger.substring(0,
|
||||
// 3)+"NNN"+trigger.substring(6));
|
||||
retVal = (trigger.equalsIgnoreCase(this.trigger))
|
||||
|| ((trigger.substring(0, 6) + "XXX")
|
||||
.equalsIgnoreCase(this.trigger))
|
||||
|| (("CCC" + trigger.substring(3, 6) + "XXX")
|
||||
.equalsIgnoreCase(this.trigger))
|
||||
|| ((trigger.substring(0, 3) + "NNNXXX")
|
||||
.equalsIgnoreCase(this.trigger))
|
||||
|| ((trigger.substring(0, 3) + "NNN" + trigger.substring(6))
|
||||
.equalsIgnoreCase(this.trigger) || (this.trigger
|
||||
.startsWith(trigger)));
|
||||
} else {
|
||||
String pattern = this.trigger.replaceAll("\\*", ".+");
|
||||
retVal = trigger.matches(pattern);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
|
@ -28,13 +28,6 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.edex.autobldsrv"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.edex.notifysrv"
|
||||
download-size="0"
|
||||
|
@ -97,7 +90,7 @@
|
|||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.common.localization.python"
|
||||
download-size="0"
|
||||
|
@ -110,4 +103,5 @@
|
|||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
|
|
@ -20,7 +20,8 @@ Export-Package: com.raytheon.uf.edex.plugin.text,
|
|||
com.raytheon.uf.edex.plugin.text.db,
|
||||
com.raytheon.uf.edex.plugin.text.dbsrv
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Import-Package: com.raytheon.uf.common.dataplugin.text,
|
||||
Import-Package: com.raytheon.edex.uengine.runners,
|
||||
com.raytheon.uf.common.dataplugin.text,
|
||||
com.raytheon.uf.common.dataplugin.text.alarms,
|
||||
com.raytheon.uf.common.dataplugin.text.db,
|
||||
com.raytheon.uf.common.dataplugin.text.dbsrv,
|
||||
|
@ -28,4 +29,5 @@ Import-Package: com.raytheon.uf.common.dataplugin.text,
|
|||
com.raytheon.uf.common.dataplugin.text.util,
|
||||
com.raytheon.uf.common.message,
|
||||
com.raytheon.uf.common.wmo,
|
||||
org.apache.commons.logging
|
||||
org.apache.commons.logging,
|
||||
org.quartz
|
||||
|
|
|
@ -43,7 +43,18 @@
|
|||
</bean>
|
||||
|
||||
<bean id="textdbsrv" class="com.raytheon.uf.edex.plugin.text.dbsrv.TextDBSrv" />
|
||||
|
||||
<!-- subscription -->
|
||||
|
||||
<bean id="subscriptionDao" class="com.raytheon.uf.edex.plugin.text.dao.SubscriptionDAO">
|
||||
<property name="subscriptionNotifyURI" value="jms-generic:topic:subscription.notify"/>
|
||||
</bean>
|
||||
|
||||
<!-- define the bean that handles ldad watch/warn script handling -->
|
||||
<bean id="ldadScriptRunner" class="com.raytheon.uf.edex.plugin.text.subscription.services.ScriptRunner">
|
||||
<property name="type" value="ldad" />
|
||||
</bean>
|
||||
|
||||
<camelContext id="autofax-common-camel"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
|
@ -64,6 +75,29 @@
|
|||
<bean ref="textdbsrv" method="processMessage" />
|
||||
<bean ref="serializationUtil" method="marshalToXml" />
|
||||
</route>
|
||||
|
||||
<route id="subscriptionNotify">
|
||||
<from uri="jms-generic:topic:subscription.notify"/>
|
||||
<doTry>
|
||||
<bean ref="subscriptionDao" method="updateCache" />
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:subscription?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
<!-- LDAD (watch/warn) triggered script runner, internal use only -->
|
||||
<route id="ldadWatchWarnDirect">
|
||||
<from uri="direct-vm:ldadWatchWarnDirect"/>
|
||||
<doTry>
|
||||
<bean ref="ldadScriptRunner" method="runScripts" />
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:subscription?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
</camelContext>
|
||||
|
||||
|
|
|
@ -112,6 +112,13 @@
|
|||
<constructor-arg ref="siteMapListener" />
|
||||
</bean>
|
||||
|
||||
<!-- subscription -->
|
||||
|
||||
<!-- define the bean that handles Quartz scheduled script running -->
|
||||
<bean id="timerScriptRunner" class="com.raytheon.uf.edex.plugin.text.subscription.services.ScriptRunner" >
|
||||
<property name="type" value="timer" />
|
||||
</bean>
|
||||
|
||||
<camelContext id="text-camel"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
|
@ -127,6 +134,9 @@
|
|||
<to uri="jms-durable:queue:Ingest.Text" />
|
||||
</route>
|
||||
-->
|
||||
|
||||
<!-- Refer to edex.xml for name/location of properties file -->
|
||||
<endpoint id="runnerCron" uri="quartz://runner/runnerScheduled/?cron=${subscription.cron}"/>
|
||||
|
||||
<!--
|
||||
Text routes.
|
||||
|
@ -253,6 +263,30 @@
|
|||
<from uri="jms-generic:topic:textDBFilesChanged"/>
|
||||
<bean ref="textDBStaticDataListener" method="setDirty"/>
|
||||
</route>
|
||||
|
||||
<!-- Quartz Timer triggered script runner -->
|
||||
<route id="runnerScheduled">
|
||||
<from uri="runnerCron" />
|
||||
<doTry>
|
||||
<bean ref="timerScriptRunner" method="runScripts" />
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:subscription?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
<!-- LDAD (watch/warn) triggered script runner -->
|
||||
<route id="ldadWatchWarn">
|
||||
<from uri="jms-durable:queue:watchwarn"/>
|
||||
<doTry>
|
||||
<bean ref="ldadScriptRunner" method="runScripts" />
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:subscription?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
</camelContext>
|
||||
|
||||
<camelContext id="clustered-text-camel"
|
||||
|
|
|
@ -122,6 +122,8 @@
|
|||
<property name="destinationResolver" ref="qpidNoDurableResolver"/>
|
||||
</bean>
|
||||
|
||||
<bean id="subscription" class="com.raytheon.uf.edex.plugin.text.subscription.services.SubscribeManager"/>
|
||||
|
||||
<camelContext id="textdbsrv-request-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
|
||||
|
||||
<proxy id="textdbRemoteRetrievalTarget"
|
||||
|
@ -130,6 +132,9 @@
|
|||
|
||||
<endpoint id="textdbsrvXml_from"
|
||||
uri="jetty:http://0.0.0.0:${HTTP_PORT}/services/textdbsrv?disableStreamCache=true" />
|
||||
|
||||
<endpoint id="subscriptionHTTP_from"
|
||||
uri="jetty:http://0.0.0.0:${HTTP_PORT}/services/subscribe?disableStreamCache=true" />
|
||||
|
||||
<route id="textdbsrvXml">
|
||||
<from uri="ref:textdbsrvXml_from" />
|
||||
|
@ -144,5 +149,12 @@
|
|||
<to uri="jms-mhs:queue:fxa.mhs.request?requestTimeout=122000" pattern="InOut" />
|
||||
<bean ref="serializationUtil" method="transformFromThrift" />
|
||||
</route>
|
||||
|
||||
<!-- SubscriptionSrv routes -->
|
||||
<route id="subscriptionHTTP">
|
||||
<from uri="ref:subscriptionHTTP_from" />
|
||||
<bean ref="subscription" method="processRequest"/>
|
||||
<bean ref="serializationUtil" method="marshalToXml" />
|
||||
</route>
|
||||
</camelContext>
|
||||
</beans>
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.subscription.dao;
|
||||
package com.raytheon.uf.edex.plugin.text.dao;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -27,8 +27,8 @@ import java.util.Map;
|
|||
|
||||
import org.hibernate.Query;
|
||||
|
||||
import com.raytheon.edex.autobldsrv.data.SubscriptionRecord;
|
||||
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
|
||||
import com.raytheon.uf.common.dataquery.db.QueryParam;
|
||||
import com.raytheon.uf.common.message.Property;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -52,6 +52,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
|||
* 14Apr2011 5163 cjeanbap NWRWAVES Setting AFOS text triggers in AWIPS II
|
||||
* 04/24/13 1949 rjpeter Removed @Override on delete.
|
||||
* Nov 08, 2013 2361 njensen Chaged method signature of saveOrUpdate(Object)
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
|
||||
* </pre>
|
||||
*
|
||||
* @author mfegan
|
||||
|
@ -82,7 +83,7 @@ public class SubscriptionDAO extends CoreDao {
|
|||
private static boolean dirtyMap = true;
|
||||
|
||||
public SubscriptionDAO() {
|
||||
this(DaoConfig.forClass(SubscriptionRecord.class));
|
||||
this(DaoConfig.forClass("fxa", SubscriptionRecord.class));
|
||||
}
|
||||
|
||||
/**
|
|
@ -17,32 +17,31 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.subscription.runners;
|
||||
package com.raytheon.uf.edex.plugin.text.subscription.runners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.edex.util.Util;
|
||||
import com.raytheon.uf.common.message.Message;
|
||||
import com.raytheon.uf.common.message.Property;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
|
||||
/**
|
||||
* Abstract base class for all subscription runners. Extending classes must
|
||||
* implement the {@link #execute()} method. Default implementations of other methods
|
||||
* specified in {@link ISubscribeRunner} are provided.
|
||||
* implement the {@link #execute()} method. Default implementations of other
|
||||
* methods specified in {@link ISubscribeRunner} are provided.
|
||||
* <P>
|
||||
* Also provided are two factory methods ({@link ASubscribeRunner#getInstance(String)}
|
||||
* and {@link ASubscribeRunner#getInstance(String, Message)}) may be used to instantiate
|
||||
* the known concrete implementations.
|
||||
* Also provided are two factory methods (
|
||||
* {@link ASubscribeRunner#getInstance(String)} and
|
||||
* {@link ASubscribeRunner#getInstance(String, Message)}) may be used to
|
||||
* instantiate the known concrete implementations.
|
||||
* <P>
|
||||
* Expected usage:
|
||||
* <PRE><CODE>
|
||||
*
|
||||
* <PRE>
|
||||
* <CODE>
|
||||
* String type = "..."; // name of an appropriate runner action
|
||||
* Message message = null; // initialized later...
|
||||
*
|
||||
|
@ -56,20 +55,22 @@ import com.raytheon.uf.edex.core.EdexException;
|
|||
* } catch (EdexException e) {
|
||||
* // handle the exception
|
||||
* }
|
||||
* </CODE></PRE>
|
||||
* </CODE>
|
||||
* </PRE>
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 14Nov2008 1709 MW Fegan Initial creation
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class ASubscribeRunner implements ISubscribeRunner {
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.subscription.runners;
|
||||
package com.raytheon.uf.edex.plugin.text.subscription.runners;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -31,21 +31,22 @@ import com.raytheon.uf.common.message.Property;
|
|||
* no-arg constructor; they should also define a constructor that takes a
|
||||
* {@link Message} instance as its sole argument.
|
||||
* <P>
|
||||
* Each implementation of this class should ensure the {@link #getResults()} returns
|
||||
* a valid, though possibly empty, List.
|
||||
* Each implementation of this class should ensure the {@link #getResults()}
|
||||
* returns a valid, though possibly empty, List.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 14Nov2008 1709 MW Fegan Initial creation.
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface ISubscribeRunner {
|
|
@ -17,17 +17,15 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.subscription.runners;
|
||||
package com.raytheon.uf.edex.plugin.text.subscription.runners;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.raytheon.edex.autobldsrv.data.SubscriptionRecord;
|
||||
import com.raytheon.edex.subscription.dao.SubscriptionDAO;
|
||||
import com.raytheon.edex.subscription.util.Tools;
|
||||
import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
|
||||
import com.raytheon.uf.common.message.Message;
|
||||
import com.raytheon.uf.common.message.Property;
|
||||
import com.raytheon.uf.edex.plugin.text.dao.SubscriptionDAO;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.util.Tools;
|
||||
|
||||
/**
|
||||
* Implements a subscription request runner that performs an insert into the
|
||||
|
@ -44,6 +42,7 @@ import com.raytheon.uf.common.message.Property;
|
|||
* 14Sep2010 3944 cjeanbap Trim property values.
|
||||
* 25May2011 8686 cjeanbap Updated if-statement to check for filepath
|
||||
* 26May2011 8686 cjeanbap fixed a punctuation bug
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
|
||||
* </pre>
|
||||
*
|
||||
* @author mfegan
|
|
@ -17,32 +17,34 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.subscription.runners;
|
||||
package com.raytheon.uf.edex.plugin.text.subscription.runners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.edex.autobldsrv.data.SubscriptionRecord;
|
||||
import com.raytheon.edex.subscription.dao.SubscriptionDAO;
|
||||
import com.raytheon.edex.subscription.util.Tools;
|
||||
import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
|
||||
import com.raytheon.uf.common.message.Message;
|
||||
import com.raytheon.uf.common.message.Property;
|
||||
import com.raytheon.uf.edex.plugin.text.dao.SubscriptionDAO;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.util.Tools;
|
||||
|
||||
/**
|
||||
* Implements a subscription request runner that performs a delete operation
|
||||
* in the subscription database.
|
||||
* Implements a subscription request runner that performs a delete operation in
|
||||
* the subscription database.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 14Nov2008 1709 MW Fegan Initial creation.
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SubscribeDeleteRunner extends ASubscribeRunner {
|
||||
|
@ -61,8 +63,12 @@ public class SubscribeDeleteRunner extends ASubscribeRunner {
|
|||
super(message);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.subscription.runners.ASubscribeRunner#execute()
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.plugin.text.subscription.runners.ASubscribeRunner
|
||||
* #execute()
|
||||
*/
|
||||
@Override
|
||||
public boolean execute() {
|
|
@ -17,25 +17,28 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.subscription.runners;
|
||||
package com.raytheon.uf.edex.plugin.text.subscription.runners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.edex.autobldsrv.data.SubscriptionRecord;
|
||||
import com.raytheon.edex.subscription.dao.SubscriptionDAO;
|
||||
import com.raytheon.edex.subscription.util.Tools;
|
||||
import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
|
||||
import com.raytheon.uf.common.message.Message;
|
||||
import com.raytheon.uf.common.message.Property;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.edex.plugin.text.dao.SubscriptionDAO;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.util.Tools;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.util.TriggerMatcher;
|
||||
|
||||
/**
|
||||
* Implements a subscription request runner that performs a query to determine
|
||||
* if there are currently any subscriptions for a specific trigger value. If there
|
||||
* are subscriptions, they are placed into the response list.
|
||||
* if there are currently any subscriptions for a specific trigger value. If
|
||||
* there are subscriptions, they are placed into the response list.
|
||||
* <P>
|
||||
* This runner expects a message similar to
|
||||
* <PRE><CODE>
|
||||
* This runner expects a message similar to
|
||||
*
|
||||
* <PRE>
|
||||
* <CODE>
|
||||
* <message>
|
||||
* <header>
|
||||
* <properties name="operation" value="query" />
|
||||
|
@ -43,10 +46,14 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
|
|||
* <properties name="trigger" value=" ... " />
|
||||
* </header>
|
||||
* </message>
|
||||
* </CODE></PRE>
|
||||
* The response following execution is a list of Property objects that can be used
|
||||
* to form a Message similar to
|
||||
* <PRE><CODE>
|
||||
* </CODE>
|
||||
* </PRE>
|
||||
*
|
||||
* The response following execution is a list of Property objects that can be
|
||||
* used to form a Message similar to
|
||||
*
|
||||
* <PRE>
|
||||
* <CODE>
|
||||
* <message>
|
||||
* <header>
|
||||
* <properties name="count" value=" ... " />
|
||||
|
@ -54,21 +61,25 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
|
|||
* <properties name="subscription" value=" ... " />
|
||||
* </header>
|
||||
* </message>
|
||||
* </CODE></PRE>
|
||||
* In the response, the value of each subscription property is the XML serialization
|
||||
* of the subscription from the database.
|
||||
* </CODE>
|
||||
* </PRE>
|
||||
*
|
||||
* In the response, the value of each subscription property is the XML
|
||||
* serialization of the subscription from the database.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 14Nov2008 1709 MW Fegan Initial creation.
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SubscribeQueryRunner extends ASubscribeRunner {
|
||||
|
@ -88,8 +99,12 @@ public class SubscribeQueryRunner extends ASubscribeRunner {
|
|||
super(message);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.subscription.runners.ASubscribeRunner#execute()
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.plugin.text.subscription.runners.ASubscribeRunner
|
||||
* #execute()
|
||||
*/
|
||||
@Override
|
||||
public boolean execute() {
|
||||
|
@ -118,7 +133,7 @@ public class SubscribeQueryRunner extends ASubscribeRunner {
|
|||
private List<SubscriptionRecord> filterRecords(List<SubscriptionRecord> records) {
|
||||
List<SubscriptionRecord> retVal = new ArrayList<SubscriptionRecord>();
|
||||
for (SubscriptionRecord record : records) {
|
||||
if (record.matchesTrigger(this.trigger)) {
|
||||
if (TriggerMatcher.matches(record, this.trigger)) {
|
||||
retVal.add(record);
|
||||
}
|
||||
}
|
|
@ -17,17 +17,17 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.subscription.runners;
|
||||
package com.raytheon.uf.edex.plugin.text.subscription.runners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.edex.autobldsrv.data.SubscriptionRecord;
|
||||
import com.raytheon.edex.subscription.dao.SubscriptionDAO;
|
||||
import com.raytheon.edex.subscription.util.Tools;
|
||||
import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
|
||||
import com.raytheon.uf.common.message.Header;
|
||||
import com.raytheon.uf.common.message.Message;
|
||||
import com.raytheon.uf.common.message.Property;
|
||||
import com.raytheon.uf.edex.plugin.text.dao.SubscriptionDAO;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.util.Tools;
|
||||
|
||||
/**
|
||||
* Implements a subscription request runner that performs a read operation in
|
||||
|
@ -73,6 +73,7 @@ import com.raytheon.uf.common.message.Property;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 14Nov2008 1709 MW Fegan Initial creation.
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -84,7 +85,7 @@ public class SubscribeReadRunner extends ASubscribeRunner {
|
|||
/**
|
||||
* Constructor. Creates an empty Runner object. This is the constructor
|
||||
* called by the {@link RunnerFactory}'s
|
||||
* {@link RunnerFactory#getWorker(com.raytheon.edex.subscription.util.SubscribeAction)
|
||||
* {@link RunnerFactory#getWorker(com.raytheon.uf.edex.plugin.text.subscription.util.SubscribeAction)
|
||||
* getWorker(...)} method. The {@link #initialize(Message)} method must be
|
||||
* called prior to using the worker.
|
||||
*/
|
||||
|
@ -105,7 +106,9 @@ public class SubscribeReadRunner extends ASubscribeRunner {
|
|||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.edex.subscription.runners.ASubscribeRunner#execute()
|
||||
* @see
|
||||
* com.raytheon.uf.edex.plugin.text.subscription.runners.ASubscribeRunner
|
||||
* #execute()
|
||||
*/
|
||||
@Override
|
||||
public boolean execute() {
|
|
@ -17,10 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.subscription.runners;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
package com.raytheon.uf.edex.plugin.text.subscription.runners;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
@ -28,16 +25,19 @@ import org.apache.commons.logging.LogFactory;
|
|||
import com.raytheon.uf.common.message.Message;
|
||||
import com.raytheon.uf.common.util.StringUtil;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.util.SubscribeAction;
|
||||
|
||||
/**
|
||||
* Factory class for creating Subscription Runner objects.
|
||||
* <P>
|
||||
* Two factory methods ({@link ASubscribeRunner#getInstance(String)}
|
||||
* and {@link ASubscribeRunner#getInstance(String, Message)}) are used to instantiate
|
||||
* the known concrete implementations.
|
||||
* Two factory methods ({@link ASubscribeRunner#getInstance(String)} and
|
||||
* {@link ASubscribeRunner#getInstance(String, Message)}) are used to
|
||||
* instantiate the known concrete implementations.
|
||||
* <P>
|
||||
* Expected usage:
|
||||
* <PRE><CODE>
|
||||
*
|
||||
* <PRE>
|
||||
* <CODE>
|
||||
* String type = "..."; // name of an appropriate runner action
|
||||
* Message message = null; // initialized later...
|
||||
*
|
||||
|
@ -50,20 +50,23 @@ import com.raytheon.uf.edex.core.EdexException;
|
|||
* } catch (EdexException e) {
|
||||
* // handle the exception
|
||||
* }
|
||||
* </CODE></PRE>
|
||||
* </CODE>
|
||||
* </PRE>
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 18Nov2008 1709 MW Fegan Initial creation
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
|
||||
* removed duplicate SubscribeAction enum
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SubscribeRunner {
|
||||
|
@ -143,63 +146,4 @@ public class SubscribeRunner {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* An enumeration of Subscription Actions. This enumeration is used by the factory methods
|
||||
* ({@link ASubscribeRunner#getInstance(String, Message)} and
|
||||
* {@link ASubscribeRunner#getInstance(String)}) to determine the correct class to
|
||||
* instantiate to create a worker.
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
*/
|
||||
public enum SubscribeAction {
|
||||
ACTION_ADD,ACTION_READ,ACTION_DELETE,ACTION_UPDATE,ACTION_QUERY;
|
||||
/**
|
||||
* A mapping of action names to SubscribeAction objects.
|
||||
*/
|
||||
private static final Map<String, SubscribeAction> actions = new HashMap<String, SubscribeAction>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
{
|
||||
put("add",ACTION_ADD);
|
||||
put("read",ACTION_READ);
|
||||
put("delete",ACTION_DELETE);
|
||||
put("update",ACTION_UPDATE);
|
||||
put("query",ACTION_QUERY);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* A mapping of SubscribeAction objects to implementation class names.
|
||||
*/
|
||||
private static final Map<SubscribeAction, String> runners = new HashMap<SubscribeAction, String>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
{
|
||||
put(ACTION_ADD,"com.raytheon.edex.subscription.runners.SubscribeAddRunner");
|
||||
put(ACTION_READ,"com.raytheon.edex.subscription.runners.SubscribeReadRunner");
|
||||
put(ACTION_DELETE,"com.raytheon.edex.subscription.runners.SubscribeDeleteRunner");
|
||||
put(ACTION_UPDATE,"com.raytheon.edex.subscription.runners.SubscribeUpdateRunner");
|
||||
put(ACTION_QUERY,"com.raytheon.edex.subscription.runners.SubscribeQueryRunner");
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
private SubscribeAction(){}
|
||||
/**
|
||||
* Factory method that gets the SubscribeAction object for an action name.
|
||||
*
|
||||
* @param action name of the requested action
|
||||
*
|
||||
* @return the corresponding action
|
||||
*/
|
||||
public static final SubscribeAction translate(String action) {
|
||||
return actions.get(action.toLowerCase());
|
||||
}
|
||||
/**
|
||||
* Returns the class name of the runner associated with the action.
|
||||
*/
|
||||
public final String getRunner() {
|
||||
return runners.get(this);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,24 +17,26 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.subscription.runners;
|
||||
package com.raytheon.uf.edex.plugin.text.subscription.runners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.edex.autobldsrv.data.SubscriptionRecord;
|
||||
import com.raytheon.edex.subscription.dao.SubscriptionDAO;
|
||||
import com.raytheon.edex.subscription.util.Tools;
|
||||
import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
|
||||
import com.raytheon.uf.common.message.Header;
|
||||
import com.raytheon.uf.common.message.Message;
|
||||
import com.raytheon.uf.common.message.Property;
|
||||
import com.raytheon.uf.edex.plugin.text.dao.SubscriptionDAO;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.util.Tools;
|
||||
|
||||
/**
|
||||
* Implements a subscription request runner that performs an update of the
|
||||
* data in the subscription table.
|
||||
* Implements a subscription request runner that performs an update of the data
|
||||
* in the subscription table.
|
||||
* <p>
|
||||
* Typical Usage:
|
||||
* <PRE><CODE>
|
||||
*
|
||||
* <PRE>
|
||||
* <CODE>
|
||||
* List<Property> results = null;
|
||||
* SubscribeAction action = SubscribeAction.ACTION_UPDATE;
|
||||
* ISubscribeRunner runner = RunnerFactory.getInstance().getWorker(action);
|
||||
|
@ -43,19 +45,22 @@ import com.raytheon.uf.common.message.Property;
|
|||
* runner.execute();
|
||||
* results = runner.getResults();
|
||||
* }
|
||||
* </CODE></PRE>
|
||||
* </CODE>
|
||||
* </PRE>
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 05Dec2008 1709 MW Fegan Initial creation.
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SubscribeUpdateRunner extends ASubscribeRunner {
|
||||
|
@ -74,8 +79,12 @@ public class SubscribeUpdateRunner extends ASubscribeRunner {
|
|||
super(message);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.subscription.runners.ASubscribeRunner#execute()
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.plugin.text.subscription.runners.ASubscribeRunner
|
||||
* #execute()
|
||||
*/
|
||||
@Override
|
||||
public boolean execute() {
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.services;
|
||||
package com.raytheon.uf.edex.plugin.text.subscription.services;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
@ -31,15 +31,12 @@ import javax.xml.bind.JAXBException;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.edex.autobldsrv.data.ReplacementRecord;
|
||||
import com.raytheon.edex.autobldsrv.data.SubscriptionRecord;
|
||||
import com.raytheon.edex.subscription.runners.ISubscribeRunner;
|
||||
import com.raytheon.edex.subscription.runners.SubscribeRunner;
|
||||
import com.raytheon.edex.subscription.util.Tools;
|
||||
import com.raytheon.edex.uengine.runners.IMicroEngine;
|
||||
import com.raytheon.edex.uengine.runners.MicroEngine;
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.message.DataURINotificationMessage;
|
||||
import com.raytheon.uf.common.dataplugin.text.db.ReplacementRecord;
|
||||
import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
|
||||
import com.raytheon.uf.common.message.Header;
|
||||
import com.raytheon.uf.common.message.Message;
|
||||
import com.raytheon.uf.common.message.Property;
|
||||
|
@ -47,6 +44,9 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
|
|||
import com.raytheon.uf.common.util.ReflectionUtil;
|
||||
import com.raytheon.uf.common.util.StringUtil;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.runners.ISubscribeRunner;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.runners.SubscribeRunner;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.util.Tools;
|
||||
|
||||
/**
|
||||
* Main class of the EDEX Script Runner.
|
||||
|
@ -72,6 +72,7 @@ import com.raytheon.uf.edex.core.EdexException;
|
|||
* 30Aug2011 10581 rferrel executeScript now sending proper trigger
|
||||
* argument to the engine.
|
||||
* Feb 15, 2013 1638 mschenke Moved DataURINotificationMessage to uf.common.dataplugin
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.services;
|
||||
package com.raytheon.uf.edex.plugin.text.subscription.services;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -25,30 +25,32 @@ import java.util.List;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.edex.subscription.runners.ISubscribeRunner;
|
||||
import com.raytheon.edex.subscription.runners.SubscribeRunner;
|
||||
import com.raytheon.edex.subscription.util.Tools;
|
||||
import com.raytheon.uf.common.message.Header;
|
||||
import com.raytheon.uf.common.message.Message;
|
||||
import com.raytheon.uf.common.message.Property;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.runners.ISubscribeRunner;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.runners.SubscribeRunner;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.util.Tools;
|
||||
|
||||
/**
|
||||
* The main class of the Subscription Manager. Receives and processes subscription
|
||||
* requests from a client. Returns a response based on the result of processing the
|
||||
* request.
|
||||
* The main class of the Subscription Manager. Receives and processes
|
||||
* subscription requests from a client. Returns a response based on the result
|
||||
* of processing the request.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 15Dec2008 1709 MW Fegan Initial Creation. Replaces SubscribeSrv.
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SubscribeManager {
|
|
@ -17,25 +17,39 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.subscription.util;
|
||||
package com.raytheon.uf.edex.plugin.text.subscription.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.message.Message;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.runners.ASubscribeRunner;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.runners.SubscribeAddRunner;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.runners.SubscribeDeleteRunner;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.runners.SubscribeQueryRunner;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.runners.SubscribeReadRunner;
|
||||
import com.raytheon.uf.edex.plugin.text.subscription.runners.SubscribeUpdateRunner;
|
||||
|
||||
/**
|
||||
* An enumeration of Subscription Actions.
|
||||
* An enumeration of Subscription Actions. This enumeration is used by the
|
||||
* factory methods ({@link ASubscribeRunner#getInstance(String, Message)} and
|
||||
* {@link ASubscribeRunner#getInstance(String)}) to determine the correct class
|
||||
* to instantiate to create a worker.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 14Nov2008 1709 MW Fegan Initial creation.
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
|
||||
* removed hard coded class names
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public enum SubscribeAction {
|
||||
|
@ -59,11 +73,11 @@ public enum SubscribeAction {
|
|||
private static final Map<SubscribeAction, String> runners = new HashMap<SubscribeAction, String>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
{
|
||||
put(ACTION_ADD,"com.raytheon.edex.subscription.runners.SubscribeAddRunner");
|
||||
put(ACTION_READ,"com.raytheon.edex.subscription.runners.SubscribeReadRunner");
|
||||
put(ACTION_DELETE,"com.raytheon.edex.subscription.runners.SubscribeDeleteRunner");
|
||||
put(ACTION_UPDATE,"com.raytheon.edex.subscription.runners.SubscribeUpdateRunner");
|
||||
put(ACTION_QUERY,"com.raytheon.edex.subscription.runners.SubscribeQueryRunner");
|
||||
put(ACTION_ADD, SubscribeAddRunner.class.getName());
|
||||
put(ACTION_READ, SubscribeReadRunner.class.getName());
|
||||
put(ACTION_DELETE, SubscribeDeleteRunner.class.getName());
|
||||
put(ACTION_UPDATE, SubscribeUpdateRunner.class.getName());
|
||||
put(ACTION_QUERY, SubscribeQueryRunner.class.getName());
|
||||
}
|
||||
};
|
||||
/**
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.subscription.util;
|
||||
package com.raytheon.uf.edex.plugin.text.subscription.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -28,19 +28,21 @@ import com.raytheon.uf.common.message.Property;
|
|||
|
||||
/**
|
||||
* Utility class for the subscription manager.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 14Nov2008 1709 MW Fegan Initial creation.
|
||||
* 14Sep2010 3944 cjeanbap Trim the newline char from value.
|
||||
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public final class Tools {
|
|
@ -0,0 +1,101 @@
|
|||
/**
|
||||
* 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.plugin.text.subscription.util;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.quartz.CronExpression;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
|
||||
|
||||
/**
|
||||
* Utility for matching stored subscriptions to query triggers
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 22, 2014 2536 bclement Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bclement
|
||||
* @version 1.0
|
||||
*/
|
||||
public class TriggerMatcher {
|
||||
|
||||
/**
|
||||
* Determines if the specified trigger value matches the trigger value of
|
||||
* the provided SubscriptionRecord.
|
||||
*
|
||||
* @param record
|
||||
* @param trigger
|
||||
* the trigger value to compare
|
||||
*
|
||||
* @return true if the trigger matches, false otherwise
|
||||
*/
|
||||
public static boolean matches(SubscriptionRecord record, String trigger) {
|
||||
String type = record.getType();
|
||||
String recordTrigger = record.getTrigger();
|
||||
boolean retVal = false;
|
||||
if ("timer".equalsIgnoreCase(type)) {
|
||||
try {
|
||||
long date = Long.parseLong(trigger);
|
||||
CronExpression cexp = new CronExpression(recordTrigger);
|
||||
retVal = cexp.isSatisfiedBy(new Date(date));
|
||||
} catch (Exception e) {
|
||||
retVal = false;
|
||||
}
|
||||
} else if ("ldad".equalsIgnoreCase(type)) {
|
||||
/*
|
||||
* Legacy code has these patterns: TextString patterns[] = {
|
||||
* productId, productId.left(6) + "XXX", "CCC" + productId.mid(3,3)
|
||||
* + "XXX", productId.left(3) + "NNNXXX", productId.left(3) + "NNN"
|
||||
* + productId.right(productId.length() - 6) };
|
||||
*/
|
||||
// System.out.println("matching trigger=" + trigger +
|
||||
// " -- this.trigger="+ this.trigger +
|
||||
// " -- trigger.substr(0,6)+\"XXX\"="+trigger.substring(0,6)+"XXX" +
|
||||
// " -- \"CCC\"+trigger.substring(3,6)+\"XXX\"="+"CCC"+trigger.substring(3,
|
||||
// 6)+"XXX" +
|
||||
// " -- trigger.substring(0,3)+\"NNNXXX\"=" + trigger.substring(0,
|
||||
// 3)+"NNNXXX" +
|
||||
// " -- trigger.substring(0, 3)+\"NNN\"+trigger.substring(6)="+trigger.substring(0,
|
||||
// 3)+"NNN"+trigger.substring(6));
|
||||
retVal = (trigger.equalsIgnoreCase(recordTrigger))
|
||||
|| ((trigger.substring(0, 6) + "XXX")
|
||||
.equalsIgnoreCase(recordTrigger))
|
||||
|| (("CCC" + trigger.substring(3, 6) + "XXX")
|
||||
.equalsIgnoreCase(recordTrigger))
|
||||
|| ((trigger.substring(0, 3) + "NNNXXX")
|
||||
.equalsIgnoreCase(recordTrigger))
|
||||
|| ((trigger.substring(0, 3) + "NNN" + trigger.substring(6))
|
||||
.equalsIgnoreCase(recordTrigger) || (recordTrigger
|
||||
.startsWith(trigger)));
|
||||
} else {
|
||||
String pattern = recordTrigger.replaceAll("\\*", ".+");
|
||||
retVal = trigger.matches(pattern);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
}
|
|
@ -273,7 +273,6 @@ execute_psql_sql_script /awips2/postgresql/share/contrib/postgis-2.0/spatial_ref
|
|||
execute_psql_sql_script /awips2/postgresql/share/contrib/postgis-2.0/rtpostgis.sql metadata
|
||||
execute_psql_sql_script /awips2/postgresql/share/contrib/postgis-2.0/legacy.sql metadata
|
||||
execute_psql_sql_script ${SQL_SHARE_DIR}/permissions.sql metadata
|
||||
execute_psql_sql_script ${SQL_SHARE_DIR}/create_subscription_tables.sql metadata
|
||||
execute_psql_sql_script ${SQL_SHARE_DIR}/fxatext.sql metadata
|
||||
|
||||
# create the events schema
|
||||
|
|
Loading…
Add table
Reference in a new issue