diff --git a/cave/com.raytheon.uf.viz.core/plugin.xml b/cave/com.raytheon.uf.viz.core/plugin.xml
index 69005c0917..dc7f16a43a 100644
--- a/cave/com.raytheon.uf.viz.core/plugin.xml
+++ b/cave/com.raytheon.uf.viz.core/plugin.xml
@@ -24,7 +24,6 @@
-
@@ -39,14 +38,6 @@
id="com.raytheon.uf.viz.core.localization.LocalizationPreferences"
name="Localization"/>
-
-
-
-
-
-
-
-
-
-
-
- Defines an extension to register script generation capability
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- The script template defines how a uEngine script is generated for a particular plugin.
-
-scriptLibrary should be populated if the standard script template is to be used.
-
-If custom script generation is desired, scriptTemplateFile can be set to a custom velocity template file.
-
-
-
-
-
-
- The name of the plugin (e.g. 'plugin-satellite')
-
-
-
-
-
-
- The script library to be used (e.g. ObsRequest)
-
-
-
-
-
-
- The template file to use, otherwise null if standard template should be used.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 2008
-
-
-
-
-
-
-
-
-
-
- [
-
-
-
-
-
diff --git a/cave/com.raytheon.uf.viz.core/scriptTemplates/standardTemplate.vm b/cave/com.raytheon.uf.viz.core/scriptTemplates/standardTemplate.vm
index a3c517b2a0..3757e74187 100644
--- a/cave/com.raytheon.uf.viz.core/scriptTemplates/standardTemplate.vm
+++ b/cave/com.raytheon.uf.viz.core/scriptTemplates/standardTemplate.vm
@@ -1,24 +1,4 @@
## The standard template gets all of its behavior from VM_global_library macros
#if($mode == "select")
#standardSelect($scriptLibrary $maxRecords $scriptMetadata false)
-#elseif($mode == "catalog")
-#standardCatalog($scriptLibrary $scriptMetadata)
-#elseif($mode == "latestTime")
-#standardLatestTime($scriptMetadata)
-#elseif($mode == "plot")
-#standardSelect($scriptLibrary $maxRecords $scriptMetadata true)
-#elseif($mode == "dbquery")
-#standardDbQuery($scriptMetadata)
-#elseif($mode == "hqlquery")
-#hqlQuery($scriptMetadata)
-#elseif($mode == "sqlquery")
-#sqlQuery($scriptMetadata)
-#elseif($mode == "sqlstatement")
-#sqlStatement($scriptMetadata)
-#elseif($mode == "hqlstatement")
-#hqlStatement($scriptMetadata)
-#elseif($mode == "saveOrUpdateObject")
-#saveOrUpdateObject($scriptMetadata)
-#elseif($mode == "getRecordClass")
-#getRecordClass($scriptMetadata)
#end
diff --git a/cave/com.raytheon.uf.viz.core/scriptTemplates/tableRequestTemplate.vm b/cave/com.raytheon.uf.viz.core/scriptTemplates/tableRequestTemplate.vm
deleted file mode 100644
index 37305105db..0000000000
--- a/cave/com.raytheon.uf.viz.core/scriptTemplates/tableRequestTemplate.vm
+++ /dev/null
@@ -1,31 +0,0 @@
-
-#if($mode == "select")
-import TableRequest
-dataRequest = TableRequest.TableRequest('${scriptMetadata.get("databasename").constraintValue}',
- '${scriptMetadata.get("classname").constraintValue}')
-dataRequest.setCount(${maxRecords})
-#foreach (${key} in ${scriptMetadata.keySet()})
-#if(${key})
-#if(${key} != "pluginName" && ${key} != "databasename" && ${key} != "classname")
-#set($constraint = $scriptMetadata.get($key))
-#if(${constraint.constraintType} == "IN")
-dataRequest.addList("${key}", "${constraint.constraintValue}")
-#elseif(${constraint.constraintType} == "LIKE")
-dataRequest.addParameter("${key}", "${constraint.constraintValue}", "like")
-#elseif ($constraint.constraintType == "ISNULL")
-dataRequest.addParameter("${key}", "${constraint.constraintValue}", "isnull")
-#else
-dataRequest.addParameter("${key}", "${constraint.constraintValue}")
-#end
-#end
-#end
-#end
-return dataRequest.execute()
-#elseif($mode == "update")
-import TableResponse
-product = '''$scriptMetadata.get("rowname").constraintValue'''
-#set($classname = $scriptMetadata.get("classname").constraintValue)
-#set($databasename = $scriptMetadata.get("databasename").constraintValue)
-dataResponse = TableResponse.TableResponse('${databasename}', '${classname}', product)
-return dataResponse.execute()
-#end
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/catalog/ScriptCreator.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/catalog/ScriptCreator.java
index f625725d23..83de15574a 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/catalog/ScriptCreator.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/catalog/ScriptCreator.java
@@ -22,25 +22,13 @@ package com.raytheon.uf.viz.core.catalog;
import java.io.File;
import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IContributor;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.osgi.framework.Bundle;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
-import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil;
@@ -71,6 +59,8 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* 3/17/2008 933 grichard Added support for taf plugin.
* 04/14/2008 chammack Complete refactor to Velocity
* Feb 15, 2013 1638 mschenke Created common VelocityManager for executing scripts
+ * Sep 12, 2013 2277 mschenke Remove references to this class and deleted unused
+ * functionality
*
*
*
@@ -79,150 +69,25 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
*/
@Deprecated
public class ScriptCreator {
- private static final transient IUFStatusHandler statusHandler = UFStatus
- .getHandler(ScriptCreator.class);
- private static final String DEFAULT_SCRIPT_LIBRARY = "BaseRequest";
+ private static String SCRIPT_LIBRARY = "BaseRequest";
- /** The extension point where resources are defined */
- private static final String RESOURCE_EXTENSION = "com.raytheon.uf.viz.core.scriptTemplate";
-
- private static final String PLUGINNAME_TAG = "pluginName";
-
- private static final String SCRIPT_TEMPLATE_TAG = "scriptTemplateFile";
-
- private static final String SCRIPT_LIBRARY_TAG = "scriptLibrary";
-
- private static Map pluginToLibraryMap;
-
- private static File DEFAULT_TEMPLATE;
+ private static File SCRIPT_TEMPLATE;
static {
try {
- DEFAULT_TEMPLATE = new File(FileLocator.resolve(
+ SCRIPT_TEMPLATE = new File(FileLocator.resolve(
FileLocator.find(Activator.getDefault().getBundle(),
new Path("scriptTemplates/standardTemplate.vm"),
null)).getPath());
} catch (IOException e) {
- statusHandler
+ UFStatus.getHandler(ScriptCreator.class)
.handle(Priority.CRITICAL,
"Unable to load the standard script template. Requesting products will not work until this is fixed.",
e);
}
}
- private static class ScriptProperties {
- public File scriptTemplate;
-
- public String scriptLibrary;
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null || !(obj instanceof ScriptProperties)) {
- return false;
- }
-
- ScriptProperties props = (ScriptProperties) obj;
-
- boolean part1 = (scriptTemplate == null && props.scriptTemplate == null)
- || (scriptTemplate != null && scriptTemplate
- .equals(props.scriptTemplate));
-
- boolean part2 = (scriptLibrary == null && props.scriptLibrary == null)
- || (scriptLibrary != null && scriptLibrary
- .equals(props.scriptLibrary));
-
- return part1 && part2;
-
- }
-
- @Override
- public String toString() {
- return "(Template: " + scriptTemplate + ", Library: "
- + scriptLibrary + ")";
- }
-
- }
-
- /**
- * Create an internal representation of script properties extensions in
- * memory
- */
- private static synchronized void createPluginToLibraryMap() {
- if (pluginToLibraryMap != null) {
- return;
- }
-
- pluginToLibraryMap = new HashMap();
- IExtensionRegistry registry = Platform.getExtensionRegistry();
-
- IExtensionPoint point = registry.getExtensionPoint(RESOURCE_EXTENSION);
-
- if (point == null) {
- return;
- }
- IExtension[] extensions = point.getExtensions();
-
- List extensionList = new ArrayList();
- extensionList.addAll(Arrays.asList(extensions));
-
- for (int i = 0; i < extensionList.size(); i++) {
- IConfigurationElement[] config = extensionList.get(i)
- .getConfigurationElements();
-
- for (int j = 0; j < config.length; j++) {
- String pluginName = config[j].getAttribute(PLUGINNAME_TAG);
- String template = config[j].getAttribute(SCRIPT_TEMPLATE_TAG);
- String library = config[j].getAttribute(SCRIPT_LIBRARY_TAG);
- IContributor contrib = extensionList.get(i).getContributor();
- Bundle bundle = Platform.getBundle(contrib.getName());
- File templateFile = null;
- try {
- if (template != null) {
- URL url = FileLocator.find(bundle, new Path(template),
- null);
- if (url == null) {
- String message = "Error opening the script template for: "
- + pluginName;
- statusHandler.handle(Priority.PROBLEM, message);
- continue;
- }
-
- templateFile = new File(FileLocator.resolve(url)
- .getPath());
- }
- } catch (IOException e) {
- statusHandler.handle(Priority.PROBLEM,
- "Error opening resource", e);
- continue;
- }
-
- if (pluginName != null) {
- ScriptProperties newValue = new ScriptProperties();
- newValue.scriptLibrary = library;
- newValue.scriptTemplate = templateFile;
-
- ScriptProperties existingValue = pluginToLibraryMap
- .get(pluginName);
- if (existingValue != null) {
- // If duplicates, warn to log, and use the first value.
- statusHandler.handle(Priority.PROBLEM,
- "Duplicate value for plugin registry: "
- + pluginName + " had value: "
- + existingValue + ", new value: "
- + newValue + ". Ignoring new value.");
-
- } else {
- pluginToLibraryMap.put(pluginName, newValue);
- }
-
- }
-
- }
- }
-
- }
-
/**
* Create a script from a LayerProperty class, with mode "select"
*
@@ -237,50 +102,8 @@ public class ScriptCreator {
*/
public static String createScript(LayerProperty layerProperty)
throws VizException {
- return createScript(layerProperty, "select");
- }
-
- /**
- * Create a script from a LayerProperty class with a mode
- *
- * The mode is a user definable concept, but typically "select", "catalog"
- * and "update" are valid values, however script templates may implement
- * anything they choose to.
- *
- * @param layerProperty
- * the layer property
- * @param mode
- * the mode
- * @return the script
- * @throws VizException
- * an exception if generation fails.
- */
- public static String createScript(LayerProperty layerProperty, String mode)
- throws VizException {
- if (mode.equals("update") || mode.equals("catalog")
- || mode.equals("plot")) {
- return createScript(layerProperty.getEntryQueryParameters(false),
- layerProperty.getNumberOfImages(), mode);
- }
return createScript(layerProperty.getEntryQueryParameters(true),
- layerProperty.getNumberOfImages(), mode);
- }
-
- /**
- * Create a script from a LayerProperty class, with mode "update"
- *
- * This is a convenience method for the more general
- * createImageScript(LayerProperty, String).
- *
- * @param layerProperty
- * the layer property
- * @return the script object
- * @throws VizException
- * an exception if generation fails.
- */
- public static String createUpdateScript(LayerProperty layerProperty)
- throws VizException {
- return createScript(layerProperty, "update");
+ layerProperty.getNumberOfImages(), "select");
}
/**
@@ -297,56 +120,27 @@ public class ScriptCreator {
* @throws VizException
*
*/
- public static String createScript(
- Map queryTerms, int maxRecords,
- String mode) throws VizException {
-
- String plugin = queryTerms.get("pluginName").getConstraintValue();
-
- if (plugin == null) {
- throw new IllegalArgumentException(
- "Metadata does not contain pluginName, which is required.");
- }
-
- return createScript(plugin, queryTerms, maxRecords, mode);
-
- }
-
- public static String createScript(String templateName,
+ private static String createScript(
Map queryTerms, int maxRecords,
String mode) throws VizException {
// long t0 = System.currentTimeMillis();
- createPluginToLibraryMap();
-
- if (templateName == null) {
- throw new IllegalArgumentException(
- "No templateName, which is required.");
- }
-
- ScriptProperties props = pluginToLibraryMap.get(templateName);
-
- if (props == null) {
- props = new ScriptProperties();
- props.scriptLibrary = DEFAULT_SCRIPT_LIBRARY;
- }
-
- File stringTemplate = props.scriptTemplate;
- if (stringTemplate == null) {
- stringTemplate = DEFAULT_TEMPLATE;
+ if (SCRIPT_TEMPLATE == null) {
+ throw new IllegalStateException(
+ "ScriptCreator did not initialize properly");
}
Map templateObjects = new HashMap();
templateObjects.put("scriptMetadata", queryTerms);
templateObjects.put("maxRecords", maxRecords);
- templateObjects.put("scriptLibrary", props.scriptLibrary);
+ templateObjects.put("scriptLibrary", SCRIPT_LIBRARY);
templateObjects.put("mode", mode);
try {
String script = VelocityManager.executeTemplate(
- stringTemplate,
- DEFAULT_TEMPLATE.getParentFile(),
+ SCRIPT_TEMPLATE,
+ SCRIPT_TEMPLATE.getParentFile(),
new File(FileUtil.join(LocalizationManager.getUserDir(),
"logs")), templateObjects);
// System.out.println("Script gen: "
diff --git a/cave/com.raytheon.viz.pointdata/plugin.xml b/cave/com.raytheon.viz.pointdata/plugin.xml
index 19bc8c5ab9..37c3f89616 100644
--- a/cave/com.raytheon.viz.pointdata/plugin.xml
+++ b/cave/com.raytheon.viz.pointdata/plugin.xml
@@ -66,34 +66,6 @@
resourceType="PLAN_VIEW">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
query = new HashMap();
- query.put("pluginName", rcTable);
- query.put("databasename", rcDatabase);
- query.put("classname", rcClass);
- query.put("rowname", rcRow);
- // New up layer property and set then entry parameters
- LayerProperty lpParm = new LayerProperty();
- try {
- lpParm.setEntryQueryParameters(query, false);
- // Create Image Script for table request
- String tableScript = ScriptCreator.createUpdateScript(lpParm);
- // Capture the script to the console for now...
- // System.out.printf("The update script is: %n%s%n", tableScript);
- // Later call loadData method to run the script...
- // For now, mouse the script in to the AWIPS Test Driver
- // Interface through the Request/Response Message dialog.
- // List list;
- // list = Loader.loadData(tableScript, 10000);
- Loader.loadData(tableScript, 10000);
- // textEditor.insert(((StdTextProduct) (list.get(0)))
- // .getProduct());
+ ThriftClient.sendRequest(request);
} catch (VizException e1) {
statusHandler.handle(Priority.PROBLEM, "Error retrieving metadata",
e1);
diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/util/RadarTextUtility.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/util/RadarTextUtility.java
index fea8fae99b..f54fc4a3cd 100644
--- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/util/RadarTextUtility.java
+++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/util/RadarTextUtility.java
@@ -24,27 +24,16 @@ import java.io.IOException;
import java.io.StringReader;
import java.text.SimpleDateFormat;
import java.util.Date;
-import java.util.HashMap;
import java.util.TimeZone;
-import javax.xml.bind.JAXBException;
-
-import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
-import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
-import com.raytheon.uf.common.serialization.SerializationUtil;
+import com.raytheon.uf.common.dataplugin.text.request.StdTextProductServerRequest;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
-import com.raytheon.uf.viz.core.catalog.LayerProperty;
-import com.raytheon.uf.viz.core.catalog.ScriptCreator;
-import com.raytheon.uf.viz.core.comm.Loader;
import com.raytheon.uf.viz.core.exception.VizException;
-import com.raytheon.uf.viz.core.status.StatusConstants;
-import com.raytheon.viz.core.mode.CAVEMode;
-import com.raytheon.viz.texteditor.Activator;
-import com.raytheon.viz.texteditor.StdTextProductFactory;
+import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.texteditor.msgs.IRadarObserver;
/**
@@ -68,7 +57,8 @@ import com.raytheon.viz.texteditor.msgs.IRadarObserver;
*/
public class RadarTextUtility implements IRadarObserver {
- private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(RadarTextUtility.class);
+ private static final transient IUFStatusHandler statusHandler = UFStatus
+ .getHandler(RadarTextUtility.class);
@Override
public void saveRadarTextProd(String textProd) {
@@ -115,66 +105,19 @@ public class RadarTextUtility implements IRadarObserver {
// System.out.println("Current header: " + currentHeader);
- // New up request constraint for table request and
- // also of the classname of the table for the request
- RequestConstraint rcTable = new RequestConstraint("table");
- String tableDatabaseName = "fxa";
- String tableClassName = StdTextProduct.class.getName();
+ StdTextProductServerRequest request = new StdTextProductServerRequest();
+ request.setWmoid(wmoId);
+ request.setSite(siteId);
+ request.setCccid(siteNode);
+ request.setNnnid(category);
+ request.setXxxid(designator);
+ request.setHdrtime(currentDate);
+ request.setBbbid("NOR");
+ request.setCreatetime(System.currentTimeMillis());
+ request.setProduct(currentHeader + "\n" + strBldr.toString());
- RequestConstraint rcDatabase = new RequestConstraint(
- tableDatabaseName);
- RequestConstraint rcClass = new RequestConstraint(tableClassName);
- // New up request constraint for table response using the
- // tmpStr editor content after marshalling this string to
- // XML format via the Util class.
- // New up a StdTextProduct, then set the product component
- // to the tmpStr that represents the new content.
-
- StdTextProduct tmpProd = StdTextProductFactory.getInstance(CAVEMode
- .getMode());
- tmpProd.setWmoid(wmoId);
- tmpProd.setSite(siteId);
- tmpProd.setCccid(siteNode);
- tmpProd.setNnnid(category);
- tmpProd.setXxxid(designator);
- tmpProd.setHdrtime(currentDate);
- tmpProd.setBbbid("NOR");
- tmpProd.setRefTime(System.currentTimeMillis());
- tmpProd.setProduct(currentHeader + "\n" + strBldr.toString());
-
- RequestConstraint rcRow;
try {
- rcRow = new RequestConstraint(
- SerializationUtil.marshalToXml(tmpProd));
- } catch (JAXBException e) {
- statusHandler.handle(Priority.PROBLEM,
- "Error serializing data", e);
- return;
- }
- // New up hash map and populate with entry query
- // parameters before newing up layer property
- HashMap query = new HashMap();
- query.put("pluginName", rcTable);
- query.put("databasename", rcDatabase);
- query.put("classname", rcClass);
- query.put("rowname", rcRow);
- // New up layer property and set then entry parameters
- LayerProperty lpParm = new LayerProperty();
- try {
- lpParm.setEntryQueryParameters(query, false);
- // Create Image Script for table request
- String tableScript = ScriptCreator.createUpdateScript(lpParm);
- // Capture the script to the console for now...
- // System.out.printf("The update script is: %n%s%n",
- // tableScript);
- // Later call loadData method to run the script...
- // For now, mouse the script in to the AWIPS Test Driver
- // Interface through the Request/Response Message dialog.
- // List list;
- // list = Loader.loadData(tableScript, 10000);
- Loader.loadData(tableScript, 10000);
- // textEditor.insert(((StdTextProduct) (list.get(0)))
- // .getProduct());
+ ThriftClient.sendRequest(request);
} catch (VizException e1) {
statusHandler.handle(Priority.PROBLEM,
"Error retrieving metadata", e1);