diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/HTTPQueryTransport.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/HTTPQueryTransport.java
deleted file mode 100644
index 0b0ec92a1a..0000000000
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/HTTPQueryTransport.java
+++ /dev/null
@@ -1,94 +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.viz.texteditor;
-
-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.common.status.IUFStatusHandler;
-import com.raytheon.uf.common.status.UFStatus;
-
-/**
- *
- *
- *
- * SOFTWARE HISTORY
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Nov 12, 2008 jkorman Initial creation
- * May 15, 2014 2536 bclement better error handling for executeQuery()
- *
- *
- * @author jkorman
- * @version 1.0
- */
-
-public class HTTPQueryTransport implements IQueryTransport {
-
- private final String serviceURL;
-
- private static final IUFStatusHandler log = UFStatus
- .getHandler(HTTPQueryTransport.class);
-
- /**
- *
- * @param urlBase
- * @param serviceName
- */
- public HTTPQueryTransport(String urlBase, String serviceName) {
- if(urlBase != null) {
- if (urlBase.endsWith("/")) {
- serviceURL = urlBase + serviceName;
- } else {
- serviceURL = urlBase + "/" + serviceName;
- }
- } else {
- throw new NullPointerException("urlBase address is null");
- }
- }
-
- /**
- *
- *
- * @see com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport#executeQuery(com.raytheon.uf.common.message.Message)
- */
- @Override
- public Message executeQuery(Message message) {
-
- HttpClient client = HttpClient.getInstance();
-
- try {
- String xml = SerializationUtil.marshalToXml(message);
-
- String response = client.post(serviceURL, xml);
-
- if(response != null) {
- message = SerializationUtil.unmarshalFromXml(Message.class,
- response);
- }
- } catch (Exception e) {
- log.error("Error executing HTTP text query", e);
- }
-
- return message;
- }
-
-}
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/PythonTextEditorToolCallback.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/PythonTextEditorToolCallback.java
index d4f95c0691..18164b123b 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/PythonTextEditorToolCallback.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/PythonTextEditorToolCallback.java
@@ -28,7 +28,6 @@ import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
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.viz.core.status.StatusConstants;
import com.raytheon.viz.texteditor.command.CommandFactory;
import com.raytheon.viz.texteditor.command.CommandFailedException;
import com.raytheon.viz.texteditor.command.ICommand;
@@ -47,6 +46,8 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil;
* 08/19/2009 2191 rjpeter Initial creation.
* 04/14/2010 4734 mhuang Corrected StdTextProduct import
* dependency
+ * 09/09/2014 3580 mapeters Removed IQueryTransport usage
+ * (no longer exists).
*
*
* @author rjpeter
@@ -66,8 +67,7 @@ public class PythonTextEditorToolCallback implements
try {
ICommand command = CommandFactory.getAfosCommand(afosCommand);
- List prods = command.executeCommand(TextEditorUtil
- .getTextDbsrvTransport());
+ List prods = command.executeCommand();
rval = prods.toArray(new StdTextProduct[0]);
} catch (CommandFailedException e) {
statusHandler.handle(Priority.PROBLEM,
@@ -86,8 +86,7 @@ public class PythonTextEditorToolCallback implements
try {
ICommand command = CommandFactory.getCommand(wmoid, siteid,
awipsid, hdrtime, bbbid, lastHours, fullRead);
- List prods = command.executeCommand(TextEditorUtil
- .getTextDbsrvTransport());
+ List prods = command.executeCommand();
rval = prods.toArray(new StdTextProduct[0]);
} catch (CommandFailedException e) {
statusHandler.handle(Priority.PROBLEM,
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.text/src/com/raytheon/uf/common/dataplugin/text/dbsrv/TextDBQuery.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextDBQuery.java
similarity index 88%
rename from edexOsgi/com.raytheon.uf.common.dataplugin.text/src/com/raytheon/uf/common/dataplugin/text/dbsrv/TextDBQuery.java
rename to cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextDBQuery.java
index 2c5642bc27..c8e3f17ba4 100644
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.text/src/com/raytheon/uf/common/dataplugin/text/dbsrv/TextDBQuery.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextDBQuery.java
@@ -17,14 +17,20 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
-package com.raytheon.uf.common.dataplugin.text.dbsrv;
+package com.raytheon.viz.texteditor;
import java.util.ArrayList;
+import com.raytheon.uf.common.dataplugin.text.dbsrv.TextDBRequest;
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.status.IUFStatusHandler;
+import com.raytheon.uf.common.status.UFStatus;
+import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.viz.core.exception.VizException;
+import com.raytheon.uf.viz.core.requests.ThriftClient;
/**
* Query for text products based on desired desired criteria.
@@ -40,6 +46,8 @@ import com.raytheon.uf.common.message.Property;
* 29Jan2013 1496 rferrel Added methods clearProductIds and clone.
* May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
* Aug 22, 2014 2926 bclement compatibility changes with new textdb service
+ * Sep 09, 2014 3580 mapeters Removed IQueryTransport usage (no longer exists),
+ * moved from uf.common.dataplugin.text.dbsrv.
*
*
*
@@ -49,7 +57,8 @@ import com.raytheon.uf.common.message.Property;
public class TextDBQuery {
- private final IQueryTransport queryTransport;
+ private static final transient IUFStatusHandler statusHandler = UFStatus
+ .getHandler(TextDBQuery.class);
private String queryViewName = null;
@@ -87,8 +96,7 @@ public class TextDBQuery {
/**
*
*/
- public TextDBQuery(IQueryTransport transport) {
- queryTransport = transport;
+ public TextDBQuery() {
}
/*
@@ -97,7 +105,7 @@ public class TextDBQuery {
* @see java.lang.Object#clone()
*/
public TextDBQuery clone() {
- TextDBQuery tdq = new TextDBQuery(queryTransport);
+ TextDBQuery tdq = new TextDBQuery();
tdq.queryViewName = this.queryViewName;
tdq.queryOpName = this.queryOpName;
tdq.querySubObName = this.querySubObName;
@@ -445,22 +453,29 @@ public class TextDBQuery {
* @return
*/
public Message executeQuery() {
- Message message = queryTransport.executeQuery(assembleQueryMessage());
- if (message != null) {
- Header hdr = message.getHeader();
- if (hdr != null) {
- Property[] properties = hdr.getProperties();
- if (properties != null) {
- for (Property p : properties) {
- String s = p.getValue();
- if (s != null) {
- p.setValue(s);
- }
+ Message assembledMessage = assembleQueryMessage();
+ Message message = null;
+ try {
+ message = (Message) ThriftClient.sendRequest(new TextDBRequest(
+ assembledMessage));
+ } catch (VizException e) {
+ statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
+ }
+ if (message == null) {
+ message = assembledMessage;
+ }
+ Header hdr = message.getHeader();
+ if (hdr != null) {
+ Property[] properties = hdr.getProperties();
+ if (properties != null) {
+ for (Property p : properties) {
+ String s = p.getValue();
+ if (s != null) {
+ p.setValue(s);
}
}
}
}
return message;
}
-
}
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/CurrentAlarmQueue.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/CurrentAlarmQueue.java
index bf829c4151..7cbe8de68d 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/CurrentAlarmQueue.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/CurrentAlarmQueue.java
@@ -55,7 +55,6 @@ 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;
@@ -71,7 +70,6 @@ import com.raytheon.viz.texteditor.command.CommandFactory;
import com.raytheon.viz.texteditor.command.CommandFailedException;
import com.raytheon.viz.texteditor.command.ICommand;
import com.raytheon.viz.texteditor.msgs.IAfosBrowserCallback;
-import com.raytheon.viz.texteditor.util.TextEditorUtil;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.dialogs.ModeListener;
@@ -110,6 +108,7 @@ import com.raytheon.viz.ui.dialogs.ModeListener;
* Jun 23, 2014 #3161 lvenable Added SWT dialog trim to the dialogs for thin client.
* Jul 24, 2014 3423 randerso Created eclipse job to get afos command
* execution off the UI thread
+ * Sep 09, 2014 3580 mapeters Removed IQueryTransport usage (no longer exists).
*
*
*
@@ -143,8 +142,6 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
private Button displayAll;
- private IQueryTransport queryTransport = null;
-
private java.util.List prodList = null;
private static CurrentAlarmQueue INSTANCE;
@@ -672,9 +669,8 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
*/
@Override
public void executeCommand(ICommand command) {
- queryTransport = TextEditorUtil.getTextDbsrvTransport();
try {
- prodList = command.executeCommand(queryTransport);
+ prodList = command.executeCommand();
if (prodList == null || prodList.size() <= 0) {
prodList = new ArrayList();
}
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/util/AlarmAlertFunctions.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/util/AlarmAlertFunctions.java
index fe2c6b2846..a4057eafa5 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/util/AlarmAlertFunctions.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/util/AlarmAlertFunctions.java
@@ -62,7 +62,6 @@ import com.raytheon.viz.texteditor.alarmalert.dialogs.AlarmAlertBell;
import com.raytheon.viz.texteditor.command.CommandFactory;
import com.raytheon.viz.texteditor.command.CommandFailedException;
import com.raytheon.viz.texteditor.command.ICommand;
-import com.raytheon.viz.texteditor.util.TextEditorUtil;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
@@ -81,6 +80,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* 12/07/2012 15555 m.gamazaychikov Added methods and constants for
* the implementation of proximity alarm
* 07/24/2014 3423 randerso Ensure ringBell is called on UI thread
+ * 09/09/2014 3580 mapeters Removed IQueryTransport usage (no longer exists).
*
*
*
@@ -261,8 +261,7 @@ public class AlarmAlertFunctions {
ICommand command = CommandFactory.getAfosCommand(productId);
try {
- productList = command.executeCommand(TextEditorUtil
- .getTextDbsrvTransport());
+ productList = command.executeCommand();
} catch (CommandFailedException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/AFOSCommand.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/AFOSCommand.java
index 783f123826..d91940d969 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/AFOSCommand.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/AFOSCommand.java
@@ -24,7 +24,6 @@ import java.util.List;
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.dataplugin.text.util.AFOSParser;
import com.raytheon.uf.common.status.IUFStatusHandler;
@@ -50,6 +49,8 @@ import com.raytheon.viz.texteditor.AfosBrowserModel;
* 02Aug2010 2187 cjeanbap Update method signature to be consistent.
* 20Mar2011 8561 jdortiz Added enterEditor field.
* May 23, 2012 14952 rferrel Added refTime.
+ * Sep 09, 2014 3580 mapeters Removed IQueryTransport usage
+ * (no longer exists).
*
*
*
@@ -93,15 +94,13 @@ public class AFOSCommand implements ICommand {
}
@Override
- public List executeCommand(IQueryTransport transport)
+ public List executeCommand()
throws CommandFailedException {
if (parser == null) {
throw new CommandFailedException("AFOS command not set");
} else if (!parser.isValidCommand()) {
throw new CommandFailedException("AFOS command is invalid: "
+ parser.getAfosCommand());
- } else if (transport == null) {
- throw new CommandFailedException("Command transport method not set");
}
List response = null;
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/AWIPSCommand.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/AWIPSCommand.java
index 6eccbf9137..eef0a4b018 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/AWIPSCommand.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/AWIPSCommand.java
@@ -22,7 +22,6 @@ 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;
@@ -44,6 +43,8 @@ import com.raytheon.viz.core.mode.CAVEMode;
* dependency
* 21May2010 2187 cjeanbap Add operational mode functionality.
* 05Jun2011 9740 cjeanbap Fixed invalid character, Form Feed.
+ * 09Sep2014 3580 mapeters Removed IQueryTransport usage
+ * (no longer exists).
*
*
* @author rjpeter
@@ -130,13 +131,11 @@ public class AWIPSCommand implements ICommand {
*/
@SuppressWarnings("unchecked")
@Override
- public List executeCommand(IQueryTransport transport)
+ public List executeCommand()
throws CommandFailedException {
// TODO verify both fields blank not allowed
if (awipsid == null) {
throw new CommandFailedException("Awips Id not set");
- } else if (transport == null) {
- throw new CommandFailedException("Command transport method not set");
}
ExecuteAwipsCmdRequest req = new ExecuteAwipsCmdRequest();
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/GeneralCommand.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/GeneralCommand.java
index 51bcc9992b..1bf91f9f6f 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/GeneralCommand.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/GeneralCommand.java
@@ -19,24 +19,22 @@
**/
package com.raytheon.viz.texteditor.command;
-import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
-import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
+import com.raytheon.uf.common.dataplugin.text.db.OperationalStdTextProduct;
+import com.raytheon.uf.common.dataplugin.text.db.PracticeStdTextProduct;
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.serialization.JAXBManager;
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.viz.core.mode.CAVEMode;
+import com.raytheon.viz.texteditor.TextDBQuery;
/**
* Pairs a command and its associated type.
@@ -50,6 +48,8 @@ import com.raytheon.viz.core.mode.CAVEMode;
* Apr 14, 2010 4734 mhuang Corrected StdTextProduct import
* dependency
* 21May2010 2187 cjeanbap Add operational mode functionality.
+ * 11Sep2014 3580 mapeters Replaced SerializationUtil usage with JAXBManager,
+ * removed IQueryTransport usage (no longer exists).
*
*
* @author rjpeter
@@ -57,6 +57,9 @@ import com.raytheon.viz.core.mode.CAVEMode;
*/
public class GeneralCommand implements ICommand {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(GeneralCommand.class);
+
+ private static volatile JAXBManager jaxb;
+
/**
*
*/
@@ -107,6 +110,14 @@ public class GeneralCommand implements ICommand {
this.fullRead = fullRead;
}
+ private static JAXBManager getJaxbManager() throws JAXBException {
+ if (jaxb == null) {
+ jaxb = new JAXBManager(true, OperationalStdTextProduct.class,
+ PracticeStdTextProduct.class);
+ }
+ return jaxb;
+ }
+
/**
*
*/
@@ -137,11 +148,11 @@ public class GeneralCommand implements ICommand {
*
*/
@Override
- public List executeCommand(IQueryTransport transport)
+ public List executeCommand()
throws CommandFailedException {
// TODO verify at least 1 field not blank
- TextDBQuery dbQuery = new TextDBQuery(transport);
+ TextDBQuery dbQuery = new TextDBQuery();
dbQuery.setQueryViewName("text");
dbQuery.setQueryOpName("GET");
dbQuery.setQuerySubObName("JOINXML");
@@ -184,13 +195,10 @@ public class GeneralCommand implements ICommand {
// TODO Add Error Handling. STDERR??
if (properties != null) {
try {
- JAXBContext context = SerializationUtil.getJaxbContext();
- Unmarshaller unmarshaller = context.createUnmarshaller();
for (Property p : properties) {
if ("STDOUT".equals(p.getName())) {
- StringReader reader = new StringReader(p.getValue());
- StdTextProduct prod = (StdTextProduct) unmarshaller
- .unmarshal(reader);
+ StdTextProduct prod = (StdTextProduct) getJaxbManager()
+ .unmarshalFromXml(p.getValue());
response.add(prod);
}
}
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/ICommand.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/ICommand.java
index 2a1ba64832..3ae26bff20 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/ICommand.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/ICommand.java
@@ -22,7 +22,6 @@ 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;
/**
* A command.
@@ -35,6 +34,7 @@ import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
* Jul 30, 2009 2191 rjpeter Initial creation
* Apr 14, 2010 4734 mhuang Corrected StdTextProduct import
* dependency
+ * Sep 09, 2014 3580 mapeters {@link #executeCommand()} takes no parameters.
*
*
*
@@ -65,11 +65,8 @@ public interface ICommand {
* Even though a command may return numerous entries, the command should
* know how to aggregate the numerous returns into a single entry.
*
- * @param transport
- * Query transport mechanism
- *
* @return
*/
- public abstract List executeCommand(
- IQueryTransport transport) throws CommandFailedException;
+ public abstract List executeCommand()
+ throws CommandFailedException;
}
\ No newline at end of file
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/ProductQueryJob.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/ProductQueryJob.java
index 5b2e06cefd..9f0becab0d 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/ProductQueryJob.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/ProductQueryJob.java
@@ -30,12 +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.viz.core.VizApp;
-import com.raytheon.viz.texteditor.util.TextEditorUtil;
/**
* Job to perform queries for text products.
@@ -48,6 +46,8 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil;
* ------------ ---------- ----------- --------------------------
* Jan 18, 2013 rferrel Initial creation
* Aug 23, 2013 DR 16514 D. Friedman Fix accum/cancel logic.
+ * Sep 09, 2014 3580 mapeters Removed IQueryTransport usage
+ * (no longer exists).
*
*
*
@@ -71,18 +71,12 @@ public class ProductQueryJob extends Job {
*/
private final Set expected;
- /**
- * Transport to use for the queries.
- */
- private final IQueryTransport queryTransport;
-
public ProductQueryJob(IProductQueryCallback callback) {
super("Product Query");
setSystem(true);
this.callback = callback;
requests = new ArrayList();
expected = new HashSet();
- queryTransport = TextEditorUtil.getTextDbsrvTransport();
}
/**
@@ -136,7 +130,7 @@ public class ProductQueryJob extends Job {
try {
try {
prodList = request.getCommand().
- executeCommand(queryTransport);
+executeCommand();
} catch (CommandFailedException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/WMOCommand.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/WMOCommand.java
index 73e4311c47..4a726f8e8b 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/WMOCommand.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/command/WMOCommand.java
@@ -22,7 +22,6 @@ 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;
@@ -43,6 +42,8 @@ import com.raytheon.viz.core.mode.CAVEMode;
* Apr 14, 2010 4734 mhuang Corrected StdTextProduct import
* dependency
* 21May2010 2187 cjeanbap Add operational mode functionality.
+ * Sep 09, 2014 3580 mapeters Removed IQueryTransport usage
+ * (no longer exists).
*
*
* @author rjpeter
@@ -128,13 +129,11 @@ public class WMOCommand implements ICommand {
*/
@SuppressWarnings("unchecked")
@Override
- public List executeCommand(IQueryTransport transport)
+ public List executeCommand()
throws CommandFailedException {
// TODO verify both fields blank not allowed
if (wmoId == null && site == null) {
throw new CommandFailedException("WMO Id not set");
- } else if (transport == null) {
- throw new CommandFailedException("Command transport method not set");
}
ExecuteWmoCmdRequest req = new ExecuteWmoCmdRequest();
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AfosBrowserDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AfosBrowserDlg.java
index 940794dd32..73f8f867df 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AfosBrowserDlg.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AfosBrowserDlg.java
@@ -59,8 +59,6 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Shell;
-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;
@@ -71,13 +69,13 @@ import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.viz.core.mode.CAVEMode;
import com.raytheon.viz.texteditor.AfosBrowserModel;
+import com.raytheon.viz.texteditor.TextDBQuery;
import com.raytheon.viz.texteditor.TextDisplayModel;
import com.raytheon.viz.texteditor.command.CommandFactory;
import com.raytheon.viz.texteditor.msgs.IAfosBrowserCallback;
import com.raytheon.viz.texteditor.msgs.ITextWorkstationCallback;
import com.raytheon.viz.texteditor.util.AFOS_CLASS;
import com.raytheon.viz.texteditor.util.AFOS_ORIGIN;
-import com.raytheon.viz.texteditor.util.TextEditorUtil;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
@@ -105,6 +103,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Changes to have multiple query jobs.
* 15Apr2014 #3031 lvenable Added dispose check in the runAsync calls.
* 19May2014 2536 bclement removed TimeTools usage
+ * 09Sep2014 3580 mapeters Removed IQueryTransport usage
+ * (no longer exists).
*
*
* @author lvenable
@@ -238,8 +238,6 @@ public class AfosBrowserDlg extends CaveSWTDialog implements
*/
private boolean isAfosActive = true;
- private IQueryTransport queryTransport = null;
-
private String localSite = LocalizationManager.getInstance()
.getCurrentSite();;
@@ -269,8 +267,6 @@ public class AfosBrowserDlg extends CaveSWTDialog implements
callbackClient = cbClient;
TextDisplayModel.getInstance().setITextWorkstationCallback(token, this);
-
- queryTransport = TextEditorUtil.getTextDbsrvTransport();
}
/*
@@ -668,7 +664,7 @@ public class AfosBrowserDlg extends CaveSWTDialog implements
*/
private void queryTableUsingNodeAndCategory() {
getShell().setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
- TextDBQuery dbQuery = new TextDBQuery(queryTransport);
+ TextDBQuery dbQuery = new TextDBQuery();
dbQuery.setQueryViewName("text");
dbQuery.setQueryOpName("GET");
dbQuery.setQuerySubObName("LATEST");
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AwipsBrowserDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AwipsBrowserDlg.java
index 76dc34935a..e826cf96ed 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AwipsBrowserDlg.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AwipsBrowserDlg.java
@@ -22,9 +22,9 @@ package com.raytheon.viz.texteditor.dialogs;
import java.util.HashMap;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
-import java.util.Map.Entry;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
@@ -43,8 +43,6 @@ import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
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.viz.core.status.StatusConstants;
-import com.raytheon.viz.texteditor.Activator;
import com.raytheon.viz.texteditor.command.CommandFactory;
import com.raytheon.viz.texteditor.command.CommandFailedException;
import com.raytheon.viz.texteditor.command.ICommand;
@@ -65,6 +63,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* ------------ ---------- ----------- --------------------------
* 08/04/2009 2191 rjpeter Initial implementation.
* 04/14/2010 4734 mhuang Corrected StdTextProduct import
+ * 09/11/2014 3580 mapeters Removed IQueryTransport usage (no longer exists).
*
*
* @author rjpeter
@@ -266,7 +265,7 @@ public class AwipsBrowserDlg extends CaveJFACEDialog {
try {
java.util.List prodList = command
- .executeCommand(callbackClient.getQueryTransport());
+ .executeCommand();
if (prodList != null && prodList.size() > 0) {
StdTextProduct prod = prodList.get(0);
@@ -483,7 +482,7 @@ public class AwipsBrowserDlg extends CaveJFACEDialog {
ICommand command = CommandFactory.getAwipsCommand(awipsId,
fields[0], fields[1], "000000", null);
java.util.List prods = command
- .executeCommand(callbackClient.getQueryTransport());
+ .executeCommand();
// Add the ddhhmm for the selected ttaaii cccc
updateProductInventory(prods);
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/RemoteSiteRequestDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/RemoteSiteRequestDlg.java
index 8489313cd8..1c0185b93d 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/RemoteSiteRequestDlg.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/RemoteSiteRequestDlg.java
@@ -58,7 +58,6 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.texteditor.command.CommandFactory;
import com.raytheon.viz.texteditor.command.CommandFailedException;
import com.raytheon.viz.texteditor.msgs.IWmoIdSelectionCallback;
-import com.raytheon.viz.texteditor.util.TextEditorUtil;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
@@ -74,6 +73,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 9/13/07 368 lvenable Initial creation.
* 10/11/2007 482 grichard Reformatted file.
* 09/20/2012 1196 rferrel Changing dialogs being called to not block.
+ * 09/09/2014 3580 mapeters Removed IQueryTransport usage (no longer exists).
*
*
*
@@ -347,7 +347,7 @@ public class RemoteSiteRequestDlg extends CaveSWTDialog implements
List latest = null;
try {
latest = CommandFactory.getAfosCommand(req.getAfosID())
- .executeCommand(TextEditorUtil.getTextDbsrvTransport());
+ .executeCommand();
} catch (CommandFailedException e) {
statusHandler.handle(Priority.PROBLEM,
"Error retrieving metatdata", e);
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java
index 344c9fc6b8..e7f6d3bf73 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java
@@ -47,6 +47,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.bind.JAXB;
+import javax.xml.bind.JAXBException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -114,9 +115,10 @@ import org.eclipse.ui.menus.IMenuService;
import com.raytheon.uf.common.activetable.SendPracticeProductRequest;
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.OperationalStdTextProduct;
+import com.raytheon.uf.common.dataplugin.text.db.PracticeStdTextProduct;
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;
@@ -134,7 +136,7 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
-import com.raytheon.uf.common.serialization.SerializationUtil;
+import com.raytheon.uf.common.serialization.JAXBManager;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.common.status.IUFStatusHandler;
@@ -337,6 +339,8 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* 14Mar2014 DR 17175 D. Friedman Get correct time zone for MND header time sync.
* 08May2014 DR 16041 kshrestha Save unofficial text products from text editor.
* 13May2014 2536 bclement moved WMO Header to common, switched from TimeTools to TimeUtil
+ * 11Sep2014 3580 mapeters Replaced SerializationTuil usage with JAXBManager,
+ * removed IQueryTransport usage (no longer exists).
*
*
*
@@ -350,9 +354,11 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
/**
* Handler used for messges.
*/
- private final IUFStatusHandler statusHandler = UFStatus
+ private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(TextEditorDialog.class);
+ private static volatile JAXBManager jaxb;
+
/**
* List of CCCs that can be handled even if the PIL is on the gfe pil list.
*/
@@ -1195,11 +1201,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
*/
private final boolean hasScripting;
- /**
- * Transport usded to send query to server and get results.
- */
- private IQueryTransport queryTransport = null;
-
/**
* Job to handle query for products off the UI thread.
*/
@@ -1460,6 +1461,14 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
this.textWorkstationFlag = textWorkstationFlag;
}
+ private static JAXBManager getJaxbManager() throws JAXBException {
+ if (jaxb == null) {
+ jaxb = new JAXBManager(OperationalStdTextProduct.class,
+ PracticeStdTextProduct.class);
+ }
+ return jaxb;
+ }
+
/*
* (non-Javadoc)
*
@@ -1538,10 +1547,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
});
}
- if (isWarnGenDlg) {
- queryTransport = TextEditorUtil.getTextDbsrvTransport();
- }
-
commandHistory = new CommandHistory();
// Create the menus
@@ -6040,10 +6045,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
+ TextEditorUtil.getCommandText(command));
statusBarLabel.update();
setBusy(true);
-
- if (queryTransport == null) {
- queryTransport = TextEditorUtil.getTextDbsrvTransport();
- }
productQueryJob.addRequest(command, isObsUpdated,
accumChkBtn.getSelection());
}
@@ -7134,17 +7135,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
updateButtonology(commandText);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * com.raytheon.viz.texteditor.msgs.IWmoBrowserCallback#getQueryTransport()
- */
- @Override
- public IQueryTransport getQueryTransport() {
- return queryTransport;
- }
-
/**
* Checks product to verify all required fields have been filled in.
*
@@ -7311,15 +7301,16 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
synchronized (this) {
bufStream = new BufferedOutputStream(
new FileOutputStream(file));
- bufStream.write(SerializationUtil.marshalToXml(
- stdTextProduct).getBytes());
+ getJaxbManager().marshalToStream(stdTextProduct,
+ bufStream);
}
}
// TODO Should the edit session be backed up to the server?
// lFile.save();
} catch (Exception e) {
- statusHandler.handle(Priority.PROBLEM, "Auto save failed", e);
+ statusHandler.handle(Priority.PROBLEM, "Auto save failed to "
+ + filename, e);
} finally {
if (bufStream != null) {
try {
@@ -7339,20 +7330,16 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
BufferedInputStream bufStream = null;
try {
- String xml = null;
synchronized (this) {
- byte[] b = new byte[(int) file.length()];
bufStream = new BufferedInputStream(
new FileInputStream(file));
- bufStream.read(b);
- xml = new String(b);
}
- rval = SerializationUtil.unmarshalFromXml(
- StdTextProduct.class, xml);
+ rval = (StdTextProduct) getJaxbManager()
+ .unmarshalFromInputStream(bufStream);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
- "Retrieval of product failed", e);
+ "Retrieval of product failed:" + file.getName(), e);
} finally {
if (bufStream != null) {
try {
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/WmoBrowserDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/WmoBrowserDlg.java
index 8eb1dd7649..0a14d6e25a 100755
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/WmoBrowserDlg.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/WmoBrowserDlg.java
@@ -63,6 +63,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* 08/04/2009 2191 rjpeter Initial implementation.
* 04/14/2010 4734 mhuang Corrected StdTextProduct import
* dependency
+ * 09/11/2014 3580 mapeters Removed IQueryTransport usage (no longer exists).
*
*
* @author rjpeter
@@ -328,7 +329,7 @@ public class WmoBrowserDlg extends CaveJFACEDialog {
try {
java.util.List prodList = command
- .executeCommand(callbackClient.getQueryTransport());
+ .executeCommand();
if (prodList != null && prodList.size() > 0) {
StdTextProduct prod = prodList.get(0);
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/msgs/IWmoBrowserCallback.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/msgs/IWmoBrowserCallback.java
index c8d695d30d..4e4173ffeb 100755
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/msgs/IWmoBrowserCallback.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/msgs/IWmoBrowserCallback.java
@@ -21,7 +21,6 @@
package com.raytheon.viz.texteditor.msgs;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
-import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
/**
* The IWmoBrowserCallback interface specifies methods that return a selected
@@ -36,6 +35,8 @@ import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
* 08/3/2009 2191 rjpeter Initial creation.
* 04/14/2010 4734 mhuang Corrected StdTextProduct import
* dependency
+ * 09/11/2014 3580 mapeters Removed getQueryTransport().
+ *
*
*
* @author rjpeter
@@ -43,7 +44,6 @@ import com.raytheon.uf.common.dataplugin.text.dbsrv.IQueryTransport;
*/
public interface IWmoBrowserCallback {
- public IQueryTransport getQueryTransport();
public void setDisplayedProduct(StdTextProduct product);
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/util/TextDBUtilities.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/util/TextDBUtilities.java
deleted file mode 100644
index a6d26e49ca..0000000000
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/util/TextDBUtilities.java
+++ /dev/null
@@ -1,149 +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.viz.texteditor.scripting.dialogs.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
-
-import com.raytheon.uf.common.comm.HttpClient;
-import com.raytheon.uf.common.message.Header;
-import com.raytheon.uf.common.message.Message;
-import com.raytheon.uf.common.message.Property;
-import com.raytheon.uf.common.serialization.SerializationUtil;
-import com.raytheon.uf.viz.core.VizApp;
-
-/**
- * Contains utility methods for interactions with the text database.
- *
- *
- *
- * SOFTWARE HISTORY
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Jul 22, 2009 mfegan Initial creation
- * Jul 13, 2010 2187 cjeanbap Add opertional mode functionality.
- * 02Aug2010 2187 cjeanbap Update variable/method signature to be consistent.
- *
- *
- *
- * @author mfegan
- * @version 1.0
- */
-
-public final class TextDBUtilities {
- public static final String TYPE_PROD = "PROD";
-
- public static final String TYPE_INFO = "INFO";
-
- /**
- *
- */
- private TextDBUtilities() {
- // no class instances
- }
-
- public static String writeProductToDatabase(String prodID, String contents, boolean operationalMode)
- throws Exception {
- Message message = createProductStoreMessage(prodID, contents, operationalMode);
- String xml = SerializationUtil.marshalToXml(message);
- String address = VizApp.getHttpServer() + "/textdbsrv";
-
- String response = HttpClient.getInstance().post(address, xml);
- message = (Message) SerializationUtil.unmarshalFromXml(response);
- StringBuffer sb = new StringBuffer();
- for (Property property : message.getHeader().getProperties()) {
- String value = hexToAscii(property.getValue());
- if (value.matches("^NORMAL")) {
- sb.append(value.split(":")[1]).append("\n");
- } else {
- throw new Exception("Received error from product retrieval - "
- + value);
- }
- }
- return sb.toString().trim();
- }
-
- public static String[] readProductFromDatabase(String prodID, String type, boolean operationalMode)
- throws Exception {
- Message message = createProductRequestMessage(prodID, type, operationalMode);
- String xml = SerializationUtil.marshalToXml(message);
- String address = VizApp.getHttpServer() + "/textdbsrv";
-
- String response = HttpClient.getInstance().post(address, xml);
-
- message = (Message) SerializationUtil.unmarshalFromXml(response);
- List products = new ArrayList();
- Property[] properties = message.getHeader().getProperties();
- if (properties == null) {
- return null;
- }
- for (Property property : message.getHeader().getProperties()) {
- if ("stdout".equalsIgnoreCase(property.getName())) {
- products.add(hexToAscii(property.getValue()));
- } else {
- throw new Exception(property.getValue());
- }
- }
-
- return products.toArray(new String[] {});
- }
-
- private static Message createProductRequestMessage(String prodID,
- String type, boolean operationalMode) throws Exception {
- Message message = new Message();
- Header header = new Header();
- List properties = new ArrayList();
- properties.add(new Property("VIEW", AsciiToHex("text")));
- properties.add(new Property("OP", AsciiToHex("GET")));
- properties.add(new Property("SUBOP", AsciiToHex(type)));
- properties.add(new Property("AFOSCMD", AsciiToHex(prodID)));
- properties.add(new Property("OPERATIONAL", AsciiToHex(new Boolean(operationalMode).toString())));
- header.setProperties(properties.toArray(new Property[] {}));
- message.setHeader(header);
- return message;
- }
-
- private static Message createProductStoreMessage(String prodID,
- String product, boolean operationalMode) throws Exception {
- Message message = new Message();
- Header header = new Header();
- List properties = new ArrayList();
- properties.add(new Property("VIEW", AsciiToHex("text")));
- properties.add(new Property("OP", AsciiToHex("PUT")));
- properties.add(new Property("PRODID", AsciiToHex(prodID)));
- properties.add(new Property("product", AsciiToHex(product)));
- properties.add(new Property("OPERATIONAL", AsciiToHex(new Boolean(operationalMode).toString())));
- header.setProperties(properties.toArray(new Property[] {}));
- message.setHeader(header);
- return message;
- }
-
- private static String AsciiToHex(String string) {
- return new HexBinaryAdapter().marshal(string.getBytes());
- }
-
- private static String hexToAscii(String hexString) {
- byte[] b = new HexBinaryAdapter().unmarshal(hexString);
- return new String(b);
- }
-
-}
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/runner/TextWsCommands.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/runner/TextWsCommands.java
deleted file mode 100644
index c5db82b52d..0000000000
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/runner/TextWsCommands.java
+++ /dev/null
@@ -1,503 +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.viz.texteditor.scripting.runner;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.TimeZone;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import jep.JepException;
-
-import com.raytheon.uf.common.time.SimulatedTime;
-import com.raytheon.viz.core.mode.CAVEMode;
-import com.raytheon.viz.texteditor.msgs.IScriptRunnerObserver;
-import com.raytheon.viz.texteditor.scripting.dialogs.util.FileUtilities;
-import com.raytheon.viz.texteditor.scripting.dialogs.util.TextDBUtilities;
-import com.raytheon.viz.texteditor.scripting.dialogs.util.Utilities;
-
-/**
- * Class providing the top level implementations of the special Text WS
- * scripting commands.
- *
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Jun 29, 2009 mfegan Initial creation
- * Jul 13, 2010 2187 cjeanbap Add operational mode functionality
- *
- *
- *
- * @author mfegan
- * @version 1.0
- */
-
-public class TextWsCommands {
- private final String TIME_FMT = "%1$tD %1$tT";
-
- private String editor = "";
-
- private IScriptRunnerObserver observer = null;
-
- private boolean canceled = false;
-
- private boolean operationalMode = true;
-
- /**
- *
- */
- public TextWsCommands() {
- CAVEMode mode = CAVEMode.getMode();
- this.operationalMode = (CAVEMode.OPERATIONAL.equals(mode)
- || CAVEMode.PRACTICE.equals(mode) ? true : false);
- }
-
- public void setEditor(String editor) {
- this.editor = editor;
- }
-
- public void setObserver(Object observer) {
- this.observer = (IScriptRunnerObserver) observer;
- }
-
- /**
- * Implements the Text Workstation script runner's {@code run(file)}
- * command. The file to execute must be in the current user's home
- * directory.
- *
- * @param file
- * name of the script to execute
- *
- * @throws Exception
- * if any problem occurs
- */
- public void runLocalFile(String file) throws JepException {
- String homeDir = System.getProperty("user.home");
- if (Utilities.isEmptyString(file)) {
- throw new JepException("no file specified -- unable to execute");
- }
- if (file.indexOf("/") != -1) {
- throw new JepException("expected local file but got \"" + file
- + "\"");
- }
-
- String script = homeDir + "/" + file;
- // try {
- // script = FileUtilities.loadFileToString(homeDir, file);
- // } catch (IOException e) {
- // throw new Exception("could not open \"" + file + "\"",e);
- // }
- System.out.println(script);
- observer.executeTextScript(script);
- }
-
- /**
- * Implements the Text Workstation script runner's {@code load(pid)}
- * command. Reads the latest product matching the specified PID from the
- * text database and sends it to the observer for display.
- *
- * @param pil
- * the product ID (PID)
- *
- * @throws Exception
- * when any error occurs
- */
- public void loadTextProduct(String pil) throws Exception {
- if (Utilities.isEmptyString(pil)) {
- throw new Exception(
- "no product ID provided -- unable to load product");
- }
- if (observer.isEditMode()) {
- throw new Exception("Cannot load product: text window in edit mode");
- }
- if (pil.startsWith("E:") || pil.startsWith("M:")) {
- throw new Exception(
- "Cannot load product: cannot edit products while script is running");
- }
- observer.writeText("--- requesting " + pil
- + " from text database ---\n");
- String[] products;// = observer.getProductFromDatabase(pid);
- try {
- products = TextDBUtilities.readProductFromDatabase(pil,
- TextDBUtilities.TYPE_PROD, this.operationalMode);
- } catch (Exception e) {
- observer.writeText("--- product \"" + pil
- + "\" not available ---\n");
- observer.showErrorMessage("failure reading from database.", e);
- return;
- }
- if (products == null || products.length == 0) {
- observer.writeText("--- product \"" + pil
- + "\" not available ---\n");
- observer.showScriptStatus("Requested product \"" + pil
- + "\" not found in data base");
- return;
- }
- observer.postProductToEditor(products, new String[] { pil });
- }
-
- /**
- * Implements the Text Workstation script runner's
- * {@code readdb(pid,filename)} command. Reads the latest product matching
- * the pid and writes the product to the specified file. Emulates the AWIPS
- * I textdb -rd PIL retrieval.
- *
- * @param pil
- * the AFOS PIL to retrieve
- * @param filename
- * path to the file to contain the results
- *
- * @throws Exception
- * if an error occurs
- */
- public void saveProductToFile(String pil, String filename) throws Exception {
- if (Utilities.isEmptyString(pil)) {
- throw new Exception(
- "no product ID provided -- unable to read product");
- }
- if (Utilities.isEmptyString(filename)) {
- throw new Exception(
- "no file name provided -- unable to read product");
- }
- observer.writeText("--- requesting " + pil
- + " from text database ---\n");
- String[] products = null;
- try {
- products = TextDBUtilities.readProductFromDatabase(pil,
- TextDBUtilities.TYPE_INFO, this.operationalMode);
- } catch (Exception e) {
- observer.writeText("--- product \"" + pil
- + "\" not available ---\n");
- observer.showErrorMessage("failure reading from database.", e);
- return;
- }
- if (products == null || products.length == 0) {
- observer.writeText("--- product \"" + pil
- + "\" not available ---\n");
- observer.showScriptStatus("Requested product \"" + pil
- + "\" not found in data base");
- return;
- }
- int count = products.length;
- String ln = System.getProperty("line.separator", "\n");
- observer.writeText("--- obtained " + count + " records for " + pil
- + " ---\n");
- StringBuffer sb = new StringBuffer();
- for (String product : products) {
- sb.append(product).append(ln);
- }
- observer.writeText("--- writing results for " + pil + " to " + filename
- + " ---\n");
- try {
- FileUtilities.writeStringToFile(filename, sb.toString());
- } catch (Exception e) {
- observer.writeText("--- cannot write to " + filename + " ---");
- observer.showErrorMessage("cannot write to " + filename, e);
- }
- }
-
- /**
- * Implements the Text Workstation script runner's
- * {@code writedb(pid,filename)} command. Reads the contents of the
- * specified file and posts the contents to the text database using the
- * specified product ID.
- *
- * @param pil
- * the product ID
- * @param filename
- * the path to the data file
- *
- * @throws Exception
- * if any problem occurs
- */
- public void readProductFromFile(String pil, String filename)
- throws Exception {
- if (Utilities.isEmptyString(pil)) {
- throw new Exception(
- "no product ID provided -- unable to write product");
- }
- if (Utilities.isEmptyString(filename)) {
- throw new Exception(
- "no file name provided -- unable to write product");
- }
- observer.writeText("--- reading product from " + filename + " ---\n");
- String contents = "";
- try {
- contents = FileUtilities.loadFileToString(filename);
- } catch (Exception e) {
- throw new Exception("cannot read from " + filename);
- }
- try {
- String result = TextDBUtilities.writeProductToDatabase(pil,
- contents, this.operationalMode);
- observer.showScriptStatus(result);
- } catch (Exception e) {
- observer.showErrorMessage("failure writing to database ", e);
- }
- }
-
- /**
- * Puts the script runner into a "safe" wait state. This state can be
- * interrupted by the user in one of two ways; 'Continue' and 'Cancel'.
- *
- * @throws Exception
- * if an error occurs
- */
- public void waitIndefinate() throws Exception {
- observer.showScriptStatus("Waiting for user to continue...");
- observer.activateControls(false, true);
- // indefinite sleep loop
- while (true) {
- if (observer.cancelScript()) {
- canceled = true;
- break;
- } else if (observer.continueScript()) {
- break;
- }
- try {
- Thread.sleep(100);
- doEvents();
- } catch (InterruptedException e) {
- // nothing to do
- }
- }
- observer.activateControls(false, false);
- }
-
- /**
- * Waits until the specified number of minutes after the hour. the number of
- * minutes must be between 0 and 59 inclusive. If the specified time is less
- * than the current minutes after the hour, the delay is scheduled into the
- * next hour.
- *
- * @param time
- * time delay after the hour
- *
- * @throws Exception
- * in case of any error
- */
- public void waitUntilTime(int minToWait) throws Exception {
- if (minToWait < 0 || minToWait > 59) {
- throw new Exception(
- "Invalid argument: expected integer between 0 and 59 but got \""
- + minToWait + "\"");
- }
- /* determine when to end wait */
- Date date = (Date) SimulatedTime.getSystemTime().getTime().clone();
- Calendar target = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- target.setTime(date);
- int minPastHour = target.get(Calendar.MINUTE);
- if (minPastHour > minToWait) {
- // past target -- wait into next hour
- target.add(Calendar.HOUR_OF_DAY, 1);
- }
- target.set(Calendar.MINUTE, minToWait);
- target.set(Calendar.SECOND, 0);
- /* execute the safe sleep */
- safeSleep(target.getTime());
- }
-
- /**
- * Waits for the specified amount of time. The format of the time
- * specification is HH:MM:SS; resulting of a delay of up to 23hrs
- * 59min 59sec.
- *
- * @param time
- * the amount of time to delay
- *
- * @throws Exception
- * in case of any error
- */
- public void waitForTime(String time) throws Exception {
- /* parse/validate the argument */
- Pattern p = Pattern.compile("(\\d{2}):(\\d{2}):(\\d{2})");
- Matcher m = p.matcher(time);
- if (!m.matches()) {
- throw new Exception(
- "Invalid argument: expected format HH:MM:SS but got \""
- + time + "\"");
- }
- int hrs = 0;
- int mins = 0;
- int secs = 0;
- try {
- hrs = Integer.parseInt(m.group(1));
- mins = Integer.parseInt(m.group(2));
- secs = Integer.parseInt(m.group(3));
- } catch (NumberFormatException e) {
- throw new Exception(
- "Invalid argument: expected format HH:MM:SS but got \""
- + time + "\"", e);
- }
- if (hrs < 0 || hrs > 23 || mins < 0 || mins > 59 || secs < 0
- || secs > 59) {
- throw new Exception(
- "Invalid argument: expected format HH:MM:SS but got \""
- + time + "\"");
- }
- /* delay time in seconds */
- int delay = 3600 * hrs + 60 * mins + secs;
- /* create a calendar representing the wait end time */
- Date now = (Date) SimulatedTime.getSystemTime().getTime().clone();
- Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- date.setTime(now);
- date.add(Calendar.SECOND, delay);
- /* execute the safe sleep */
- safeSleep(date.getTime());
- }
-
- /**
- * Safely sleeps the specified number of seconds.
- *
- * @param sleepToTime
- * provides the end time of the sleep
- *
- * @throws Exception
- * if an error occurs
- */
- private void safeSleep(Date sleepToTime) throws Exception {
- /* short circuit -- return if end time already past */
- if (SimulatedTime.getSystemTime().getTime().after(sleepToTime)) {
- return;
- }
- observer.activateControls(true, false);
- observer.showScriptStatus("Waiting until "
- + String.format(TIME_FMT, sleepToTime) + " to proceed...");
- while (SimulatedTime.getSystemTime().getTime().before(sleepToTime)) {
- if (observer.cancelScript()) {
- canceled = true;
- break;
- } else if (observer.skipWait()) {
- break;
- }
- try {
- Thread.sleep(100);
- doEvents();
- } catch (InterruptedException e) {
- // nothing to do
- }
- }
- observer.activateControls(false, false);
- }
-
- /**
- * Turns results accumulation on in the Text Editor Window.
- *
- * @param flag
- * true to start accumulation, false to stop accumulation
- *
- * @throws Exception
- * if an error occurs
- */
- public void setAccumulation(boolean flag) throws Exception {
- if (observer.isEditMode()) {
- throw new Exception(
- "Cannot set accumulate: text window in edit mode");
- }
- observer.writeText("--- turning accumulation " + (flag ? "on" : "off")
- + " ---\n");
- observer.setAccumulation(flag);
- }
-
- /**
- * Clears the Text Editor Window
- *
- * @throws Exception
- * if an error occurs
- */
- public void clearTextDisplay() throws Exception {
- if (observer.isEditMode()) {
- throw new Exception("Cannot clear: text window in edit mode");
- }
- observer.writeText("--- clearing text display window ---\n");
- observer.clearTextDisplay();
- }
-
- /**
- * Sends the specified text to the observer for display. This method is used
- * to cause output from Python's print command to be redirected to the
- * observer.
- *
- * @param text
- * the text to display
- */
- public void writeText(String text) {
- observer.writeText(text);
- }
-
- /**
- * Sends the specified text to the observer for display. This method is used
- * to capture output from {@code stderr} in the a python script and redirect
- * it to the observer.
- *
- * @param errMsg
- * the stderr text to display
- */
- public void writeError(String errMsg) {
- observer.scriptError();
- writeText(errMsg);
- observer.addStdErrMsg(errMsg);
- }
-
- /**
- * allows the script to request a refresh of the GUI
- */
- public void doEvents() {
- while (observer.getDisplay().readAndDispatch()) {
- }
- }
-
- // /**
- // *
- // * @return
- // */
- // public boolean continueScript() {
- // return observer.continueScript();
- // }
- // /**
- // *
- // * @return
- // */
- // public boolean skipWait() {
- // return observer.skipWait();
- // }
-
- /**
- * Returns {@code true} is the user has canceled the script via a user
- * interface element. This method should be called periodically during loops
- * and pauses to determine if a user ordered cancel has occurred.
- */
- public boolean cancelScript() {
- return observer.cancelScript();
- }
-
- /**
- * Returns {@code true} if the script was canceled. This allows the Python
- * wrapper to properly relay the script cancellation to the script runner.
- * Note: this is not set by all commands.
- */
- public boolean isCanceled() {
- return canceled;
- }
-}
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/util/TextEditorUtil.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/util/TextEditorUtil.java
index 49e139bad8..a797f3ecf1 100755
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/util/TextEditorUtil.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/util/TextEditorUtil.java
@@ -34,11 +34,8 @@ 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.viz.core.localization.LocalizationManager;
-import com.raytheon.viz.texteditor.HTTPQueryTransport;
import com.raytheon.viz.texteditor.command.ICommand;
/**
@@ -51,6 +48,7 @@ import com.raytheon.viz.texteditor.command.ICommand;
* Date Ticket# Engineer Description
* ------------ ---------- ---------- --------------------------
* 8/11/2009 2191 rjpeter Initial creation.
+ * 9/09/2014 3580 mapeters Removed getTextDbsrvTransport().
*
*
* @author rjpeter
@@ -58,10 +56,6 @@ import com.raytheon.viz.texteditor.command.ICommand;
public class TextEditorUtil {
public static final String TEXTEDITOR_PYTHON_DIR = "textws/python";
- private static final String HTTP_SERVER_ADDRESS_PROPERTY = "httpServerAddress";
-
- private static final String TEXT_DB_SERVICE_NAME = "textdbsrv";
-
private static String pythonIncludeDir;
public static void setCommandField(ICommand command, Text... fields) {
@@ -177,11 +171,6 @@ public class TextEditorUtil {
return pythonIncludeDir;
}
- public static IQueryTransport getTextDbsrvTransport() {
- return new HTTPQueryTransport(LocalizationManager.getInstance()
- .getLocalizationServer(), TEXT_DB_SERVICE_NAME);
- }
-
public static void userInformation(Shell shell, String information) {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setText("Notice");
diff --git a/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationComponent.java b/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationComponent.java
index 24467330e1..a7f9c380bf 100644
--- a/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationComponent.java
+++ b/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationComponent.java
@@ -40,6 +40,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent;
* Oct 02, 2012 1229 rferrel Make a blocking dialog.
* Oct 17, 2012 1229 rferrel Changes for non-blocking
* TextWorkstationDlg.
+ * Sep 09, 2014 3580 mapeters Removed {@link SerializationUtil} usage.
*
*
*
@@ -58,7 +59,6 @@ public class TextWorkstationComponent extends AbstractCAVEDialogComponent {
*/
@Override
protected void startInternal(String componentName) throws Exception {
- SerializationUtil.getJaxbContext();
TextWorkstationDlg textWorkstationDlg = new TextWorkstationDlg(
new Shell(Display.getCurrent()));
textWorkstationDlg.open();
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.text/src/com/raytheon/uf/common/dataplugin/text/dbsrv/IQueryTransport.java b/edexOsgi/com.raytheon.uf.common.dataplugin.text/src/com/raytheon/uf/common/dataplugin/text/dbsrv/IQueryTransport.java
deleted file mode 100644
index c6412c2000..0000000000
--- a/edexOsgi/com.raytheon.uf.common.dataplugin.text/src/com/raytheon/uf/common/dataplugin/text/dbsrv/IQueryTransport.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * This software was developed and / or modified by Raytheon Company,
- * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
- *
- * U.S. EXPORT CONTROLLED TECHNICAL DATA
- * This software product contains export-restricted data whose
- * export/transfer/disclosure is restricted by U.S. law. Dissemination
- * to non-U.S. persons whether in the United States or abroad requires
- * an export license or other authorization.
- *
- * Contractor Name: Raytheon Company
- * Contractor Address: 6825 Pine Street, Suite 340
- * Mail Stop B8
- * Omaha, NE 68106
- * 402.291.0100
- *
- * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
- * further licensing information.
- **/
-package com.raytheon.uf.common.dataplugin.text.dbsrv;
-
-import com.raytheon.uf.common.message.Message;
-
-/**
- * Transport interface for sending textdb query messages to query service
- *
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Nov 3, 2008 jkorman Initial creation
- * May 15, 2014 2536 bclement moved from uf.edex.textdbsrv
- *
- *
- *
- * @author jkorman
- * @version 1.0
- */
-
-public interface IQueryTransport {
-
- /**
- *
- * @param message
- * @return
- */
- public Message executeQuery(Message message);
-
-}