Merge "Omaha #2536 merge autobldsrv into text plugins" into omaha_14.4.1

Former-commit-id: 5f72fc0a65a1b3b64298a2aacaa18ab84c8df93e
This commit is contained in:
Nate Jensen 2014-05-29 13:51:09 -05:00 committed by Gerrit Code Review
commit c43a2bf217
41 changed files with 474 additions and 600 deletions

View 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"

View file

@ -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;

View file

@ -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>

View file

@ -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>

View file

@ -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

View file

@ -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"

View file

@ -1,2 +0,0 @@
com.raytheon.edex.autobldsrv.data.ReplacementRecord
com.raytheon.edex.autobldsrv.data.SubscriptionRecord

View file

@ -1,6 +0,0 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
res/,\
resources/

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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.TextProductInfo
com.raytheon.uf.common.dataplugin.text.db.TextProductInfoPK com.raytheon.uf.common.dataplugin.text.db.TextProductInfoPK
com.raytheon.uf.common.dataplugin.text.db.WatchWarn 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

View file

@ -17,14 +17,16 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.edex.autobldsrv.data; package com.raytheon.uf.common.dataplugin.text.db;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table; import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; 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; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* TODO Add Description * Data object for subscription record substitution attribute
* *
* <pre> * <pre>
* *
@ -44,7 +46,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* * May 22, 2014 2536 bclement moved from autobldsrv to common.dataplugin.text
* *
* </pre> * </pre>
* *
@ -53,7 +55,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/ */
@Entity @Entity
@Table(name = "replacements", schema = "subscription") @SequenceGenerator(initialValue = 1, name = ReplacementRecord.SEQ_GEN_NAME, sequenceName = "replacementseq")
@Table(name = "replacements")
@XmlRootElement @XmlRootElement
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize @DynamicSerialize
@ -61,10 +64,12 @@ public class ReplacementRecord extends PersistableDataObject {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String SEQ_GEN_NAME = "REPLACEMENT_GENERATOR";
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@Id @Id
@GeneratedValue @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = SEQ_GEN_NAME)
private long id; private long id;
@ManyToOne @ManyToOne

View file

@ -17,9 +17,8 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
@ -30,8 +29,10 @@ import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType; 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.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; 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.IPersistableDataObject;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -58,6 +57,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 18Nov2008 1709 MW Fegan Initial creation * 18Nov2008 1709 MW Fegan Initial creation
* May 22, 2014 2536 bclement moved from autobldsrv to common.dataplugin.text
* moved matchesTrigger() to TriggerMatcher class
* *
* </pre> * </pre>
* *
@ -65,7 +66,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* @version 1.0 * @version 1.0
*/ */
@Entity @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" })) "type", "trigger", "runner", "script", "filepath", "arguments" }))
@XmlRootElement @XmlRootElement
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@ -75,10 +77,12 @@ public class SubscriptionRecord extends PersistableDataObject implements
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String SEQ_GEN_NAME = "SUBSCRIPTION_GENERATOR";
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@Id @Id
@GeneratedValue @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = SEQ_GEN_NAME)
private long id; private long id;
@XmlAttribute @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 * @param name

View file

@ -28,13 +28,6 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.edex.autobldsrv"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="com.raytheon.edex.notifysrv" id="com.raytheon.edex.notifysrv"
download-size="0" download-size="0"
@ -97,7 +90,7 @@
install-size="0" install-size="0"
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin <plugin
id="com.raytheon.uf.common.localization.python" id="com.raytheon.uf.common.localization.python"
download-size="0" download-size="0"
@ -110,4 +103,5 @@
install-size="0" install-size="0"
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
</feature> </feature>

View file

@ -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.db,
com.raytheon.uf.edex.plugin.text.dbsrv com.raytheon.uf.edex.plugin.text.dbsrv
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 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.alarms,
com.raytheon.uf.common.dataplugin.text.db, com.raytheon.uf.common.dataplugin.text.db,
com.raytheon.uf.common.dataplugin.text.dbsrv, 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.dataplugin.text.util,
com.raytheon.uf.common.message, com.raytheon.uf.common.message,
com.raytheon.uf.common.wmo, com.raytheon.uf.common.wmo,
org.apache.commons.logging org.apache.commons.logging,
org.quartz

View file

@ -43,7 +43,18 @@
</bean> </bean>
<bean id="textdbsrv" class="com.raytheon.uf.edex.plugin.text.dbsrv.TextDBSrv" /> <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" <camelContext id="autofax-common-camel"
xmlns="http://camel.apache.org/schema/spring" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"> errorHandlerRef="errorHandler">
@ -64,6 +75,29 @@
<bean ref="textdbsrv" method="processMessage" /> <bean ref="textdbsrv" method="processMessage" />
<bean ref="serializationUtil" method="marshalToXml" /> <bean ref="serializationUtil" method="marshalToXml" />
</route> </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> </camelContext>

View file

@ -112,6 +112,13 @@
<constructor-arg ref="siteMapListener" /> <constructor-arg ref="siteMapListener" />
</bean> </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" <camelContext id="text-camel"
xmlns="http://camel.apache.org/schema/spring" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"> errorHandlerRef="errorHandler">
@ -127,6 +134,9 @@
<to uri="jms-durable:queue:Ingest.Text" /> <to uri="jms-durable:queue:Ingest.Text" />
</route> </route>
--> -->
<!-- Refer to edex.xml for name/location of properties file -->
<endpoint id="runnerCron" uri="quartz://runner/runnerScheduled/?cron=${subscription.cron}"/>
<!-- <!--
Text routes. Text routes.
@ -253,6 +263,30 @@
<from uri="jms-generic:topic:textDBFilesChanged"/> <from uri="jms-generic:topic:textDBFilesChanged"/>
<bean ref="textDBStaticDataListener" method="setDirty"/> <bean ref="textDBStaticDataListener" method="setDirty"/>
</route> </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>
<camelContext id="clustered-text-camel" <camelContext id="clustered-text-camel"

View file

@ -122,6 +122,8 @@
<property name="destinationResolver" ref="qpidNoDurableResolver"/> <property name="destinationResolver" ref="qpidNoDurableResolver"/>
</bean> </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"> <camelContext id="textdbsrv-request-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
<proxy id="textdbRemoteRetrievalTarget" <proxy id="textdbRemoteRetrievalTarget"
@ -130,6 +132,9 @@
<endpoint id="textdbsrvXml_from" <endpoint id="textdbsrvXml_from"
uri="jetty:http://0.0.0.0:${HTTP_PORT}/services/textdbsrv?disableStreamCache=true" /> 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"> <route id="textdbsrvXml">
<from uri="ref:textdbsrvXml_from" /> <from uri="ref:textdbsrvXml_from" />
@ -144,5 +149,12 @@
<to uri="jms-mhs:queue:fxa.mhs.request?requestTimeout=122000" pattern="InOut" /> <to uri="jms-mhs:queue:fxa.mhs.request?requestTimeout=122000" pattern="InOut" />
<bean ref="serializationUtil" method="transformFromThrift" /> <bean ref="serializationUtil" method="transformFromThrift" />
</route> </route>
<!-- SubscriptionSrv routes -->
<route id="subscriptionHTTP">
<from uri="ref:subscriptionHTTP_from" />
<bean ref="subscription" method="processRequest"/>
<bean ref="serializationUtil" method="marshalToXml" />
</route>
</camelContext> </camelContext>
</beans> </beans>

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.edex.subscription.dao; package com.raytheon.uf.edex.plugin.text.dao;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -27,8 +27,8 @@ import java.util.Map;
import org.hibernate.Query; 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.persist.PersistableDataObject;
import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
import com.raytheon.uf.common.dataquery.db.QueryParam; import com.raytheon.uf.common.dataquery.db.QueryParam;
import com.raytheon.uf.common.message.Property; import com.raytheon.uf.common.message.Property;
import com.raytheon.uf.common.status.IUFStatusHandler; 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 * 14Apr2011 5163 cjeanbap NWRWAVES Setting AFOS text triggers in AWIPS II
* 04/24/13 1949 rjpeter Removed @Override on delete. * 04/24/13 1949 rjpeter Removed @Override on delete.
* Nov 08, 2013 2361 njensen Chaged method signature of saveOrUpdate(Object) * Nov 08, 2013 2361 njensen Chaged method signature of saveOrUpdate(Object)
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
* </pre> * </pre>
* *
* @author mfegan * @author mfegan
@ -82,7 +83,7 @@ public class SubscriptionDAO extends CoreDao {
private static boolean dirtyMap = true; private static boolean dirtyMap = true;
public SubscriptionDAO() { public SubscriptionDAO() {
this(DaoConfig.forClass(SubscriptionRecord.class)); this(DaoConfig.forClass("fxa", SubscriptionRecord.class));
} }
/** /**

View file

@ -17,32 +17,31 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; 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.Message;
import com.raytheon.uf.common.message.Property; import com.raytheon.uf.common.message.Property;
import com.raytheon.uf.edex.core.EdexException;
/** /**
* Abstract base class for all subscription runners. Extending classes must * Abstract base class for all subscription runners. Extending classes must
* implement the {@link #execute()} method. Default implementations of other methods * implement the {@link #execute()} method. Default implementations of other
* specified in {@link ISubscribeRunner} are provided. * methods specified in {@link ISubscribeRunner} are provided.
* <P> * <P>
* Also provided are two factory methods ({@link ASubscribeRunner#getInstance(String)} * Also provided are two factory methods (
* and {@link ASubscribeRunner#getInstance(String, Message)}) may be used to instantiate * {@link ASubscribeRunner#getInstance(String)} and
* the known concrete implementations. * {@link ASubscribeRunner#getInstance(String, Message)}) may be used to
* instantiate the known concrete implementations.
* <P> * <P>
* Expected usage: * Expected usage:
* <PRE><CODE> *
* <PRE>
* <CODE>
* String type = "..."; // name of an appropriate runner action * String type = "..."; // name of an appropriate runner action
* Message message = null; // initialized later... * Message message = null; // initialized later...
* *
@ -56,20 +55,22 @@ import com.raytheon.uf.edex.core.EdexException;
* } catch (EdexException e) { * } catch (EdexException e) {
* // handle the exception * // handle the exception
* } * }
* </CODE></PRE> * </CODE>
* </PRE>
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 14Nov2008 1709 MW Fegan Initial creation * 14Nov2008 1709 MW Fegan Initial creation
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
* *
* </pre> * </pre>
* *
* @author mfegan * @author mfegan
* @version 1.0 * @version 1.0
*/ */
public abstract class ASubscribeRunner implements ISubscribeRunner { public abstract class ASubscribeRunner implements ISubscribeRunner {

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.List;
@ -31,21 +31,22 @@ import com.raytheon.uf.common.message.Property;
* no-arg constructor; they should also define a constructor that takes a * no-arg constructor; they should also define a constructor that takes a
* {@link Message} instance as its sole argument. * {@link Message} instance as its sole argument.
* <P> * <P>
* Each implementation of this class should ensure the {@link #getResults()} returns * Each implementation of this class should ensure the {@link #getResults()}
* a valid, though possibly empty, List. * returns a valid, though possibly empty, List.
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 14Nov2008 1709 MW Fegan Initial creation. * 14Nov2008 1709 MW Fegan Initial creation.
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
* *
* </pre> * </pre>
* *
* @author mfegan * @author mfegan
* @version 1.0 * @version 1.0
*/ */
public interface ISubscribeRunner { public interface ISubscribeRunner {

View file

@ -17,17 +17,15 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.raytheon.edex.autobldsrv.data.SubscriptionRecord; import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
import com.raytheon.edex.subscription.dao.SubscriptionDAO;
import com.raytheon.edex.subscription.util.Tools;
import com.raytheon.uf.common.message.Message; import com.raytheon.uf.common.message.Message;
import com.raytheon.uf.common.message.Property; 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 * 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. * 14Sep2010 3944 cjeanbap Trim property values.
* 25May2011 8686 cjeanbap Updated if-statement to check for filepath * 25May2011 8686 cjeanbap Updated if-statement to check for filepath
* 26May2011 8686 cjeanbap fixed a punctuation bug * 26May2011 8686 cjeanbap fixed a punctuation bug
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
* </pre> * </pre>
* *
* @author mfegan * @author mfegan

View file

@ -17,32 +17,34 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.ArrayList;
import java.util.List; import java.util.List;
import com.raytheon.edex.autobldsrv.data.SubscriptionRecord; import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
import com.raytheon.edex.subscription.dao.SubscriptionDAO;
import com.raytheon.edex.subscription.util.Tools;
import com.raytheon.uf.common.message.Message; import com.raytheon.uf.common.message.Message;
import com.raytheon.uf.common.message.Property; 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 * Implements a subscription request runner that performs a delete operation in
* in the subscription database. * the subscription database.
*
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 14Nov2008 1709 MW Fegan Initial creation. * 14Nov2008 1709 MW Fegan Initial creation.
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
* *
* </pre> * </pre>
* *
* @author mfegan * @author mfegan
* @version 1.0 * @version 1.0
*/ */
public class SubscribeDeleteRunner extends ASubscribeRunner { public class SubscribeDeleteRunner extends ASubscribeRunner {
@ -61,8 +63,12 @@ public class SubscribeDeleteRunner extends ASubscribeRunner {
super(message); 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 @Override
public boolean execute() { public boolean execute() {

View file

@ -17,25 +17,28 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.ArrayList;
import java.util.List; import java.util.List;
import com.raytheon.edex.autobldsrv.data.SubscriptionRecord; import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
import com.raytheon.edex.subscription.dao.SubscriptionDAO;
import com.raytheon.edex.subscription.util.Tools;
import com.raytheon.uf.common.message.Message; import com.raytheon.uf.common.message.Message;
import com.raytheon.uf.common.message.Property; import com.raytheon.uf.common.message.Property;
import com.raytheon.uf.common.serialization.SerializationUtil; 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 * Implements a subscription request runner that performs a query to determine
* if there are currently any subscriptions for a specific trigger value. If there * if there are currently any subscriptions for a specific trigger value. If
* are subscriptions, they are placed into the response list. * there are subscriptions, they are placed into the response list.
* <P> * <P>
* This runner expects a message similar to * This runner expects a message similar to
* <PRE><CODE> *
* <PRE>
* <CODE>
* <message> * <message>
* <header> * <header>
* <properties name="operation" value="query" /> * <properties name="operation" value="query" />
@ -43,10 +46,14 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
* <properties name="trigger" value=" ... " /> * <properties name="trigger" value=" ... " />
* </header> * </header>
* </message> * </message>
* </CODE></PRE> * </CODE>
* The response following execution is a list of Property objects that can be used * </PRE>
* to form a Message similar to *
* <PRE><CODE> * The response following execution is a list of Property objects that can be
* used to form a Message similar to
*
* <PRE>
* <CODE>
* <message> * <message>
* <header> * <header>
* <properties name="count" value=" ... " /> * <properties name="count" value=" ... " />
@ -54,21 +61,25 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
* <properties name="subscription" value=" ... " /> * <properties name="subscription" value=" ... " />
* </header> * </header>
* </message> * </message>
* </CODE></PRE> * </CODE>
* In the response, the value of each subscription property is the XML serialization * </PRE>
* of the subscription from the database. *
* In the response, the value of each subscription property is the XML
* serialization of the subscription from the database.
*
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 14Nov2008 1709 MW Fegan Initial creation. * 14Nov2008 1709 MW Fegan Initial creation.
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
* *
* </pre> * </pre>
* *
* @author mfegan * @author mfegan
* @version 1.0 * @version 1.0
*/ */
public class SubscribeQueryRunner extends ASubscribeRunner { public class SubscribeQueryRunner extends ASubscribeRunner {
@ -88,8 +99,12 @@ public class SubscribeQueryRunner extends ASubscribeRunner {
super(message); 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 @Override
public boolean execute() { public boolean execute() {
@ -118,7 +133,7 @@ public class SubscribeQueryRunner extends ASubscribeRunner {
private List<SubscriptionRecord> filterRecords(List<SubscriptionRecord> records) { private List<SubscriptionRecord> filterRecords(List<SubscriptionRecord> records) {
List<SubscriptionRecord> retVal = new ArrayList<SubscriptionRecord>(); List<SubscriptionRecord> retVal = new ArrayList<SubscriptionRecord>();
for (SubscriptionRecord record : records) { for (SubscriptionRecord record : records) {
if (record.matchesTrigger(this.trigger)) { if (TriggerMatcher.matches(record, this.trigger)) {
retVal.add(record); retVal.add(record);
} }
} }

View file

@ -17,17 +17,17 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.ArrayList;
import java.util.List; import java.util.List;
import com.raytheon.edex.autobldsrv.data.SubscriptionRecord; import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
import com.raytheon.edex.subscription.dao.SubscriptionDAO;
import com.raytheon.edex.subscription.util.Tools;
import com.raytheon.uf.common.message.Header; import com.raytheon.uf.common.message.Header;
import com.raytheon.uf.common.message.Message; import com.raytheon.uf.common.message.Message;
import com.raytheon.uf.common.message.Property; 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 * 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 * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 14Nov2008 1709 MW Fegan Initial creation. * 14Nov2008 1709 MW Fegan Initial creation.
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
* *
* </pre> * </pre>
* *
@ -84,7 +85,7 @@ public class SubscribeReadRunner extends ASubscribeRunner {
/** /**
* Constructor. Creates an empty Runner object. This is the constructor * Constructor. Creates an empty Runner object. This is the constructor
* called by the {@link RunnerFactory}'s * 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 * getWorker(...)} method. The {@link #initialize(Message)} method must be
* called prior to using the worker. * called prior to using the worker.
*/ */
@ -105,7 +106,9 @@ public class SubscribeReadRunner extends ASubscribeRunner {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see com.raytheon.edex.subscription.runners.ASubscribeRunner#execute() * @see
* com.raytheon.uf.edex.plugin.text.subscription.runners.ASubscribeRunner
* #execute()
*/ */
@Override @Override
public boolean execute() { public boolean execute() {

View file

@ -17,10 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.edex.subscription.runners; package com.raytheon.uf.edex.plugin.text.subscription.runners;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; 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.message.Message;
import com.raytheon.uf.common.util.StringUtil; import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.edex.core.EdexException; import com.raytheon.uf.edex.core.EdexException;
import com.raytheon.uf.edex.plugin.text.subscription.util.SubscribeAction;
/** /**
* Factory class for creating Subscription Runner objects. * Factory class for creating Subscription Runner objects.
* <P> * <P>
* Two factory methods ({@link ASubscribeRunner#getInstance(String)} * Two factory methods ({@link ASubscribeRunner#getInstance(String)} and
* and {@link ASubscribeRunner#getInstance(String, Message)}) are used to instantiate * {@link ASubscribeRunner#getInstance(String, Message)}) are used to
* the known concrete implementations. * instantiate the known concrete implementations.
* <P> * <P>
* Expected usage: * Expected usage:
* <PRE><CODE> *
* <PRE>
* <CODE>
* String type = "..."; // name of an appropriate runner action * String type = "..."; // name of an appropriate runner action
* Message message = null; // initialized later... * Message message = null; // initialized later...
* *
@ -50,20 +50,23 @@ import com.raytheon.uf.edex.core.EdexException;
* } catch (EdexException e) { * } catch (EdexException e) {
* // handle the exception * // handle the exception
* } * }
* </CODE></PRE> * </CODE>
* </PRE>
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 18Nov2008 1709 MW Fegan Initial creation * 18Nov2008 1709 MW Fegan Initial creation
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
* removed duplicate SubscribeAction enum
* *
* </pre> * </pre>
* *
* @author mfegan * @author mfegan
* @version 1.0 * @version 1.0
*/ */
public class SubscribeRunner { public class SubscribeRunner {
@ -143,63 +146,4 @@ public class SubscribeRunner {
return retVal; 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);
}
}
} }

View file

@ -17,24 +17,26 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.ArrayList;
import java.util.List; import java.util.List;
import com.raytheon.edex.autobldsrv.data.SubscriptionRecord; import com.raytheon.uf.common.dataplugin.text.db.SubscriptionRecord;
import com.raytheon.edex.subscription.dao.SubscriptionDAO;
import com.raytheon.edex.subscription.util.Tools;
import com.raytheon.uf.common.message.Header; import com.raytheon.uf.common.message.Header;
import com.raytheon.uf.common.message.Message; import com.raytheon.uf.common.message.Message;
import com.raytheon.uf.common.message.Property; 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 * Implements a subscription request runner that performs an update of the data
* data in the subscription table. * in the subscription table.
* <p> * <p>
* Typical Usage: * Typical Usage:
* <PRE><CODE> *
* <PRE>
* <CODE>
* List<Property> results = null; * List<Property> results = null;
* SubscribeAction action = SubscribeAction.ACTION_UPDATE; * SubscribeAction action = SubscribeAction.ACTION_UPDATE;
* ISubscribeRunner runner = RunnerFactory.getInstance().getWorker(action); * ISubscribeRunner runner = RunnerFactory.getInstance().getWorker(action);
@ -43,19 +45,22 @@ import com.raytheon.uf.common.message.Property;
* runner.execute(); * runner.execute();
* results = runner.getResults(); * results = runner.getResults();
* } * }
* </CODE></PRE> * </CODE>
* </PRE>
*
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 05Dec2008 1709 MW Fegan Initial creation. * 05Dec2008 1709 MW Fegan Initial creation.
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
* *
* </pre> * </pre>
* *
* @author mfegan * @author mfegan
* @version 1.0 * @version 1.0
*/ */
public class SubscribeUpdateRunner extends ASubscribeRunner { public class SubscribeUpdateRunner extends ASubscribeRunner {
@ -74,8 +79,12 @@ public class SubscribeUpdateRunner extends ASubscribeRunner {
super(message); 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 @Override
public boolean execute() { public boolean execute() {

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.edex.services; package com.raytheon.uf.edex.plugin.text.subscription.services;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -31,15 +31,12 @@ import javax.xml.bind.JAXBException;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; 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.IMicroEngine;
import com.raytheon.edex.uengine.runners.MicroEngine; import com.raytheon.edex.uengine.runners.MicroEngine;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.message.DataURINotificationMessage; 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.Header;
import com.raytheon.uf.common.message.Message; import com.raytheon.uf.common.message.Message;
import com.raytheon.uf.common.message.Property; 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.ReflectionUtil;
import com.raytheon.uf.common.util.StringUtil; import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.edex.core.EdexException; 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. * 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 * 30Aug2011 10581 rferrel executeScript now sending proper trigger
* argument to the engine. * argument to the engine.
* Feb 15, 2013 1638 mschenke Moved DataURINotificationMessage to uf.common.dataplugin * Feb 15, 2013 1638 mschenke Moved DataURINotificationMessage to uf.common.dataplugin
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
* *
* </pre> * </pre>
* *

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.edex.services; package com.raytheon.uf.edex.plugin.text.subscription.services;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -25,30 +25,32 @@ import java.util.List;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; 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.Header;
import com.raytheon.uf.common.message.Message; import com.raytheon.uf.common.message.Message;
import com.raytheon.uf.common.message.Property; import com.raytheon.uf.common.message.Property;
import com.raytheon.uf.common.serialization.SerializationUtil; 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 * The main class of the Subscription Manager. Receives and processes
* requests from a client. Returns a response based on the result of processing the * subscription requests from a client. Returns a response based on the result
* request. * of processing the request.
*
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 15Dec2008 1709 MW Fegan Initial Creation. Replaces SubscribeSrv. * 15Dec2008 1709 MW Fegan Initial Creation. Replaces SubscribeSrv.
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
* *
* </pre> * </pre>
* *
* @author mfegan * @author mfegan
* @version 1.0 * @version 1.0
*/ */
public class SubscribeManager { public class SubscribeManager {

View file

@ -17,25 +17,39 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.HashMap;
import java.util.Map; 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> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 14Nov2008 1709 MW Fegan Initial creation. * 14Nov2008 1709 MW Fegan Initial creation.
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
* removed hard coded class names
* *
* </pre> * </pre>
* *
* @author mfegan * @author mfegan
* @version 1.0 * @version 1.0
*/ */
public enum SubscribeAction { public enum SubscribeAction {
@ -59,11 +73,11 @@ public enum SubscribeAction {
private static final Map<SubscribeAction, String> runners = new HashMap<SubscribeAction, String>() { private static final Map<SubscribeAction, String> runners = new HashMap<SubscribeAction, String>() {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
{ {
put(ACTION_ADD,"com.raytheon.edex.subscription.runners.SubscribeAddRunner"); put(ACTION_ADD, SubscribeAddRunner.class.getName());
put(ACTION_READ,"com.raytheon.edex.subscription.runners.SubscribeReadRunner"); put(ACTION_READ, SubscribeReadRunner.class.getName());
put(ACTION_DELETE,"com.raytheon.edex.subscription.runners.SubscribeDeleteRunner"); put(ACTION_DELETE, SubscribeDeleteRunner.class.getName());
put(ACTION_UPDATE,"com.raytheon.edex.subscription.runners.SubscribeUpdateRunner"); put(ACTION_UPDATE, SubscribeUpdateRunner.class.getName());
put(ACTION_QUERY,"com.raytheon.edex.subscription.runners.SubscribeQueryRunner"); put(ACTION_QUERY, SubscribeQueryRunner.class.getName());
} }
}; };
/** /**

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * 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.ArrayList;
import java.util.List; import java.util.List;
@ -28,19 +28,21 @@ import com.raytheon.uf.common.message.Property;
/** /**
* Utility class for the subscription manager. * Utility class for the subscription manager.
*
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 14Nov2008 1709 MW Fegan Initial creation. * 14Nov2008 1709 MW Fegan Initial creation.
* 14Sep2010 3944 cjeanbap Trim the newline char from value. * 14Sep2010 3944 cjeanbap Trim the newline char from value.
* May 22, 2014 2536 bclement moved from autobldsrv to edex.plugin.text
* *
* </pre> * </pre>
* *
* @author mfegan * @author mfegan
* @version 1.0 * @version 1.0
*/ */
public final class Tools { public final class Tools {

View file

@ -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;
}
}

View file

@ -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/rtpostgis.sql metadata
execute_psql_sql_script /awips2/postgresql/share/contrib/postgis-2.0/legacy.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}/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 execute_psql_sql_script ${SQL_SHARE_DIR}/fxatext.sql metadata
# create the events schema # create the events schema