diff --git a/ncep/gov.noaa.nws.ncep.staticdataprovider/src/gov/noaa/nws/ncep/staticdataprovider/ContinuingWatch.java b/ncep/gov.noaa.nws.ncep.staticdataprovider/src/gov/noaa/nws/ncep/staticdataprovider/ContinuingWatch.java index b437aea41c..a883e9fc44 100644 --- a/ncep/gov.noaa.nws.ncep.staticdataprovider/src/gov/noaa/nws/ncep/staticdataprovider/ContinuingWatch.java +++ b/ncep/gov.noaa.nws.ncep.staticdataprovider/src/gov/noaa/nws/ncep/staticdataprovider/ContinuingWatch.java @@ -19,17 +19,20 @@ import java.util.GregorianCalendar; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.TimeZone; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; +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.DataTime; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; -import com.raytheon.uf.viz.core.comm.Connector; import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.rsc.ResourceType; +import com.raytheon.uf.viz.core.requests.ThriftClient; /** * @@ -40,6 +43,7 @@ import com.raytheon.uf.viz.core.rsc.ResourceType; * 08/12 #770 Q. Zhou Initial Creation. * 09/12 #770 Q. Zhou Clean up and change selectedWatch to a collection * 08/13 #1028 G. Hull rm dependency on viz.rsc.wtch project + * 12/14 ? B. Yin Remove ScriptCreator, use Thrift Client. * * * @author Q. Zhou @@ -47,6 +51,9 @@ import com.raytheon.uf.viz.core.rsc.ResourceType; public class ContinuingWatch { + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(ContinuingWatch.class); + /* * WtchRscDataObj class */ @@ -147,26 +154,27 @@ public class ContinuingWatch { metadataMap.put( "reportType",ids ); metadataMap.put( "pluginName", new RequestConstraint("aww") ); - HashMap queryList = new HashMap(metadataMap); + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(metadataMap); + + try { + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); - LayerProperty prop = new LayerProperty(); - prop.setDesiredProduct(ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters(queryList, false); - prop.setNumberOfImages(15000); // TODO: max # records ?? should we cap this ? - - String script = null; - script = ScriptCreator.createScript(prop); - if (script == null) - return null; - - Object[] pdoList = Connector.getInstance().connect(script, null, 60000); - for (Object pdo : pdoList) { - awwRecord = (AwwRecord) pdo; - Collection num = getAwwRecord( awwRecord ); - if (num != null && !num.isEmpty()) - contWatch.addAll( num ); - } - + for (Map result : response.getResults()) { + + for (Object pdo : result.values()) { + awwRecord = (AwwRecord) pdo; + Collection num = getAwwRecord( awwRecord ); + if (num != null && !num.isEmpty()) + contWatch.addAll( num ); + } + } + } + catch (VizException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), + e); + } + //Retrieving unique items from the list Set set = new HashSet(contWatch); contWatch = new ArrayList(set); diff --git a/ncep/gov.noaa.nws.ncep.viz.resources/src/gov/noaa/nws/ncep/viz/resources/AbstractNatlCntrsResource.java b/ncep/gov.noaa.nws.ncep.viz.resources/src/gov/noaa/nws/ncep/viz/resources/AbstractNatlCntrsResource.java index ad9feb40e5..54f948d24e 100644 --- a/ncep/gov.noaa.nws.ncep.viz.resources/src/gov/noaa/nws/ncep/viz/resources/AbstractNatlCntrsResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.resources/src/gov/noaa/nws/ncep/viz/resources/AbstractNatlCntrsResource.java @@ -13,28 +13,28 @@ import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.TreeMap; import java.util.concurrent.ConcurrentLinkedQueue; import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IRenderableDisplayChangedListener; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; -import com.raytheon.uf.viz.core.comm.Connector; import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IFrameCoordinator; import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.uf.viz.core.rsc.ResourceType; /** *
@@ -54,6 +54,7 @@ import com.raytheon.uf.viz.core.rsc.ResourceType;
  *                                        set frame to LAST and issueRefresh() to force paint (per legacy; TTR 520).
  * 06 Feb 2013     #972      G. Hull      define on IDescriptor instead of IMapDescriptor
  * 06/16/2014      #1136     qzhou        remove final for paintInternal, since paintFrame does not work for Graph
+ * 12/14              ?      B. Yin       Remove ScriptCreator, use Thrift Client.
  * 
* * @author ghull @@ -754,26 +755,19 @@ public abstract class AbstractNatlCntrsResource queryList = new HashMap( resourceData.getMetadataMap()); - LayerProperty prop = new LayerProperty(); - prop.setDesiredProduct(ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters(queryList, false); - prop.setNumberOfImages(15000); // TODO: max # records ?? should we cap - // this ? - String script = null; - script = ScriptCreator.createScript(prop); + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(queryList); + + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); - if (script == null) - return; - - Object[] pdoList = Connector.getInstance().connect(script, null, 60000); - - for (Object pdo : pdoList) { - for (IRscDataObject dataObject : processRecord(pdo)) { - newRscDataObjsQueue.add(dataObject); + for (Map result : response.getResults()) { + for (Object pdo : result.values()) { + for (IRscDataObject dataObject : processRecord(pdo)) { + newRscDataObjsQueue.add(dataObject); + } } } - // setAllFramesAsPopulated(); } diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/ffa/FFAResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/ffa/FFAResource.java index 800764d066..df7f9c02e9 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/ffa/FFAResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/ffa/FFAResource.java @@ -42,6 +42,8 @@ import org.eclipse.swt.graphics.RGB; import org.geotools.geometry.jts.ReferencedEnvelope; import org.opengis.referencing.crs.CoordinateReferenceSystem; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.TimeRange; @@ -61,6 +63,7 @@ import com.raytheon.uf.viz.core.drawables.IWireframeShape; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.map.IMapDescriptor; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.viz.core.rsc.jts.JTSCompiler; import com.raytheon.viz.core.rsc.jts.JTSCompiler.PointStyle; @@ -88,7 +91,7 @@ import com.vividsolutions.jts.io.WKBReader; * 09/11/12 852 Q. Zhou Modified time string and alignment in drawLabel(). * 02/01/13 972 G. Hull define on NcMapDescriptor instead of IMapDescriptor * 08/14/13 1028 G. Hull Move to aww project. Use AwwReportType enum. - * + * 12/14 ? B. Yin Remove ScriptCreator, use Thrift Client. * * * @author mgao @@ -1164,28 +1167,22 @@ public class FFAResource extends AbstractNatlCntrsResource queryList = new HashMap(resourceData.getMetadataMap()); - com.raytheon.uf.viz.core.catalog.LayerProperty prop = new com.raytheon.uf.viz.core.catalog.LayerProperty(); - prop.setDesiredProduct(com.raytheon.uf.viz.core.rsc.ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters(queryList, false); - prop.setNumberOfImages(15000); // TODO: max # records ?? should we cap this ? - - String script = null; - script = com.raytheon.uf.viz.core.catalog.ScriptCreator.createScript(prop); - - if (script == null) - return; - Object[] pdoList = com.raytheon.uf.viz.core.comm.Connector.getInstance().connect(script, null, 60000); - - queryResult = new FfaZoneQueryResult(); - - for (Object pdo : pdoList) { - for( IRscDataObject dataObject : processRecord( pdo ) ) { - newRscDataObjsQueue.add(dataObject); -//FfaRscDataObj frdo=(FfaRscDataObj)dataObject; System.out.println("_______^^^ queryRecords(): action: "+frdo.actionType+ " vtec: "+frdo.vtecline); - queryResult.buildQueryPart2(dataObject); - } - } + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(queryList); + + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); + + queryResult = new FfaZoneQueryResult(); + + for (Map result : response.getResults()) { + for (Object pdo : result.values()) { + for( IRscDataObject dataObject : processRecord( pdo ) ) { + newRscDataObjsQueue.add(dataObject); + queryResult.buildQueryPart2(dataObject); + } + } + } //TODO: handle EXA, EXB here: add newly extended areas diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/svrl/SvrlResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/svrl/SvrlResource.java index 7f8e7d2fa3..47cad665e4 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/svrl/SvrlResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/svrl/SvrlResource.java @@ -13,6 +13,7 @@ package gov.noaa.nws.ncep.viz.rsc.aww.svrl; * 27 May 2010 Uma Josyula Initial creation. * 01/10/11 Uma Josyula Made changes to preprocess update and event date * 02/16/2012 555 S. Gurung Added call to setAllFramesAsPopulated() in queryRecords(). + * 12/14 ? B. Yin Remove ScriptCreator, use Thrift Client. * * * @author ujosyula @@ -24,6 +25,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.StringTokenizer; @@ -31,7 +33,9 @@ import org.eclipse.swt.graphics.RGB; import org.geotools.geometry.jts.ReferencedEnvelope; import org.opengis.referencing.crs.CoordinateReferenceSystem; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.TimeRange; @@ -41,6 +45,7 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle; import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle; import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage; @@ -643,33 +648,26 @@ implements INatlCntrsResource, IStationField { @Override public void queryRecords() throws VizException { - // this method is almost similar to its super class's queryRecords(), may need to be modified later - // to use the super class's version for the common part - - HashMap queryList = new HashMap( - resourceData.getMetadataMap()); + // this method is almost similar to its super class's queryRecords(), may need to be modified later + // to use the super class's version for the common part - com.raytheon.uf.viz.core.catalog.LayerProperty prop = new com.raytheon.uf.viz.core.catalog.LayerProperty(); - prop.setDesiredProduct(com.raytheon.uf.viz.core.rsc.ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters(queryList, false); - prop.setNumberOfImages(15000); // TODO: max # records ?? should we cap - // this ? - String script = null; - script = com.raytheon.uf.viz.core.catalog.ScriptCreator.createScript(prop); + HashMap queryList = new HashMap( + resourceData.getMetadataMap()); - if (script == null) - return; + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(queryList); - Object[] pdoList = com.raytheon.uf.viz.core.comm.Connector.getInstance().connect(script, null, 60000); + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); + + for (Map result : response.getResults()) { + for (Object pdo : result.values()) { + for( IRscDataObject dataObject : processRecord( pdo ) ) { + newRscDataObjsQueue.add(dataObject); + scqr.buildeQueryPart(dataObject); + } + } + } - for (Object pdo : pdoList) { - for( IRscDataObject dataObject : processRecord( pdo ) ) { - newRscDataObjsQueue.add(dataObject); - - scqr.buildeQueryPart(dataObject); - } - } - scqr.populateMap(); setAllFramesAsPopulated(); } diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/warn/WarnResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/warn/WarnResource.java index 93d61d1b08..dd8a5769f8 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/warn/WarnResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/warn/WarnResource.java @@ -40,7 +40,9 @@ import org.eclipse.core.runtime.jobs.Job; import org.eclipse.swt.graphics.RGB; import org.opengis.referencing.crs.CoordinateReferenceSystem; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.edex.decodertools.core.LatLonPoint; @@ -58,6 +60,7 @@ import com.raytheon.uf.viz.core.drawables.IWireframeShape; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.map.IMapDescriptor; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.viz.core.rsc.jts.JTSCompiler; @@ -89,6 +92,7 @@ import com.vividsolutions.jts.io.WKBReader; * 08/12/2013 1021 G. Hull rm CountyResultJob; change to save map of wireframes for each * county/fips instead of collection for each unique warning/uri. * 08/14/2013 1028 G. Hull Move to aww project. Use AwwReportType enum. + * 12/14 ? B. Yin Remove ScriptCreator, use Thrift Client. * * * @@ -435,28 +439,20 @@ public class WarnResource extends HashMap queryList = new HashMap( resourceData.getMetadataMap()); + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(queryList); - LayerProperty prop = new LayerProperty(); - prop.setDesiredProduct(ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters(queryList, false); - prop.setNumberOfImages(15000); // TODO: max # records ?? should we cap - // this ? - String script = null; - script = ScriptCreator.createScript(prop); - - if (script == null) - return; - - Object[] pdoList = Connector.getInstance().connect(script, null, 60000); + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); countyResult = new WarnCountyResult(); - for (Object pdo : pdoList) { - for (IRscDataObject dataObject : processRecord(pdo)) { - newRscDataObjsQueue.add(dataObject); - - countyResult - .buildQueryPart2(((WarnRscDataObj) dataObject).countyFips); + for (Map result : response.getResults()) { + for (Object pdo : result.values()) { + for (IRscDataObject dataObject : processRecord(pdo)) { + newRscDataObjsQueue.add(dataObject); + countyResult + .buildQueryPart2(((WarnRscDataObj) dataObject).countyFips); + } } } countyResult.populateMap(); diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/wstm/WstmResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/wstm/WstmResource.java index bc00bcbdd2..12ef07a187 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/wstm/WstmResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/wstm/WstmResource.java @@ -7,47 +7,6 @@ */ package gov.noaa.nws.ncep.viz.rsc.aww.wstm; -import java.awt.geom.Rectangle2D; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Calendar; -import java.util.TimeZone; -import java.awt.Color; - -import org.eclipse.swt.graphics.RGB; -import org.opengis.referencing.crs.CoordinateReferenceSystem; - -import com.raytheon.uf.viz.core.DrawableString; -import com.raytheon.uf.viz.core.IGraphicsTarget; -import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; -import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle; -import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle; -import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment; -import com.raytheon.uf.viz.core.catalog.DirectDbQuery; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; -import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage; -import com.raytheon.uf.viz.core.comm.Connector; -import com.raytheon.uf.viz.core.drawables.IFont; -import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; -import com.raytheon.uf.viz.core.drawables.IShadedShape; -import com.raytheon.uf.viz.core.drawables.IWireframeShape; -import com.raytheon.uf.viz.core.drawables.PaintProperties; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.geom.PixelCoordinate; -import com.raytheon.uf.viz.core.map.IMapDescriptor; -import com.raytheon.uf.viz.core.map.MapDescriptor; -import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.uf.viz.core.rsc.ResourceType; -import com.raytheon.uf.edex.decodertools.core.LatLonPoint; - import gov.noaa.nws.ncep.common.dataplugin.aww.AwwFips; import gov.noaa.nws.ncep.common.dataplugin.aww.AwwRecord; import gov.noaa.nws.ncep.common.dataplugin.aww.AwwUgc; @@ -62,17 +21,56 @@ import gov.noaa.nws.ncep.viz.rsc.aww.query.WstmQueryResult; import gov.noaa.nws.ncep.viz.ui.display.NCMapDescriptor; import gov.noaa.nws.ncep.viz.ui.display.NcDisplayMngr; +import java.awt.Color; +import java.awt.geom.Rectangle2D; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TimeZone; + +import org.eclipse.swt.graphics.RGB; +import org.opengis.referencing.crs.CoordinateReferenceSystem; + +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.TimeRange; +import com.raytheon.uf.edex.decodertools.core.LatLonPoint; +import com.raytheon.uf.viz.core.DrawableString; +import com.raytheon.uf.viz.core.IGraphicsTarget; +import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; +import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle; +import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle; +import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment; +import com.raytheon.uf.viz.core.catalog.DirectDbQuery; +import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage; +import com.raytheon.uf.viz.core.comm.Connector; +import com.raytheon.uf.viz.core.drawables.IFont; +import com.raytheon.uf.viz.core.drawables.IShadedShape; +import com.raytheon.uf.viz.core.drawables.IWireframeShape; +import com.raytheon.uf.viz.core.drawables.PaintProperties; +import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.geom.PixelCoordinate; +import com.raytheon.uf.viz.core.map.IMapDescriptor; +import com.raytheon.uf.viz.core.requests.ThriftClient; +import com.raytheon.uf.viz.core.rsc.LoadProperties; +import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.viz.core.rsc.jts.JTSCompiler; import com.raytheon.viz.core.rsc.jts.JTSCompiler.PointStyle; import com.raytheon.viz.ui.editor.AbstractEditor; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.Point; -import com.vividsolutions.jts.io.WKBReader; import com.vividsolutions.jts.io.ParseException; +import com.vividsolutions.jts.io.WKBReader; /** @@ -89,7 +87,9 @@ import com.vividsolutions.jts.io.ParseException; * 05/23/2012 785 Q. Zhou Added getName for legend. * 17 Aug 2012 655 B. Hebbard Added paintProps as parameter to IDisplayable draw * 31-Jan-2013 976 Archana Updated paintFrame() to not render any null strings - * Replaced the depreciated target.drawString() method with target.drawStrings(). + * Replaced the depreciated target.drawString() method with target.drawStrings(). + * 12/14 ? B. Yin Remove ScriptCreator, use Thrift Client. + * * * * @author archana @@ -1206,24 +1206,18 @@ wqr.buildQueryPart(aSetOfAwwFips); wstmRscDataObject.aListOfFipsInfoObjects=crea HashMap queryList = new HashMap( resourceData.getMetadataMap()); - LayerProperty prop = new LayerProperty(); - prop.setDesiredProduct(ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters(queryList, false); - prop.setNumberOfImages(15000); // TODO: max # records ?? should we cap - // this ? - String script = null; - script = ScriptCreator.createScript(prop); + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(queryList); + + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); - if (script == null) - return; - - Object[] pdoList = Connector.getInstance().connect(script, null, 60000); - - for (Object pdo : pdoList) { - for( IRscDataObject dataObject : processRecord( pdo ) ) { - newRscDataObjsQueue.add(dataObject); - } - } + for (Map result : response.getResults()) { + for (Object pdo : result.values()) { + for( IRscDataObject dataObject : processRecord( pdo ) ) { + newRscDataObjsQueue.add(dataObject); + } + } + } wqr.populateFipsMap(); setAllFramesAsPopulated(); diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/wtch/WtchResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/wtch/WtchResource.java index 982f4e6414..34147e8c9a 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/wtch/WtchResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.aww/src/gov/noaa/nws/ncep/viz/rsc/aww/wtch/WtchResource.java @@ -19,6 +19,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.TimeZone; import java.util.logging.Level; @@ -26,6 +27,8 @@ import java.util.logging.Logger; import org.eclipse.swt.graphics.RGB; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.viz.core.IExtent; @@ -38,6 +41,7 @@ import com.raytheon.uf.viz.core.drawables.IFont; import com.raytheon.uf.viz.core.drawables.IWireframeShape; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.vividsolutions.jts.geom.Coordinate; @@ -56,6 +60,7 @@ import com.vividsolutions.jts.geom.Coordinate; * Fixed label colorCode not change problem. Fixed colorCode not change back problem. * 08/14/13 1028 G. Hull Move to aww project. Use AwwReportType enum. * 06/27/14 ??? D. Sushon fix endTime selection issue, investigating why watches never display + * 12/14 ? B. Yin Remove ScriptCreator, use Thrift Client. * * * @@ -742,25 +747,17 @@ public class WtchResource extends HashMap queryList = new HashMap( resourceData.getMetadataMap()); - com.raytheon.uf.viz.core.catalog.LayerProperty prop = new com.raytheon.uf.viz.core.catalog.LayerProperty(); - prop.setDesiredProduct(com.raytheon.uf.viz.core.rsc.ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters(queryList, false); - prop.setNumberOfImages(15000); - String script = null; - script = com.raytheon.uf.viz.core.catalog.ScriptCreator - .createScript(prop); + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(queryList); - if (script == null) { - return; // notify something?? - } + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); - Object[] pdoList = com.raytheon.uf.viz.core.comm.Connector - .getInstance().connect(script, null, 60000); - - for (Object pdo : pdoList) { - for (IRscDataObject dataObject : processRecord(pdo)) { - newRscDataObjsQueue.add(dataObject); + for (Map result : response.getResults()) { + for (Object pdo : result.values()) { + for (IRscDataObject dataObject : processRecord(pdo)) { + newRscDataObjsQueue.add(dataObject); + } } } diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.lightning/src/gov/noaa/nws/ncep/viz/rsc/lightning/rsc/LightningResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.lightning/src/gov/noaa/nws/ncep/viz/rsc/lightning/rsc/LightningResource.java index dd7fb62d8e..f993ea5ca2 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.lightning/src/gov/noaa/nws/ncep/viz/rsc/lightning/rsc/LightningResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.lightning/src/gov/noaa/nws/ncep/viz/rsc/lightning/rsc/LightningResource.java @@ -14,12 +14,15 @@ import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; +import java.util.Map; import com.raytheon.uf.common.dataplugin.HDF5Util; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; import com.raytheon.uf.common.dataplugin.binlightning.LightningConstants; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.Request; @@ -36,13 +39,12 @@ import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.PixelExtent; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; import com.raytheon.uf.viz.core.comm.Connector; import com.raytheon.uf.viz.core.drawables.IWireframeShape; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.ResourceProperties; import com.raytheon.uf.viz.core.rsc.ResourceType; @@ -66,7 +68,7 @@ import com.raytheon.uf.viz.core.rsc.ResourceType; * 12/19/2012 #960 Greg Hull override propertiesChanged() to update colorBar. * 05/07/2013 #993 Greg Hull change key for strikeMap from URI to the HDF5 group * Jun 05, 2014 3226 bclement reference datarecords by LightningConstants - * + * 12/19/2014 ? B. Yin Remove ScriptCreator, use Thrift Client. * * * @author ghull @@ -236,44 +238,28 @@ public class LightningResource extends AbstractNatlCntrsResource requestConstraints = new HashMap( ltngRscData.getMetadataMap() ); - if( queryTimes != null ) { - // This doesn't work because the dataTimes in the DB are time Ranges -// RequestConstraint timeConstraint = new RequestConstraint(); -// String[] constraintList = { -// new DataTime( queryTimes.getStart() ).toString(), -// new DataTime( queryTimes.getEnd() ).toString() }; -// timeConstraint.setBetweenValueList(constraintList); -// timeConstraint.setConstraintType(RequestConstraint.ConstraintType.BETWEEN); -// requestConstraints.put("dataTime", timeConstraint); + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(requestConstraints); + + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); + + ArrayList pdoArray = new ArrayList(); + + for (Map result : response.getResults()) { + for (Object pdo : result.values()) { + if( !(pdo instanceof PluginDataObject) ) { // ??? + continue; + } + + DataTime pdoDataTime = ((PluginDataObject)pdo).getDataTime(); + + if( queryTimes == null || + queryTimes.contains( pdoDataTime.getValidPeriod().getStart() ) || + queryTimes.contains( pdoDataTime.getValidPeriod().getEnd() ) ) { + pdoArray.add( pdo ); + } + } } - - LayerProperty prop = new LayerProperty(); - prop.setDesiredProduct(ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters(requestConstraints, false); - prop.setNumberOfImages(15000); // TODO: max # records ?? should we cap this - - String script = null; - script = ScriptCreator.createScript(prop); - - if (script == null) - return; - - Object[] pdoList = Connector.getInstance().connect(script, null, 90000); - ArrayList pdoArray = new ArrayList(); - - for( Object pdo : pdoList ) { - if( !(pdo instanceof PluginDataObject) ) { // ??? - continue; - } - - DataTime pdoDataTime = ((PluginDataObject)pdo).getDataTime(); - - if( queryTimes == null || - queryTimes.contains( pdoDataTime.getValidPeriod().getStart() ) || - queryTimes.contains( pdoDataTime.getValidPeriod().getEnd() ) ) { - pdoArray.add( pdo ); - } - } List strikeList = getStrikeDataFromHDF( pdoArray.toArray() ); diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/dgdriv/TestDgdriv.java b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/dgdriv/TestDgdriv.java index f5cdbc57fc..73633cc912 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/dgdriv/TestDgdriv.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/dgdriv/TestDgdriv.java @@ -15,7 +15,9 @@ import java.util.HashMap; import java.util.Map; import com.raytheon.uf.common.dataplugin.grid.GridRecord; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.Request; @@ -27,10 +29,9 @@ import com.raytheon.uf.common.gridcoverage.LatLonGridCoverage; import com.raytheon.uf.common.gridcoverage.MercatorGridCoverage; import com.raytheon.uf.common.gridcoverage.PolarStereoGridCoverage; import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; import com.raytheon.uf.viz.core.comm.Connector; import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.rsc.ResourceType; import com.sun.jna.Native; import com.sun.jna.ptr.FloatByReference; @@ -79,6 +80,8 @@ import com.sun.jna.ptr.IntByReference; * made changes for ensemble functionality. * 10/2011 168 mgamazaychikov added methods to removed dependency on datatype.tbl * 10/2011 X. Guo Added grib inventory + * 12/14 ? B. Yin Remove ScriptCreator, use Thrift Client. + * * * * @author tlee @@ -1313,26 +1316,15 @@ public class TestDgdriv { String fcstTime = Integer .toString(((Integer.parseInt(fcstTimeg)) * 3600)); - if (queryList == null) - return null; - queryList.put("dataTime.refTime", new RequestConstraint(refTime)); queryList.put("dataTime.fcstTime", new RequestConstraint(fcstTime)); - LayerProperty prop = new LayerProperty(); - prop.setDesiredProduct(ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters(queryList, false); - prop.setNumberOfImages(1); + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(queryList); + + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); - String script = null; - script = ScriptCreator.createScript(prop); - - if (script == null) - return null; - - Object[] pdoList = Connector.getInstance().connect(script, null, 60000); - - GridRecord rec = (GridRecord) pdoList[0]; + GridRecord rec = (GridRecord) ((Map)response.getResults().get(0)).values().iterator().next(); long t1 = System.currentTimeMillis(); System.out.println("\tgetDataURI took: " + (t1 - t0)); // logger.info("getDataURI took: " + (t1-t0)); diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/src/gov/noaa/nws/ncep/viz/rsc/ncradar/rsc/AbstractRadarResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/src/gov/noaa/nws/ncep/viz/rsc/ncradar/rsc/AbstractRadarResource.java index 6d805395c3..0705169fa5 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/src/gov/noaa/nws/ncep/viz/rsc/ncradar/rsc/AbstractRadarResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/src/gov/noaa/nws/ncep/viz/rsc/ncradar/rsc/AbstractRadarResource.java @@ -15,6 +15,7 @@ import java.io.File; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.Map; import javax.measure.Measure; import javax.measure.quantity.Length; @@ -23,17 +24,18 @@ import javax.measure.unit.NonSI; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.dataplugin.radar.util.RadarInfoDict; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.localization.PathManagerFactory; 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.DataTime; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; import com.raytheon.uf.viz.core.comm.Connector; import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.ResourceType; @@ -65,6 +67,7 @@ import com.vividsolutions.jts.geom.Coordinate; * 06/10/2013 #999 G. Hull rm IDataScaleResource * 06/16/2014 #2061 bsteffen update IRangeableResource * 06/18/2014 TTR1026 J. Wu (/bh) Fixed potential exceptions for loading local radar data. + * 12/14 ? B. Yin Remove ScriptCreator, use Thrift Client. * * * @@ -157,22 +160,16 @@ public abstract class AbstractRadarResource extends queryList.put("dataTime.refTime", reqConstr); - LayerProperty prop = new LayerProperty(); - prop.setDesiredProduct(ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters(queryList, false); - prop.setNumberOfImages(15000); // TODO: max # records ?? should we cap - // this ? - String script = null; - script = ScriptCreator.createScript(prop); + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(queryList); - if (script == null) - return; + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); - Object[] pdoList = Connector.getInstance().connect(script, null, 60000); - - for (Object pdo : pdoList) { - for (IRscDataObject dataObject : processRecord(pdo)) { - newRscDataObjsQueue.add(dataObject); + for (Map result : response.getResults()) { + for (Object pdo : result.values()) { + for (IRscDataObject dataObject : processRecord(pdo)) { + newRscDataObjsQueue.add(dataObject); + } } } // preProcess diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.ntrans/src/gov/noaa/nws/ncep/viz/rsc/ntrans/rsc/NtransResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.ntrans/src/gov/noaa/nws/ncep/viz/rsc/ntrans/rsc/NtransResource.java index 6e756ccd29..d85a59c93a 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.ntrans/src/gov/noaa/nws/ncep/viz/rsc/ntrans/rsc/NtransResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.ntrans/src/gov/noaa/nws/ncep/viz/rsc/ntrans/rsc/NtransResource.java @@ -16,12 +16,15 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.HashMap; +import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.raytheon.uf.common.dataplugin.HDF5Util; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.Request; @@ -29,13 +32,10 @@ import com.raytheon.uf.common.datastorage.StorageException; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.IGraphicsTarget; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; -import com.raytheon.uf.viz.core.comm.Connector; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.uf.viz.core.rsc.ResourceType; /** * NtransResource - Resource for Display of NTRANS Metafiles. @@ -57,7 +57,7 @@ import com.raytheon.uf.viz.core.rsc.ResourceType; * (1) user sees "Initializing..." and (2) GUI doesn't lock up * 29 Aug 2014 B. Hebbard Remove time string and "/" separator from legend * 12 Sep 2014 B. Hebbard Refactor to avoid regenerating paintables from CGM on each paint. - * + * 19 Dec 2014 ? B. Yin Remove ScriptCreator, use Thrift Client. * * * @author bhebbard @@ -307,28 +307,21 @@ public class NtransResource extends RequestConstraint timeConstraint = new RequestConstraint(cycleTimeStr); reqConstraintsMap.put("dataTime.refTime", timeConstraint); - LayerProperty prop = new LayerProperty(); - prop.setDesiredProduct(ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters(reqConstraintsMap, false); - prop.setNumberOfImages(15000); // TODO: max # records ?? - // Should we cap this ? - String script = null; - script = ScriptCreator.createScript(prop); - - if (script == null) { - return; - } - + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(reqConstraintsMap); + long t0 = System.currentTimeMillis(); - Object[] pdoList = Connector.getInstance().connect(script, null, 60000); + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); long t1 = System.currentTimeMillis(); logger.info("Metadata records for " + this.newRscDataObjsQueue.size() + " images retrieved from DB in " + (t1 - t0) + " ms"); - for (Object pdo : pdoList) { - for (IRscDataObject dataObject : processRecord(pdo)) { - newRscDataObjsQueue.add(dataObject); + for (Map result : response.getResults()) { + for (Object pdo : result.values()) { + for (IRscDataObject dataObject : processRecord(pdo)) { + newRscDataObjsQueue.add(dataObject); + } } } diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/src/gov/noaa/nws/ncep/viz/rsc/satellite/area/GiniAreaProviderFactory.java b/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/src/gov/noaa/nws/ncep/viz/rsc/satellite/area/GiniAreaProviderFactory.java index 325edafc06..bf1ad053ae 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/src/gov/noaa/nws/ncep/viz/rsc/satellite/area/GiniAreaProviderFactory.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/src/gov/noaa/nws/ncep/viz/rsc/satellite/area/GiniAreaProviderFactory.java @@ -17,9 +17,6 @@ import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord; import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; -import com.raytheon.uf.common.geospatial.MapUtil; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; import com.raytheon.uf.viz.core.comm.Connector; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; @@ -56,14 +53,12 @@ public class GiniAreaProviderFactory implements INcAreaProviderFactory { reqConstraints.put( "creatingEntity", new RequestConstraint( satAndArea[0]) ); reqConstraints.put( "sectorID", new RequestConstraint( satAndArea[1]) ); - LayerProperty prop = new LayerProperty(); - prop.setDesiredProduct(ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters( reqConstraints, false); - prop.setNumberOfImages(1); // just need 1 record to get the coverage - - String script = ScriptCreator.createScript(prop); + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(reqConstraints); + + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); - Object[] satRecList = Connector.getInstance().connect( script, null, 10000 ); + Object[] satRecList = ((Map)response.getResults().get(0)).values().toArray(); // NOTE: It would be nice to query the mcidas_area_names and/or mcidas_spatial // directly so that we don't have to depend on data being in the db, but diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/src/gov/noaa/nws/ncep/viz/rsc/satellite/area/McIdasAreaProviderFactory.java b/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/src/gov/noaa/nws/ncep/viz/rsc/satellite/area/McIdasAreaProviderFactory.java index a1e7c55f14..9db9d1aebd 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/src/gov/noaa/nws/ncep/viz/rsc/satellite/area/McIdasAreaProviderFactory.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/src/gov/noaa/nws/ncep/viz/rsc/satellite/area/McIdasAreaProviderFactory.java @@ -1,45 +1,31 @@ package gov.noaa.nws.ncep.viz.rsc.satellite.area; +import gov.noaa.nws.ncep.common.dataplugin.mcidas.McidasMapCoverage; +import gov.noaa.nws.ncep.common.dataplugin.mcidas.McidasRecord; +import gov.noaa.nws.ncep.viz.common.area.AreaName; +import gov.noaa.nws.ncep.viz.common.area.AreaName.AreaSource; +import gov.noaa.nws.ncep.viz.common.area.IGridGeometryProvider; +import gov.noaa.nws.ncep.viz.common.area.INcAreaProviderFactory; + import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; import org.geotools.coverage.grid.GeneralGridEnvelope; import org.geotools.coverage.grid.GeneralGridGeometry; import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.geometry.GeneralEnvelope; -import org.geotools.referencing.CRS; -import org.geotools.referencing.operation.transform.ConcatenatedTransform; -import org.opengis.referencing.operation.MathTransform; -import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord; import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; -import com.raytheon.uf.common.geospatial.BoundaryTool; -import com.raytheon.uf.common.geospatial.ISpatialObject; import com.raytheon.uf.common.geospatial.MapUtil; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; import com.raytheon.uf.viz.core.comm.Connector; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; -import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.ResourceType; -import com.vividsolutions.jts.geom.Polygon; - -import gov.noaa.nws.ncep.common.dataplugin.mcidas.McidasMapCoverage; -import gov.noaa.nws.ncep.common.dataplugin.mcidas.McidasRecord; -import gov.noaa.nws.ncep.viz.common.area.AreaName.AreaSource; -import gov.noaa.nws.ncep.viz.common.area.AreaName; -import gov.noaa.nws.ncep.viz.common.area.IGridGeometryProvider; -import gov.noaa.nws.ncep.viz.common.area.INcAreaProviderFactory; -import gov.noaa.nws.ncep.viz.common.area.PredefinedAreaFactory; -import gov.noaa.nws.ncep.viz.common.display.NcDisplayType; public class McIdasAreaProviderFactory implements INcAreaProviderFactory { @@ -72,14 +58,12 @@ public class McIdasAreaProviderFactory implements INcAreaProviderFactory { reqConstraints.put( "satelliteName", new RequestConstraint( satAndArea[0]) ); reqConstraints.put( "areaName", new RequestConstraint( satAndArea[1]) ); - LayerProperty prop = new LayerProperty(); - prop.setDesiredProduct(ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters( reqConstraints, false); - prop.setNumberOfImages(1); // just need 1 record to get the coverage - - String script = ScriptCreator.createScript(prop); - - Object[] satRecList = Connector.getInstance().connect( script, null, 10000 ); + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(reqConstraints); + + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); + + Object[] satRecList = ((Map)response.getResults().get(0)).values().toArray(); // NOTE: It would be nice to query the mcidas_area_names and/or mcidas_spatial // directly so that we don't have to depend on data being in the db, but diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.stormtrack/src/gov/noaa/nws/ncep/viz/rsc/stormtrack/rsc/StormTrackResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.stormtrack/src/gov/noaa/nws/ncep/viz/rsc/stormtrack/rsc/StormTrackResource.java index 88e39c30ae..bfa6c98a49 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.stormtrack/src/gov/noaa/nws/ncep/viz/rsc/stormtrack/rsc/StormTrackResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.stormtrack/src/gov/noaa/nws/ncep/viz/rsc/stormtrack/rsc/StormTrackResource.java @@ -7,37 +7,10 @@ */ package gov.noaa.nws.ncep.viz.rsc.stormtrack.rsc; -import java.awt.geom.Rectangle2D; -import java.text.SimpleDateFormat; - -import java.util.HashMap; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.EnumMap; -import java.util.List; -import java.util.Map; -import java.util.TimeZone; -import java.util.TreeSet; - -import javax.measure.unit.NonSI; - import gov.noaa.nws.ncep.common.dataplugin.stormtrack.StormTrackRecord; -import gov.noaa.nws.ncep.gempak.parameters.colorbar.ColorBarAnchorLocation; -import gov.noaa.nws.ncep.gempak.parameters.colorbar.ColorBarOrientation; -import gov.noaa.nws.ncep.viz.common.ui.NmapCommon; -import gov.noaa.nws.ncep.viz.resources.AbstractNatlCntrsResource; - -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; -import com.raytheon.uf.common.time.DataTime; - import gov.noaa.nws.ncep.viz.resources.AbstractNatlCntrsRequestableResourceData.TimeMatchMethod; +import gov.noaa.nws.ncep.viz.resources.AbstractNatlCntrsResource; import gov.noaa.nws.ncep.viz.resources.INatlCntrsResource; -import gov.noaa.nws.ncep.viz.resources.AbstractNatlCntrsResource.IRscDataObject; import gov.noaa.nws.ncep.viz.resources.colorBar.ColorBarResource; import gov.noaa.nws.ncep.viz.resources.colorBar.ColorBarResourceData; import gov.noaa.nws.ncep.viz.resources.manager.ResourceName; @@ -45,14 +18,32 @@ import gov.noaa.nws.ncep.viz.rsc.stormtrack.rsc.StormTrackResourceData.ModelDisp import gov.noaa.nws.ncep.viz.ui.display.ColorBar; import gov.noaa.nws.ncep.viz.ui.display.NCMapDescriptor; +import java.awt.geom.Rectangle2D; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeSet; + +import javax.measure.unit.NonSI; + +import org.eclipse.swt.graphics.RGB; +import org.opengis.referencing.crs.CoordinateReferenceSystem; + +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; +import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; +import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.edex.decodertools.core.LatLonPoint; import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IGraphicsTarget; -import com.raytheon.uf.viz.core.PixelExtent; import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle; import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; +import com.raytheon.uf.viz.core.PixelExtent; import com.raytheon.uf.viz.core.comm.Connector; import com.raytheon.uf.viz.core.drawables.IFont; import com.raytheon.uf.viz.core.drawables.IWireframeShape; @@ -60,15 +51,10 @@ import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.geom.PixelCoordinate; -import com.raytheon.uf.viz.core.map.IMapDescriptor; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.ResourceProperties; import com.raytheon.uf.viz.core.rsc.ResourceType; -import com.raytheon.uf.edex.decodertools.core.LatLonPoint; - -import org.eclipse.swt.graphics.RGB; -import org.opengis.referencing.crs.CoordinateReferenceSystem; - import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.CoordinateList; @@ -95,6 +81,7 @@ import com.vividsolutions.jts.geom.CoordinateList; * 10/15/2012 858 Greg Hull add options to display forecastHour, modelName, windSpeed and cycloneId * 10/20/2012 858 Greg Hull change query to handle the ENS_CYC_FCST version of this resource * 12/19/2012 #960 Greg Hull override propertiesChanged() to update colorBar. + * 12/19/2014 ? B. Yin Remove ScriptCreator, use Thrift Client. * * @author sgilbert * @@ -273,20 +260,13 @@ implements INatlCntrsResource{ reqConstr = new RequestConstraint( modelNamesString.toString(), ConstraintType.IN ); metadataMap.put( "model", reqConstr ); - - LayerProperty prop = new LayerProperty(); - prop.setDesiredProduct( ResourceType.PLAN_VIEW); - - prop.setEntryQueryParameters( metadataMap, false ); - prop.setNumberOfImages(100000); // TODO: max # records ?? should we cap - // this ? - String script = null; - script = ScriptCreator.createScript(prop); - - if (script == null) - return; - - Object[] pdoList = Connector.getInstance().connect(script, null, 120000); + + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(metadataMap); + + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); + + Object[] pdoList = ((Map)response.getResults().get(0)).values().toArray(); // This could really be considered an error. If the limit is reached then this probably // took too long and the calling resource should be making its own query for data. diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.timeseries/src/gov/noaa/nws/ncep/viz/rsc/timeseries/rsc/GeoMagResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.timeseries/src/gov/noaa/nws/ncep/viz/rsc/timeseries/rsc/GeoMagResource.java index 3b053cd84f..73cd4a3514 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.timeseries/src/gov/noaa/nws/ncep/viz/rsc/timeseries/rsc/GeoMagResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.timeseries/src/gov/noaa/nws/ncep/viz/rsc/timeseries/rsc/GeoMagResource.java @@ -47,6 +47,7 @@ import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.TimeZone; import java.util.TreeSet; @@ -61,7 +62,9 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; @@ -74,11 +77,10 @@ import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.PixelCoverage; import com.raytheon.uf.viz.core.PixelExtent; import com.raytheon.uf.viz.core.RGBColors; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; import com.raytheon.uf.viz.core.comm.Connector; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.IInputHandler; import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority; @@ -117,6 +119,7 @@ import com.vividsolutions.jts.geom.Coordinate; * 07/03/2014 R4079 qzhou Added k-index view. * 07/10/2014 R4079 qzhou Added SamplingView and Sampling related classes. * 07/28/2014 R4078 sgurung Added code changes to support loading GeoMagResource in a new window. + * 12/19/2014 ? B. Yin Remove ScriptCreator, use Thrift Client. * * * @author qzhou @@ -446,26 +449,21 @@ public class GeoMagResource extends queryList.put("dataTime.refTime", reqConstr); - LayerProperty prop = new LayerProperty(); - prop.setDesiredProduct(ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters(queryList, false); - prop.setNumberOfImages(100000); - - String script = null; - script = ScriptCreator.createScript(prop); - - if (script == null) - return; + DbQueryRequest request = new DbQueryRequest(); + request.setConstraints(queryList); + + DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); magRecords = new ArrayList(); - Object[] pdoList = Connector.getInstance().connect(script, null, 60000); - for (Object pdo : pdoList) { - for (IRscDataObject dataObject : processRecord(pdo)) { - newRscDataObjsQueue.add(dataObject); - magRecords - .add((GeoMagRecord) ((DfltRecordRscDataObj) dataObject) - .getPDO()); + for (Map result : response.getResults()) { + for (Object pdo : result.values()) { + for (IRscDataObject dataObject : processRecord(pdo)) { + newRscDataObjsQueue.add(dataObject); + magRecords + .add((GeoMagRecord) ((DfltRecordRscDataObj) dataObject) + .getPDO()); + } } }