Omaha #2536 merged uf.edex.textdbsrv into text plugins

split into uf.common.dataplugin.text and uf.edex.plugin.text


Former-commit-id: 5f238c51d856984808dee0d2ba62b6a8fbdbd6a1
This commit is contained in:
Brian Clements 2014-05-13 09:16:59 -05:00
parent d9e395e51c
commit 2f5cffbe15
54 changed files with 473 additions and 603 deletions

View file

@ -25,35 +25,28 @@
</requires>
<plugin
id="com.raytheon.uf.common.archive"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.auth"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.archive"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.edex.textdb"
id="com.raytheon.uf.common.archive"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.textdbsrv"
id="com.raytheon.uf.edex.auth"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.archive"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.edex.textdb"
download-size="0"
install-size="0"
version="0.0.0"

View file

@ -2,31 +2,29 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Texteditor Plug-in
Bundle-SymbolicName: com.raytheon.viz.texteditor;singleton:=true
Bundle-Version: 1.12.1174.qualifier
Bundle-Version: 1.14.0.qualifier
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
Bundle-Activator: com.raytheon.viz.texteditor.Activator
Bundle-Vendor: Raytheon
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.jep;bundle-version="1.0.0",
com.raytheon.viz.core,
com.raytheon.viz.ui,
org.eclipse.ui.workbench.texteditor,
org.eclipse.jface.text,
com.raytheon.edex.common,
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
Require-Bundle: com.raytheon.edex.common,
com.raytheon.edex.textdb,
com.raytheon.uf.edex.textdbsrv,
com.raytheon.uf.common.activetable,
com.raytheon.uf.common.auth;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.text;bundle-version="1.11.30",
com.raytheon.uf.common.dataplugin.warning;bundle-version="1.12.1174",
com.raytheon.uf.common.python,
com.raytheon.uf.common.serialization.comm,
com.raytheon.uf.viz.spellchecker;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.text;bundle-version="1.11.30",
com.raytheon.uf.common.site;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
com.raytheon.uf.viz.localization,
com.raytheon.uf.common.auth;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.warning;bundle-version="1.12.1174",
com.raytheon.uf.common.activetable
com.raytheon.uf.viz.spellchecker;bundle-version="1.0.0",
com.raytheon.viz.core,
com.raytheon.viz.ui,
org.eclipse.core.runtime,
org.eclipse.jface.text,
org.eclipse.ui,
org.eclipse.ui.workbench.texteditor,
org.jep;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.viz.texteditor,
com.raytheon.viz.texteditor.alarmalert.dialogs,

View file

@ -19,12 +19,12 @@
**/
package com.raytheon.viz.texteditor;
import javax.xml.bind.JAXBException;
import com.raytheon.uf.common.comm.HttpClient;
import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
import com.raytheon.uf.common.message.Message;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/**
*
@ -34,6 +34,7 @@ import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 12, 2008 jkorman Initial creation
* May 15, 2014 2536 bclement better error handling for executeQuery()
* </pre>
*
* @author jkorman
@ -44,6 +45,9 @@ public class HTTPQueryTransport implements IQueryTransport {
private final String serviceURL;
private static final IUFStatusHandler log = UFStatus
.getHandler(HTTPQueryTransport.class);
/**
*
* @param urlBase
@ -64,7 +68,7 @@ public class HTTPQueryTransport implements IQueryTransport {
/**
*
*
* @see com.raytheon.uf.edex.services.textdbsrv.IQueryTransport#executeQuery(com.raytheon.uf.common.message.Message)
* @see com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport#executeQuery(com.raytheon.uf.common.message.Message)
*/
@Override
public Message executeQuery(Message message) {
@ -77,16 +81,11 @@ public class HTTPQueryTransport implements IQueryTransport {
String response = client.post(serviceURL, xml);
if(response != null) {
Object o = SerializationUtil.unmarshalFromXml(response);
if(o instanceof Message) {
message = (Message) o;
}
message = SerializationUtil.unmarshalFromXml(Message.class,
response);
}
} catch (JAXBException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
log.error("Error executing HTTP text query", e);
}
return message;

View file

@ -49,10 +49,10 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.text.alarms.AlarmAlertProduct;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.viz.core.mode.CAVEMode;
import com.raytheon.viz.texteditor.alarmalert.dialogs.AlarmDisplayWindow.ACCUMULATE_STATE;
import com.raytheon.viz.texteditor.alarmalert.util.AlarmAlertFunctions;

View file

@ -25,11 +25,11 @@ import java.util.List;
import com.raytheon.edex.textdb.dbapi.impl.AFOSParser;
import com.raytheon.uf.common.dataplugin.text.StdTextProductContainer;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
import com.raytheon.uf.common.dataplugin.text.request.ExecuteAfosCmdRequest;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.core.mode.CAVEMode;

View file

@ -22,11 +22,11 @@ package com.raytheon.viz.texteditor.command;
import java.util.List;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
import com.raytheon.uf.common.dataplugin.text.request.ExecuteAwipsCmdRequest;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.core.mode.CAVEMode;

View file

@ -28,17 +28,15 @@ import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
import com.raytheon.uf.common.dataplugin.text.dbsrv.TextDBQuery;
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.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.uf.edex.services.textdbsrv.TextDBQuery;
import com.raytheon.uf.viz.core.status.StatusConstants;
import com.raytheon.viz.core.mode.CAVEMode;
import com.raytheon.viz.texteditor.Activator;
/**
* Pairs a command and its associated type.

View file

@ -22,7 +22,7 @@ package com.raytheon.viz.texteditor.command;
import java.util.List;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
/**
* A command.

View file

@ -30,10 +30,10 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.texteditor.util.TextEditorUtil;

View file

@ -22,11 +22,11 @@ package com.raytheon.viz.texteditor.command;
import java.util.List;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
import com.raytheon.uf.common.dataplugin.text.request.ExecuteWmoCmdRequest;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.core.mode.CAVEMode;

View file

@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.SortedSet;
import java.util.concurrent.LinkedBlockingQueue;
@ -60,14 +61,14 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.edex.textdb.dbapi.impl.AFOS_CLASS;
import com.raytheon.edex.textdb.dbapi.impl.AFOS_ORIGIN;
import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
import com.raytheon.uf.common.dataplugin.text.dbsrv.TextDBQuery;
import com.raytheon.uf.common.message.Message;
import com.raytheon.uf.common.message.Property;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.uf.edex.services.textdbsrv.TextDBQuery;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.viz.core.mode.CAVEMode;
@ -103,6 +104,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* off the UI thread.
* Changes to have multiple query jobs.
* 15Apr2014 #3031 lvenable Added dispose check in the runAsync calls.
* 19May2014 2536 bclement removed TimeTools usage
* </pre>
*
* @author lvenable
@ -712,7 +714,7 @@ public class AfosBrowserDlg extends CaveSWTDialog implements
private void finishDesignatorTimeList() {
String value = null;
if (newestTime > 0L) {
Calendar c = TimeTools.newCalendar(newestTime);
Calendar c = TimeUtil.newGmtCalendar(new Date(newestTime));
value = String.format(TIME_FORMAT, c);
} else if (newestTime == -1) {
value = DATA_ERROR;
@ -760,7 +762,7 @@ public class AfosBrowserDlg extends CaveSWTDialog implements
int selectIndex = designatorList.getSelectionIndex();
for (Long time : times) {
if (time > 0) {
Calendar c = TimeTools.newCalendar(time);
Calendar c = TimeUtil.newGmtCalendar(new Date(time));
value = String.format(TIME_FORMAT, c);
} else if (time == -1) {
value = DATA_ERROR;

View file

@ -117,6 +117,7 @@ import com.raytheon.uf.common.dataplugin.text.RemoteRetrievalResponse;
import com.raytheon.uf.common.dataplugin.text.alarms.AlarmAlertProduct;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProductId;
import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
import com.raytheon.uf.common.dataplugin.text.request.RemoteRetrievalRequest;
import com.raytheon.uf.common.dataplugin.text.request.StdTextProductServerRequest;
import com.raytheon.uf.common.dataplugin.text.request.TextProductInfoCreateRequest;
@ -138,7 +139,6 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.wmo.WMOHeader;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.exception.VizException;

View file

@ -21,7 +21,7 @@
package com.raytheon.viz.texteditor.msgs;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
/**
* The IWmoBrowserCallback interface specifies methods that return a selected

View file

@ -34,9 +34,9 @@ import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.python.PythonLocalizationPathBuilder;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.viz.texteditor.HTTPQueryTransport;
import com.raytheon.viz.texteditor.command.ICommand;

View file

@ -24,8 +24,6 @@ import java.util.Calendar;
import java.util.List;
import java.util.TimeZone;
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -40,7 +38,6 @@ import com.raytheon.uf.common.dataplugin.text.db.StateMatch;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.dataplugin.text.db.TextProductInfo;
import com.raytheon.uf.common.dataplugin.text.db.WatchWarn;
import com.raytheon.uf.common.message.Header;
import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.common.wmo.AFOSProductId;
import com.raytheon.uf.common.wmo.WMOHeader;
@ -73,6 +70,7 @@ import com.raytheon.uf.edex.core.props.PropertiesFactory;
* 23 May 2012 14952 rferrel Allow queries with refTime.
* Feb 18, 2014 2652 skorolev Corrected writeProduct for WMO header if archive is allowed. Deleted unused code.
* May 14, 2014 2536 bclement moved WMO Header to common, removed TimeTools usage
* May 15, 2014 2536 bclement moved asciiToHex() hexToAscii() and getProperty() to PropConverter
* </pre>
*
* @author jkorman
@ -994,8 +992,14 @@ public class TextDB {
if (pieces.length > 1) {
pieces[0] += "\n"; // WMOHeader expects this
}
String fileName = (String) headers.get(WMOHeader.INGEST_FILE_NAME);
WMOHeader header = new WMOHeader(pieces[0].getBytes(), fileName);
byte[] bytes = pieces[0].getBytes();
WMOHeader header;
if (headers != null) {
String fileName = (String) headers.get(WMOHeader.INGEST_FILE_NAME);
header = new WMOHeader(bytes, fileName);
} else {
header = new WMOHeader(bytes);
}
// Need to construct an AFOSProductId from the productId
if (productId.length() <= 6) {
@ -1022,50 +1026,6 @@ public class TextDB {
return retValue;
}
/**
* ASCII to HEX conversion.
*
* @param string
* ascii string
* @return hex code
*/
public static String asciiToHex(String string) {
return new HexBinaryAdapter().marshal(string.getBytes());
}
/**
* HEX To ASCII conversion
*
* @param hexString
* @return ascii string
*/
public static String hexToAscii(String hexString) {
byte[] b = new HexBinaryAdapter().unmarshal(hexString);
return new String(b);
}
/**
* Get Property.
*
* @param header
* contains message header.
* @param propName
* contains property name.
* @return property name
*/
public static String getProperty(Header header, String propName) {
String result = null;
String value = header.getProperty(propName);
if (value != null) {
result = hexToAscii(value);
}
return result;
}
/**
* Get Operational Mode
*

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Textdb Plug-in
Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.text
Bundle-Version: 1.12.1174.qualifier
Bundle-Version: 1.14.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
@ -10,6 +10,7 @@ Require-Bundle: com.raytheon.uf.common.serialization,
org.hibernate,
com.raytheon.uf.common.localization;bundle-version="1.12.1174"
Import-Package: com.raytheon.uf.common.dataplugin.persist,
com.raytheon.uf.common.message,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.serialization.annotations,
com.raytheon.uf.common.serialization.comm,
@ -19,5 +20,6 @@ Import-Package: com.raytheon.uf.common.dataplugin.persist,
Export-Package: com.raytheon.uf.common.dataplugin.text;uses:="com.raytheon.uf.common.dataplugin.text.db,com.raytheon.uf.common.serialization",
com.raytheon.uf.common.dataplugin.text.alarms,
com.raytheon.uf.common.dataplugin.text.db;uses:="com.raytheon.uf.common.dataplugin.persist,com.raytheon.uf.common.wmo,com.raytheon.uf.common.serialization",
com.raytheon.uf.common.dataplugin.text.dbsrv,
com.raytheon.uf.common.dataplugin.text.request;uses:="com.raytheon.uf.common.serialization.comm"

View file

@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.common.dataplugin.text.db.AfosToAwips;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -36,6 +35,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 24, 2009 2924 rjpeter Initial creation
* May 15, 2014 2536 bclement removed ISerializableObject
*
* </pre>
*
@ -43,7 +43,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* @version 1.0
*/
@DynamicSerialize
public class AfosWmoIdDataContainer implements ISerializableObject {
public class AfosWmoIdDataContainer {
@DynamicSerializeElement
private List<AfosToAwips> idList = new ArrayList<AfosToAwips>();

View file

@ -23,12 +23,11 @@ import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.common.dataplugin.text.db.AutoFaxRecord;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* TODO Add Description
* Serialization wrapper for a list of AutoFaxRecords
*
* <pre>
*
@ -37,6 +36,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 2, 2010 bfarmer Initial creation
* May 15, 2014 2536 bclement removed ISerializableObject
*
* </pre>
*
@ -44,7 +44,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* @version 1.0
*/
@DynamicSerialize
public class AutoFaxContainer implements ISerializableObject {
public class AutoFaxContainer {
@DynamicSerializeElement
private List<AutoFaxRecord> autoFaxList = new ArrayList<AutoFaxRecord>();

View file

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -17,6 +16,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* March 24, 2010 4734 M. Huang Initial creation
* May 15, 2014 2536 bclement removed ISerializableObject
*
* </pre>
*
@ -24,7 +24,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* @version 1.0
*/
@DynamicSerialize
public class StdTextProductContainer implements ISerializableObject{
public class StdTextProductContainer {
@DynamicSerializeElement
private static List<StdTextProduct> productList = new ArrayList<StdTextProduct>();

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.common.dataplugin.text.alarms;
import java.util.Date;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -37,6 +36,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Sep 29, 2009 mnash Initial creation
* 07Jul2010 2187 cjeanbap Added operational mode flag.
* May 23, 2012 14952 rferrel Added refTime.
* May 15, 2014 2536 bclement removed ISerializableObject
*
* </pre>
*
@ -45,7 +45,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/
@DynamicSerialize
public class AlarmAlertProduct implements ISerializableObject {
public class AlarmAlertProduct {
public enum ProductType {
Alarm_Alert, Proximity_Alarm

View file

@ -17,25 +17,26 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbsrv;
package com.raytheon.uf.common.dataplugin.text.dbsrv;
import com.raytheon.uf.common.message.Message;
/**
* TODO Add Description
* Command executor interface for textdbsrv
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 7, 2008 1538 jkorman Initial creation
*
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
*
* </pre>
*
*
* @author jkorman
* @version 1.0
* @version 1.0
*/
public interface ICommandExecutor {

View file

@ -17,25 +17,26 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbsrv;
package com.raytheon.uf.common.dataplugin.text.dbsrv;
import com.raytheon.uf.common.message.Message;
/**
* TODO Add Description
* Transport interface for sending textdb query messages to query service
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 3, 2008 jkorman Initial creation
*
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
*
* </pre>
*
*
* @author jkorman
* @version 1.0
* @version 1.0
*/
public interface IQueryTransport {

View file

@ -0,0 +1,89 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.dataplugin.text.dbsrv;
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
import com.raytheon.uf.common.message.Header;
/**
* Utilities for hexadecimal property values
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 15, 2014 2536 bclement Initial creation
*
* </pre>
*
* @author bclement
* @version 1.0
*/
public class PropConverter {
/**
* ASCII to HEX conversion.
*
* @param string
* ascii string
* @return hex code
*/
public static String asciiToHex(String string) {
return new HexBinaryAdapter().marshal(string.getBytes());
}
/**
* HEX To ASCII conversion
*
* @param hexString
* @return ascii string
*/
public static String hexToAscii(String hexString) {
byte[] b = new HexBinaryAdapter().unmarshal(hexString);
return new String(b);
}
/**
* Get hexadecimal property value. Converts value from hex to ASCII (if
* non-null).
*
* @param header
* contains message header.
* @param propName
* contains property name.
* @return property value or null if property is not in header
*/
public static String getProperty(Header header, String propName) {
String result = null;
String value = header.getProperty(propName);
if (value != null) {
result = hexToAscii(value);
}
return result;
}
}

View file

@ -17,23 +17,24 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbsrv;
package com.raytheon.uf.common.dataplugin.text.dbsrv;
/**
* TODO Add Description
* Textdbsrv state table enum
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 7, 2008 1538 jkorman Initial creation
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
* </pre>
*
* @author jkorman
* @version 1.0
*/
public enum StateTableTags implements ICommandTags {
public enum StateTableTags {
OP, STATE, CCC, XXX;
}

View file

@ -17,10 +17,8 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbsrv;
package com.raytheon.uf.common.dataplugin.text.dbsrv;
import static com.raytheon.edex.textdb.dbapi.impl.TextDB.asciiToHex;
import static com.raytheon.edex.textdb.dbapi.impl.TextDB.hexToAscii;
import java.util.ArrayList;
@ -40,6 +38,7 @@ import com.raytheon.uf.common.message.Property;
* 28May2010 cjeanbap Added operational functionality.
* 02Aug2010 2187 cjeanbap Update variable/method signature to be consistent.
* 29Jan2013 1496 rferrel Added methods clearProductIds and clone.
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
*
* </pre>
*
@ -432,7 +431,7 @@ public class TextDBQuery {
for (Property property : properties) {
String s = property.getValue();
if (s != null) {
property.setValue(asciiToHex(s));
property.setValue(PropConverter.asciiToHex(s));
}
}
Property[] p = new Property[properties.size()];
@ -454,7 +453,7 @@ public class TextDBQuery {
for (Property p : properties) {
String s = p.getValue();
if (s != null) {
p.setValue(hexToAscii(s));
p.setValue(PropConverter.hexToAscii(s));
}
}
}

View file

@ -17,23 +17,24 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbsrv;
package com.raytheon.uf.common.dataplugin.text.dbsrv;
/**
* TODO Add Description
* Textdbsrv command enum
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 7, 2008 1538 jkorman Initial creation
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
* </pre>
*
* @author jkorman
* @version 1.0
*/
public enum TextDBSrvCommandTags implements ICommandTags {
public enum TextDBSrvCommandTags {
VIEW, ERROR, PUT, GET, DELETE;
}

View file

@ -17,10 +17,10 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbsrv;
package com.raytheon.uf.common.dataplugin.text.dbsrv;
/**
* TODO Add Description
* Enumeration for textdbsrv view retrieval options
*
* <pre>
*
@ -30,12 +30,13 @@ package com.raytheon.uf.edex.services.textdbsrv;
* 10/15/2008 1538 jkorman Initial creation.
* 08/05/2009 2191 rjpeter Added PRODXML and JOINXML.
* 05/17/2010 2187 cjeanbap Added OPERATIONAL.
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
* </pre>
*
* @author jkorman
* @version 1.0
*/
public enum TextViewGetTags implements ICommandTags {
public enum TextViewGetTags {
LATEST, ALL, INFO, PROD, JOIN, RAW, UNIX, DEFAULT, CLIENT, PRODXML, JOINXML, OPERATIONAL;
}

View file

@ -17,10 +17,10 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbsrv;
package com.raytheon.uf.common.dataplugin.text.dbsrv;
/**
* TODO Add Description
* Enumeration for textdbsrv view options
*
* <pre>
* SOFTWARE HISTORY
@ -28,12 +28,13 @@ package com.raytheon.uf.edex.services.textdbsrv;
* ------------ ---------- ----------- --------------------------
* Oct 14, 2008 1538 jkorman Initial creation
* 21May2010 2187 cjeanbap Add OPERATIONAL code
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
* </pre>
*
* @author jkorman
* @version 1.0
*/
public enum TextViewTags implements ICommandTags {
public enum TextViewTags {
OP, SUBOP, PRODID, FORMAT, CLIENTFMT, PRODUCT, AFOSCMD, WMOID, SITE, HOUR, HDRTIME, BBB, NNNXXX, FULLREAD, OPERATIONAL, TEST, PRACTICE;
}

View file

@ -17,26 +17,27 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbsrv;
package com.raytheon.uf.common.dataplugin.text.dbsrv;
/**
* TODO Add Description
* Enumeration for textdbsrv version header fields
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 8, 2008 1538 jkorman Initial creation
*
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
*
* </pre>
*
*
* @author jkorman
* @version 1.0
* @version 1.0
*/
public enum VersionsTableTags implements ICommandTags {
public enum VersionsTableTags {
OP, PRODID, VERSION;
}

View file

@ -17,26 +17,27 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbsrv;
package com.raytheon.uf.common.dataplugin.text.dbsrv;
/**
*
* Textdbsrv warning header fields
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 8, 2008 1538 jkorman Initial creation
*
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
*
* </pre>
*
*
* @author jkorman
* @version 1.0
* @version 1.0
*/
public enum WarnTableTags implements ICommandTags {
public enum WarnTableTags {
OP, PRODID, SCRIPT;
}

View file

@ -17,10 +17,13 @@ Require-Bundle: com.raytheon.edex.textdb,
com.raytheon.uf.edex.ndm;bundle-version="1.0.0",
com.raytheon.uf.common.localization;bundle-version="1.14.0"
Export-Package: com.raytheon.uf.edex.plugin.text,
com.raytheon.uf.edex.plugin.text.dao
com.raytheon.uf.edex.plugin.text.dao,
com.raytheon.uf.edex.plugin.text.dbsrv
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.dataplugin.text,
com.raytheon.uf.common.dataplugin.text.db,
com.raytheon.uf.common.dataplugin.text.dbsrv,
com.raytheon.uf.common.dataplugin.text.request,
com.raytheon.uf.common.message,
com.raytheon.uf.common.wmo,
org.apache.commons.logging

View file

@ -42,6 +42,8 @@
<property name="autoFaxNotifyURI" value="jms-generic:topic:autofax.notify"/>
</bean>
<bean id="textdbsrv" class="com.raytheon.uf.edex.plugin.text.dbsrv.TextDBSrv" />
<camelContext id="autofax-common-camel"
xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler">
@ -56,6 +58,13 @@
</doTry>
</route>
<route id="textdbsrvinternal">
<from uri="direct-vm:int.textdb.request" />
<bean ref="serializationUtil" method="unmarshalFromXml" />
<bean ref="textdbsrv" method="processMessage" />
<bean ref="serializationUtil" method="marshalToXml" />
</route>
</camelContext>
<bean factory-bean="manualProc"

View file

@ -58,4 +58,21 @@
<constructor-arg value="com.raytheon.uf.common.dataplugin.text.request.GetAutoFaxRecordsRequest"/>
<constructor-arg ref="getAutoFaxRecordsRequestHandler"/>
</bean>
<!-- textdb -->
<bean id="textDbSrvWrapper" class = "com.raytheon.uf.edex.plugin.text.dbsrv.TextDBSrvWrapper">
<property name="textdbSrv" ref="textdbsrv"/>
<property name="byteLimitInMB" value="${textdbsrv.byteLimitInMB}"/>
</bean>
<camelContext id="textdbsrv-request-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
<endpoint id="textdbsrvXml_from"
uri="jetty:http://0.0.0.0:${HTTP_PORT}/services/textdbsrv?disableStreamCache=true" />
<route id="textdbsrvXml">
<from uri="ref:textdbsrvXml_from" />
<bean ref="textDbSrvWrapper" method="executeTextDBMessage" />
</route>
</camelContext>
</beans>

View file

@ -17,16 +17,16 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services;
package com.raytheon.uf.edex.plugin.text.dbsrv;
import com.raytheon.uf.common.dataplugin.text.dbsrv.ICommandExecutor;
import com.raytheon.uf.common.message.Message;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.services.textdbimpl.CommandExecutor;
import com.raytheon.uf.edex.services.textdbsrv.ICommandExecutor;
import com.raytheon.uf.edex.plugin.text.dbsrv.impl.CommandExecutor;
/**
*
* Service for processing textdb queries
*
* <pre>
* SOFTWARE HISTORY
@ -34,6 +34,7 @@ import com.raytheon.uf.edex.services.textdbsrv.ICommandExecutor;
* ------------ ---------- ----------- --------------------------
* Oct 03, 2008 1538 jkorman Initial implementation.
* Mar 26, 2014 2835 rjpeter Added logging.
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
* </pre>
*
* @author jkorman

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
*/
package com.raytheon.uf.edex.textdbsrv;
package com.raytheon.uf.edex.plugin.text.dbsrv;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@ -33,8 +33,7 @@ import com.raytheon.uf.common.util.ByteArrayOutputStreamPool;
import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.common.util.stream.LimitingInputStream;
import com.raytheon.uf.common.util.stream.LimitingOutputStream;
import com.raytheon.uf.edex.services.TextDBSrv;
import com.raytheon.uf.edex.services.textdbimpl.CommandExecutor;
import com.raytheon.uf.edex.plugin.text.dbsrv.impl.CommandExecutor;
/**
* Thin wrapper around TextDBSrv to handle marshalling/unmarshalling and
@ -47,6 +46,7 @@ import com.raytheon.uf.edex.services.textdbimpl.CommandExecutor;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 15, 2014 2928 rjpeter Initial creation.
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
*
* </pre>
*

View file

@ -17,25 +17,22 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbimpl;
package com.raytheon.uf.edex.plugin.text.dbsrv.impl;
import static com.raytheon.edex.textdb.dbapi.impl.TextDB.asciiToHex;
import static com.raytheon.edex.textdb.dbapi.impl.TextDB.getProperty;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.uf.common.dataplugin.text.dbsrv.ICommandExecutor;
import com.raytheon.uf.common.dataplugin.text.dbsrv.PropConverter;
import com.raytheon.uf.common.dataplugin.text.dbsrv.TextDBSrvCommandTags;
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.services.textdbsrv.ICommandExecutor;
import com.raytheon.uf.edex.services.textdbsrv.TextDBSrvCommandTags;
/**
* TODO Add Description
* Executes command messages in ICommandExecutors. The executor is determined by
* the VIEW_CMD header in the message.
*
* <pre>
*
@ -43,6 +40,7 @@ import com.raytheon.uf.edex.services.textdbsrv.TextDBSrvCommandTags;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 7, 2008 1538 jkorman Initial creation
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv, removed unused logger
*
* </pre>
*
@ -52,8 +50,6 @@ import com.raytheon.uf.edex.services.textdbsrv.TextDBSrvCommandTags;
public class CommandExecutor implements ICommandExecutor {
private Log logger = LogFactory.getLog(getClass());
private static final TextDBSrvCommandTags VIEW_CMD = TextDBSrvCommandTags.VIEW;
private Map<String, ICommandExecutor> execMap = new HashMap<String, ICommandExecutor>();
@ -100,7 +96,7 @@ public class CommandExecutor implements ICommandExecutor {
if (message != null) {
Header header = message.getHeader();
if (header != null) {
cmdView = getProperty(header, VIEW_CMD.name());
cmdView = PropConverter.getProperty(header, VIEW_CMD.name());
}
}
return cmdView;
@ -139,8 +135,8 @@ public class CommandExecutor implements ICommandExecutor {
public static final Message createErrorMessage(String error) {
Message msg = new Message();
Header h = new Header();
h.setProperties(new Property[] { new Property("STDERR",
asciiToHex(error)), });
h.setProperties(new Property[] { new Property("STDERR", PropConverter
.asciiToHex(error)), });
msg.setHeader(h);

View file

@ -17,21 +17,20 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbimpl;
package com.raytheon.uf.edex.plugin.text.dbsrv.impl;
import static com.raytheon.edex.textdb.dbapi.impl.TextDB.asciiToHex;
import static com.raytheon.edex.textdb.dbapi.impl.TextDB.getProperty;
import java.util.List;
import com.raytheon.edex.textdb.dbapi.impl.TextDB;
import com.raytheon.uf.common.dataplugin.text.db.StateMatch;
import com.raytheon.uf.common.dataplugin.text.dbsrv.ICommandExecutor;
import com.raytheon.uf.common.dataplugin.text.dbsrv.PropConverter;
import com.raytheon.uf.common.dataplugin.text.dbsrv.StateTableTags;
import com.raytheon.uf.common.dataplugin.text.dbsrv.TextDBSrvCommandTags;
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.services.textdbsrv.ICommandExecutor;
import com.raytheon.uf.edex.services.textdbsrv.StateTableTags;
import com.raytheon.uf.edex.services.textdbsrv.TextDBSrvCommandTags;
/**
*
@ -42,7 +41,8 @@ import com.raytheon.uf.edex.services.textdbsrv.TextDBSrvCommandTags;
* ------------ ---------- ----------- --------------------------
* Oct 7, 2008 1538 jkorman Initial creation
* Aug 31, 2010 2103 cjeanbap Check variable for null.
*
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
*
* </pre>
*
* @author jkorman
@ -86,7 +86,8 @@ public class StateTableAdapter implements ICommandExecutor {
Header sHeader = cmdMessage.getHeader();
// Get the operation code
String op = getProperty(sHeader, StateTableTags.OP.name());
String op = PropConverter
.getProperty(sHeader, StateTableTags.OP.name());
TextDBSrvCommandTags opTag = TextDBSrvCommandTags.valueOf(op);
@ -94,25 +95,32 @@ public class StateTableAdapter implements ICommandExecutor {
switch (opTag) {
case PUT: {
String state = getProperty(sHeader, StateTableTags.STATE.name());
String cccId = getProperty(sHeader, StateTableTags.CCC.name());
String xxxId = getProperty(sHeader, StateTableTags.XXX.name());
String state = PropConverter.getProperty(sHeader,
StateTableTags.STATE.name());
String cccId = PropConverter.getProperty(sHeader,
StateTableTags.CCC.name());
String xxxId = PropConverter.getProperty(sHeader,
StateTableTags.XXX.name());
if ((state != null) && (cccId != null) && (xxxId != null)) {
addStateData(sHeader, state, xxxId, cccId);
}
break;
}
case GET: {
String state = getProperty(sHeader, StateTableTags.STATE.name());
String state = PropConverter.getProperty(sHeader,
StateTableTags.STATE.name());
if (state != null) {
getStateData(sHeader, state);
}
break;
}
case DELETE: {
String state = getProperty(sHeader, StateTableTags.STATE.name());
String cccId = getProperty(sHeader, StateTableTags.CCC.name());
String xxxId = getProperty(sHeader, StateTableTags.XXX.name());
String state = PropConverter.getProperty(sHeader,
StateTableTags.STATE.name());
String cccId = PropConverter.getProperty(sHeader,
StateTableTags.CCC.name());
String xxxId = PropConverter.getProperty(sHeader,
StateTableTags.XXX.name());
if ((state != null) && (cccId != null) && (xxxId != null)) {
deleteStateData(sHeader, state, xxxId, cccId);
}
@ -121,8 +129,9 @@ public class StateTableAdapter implements ICommandExecutor {
default: {
String tagName = (opTag != null) ? opTag.name() : "null";
Property[] props = new Property[] { new Property("STDERR",
asciiToHex("ERROR:Invalid command tag = [" + tagName
+ "]")), };
PropConverter
.asciiToHex("ERROR:Invalid command tag = ["
+ tagName + "]")), };
sHeader.setProperties(props);
break;
}
@ -144,9 +153,10 @@ public class StateTableAdapter implements ICommandExecutor {
private void addStateData(Header header, String state, String xxxId,
String cccId) {
Property newProperty = new Property("STDERR",
asciiToHex("NORMAL:Adding a new state-ccc."));
PropConverter.asciiToHex("NORMAL:Adding a new state-ccc."));
Property errProperty = new Property("STDERR",
asciiToHex("ERROR:Failure adding to state_ccc table."));
PropConverter
.asciiToHex("ERROR:Failure adding to state_ccc table."));
Property[] props = new Property[] { newProperty, };
if (!textDB.addState(state, cccId, xxxId)) {
@ -174,17 +184,20 @@ public class StateTableAdapter implements ICommandExecutor {
if (dataList != null && dataList.size() > 0) {
props = new Property[dataList.size() + HEADER_LINES];
int i = 0;
props[i++] = new Property(PROP_FMT, asciiToHex("XXX CCC"));
props[i++] = new Property(PROP_FMT, asciiToHex("-------"));
props[i++] = new Property(PROP_FMT,
PropConverter.asciiToHex("XXX CCC"));
props[i++] = new Property(PROP_FMT,
PropConverter.asciiToHex("-------"));
for (StateMatch s : dataList) {
props[i++] = new Property(PROP_FMT, asciiToHex(s.getPk()
.getXxx()
+ " " + s.getPk().getCcc()));
props[i++] = new Property(PROP_FMT, PropConverter.asciiToHex(s
.getPk()
.getXxx() + " " + s.getPk().getCcc()));
}
} else {
props = new Property[] { new Property(
"STDERR",
asciiToHex("ERROR:Failure reading from state lookup table.")), };
PropConverter
.asciiToHex("ERROR:Failure reading from state lookup table.")), };
}
header.setProperties(props);
}
@ -203,10 +216,11 @@ public class StateTableAdapter implements ICommandExecutor {
if (textDB.removeState(state, xxxId, cccId)) {
props = new Property[] { new Property("STDERR",
asciiToHex("NORMAL:Deleting state-ccc.")), };
PropConverter.asciiToHex("NORMAL:Deleting state-ccc.")), };
} else {
props = new Property[] { new Property("STDERR",
asciiToHex("ERROR:Failure deleting from state_ccc table.")), };
PropConverter
.asciiToHex("ERROR:Failure deleting from state_ccc table.")), };
}
header.setProperties(props);
}

View file

@ -17,22 +17,18 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbimpl;
package com.raytheon.uf.edex.plugin.text.dbsrv.impl;
import static com.raytheon.edex.textdb.dbapi.impl.TextDB.asciiToHex;
import static com.raytheon.edex.textdb.dbapi.impl.TextDB.getProperty;
import static com.raytheon.edex.textdb.dbapi.impl.TextDB.hexToAscii;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -40,18 +36,21 @@ import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.textdb.alarms.AlarmAlertUtil;
import com.raytheon.edex.textdb.dbapi.impl.TextDB;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.dataplugin.text.dbsrv.ICommandExecutor;
import com.raytheon.uf.common.dataplugin.text.dbsrv.PropConverter;
import com.raytheon.uf.common.dataplugin.text.dbsrv.TextDBSrvCommandTags;
import com.raytheon.uf.common.dataplugin.text.dbsrv.TextViewGetTags;
import com.raytheon.uf.common.dataplugin.text.dbsrv.TextViewTags;
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.JAXBManager;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.edex.core.EDEXUtil;
import com.raytheon.uf.edex.core.EdexException;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.edex.services.textdbsrv.ICommandExecutor;
import com.raytheon.uf.edex.services.textdbsrv.TextDBSrvCommandTags;
import com.raytheon.uf.edex.services.textdbsrv.TextViewGetTags;
import com.raytheon.uf.edex.services.textdbsrv.TextViewTags;
/**
* Handles database interactions with the Text DB's standard text products
@ -73,6 +72,7 @@ import com.raytheon.uf.edex.services.textdbsrv.TextViewTags;
* 28Sep2010 6338 cjeanbap Added retrieval of current node by site.
* --------------------------------
* 27Apr2012 564 jkorman Added sort to ALL times retrieval.
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv, added marshalToStream()
*
* </pre>
*
@ -129,7 +129,7 @@ public class TextViewAdapter implements ICommandExecutor {
Header sHeader = cmdMessage.getHeader();
// Get the operation code
String op = getProperty(sHeader, TextViewTags.OP.name());
String op = PropConverter.getProperty(sHeader, TextViewTags.OP.name());
TextDBSrvCommandTags opTag = TextDBSrvCommandTags.valueOf(op);
@ -147,14 +147,17 @@ public class TextViewAdapter implements ICommandExecutor {
}
case DELETE: {
Property[] props = new Property[] { new Property("STDERR",
asciiToHex("ERROR:Command tag = [" + opTag.name()
PropConverter.asciiToHex("ERROR:Command tag = ["
+ opTag.name()
+ "] not implemented")), };
sHeader.setProperties(props);
break;
}
default: {
Property[] props = new Property[] { new Property("STDERR",
asciiToHex("ERROR:Invalid command tag = [" + op + "]")), };
PropConverter
.asciiToHex("ERROR:Invalid command tag = ["
+ op + "]")), };
sHeader.setProperties(props);
break;
}
@ -179,9 +182,12 @@ public class TextViewAdapter implements ICommandExecutor {
* @return the updated message header
*/
private Header processPutRequest(Header msgHeader) {
String prodId = getProperty(msgHeader, TextViewTags.PRODID.name());
String product = getProperty(msgHeader, TextViewTags.PRODUCT.name());
String strMode = getProperty(msgHeader, TextViewTags.OPERATIONAL.name());
String prodId = PropConverter.getProperty(msgHeader,
TextViewTags.PRODID.name());
String product = PropConverter.getProperty(msgHeader,
TextViewTags.PRODUCT.name());
String strMode = PropConverter.getProperty(msgHeader,
TextViewTags.OPERATIONAL.name());
boolean operationalMode = isOperationalMode(strMode);
long insertTime = textDB.writeProduct(prodId, product, operationalMode,
@ -195,11 +201,13 @@ public class TextViewAdapter implements ICommandExecutor {
d.setTime(insertTime);
AlarmAlertUtil.sendProductAlarmAlert(prodId, d, operationalMode);
Property[] props = new Property[] { new Property("STDERR",
asciiToHex("NORMAL:Saved " + prodId)), };
PropConverter.asciiToHex("NORMAL:Saved " + prodId)), };
msgHeader.setProperties(props);
} else {
Property[] props = new Property[] { new Property("STDERR",
asciiToHex("NORMAL:Not Saved; duplicate product " + prodId)), };
PropConverter
.asciiToHex("NORMAL:Not Saved; duplicate product "
+ prodId)), };
msgHeader.setProperties(props);
}
@ -213,10 +221,12 @@ public class TextViewAdapter implements ICommandExecutor {
*/
private Header processGetRequest(Header msgHeader) {
String op = getProperty(msgHeader, TextViewTags.SUBOP.name());
String op = PropConverter.getProperty(msgHeader,
TextViewTags.SUBOP.name());
TextViewGetTags subOp = TextViewGetTags.valueOf(op);
boolean operationalMode = isOperationalMode(getProperty(msgHeader,
boolean operationalMode = isOperationalMode(PropConverter.getProperty(
msgHeader,
TextViewTags.OPERATIONAL.name()));
if (subOp != null) {
@ -224,9 +234,9 @@ public class TextViewAdapter implements ICommandExecutor {
List<Long> times = new ArrayList<Long>();
String fmtType = getProperty(msgHeader,
String fmtType = PropConverter.getProperty(msgHeader,
TextViewTags.FORMAT.name());
String timeFmt = getProperty(msgHeader,
String timeFmt = PropConverter.getProperty(msgHeader,
TextViewTags.CLIENTFMT.name());
// get the latest time for one or more products.
@ -235,23 +245,25 @@ public class TextViewAdapter implements ICommandExecutor {
if (TextViewTags.PRODID.name().equals(p.getName())) {
times.add(textDB.getLatestTime(
hexToAscii(p.getValue()), operationalMode));
PropConverter.hexToAscii(p.getValue()),
operationalMode));
}
} // for
msgProps = new Property[times.size()];
int pIndex = 0;
for (Long t : times) {
String s = formatTime(t, fmtType, timeFmt);
msgProps[pIndex++] = new Property("STDOUT", asciiToHex(s));
msgProps[pIndex++] = new Property("STDOUT",
PropConverter.asciiToHex(s));
}
msgHeader.setProperties(msgProps);
} else if (TextViewGetTags.ALL.equals(subOp)) {
// get all times for a product
String productId = getProperty(msgHeader,
String productId = PropConverter.getProperty(msgHeader,
TextViewTags.PRODID.name());
String fmtType = getProperty(msgHeader,
String fmtType = PropConverter.getProperty(msgHeader,
TextViewTags.FORMAT.name());
String timeFmt = getProperty(msgHeader,
String timeFmt = PropConverter.getProperty(msgHeader,
TextViewTags.CLIENTFMT.name());
List<Long> times = textDB.getAllTimes(productId,
@ -263,21 +275,20 @@ public class TextViewAdapter implements ICommandExecutor {
int pIndex = 0;
for (Long t : times) {
String s = formatTime(t, fmtType, timeFmt);
msgProps[pIndex++] = new Property("STDOUT", asciiToHex(s));
msgProps[pIndex++] = new Property("STDOUT",
PropConverter.asciiToHex(s));
}
msgHeader.setProperties(msgProps);
} else if (TextViewGetTags.INFO.equals(subOp)
|| TextViewGetTags.PROD.equals(subOp)
|| TextViewGetTags.PRODXML.equals(subOp)) {
String siteCCCNNNXX = getProperty(msgHeader,
String siteCCCNNNXX = PropConverter.getProperty(msgHeader,
TextViewTags.SITE.name());
if (siteCCCNNNXX == null) {
boolean infoFlag = TextViewGetTags.INFO.equals(subOp);
boolean xmlFlag = TextViewGetTags.PRODXML.equals(subOp);
JAXBContext ctx = null;
Marshaller msh = null;
String afosCmd = getProperty(msgHeader,
String afosCmd = PropConverter.getProperty(msgHeader,
TextViewTags.AFOSCMD.name());
logger.info("AFOS Command = " + afosCmd);
@ -290,23 +301,18 @@ public class TextViewAdapter implements ICommandExecutor {
if (infoFlag) {
String ss = "********** Product Count = "
+ prods.size();
prodList.add(new Property("STDOUT", asciiToHex(ss)));
prodList.add(new Property("STDOUT", PropConverter
.asciiToHex(ss)));
}
try {
if (xmlFlag) {
ctx = SerializationUtil.getJaxbContext();
msh = ctx.createMarshaller();
msh.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
Boolean.FALSE);
}
for (StdTextProduct prod : prods) {
if (xmlFlag) {
ByteArrayOutputStream strm = new ByteArrayOutputStream();
msh.marshal(prod, strm);
marshalToStream(prod, strm);
prodList.add(new Property("STDOUT",
asciiToHex(strm.toString())));
PropConverter.asciiToHex(strm
.toString())));
} else {
String s = prod.getProduct();
if (s != null) {
@ -314,15 +320,15 @@ public class TextViewAdapter implements ICommandExecutor {
String ss = "********** Product Size = "
+ s.length();
prodList.add(new Property("STDOUT",
asciiToHex(ss)));
PropConverter.asciiToHex(ss)));
}
prodList.add(new Property("STDOUT",
asciiToHex(s)));
PropConverter.asciiToHex(s)));
}
}
}
} catch (JAXBException e) {
} catch (SerializationException e) {
logger.error(
"JAXB Exception marshaling StdTextProducts", e);
}
@ -335,10 +341,11 @@ public class TextViewAdapter implements ICommandExecutor {
Property[] props = new Property[1];
if (cccNNNXXX != null) {
props[0] = new Property("STDOUT", asciiToHex(cccNNNXXX));
props[0] = new Property("STDOUT",
PropConverter.asciiToHex(cccNNNXXX));
} else {
props[0] = new Property("STDERR",
asciiToHex(UNKNOWN_SITE));
PropConverter.asciiToHex(UNKNOWN_SITE));
}
msgHeader.setProperties(props);
@ -346,20 +353,21 @@ public class TextViewAdapter implements ICommandExecutor {
} else if (TextViewGetTags.JOIN.equals(subOp)
|| TextViewGetTags.JOINXML.equals(subOp)) {
boolean xmlFlag = TextViewGetTags.JOINXML.equals(subOp);
JAXBContext ctx = null;
Marshaller msh = null;
// get all times for a product
String wmoId = getProperty(msgHeader, TextViewTags.WMOID.name());
String site = getProperty(msgHeader, TextViewTags.SITE.name());
String abbrId = getProperty(msgHeader,
String wmoId = PropConverter.getProperty(msgHeader,
TextViewTags.WMOID.name());
String site = PropConverter.getProperty(msgHeader,
TextViewTags.SITE.name());
String abbrId = PropConverter.getProperty(msgHeader,
TextViewTags.NNNXXX.name());
String lastHrs = getProperty(msgHeader,
String lastHrs = PropConverter.getProperty(msgHeader,
TextViewTags.HOUR.name());
String hdrTime = getProperty(msgHeader,
String hdrTime = PropConverter.getProperty(msgHeader,
TextViewTags.HDRTIME.name());
String bbbId = getProperty(msgHeader, TextViewTags.BBB.name());
String fullDataReadProp = getProperty(msgHeader,
String bbbId = PropConverter.getProperty(msgHeader,
TextViewTags.BBB.name());
String fullDataReadProp = PropConverter.getProperty(msgHeader,
TextViewTags.FULLREAD.name());
boolean fullDataRead = false;
@ -378,25 +386,21 @@ public class TextViewAdapter implements ICommandExecutor {
// if not xml or last hours request, add the number of returned
// items
if (!xmlFlag && (lastHrs == null || lastHrs.length() == 0)) {
prodList.add(new Property("STDOUT", asciiToHex(""
prodList.add(new Property("STDOUT", PropConverter
.asciiToHex(""
+ prods.size())));
}
StringBuilder header = new StringBuilder();
try {
if (xmlFlag) {
ctx = SerializationUtil.getJaxbContext();
msh = ctx.createMarshaller();
msh.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
Boolean.FALSE);
}
for (StdTextProduct prod : prods) {
if (xmlFlag) {
ByteArrayOutputStream strm = new ByteArrayOutputStream();
msh.marshal(prod, strm);
prodList.add(new Property("STDOUT", asciiToHex(strm
marshalToStream(prod, strm);
prodList.add(new Property("STDOUT", PropConverter
.asciiToHex(strm
.toString())));
} else {
String cccId = prod.getCccid();
@ -422,11 +426,11 @@ public class TextViewAdapter implements ICommandExecutor {
header.append(cccId);
header.append(nnnId);
header.append(xxxId);
prodList.add(new Property("STDOUT",
asciiToHex(header.toString())));
prodList.add(new Property("STDOUT", PropConverter
.asciiToHex(header.toString())));
}
}
} catch (JAXBException e) {
} catch (SerializationException e) {
logger.error("JAXB Exception marshaling StdTextProducts", e);
}
@ -438,6 +442,25 @@ public class TextViewAdapter implements ICommandExecutor {
return msgHeader;
}
/**
* Marshals product to XML in the provided stream. Does not format the
* output.
*
* @param prod
* @param stream
* @throws SerializationException
*/
private void marshalToStream(StdTextProduct prod, OutputStream stream)
throws SerializationException {
JAXBManager jaxbManager;
try {
jaxbManager = SerializationUtil.getJaxbManager();
} catch (JAXBException e) {
throw new SerializationException("Unable to create JAXB manager", e);
}
jaxbManager.marshalToStream(prod, stream, false);
}
/**
* Convert the database product time into the client requested format.
*
@ -459,12 +482,12 @@ public class TextViewAdapter implements ICommandExecutor {
break;
}
case DEFAULT: {
Calendar t = TimeTools.newCalendar(prodTime);
Calendar t = TimeUtil.newGmtCalendar(new Date(prodTime));
formattedTime = String.format(DEFAULT_TIME_FORMAT, t);
break;
}
case CLIENT: {
Calendar t = TimeTools.newCalendar(prodTime);
Calendar t = TimeUtil.newGmtCalendar(new Date(prodTime));
if (timeFormat != null) {
formattedTime = String.format(timeFormat, t);
} else {

View file

@ -17,22 +17,21 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbimpl;
package com.raytheon.uf.edex.plugin.text.dbsrv.impl;
import static com.raytheon.edex.textdb.dbapi.impl.TextDB.asciiToHex;
import static com.raytheon.edex.textdb.dbapi.impl.TextDB.getProperty;
import com.raytheon.edex.textdb.dbapi.impl.TextDB;
import com.raytheon.uf.common.dataplugin.text.dbsrv.ICommandExecutor;
import com.raytheon.uf.common.dataplugin.text.dbsrv.PropConverter;
import com.raytheon.uf.common.dataplugin.text.dbsrv.TextDBSrvCommandTags;
import com.raytheon.uf.common.dataplugin.text.dbsrv.VersionsTableTags;
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.wmo.AFOSProductId;
import com.raytheon.uf.edex.services.textdbsrv.ICommandExecutor;
import com.raytheon.uf.edex.services.textdbsrv.TextDBSrvCommandTags;
import com.raytheon.uf.edex.services.textdbsrv.VersionsTableTags;
/**
*
* Manipulates version headers on textdbsrv messages
*
* <pre>
*
@ -40,6 +39,7 @@ import com.raytheon.uf.edex.services.textdbsrv.VersionsTableTags;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 8, 2008 1538 jkorman Initial creation
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
*
* </pre>
*
@ -81,10 +81,12 @@ public class VersionsAdapter implements ICommandExecutor {
Header sHeader = cmdMessage.getHeader();
// Get the operation code
String op = getProperty(sHeader, VersionsTableTags.OP.name());
String op = PropConverter.getProperty(sHeader,
VersionsTableTags.OP.name());
TextDBSrvCommandTags opTag = TextDBSrvCommandTags.valueOf(op);
String productId = getProperty(sHeader, VersionsTableTags.PRODID.name());
String productId = PropConverter.getProperty(sHeader,
VersionsTableTags.PRODID.name());
if (opTag != null && productId != null) {
AFOSProductId prodId = new AFOSProductId(productId);
@ -92,7 +94,7 @@ public class VersionsAdapter implements ICommandExecutor {
switch (opTag) {
case PUT: {
String versions = getProperty(sHeader,
String versions = PropConverter.getProperty(sHeader,
VersionsTableTags.VERSION.name());
addVersionInfo(sHeader, prodId.getCcc(), prodId.getNnn(),
@ -113,8 +115,9 @@ public class VersionsAdapter implements ICommandExecutor {
default: {
String tagName = (opTag != null) ? opTag.name() : "null";
Property[] props = new Property[] { new Property("STDERR",
asciiToHex("ERROR:Invalid command tag = ["
+ tagName + "]")), };
PropConverter
.asciiToHex("ERROR:Invalid command tag = ["
+ tagName + "]")), };
sHeader.setProperties(props);
break;
}
@ -138,10 +141,11 @@ public class VersionsAdapter implements ICommandExecutor {
private void addVersionInfo(Header header, String ccc, String nnn,
String xxx, String versions) {
Property newProperty = new Property("STDERR",
asciiToHex("NORMAL:Adding productId " + ccc + nnn + xxx
+ " versions " + versions));
PropConverter.asciiToHex("NORMAL:Adding productId " + ccc + nnn
+ xxx + " versions " + versions));
Property errProperty = new Property("STDERR",
asciiToHex("ERROR:Failure adding to versions table."));
PropConverter
.asciiToHex("ERROR:Failure adding to versions table."));
Property[] props = new Property[] { newProperty, };
if (!textDB.addVersions(ccc, nnn, xxx, Integer.parseInt(versions))) {
@ -165,10 +169,13 @@ public class VersionsAdapter implements ICommandExecutor {
String vers = textDB.getVersions(ccc, nnn, xxx);
if (vers != null) {
props = new Property[] { new Property(PROP_FMT, asciiToHex(vers)) };
props = new Property[] { new Property(PROP_FMT,
PropConverter.asciiToHex(vers)) };
} else {
props = new Property[] { new Property("STDERR",
asciiToHex("ERROR:Failure reading versions table.")), };
props = new Property[] { new Property(
"STDERR",
PropConverter
.asciiToHex("ERROR:Failure reading versions table.")), };
}
header.setProperties(props);
}
@ -183,11 +190,11 @@ public class VersionsAdapter implements ICommandExecutor {
private void deleteVersionInfo(Header header, String ccc, String nnn,
String xxx) {
Property newProperty = new Property("STDERR",
asciiToHex("NORMAL:Deleting product id " + ccc + nnn + xxx
+ " from versionstable."));
PropConverter.asciiToHex("NORMAL:Deleting product id " + ccc
+ nnn + xxx + " from versionstable."));
Property errProperty = new Property("STDERR",
asciiToHex("ERROR:Failure deleting " + ccc + nnn + xxx
+ " from versionstable."));
PropConverter.asciiToHex("ERROR:Failure deleting " + ccc + nnn
+ xxx + " from versionstable."));
Property[] props = new Property[] { newProperty, };
if (!textDB.deleteVersions(ccc, nnn, xxx)) {

View file

@ -17,10 +17,8 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbimpl;
package com.raytheon.uf.edex.plugin.text.dbsrv.impl;
import static com.raytheon.edex.textdb.dbapi.impl.TextDB.asciiToHex;
import static com.raytheon.edex.textdb.dbapi.impl.TextDB.getProperty;
import java.util.Collection;
import java.util.List;
@ -30,17 +28,18 @@ import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.textdb.dbapi.impl.TextDB;
import com.raytheon.uf.common.dataplugin.text.db.WatchWarn;
import com.raytheon.uf.common.dataplugin.text.dbsrv.ICommandExecutor;
import com.raytheon.uf.common.dataplugin.text.dbsrv.PropConverter;
import com.raytheon.uf.common.dataplugin.text.dbsrv.TextDBSrvCommandTags;
import com.raytheon.uf.common.dataplugin.text.dbsrv.WarnTableTags;
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.core.EDEXUtil;
import com.raytheon.uf.edex.core.EdexException;
import com.raytheon.uf.edex.services.textdbsrv.ICommandExecutor;
import com.raytheon.uf.edex.services.textdbsrv.TextDBSrvCommandTags;
import com.raytheon.uf.edex.services.textdbsrv.WarnTableTags;
/**
*
* Processes warning textdbsrv command messages
*
* <pre>
* SOFTWARE HISTORY
@ -50,6 +49,7 @@ import com.raytheon.uf.edex.services.textdbsrv.WarnTableTags;
* Aug 9,2010 3944 cjeanbap Added logic to delete all records
* from WatchWarn table.
* Sep 14,2010 3944 cjenabap Added sendTextToQueue()
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
* </pre>
*
* @author jkorman
@ -94,7 +94,7 @@ public class WarnTableAdapter implements ICommandExecutor {
Header sHeader = cmdMessage.getHeader();
// Get the operation code
String op = getProperty(sHeader,WarnTableTags.OP.name());
String op = PropConverter.getProperty(sHeader, WarnTableTags.OP.name());
TextDBSrvCommandTags opTag = TextDBSrvCommandTags.valueOf(op);
@ -102,8 +102,10 @@ public class WarnTableAdapter implements ICommandExecutor {
switch (opTag) {
case PUT: {
String productId = getProperty(sHeader,WarnTableTags.PRODID.name());
String script = getProperty(sHeader,WarnTableTags.SCRIPT.name());
String productId = PropConverter.getProperty(sHeader,
WarnTableTags.PRODID.name());
String script = PropConverter.getProperty(sHeader,
WarnTableTags.SCRIPT.name());
addWatchWarn(sHeader, productId, script);
sendTextToQueue(productId, WATCH_WARN_QUEUE);
@ -111,15 +113,18 @@ public class WarnTableAdapter implements ICommandExecutor {
}
case GET: {
String productId = getProperty(sHeader,WarnTableTags.PRODID.name());
String productId = PropConverter.getProperty(sHeader,
WarnTableTags.PRODID.name());
if (productId != null) {
getWatchWarn(sHeader, productId);
}
break;
}
case DELETE: {
String productId = getProperty(sHeader,WarnTableTags.PRODID.name());
String script = getProperty(sHeader,WarnTableTags.SCRIPT.name());
String productId = PropConverter.getProperty(sHeader,
WarnTableTags.PRODID.name());
String script = PropConverter.getProperty(sHeader,
WarnTableTags.SCRIPT.name());
if ((productId != null) && (script != null)) {
deleteWatchWarn(sHeader, productId, script);
@ -138,7 +143,8 @@ public class WarnTableAdapter implements ICommandExecutor {
default: {
String tagName = (opTag != null) ? opTag.name() : "null";
Property[] props = new Property[] { new Property("STDERR",
asciiToHex("ERROR:Invalid command tag = [" + tagName + "]")), };
PropConverter.asciiToHex("ERROR:Invalid command tag = ["
+ tagName + "]")), };
sHeader.setProperties(props);
break;
}
@ -159,9 +165,11 @@ public class WarnTableAdapter implements ICommandExecutor {
*/
private void addWatchWarn(Header header, String productId, String script) {
Property newProperty = new Property("STDERR",
asciiToHex("NORMAL:Adding productId " + productId + " to trigger."));
PropConverter.asciiToHex("NORMAL:Adding productId " + productId
+ " to trigger."));
Property errProperty = new Property("STDERR",
asciiToHex("ERROR:Failure adding to state_ccc table."));
PropConverter
.asciiToHex("ERROR:Failure adding to state_ccc table."));
Property[] props = new Property[] { newProperty, };
if (!textDB.addWatchWarn(productId, script)) {
@ -185,15 +193,20 @@ public class WarnTableAdapter implements ICommandExecutor {
if (dataList.size() > 0) {
props = new Property[dataList.size() + 2];
int i = 0;
props[i] = new Property(PROP_FMT, asciiToHex("PRODUCTID SCRIPT"));
props[i] = new Property(PROP_FMT, asciiToHex("--------- ------"));
props[i] = new Property(PROP_FMT,
PropConverter.asciiToHex("PRODUCTID SCRIPT"));
props[i] = new Property(PROP_FMT,
PropConverter.asciiToHex("--------- ------"));
for (WatchWarn w : dataList) {
props[i++] = new Property(PROP_FMT, asciiToHex(String.format("%9s %s", w
props[i++] = new Property(PROP_FMT,
PropConverter.asciiToHex(String.format("%9s %s",
w
.getProductid(), w.getScript())));
}
} else {
props = new Property[] { new Property("STDERR",
asciiToHex("ERROR:Failure reading from watch warn table.")), };
PropConverter
.asciiToHex("ERROR:Failure reading from watch warn table.")), };
}
header.setProperties(props);
}
@ -207,9 +220,11 @@ public class WarnTableAdapter implements ICommandExecutor {
*/
private void deleteWatchWarn(Header header, String productId, String script) {
Property newProperty = new Property("STDERR",
asciiToHex("NORMAL:Deleting product id " + productId + " trigger."));
PropConverter.asciiToHex("NORMAL:Deleting product id "
+ productId + " trigger."));
Property errProperty = new Property("STDERR",
asciiToHex("ERROR:Failure adding to state_ccc table."));
PropConverter
.asciiToHex("ERROR:Failure adding to state_ccc table."));
Property[] props = new Property[] { newProperty, };
if (!textDB.deleteWatchWarn(productId, script)) {

View file

@ -29,13 +29,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.textdbsrv"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.dissemination"
download-size="0"

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.uf.edex.textdbsrv</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:34:04 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,22 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: textdbsrv
Bundle-SymbolicName: com.raytheon.uf.edex.textdbsrv
Bundle-Version: 1.12.1174.qualifier
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
Bundle-Vendor: RAYTHEON
Require-Bundle: com.raytheon.edex.common,
com.raytheon.edex.textdb,
org.apache.commons.lang,
com.raytheon.uf.common.status,
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.text,
com.raytheon.uf.common.site;bundle-version="1.12.1152",
com.raytheon.uf.common.status
Export-Package: com.raytheon.uf.edex.services,
com.raytheon.uf.edex.services.textdbimpl,
com.raytheon.uf.edex.services.textdbsrv
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.message,
com.raytheon.uf.common.wmo,
org.apache.commons.logging

View file

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

View file

@ -1,17 +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="textdbsrv" class="com.raytheon.uf.edex.services.TextDBSrv" />
<camelContext id="textdbsrv-common-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
<route id="textdbsrvinternal">
<from uri="direct-vm:int.textdb.request"/>
<bean ref="serializationUtil" method="unmarshalFromXml" />
<bean ref="textdbsrv" method="processMessage" />
<bean ref="serializationUtil" method="marshalToXml" />
</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="textDbSrvWrapper" class = "com.raytheon.uf.edex.textdbsrv.TextDBSrvWrapper">
<property name="textdbSrv" ref="textdbsrv"/>
<property name="byteLimitInMB" value="${textdbsrv.byteLimitInMB}"/>
</bean>
<camelContext id="textdbsrv-request-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
<endpoint id="textdbsrvXml_from"
uri="jetty:http://0.0.0.0:${HTTP_PORT}/services/textdbsrv?disableStreamCache=true" />
<route id="textdbsrvXml">
<from uri="ref:textdbsrvXml_from" />
<bean ref="textDbSrvWrapper" method="executeTextDBMessage" />
</route>
</camelContext>
</beans>

View file

@ -1,63 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services;
/**
* TODO Add Description
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 03, 2008 1538 jkorman Initial implementation
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface TextDBSrvInterface {
/**
*
* @return
*/
public String getServiceName();
/**
* Get a count of messages processed since startup or the last reset.
*
* @return Message count.
*/
public int getMessageCount();
/**
* Reset the message count to zero.
*/
public void clearMessageCount();
/**
* Execute an arbitrary string command..
*
* @param command
* A command to execute.
*/
public void execute(String command);
}

View file

@ -1,40 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.services.textdbsrv;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 7, 2008 1538 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
public interface ICommandTags {
}

View file

@ -1,45 +0,0 @@
#!/home/jkorman/awips/bin/python
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
import httplib
import sys
import os
xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><message><header><properties value=\"read:OMAMTROMA\" name=\"command\"/></header></message>"
conn = httplib.HTTP("localhost:9581")
conn.putrequest("POST", "/services/textdbsrv")
conn.putheader("Content-Type", "text/plain")
conn.putheader("Content-Length", "%d" % len(xml))
conn.endheaders()
conn.send(xml)
# Success/Failure messages
reply, messages, headers = conn.getreply()
result = conn.getfile().read()
conn.close()
# expect message 200, if not exit
if reply != 200:
print reply + " " + messages
exit (1)
print result