Issue #2277 Got rid of all ScriptCreator references in raytheon code.
Change-Id: I255301d36da8546ef0850b3dc0b4d00ee0bfa002 Former-commit-id:661d47c894
[formerly955db6a722
] [formerly661d47c894
[formerly955db6a722
] [formerly0faed07d58
[formerly 3183c0abb055acf02e255392f92402e84abd0e08]]] Former-commit-id:0faed07d58
Former-commit-id:08e85c8588
[formerly2a8d148a74
] Former-commit-id:65d11c8e51
This commit is contained in:
parent
165a6571cb
commit
f8d2a9770b
8 changed files with 42 additions and 555 deletions
|
@ -24,7 +24,6 @@
|
|||
<extension-point id="units" name="units" schema="schema/units.exsd"/>
|
||||
<extension-point id="descriptor" name="descriptor" schema="schema/descriptor.exsd"/>
|
||||
<extension-point id="renderingOrder" name="renderingOrder" schema="schema/renderingOrder.exsd"/>
|
||||
<extension-point id="scriptTemplate" name="Script Template Extension" schema="schema/scriptTemplate.exsd"/>
|
||||
<extension-point id="graphicsFactory" name="graphics factory" schema="schema/graphicsFactory.exsd"/>
|
||||
<extension-point id="classContext" name="classContext" schema="schema/classContext.exsd"/>
|
||||
<extension-point id="userManager" name="userManager" schema="schema/userManager.exsd"/>
|
||||
|
@ -39,14 +38,6 @@
|
|||
id="com.raytheon.uf.viz.core.localization.LocalizationPreferences"
|
||||
name="Localization"/>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.core.scriptTemplate">
|
||||
<scriptTemplate
|
||||
pluginName="table"
|
||||
scriptLibrary="TableRequest"
|
||||
scriptTemplateFile="scriptTemplates/tableRequestTemplate.vm">
|
||||
</scriptTemplate>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.themes">
|
||||
<themeElementCategory
|
||||
id="com.raytheon.uf.viz.core.theme"
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="com.raytheon.uf.viz.core" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="com.raytheon.uf.viz.core" id="scriptTemplate" name="Script Template Extension"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
Defines an extension to register script generation capability
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="scriptTemplate" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="scriptTemplate">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<attribute name="pluginName" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
The name of the plugin (e.g. 'plugin-satellite')
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="scriptLibrary" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
The script library to be used (e.g. ObsRequest)
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="scriptTemplateFile" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
The template file to use, otherwise null if standard template should be used.
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="resource"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
2008
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
</schema>
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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<String, ScriptProperties> 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<String, ScriptProperties>();
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
|
||||
IExtensionPoint point = registry.getExtensionPoint(RESOURCE_EXTENSION);
|
||||
|
||||
if (point == null) {
|
||||
return;
|
||||
}
|
||||
IExtension[] extensions = point.getExtensions();
|
||||
|
||||
List<IExtension> extensionList = new ArrayList<IExtension>();
|
||||
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<String, RequestConstraint> 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<String, RequestConstraint> 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<String, Object> templateObjects = new HashMap<String, Object>();
|
||||
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: "
|
||||
|
|
|
@ -66,34 +66,6 @@
|
|||
resourceType="PLAN_VIEW">
|
||||
</resource>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.core.scriptTemplate">
|
||||
<scriptTemplate
|
||||
pluginName="obs"
|
||||
scriptLibrary="ObsRequest">
|
||||
</scriptTemplate>
|
||||
<scriptTemplate
|
||||
pluginName="sfcobs"
|
||||
scriptLibrary="SfcObsRequest">
|
||||
</scriptTemplate>
|
||||
<scriptTemplate
|
||||
pluginName="fssobs"
|
||||
scriptLibrary="FSSObsRequest">
|
||||
</scriptTemplate>
|
||||
<scriptTemplate
|
||||
pluginName="bufrua"
|
||||
scriptLibrary="UARequest">
|
||||
</scriptTemplate>
|
||||
<scriptTemplate
|
||||
pluginName="profiler"
|
||||
scriptLibrary="ProfilerRequest">
|
||||
</scriptTemplate>
|
||||
<scriptTemplate
|
||||
pluginName="pointdata"
|
||||
scriptTemplateFile="scriptTemplates/pointData.vm">
|
||||
</scriptTemplate>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.localization.localizationpath">
|
||||
<path
|
||||
|
|
|
@ -21,26 +21,17 @@ package com.raytheon.viz.texteditor.util;
|
|||
|
||||
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.site.SiteMap;
|
||||
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.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.localization.LocalizationManager;
|
||||
import com.raytheon.viz.core.mode.CAVEMode;
|
||||
import com.raytheon.viz.texteditor.StdTextProductFactory;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.viz.texteditor.msgs.IAviationObserver;
|
||||
|
||||
/**
|
||||
|
@ -94,63 +85,19 @@ public class AviationTextUtility implements IAviationObserver {
|
|||
currentDate, "\n", "WRK" + "TAF");
|
||||
// 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(siteWmoId);
|
||||
request.setSite(siteName);
|
||||
request.setCccid(siteNode);
|
||||
request.setNnnid("WRK");
|
||||
request.setXxxid("TAF");
|
||||
request.setHdrtime(currentDate);
|
||||
request.setBbbid("NOR");
|
||||
request.setCreatetime(System.currentTimeMillis());
|
||||
request.setProduct(currentHeader + "\n" + tmpStr);
|
||||
|
||||
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(siteWmoId);
|
||||
tmpProd.setSite(siteName);
|
||||
tmpProd.setCccid(siteNode);
|
||||
tmpProd.setNnnid("WRK");
|
||||
tmpProd.setXxxid("TAF");
|
||||
tmpProd.setHdrtime(currentDate);
|
||||
tmpProd.setBbbid("NOR");
|
||||
tmpProd.setRefTime(System.currentTimeMillis());
|
||||
tmpProd.setProduct(currentHeader + "\n" + tmpStr);
|
||||
|
||||
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<String, RequestConstraint> query = new HashMap<String, RequestConstraint>();
|
||||
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 <Any> 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<IMarshallable> 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);
|
||||
|
|
|
@ -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<String, RequestConstraint> query = new HashMap<String, RequestConstraint>();
|
||||
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 <Any> 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<IMarshallable> 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);
|
||||
|
|
Loading…
Add table
Reference in a new issue