13.3.1-12 baseline

Former-commit-id: 1f109861760e5fbc9d7a13cc4f518341cbc31276
This commit is contained in:
Steve Harris 2013-03-25 13:27:13 -05:00
parent 373d13df39
commit aaac0b51e5
1086 changed files with 56383 additions and 29194 deletions

View file

@ -304,6 +304,10 @@
<param name="feature" <param name="feature"
value="com.raytheon.uf.viz.gisdatastore.feature" /> value="com.raytheon.uf.viz.gisdatastore.feature" />
</antcall> </antcall>
<antcall target="p2.build.repo">
<param name="feature"
value="com.raytheon.viz.dataaccess.feature" />
</antcall>
<antcall target="cleanup.features" /> <antcall target="cleanup.features" />
</target> </target>

View file

@ -60,9 +60,6 @@
# Status: TEST # Status: TEST
# Title: AvnFPS: tpo indicator not monitoring properly # Title: AvnFPS: tpo indicator not monitoring properly
# #
# Date Ticket# Engineer Description
# ------------- ---------- ----------- --------------------------
# Feb. 21, 2013 15834 zhao Modified for CCFP 8hr data
# #
import logging, time import logging, time
import Avn, AvnLib, Globals, MonitorP import Avn, AvnLib, Globals, MonitorP
@ -71,10 +68,10 @@ import CCFPData
_Logger = logging.getLogger(__name__) _Logger = logging.getLogger(__name__)
_Code = { \ _Code = { \
'tops': {1: '400+ ', 2: '350-390', 3: '300-340', 4: '250-290'}, \ 'tops': {1: '370+ ', 2: '310-370', 3: '250-310'}, \
'gwth': {1: '+ ', 2: 'NC', 3: '- '}, \ 'gwth': {1: '++', 2: '+ ', 3: 'NC', 4: '- '}, \
'conf': {1: 'HIGH', 3: 'LOW'}, \ 'conf': {1: 'HIGH', 3: 'LOW'}, \
'cvrg': {1: '75-100%', 2: ' 40-74%', 3: ' 25-39%'}, \ 'cvrg': {1: '75-100%', 2: ' 50-74%', 3: ' 25-49%'}, \
} }
############################################################################## ##############################################################################
@ -85,7 +82,7 @@ class Monitor(MonitorP.Monitor):
def __makeData(self, data): def __makeData(self, data):
# 6 hour forecast # 6 hour forecast
tstart = (time.time()//3600.0 + 1) * 3600.0 tstart = (time.time()//3600.0 + 1) * 3600.0
tend = tstart + 9*3600.0 - 10.0 tend = tstart + 7*3600.0 - 10.0
seq = [{'time': t} for t in Avn.frange(tstart, tend, 3600.0)] seq = [{'time': t} for t in Avn.frange(tstart, tend, 3600.0)]
fcst, text = {}, [] fcst, text = {}, []
try: try:

View file

@ -141,9 +141,19 @@
# Status: TEST # Status: TEST
# Title: AvnFPS: Lack of customization in QC check # Title: AvnFPS: Lack of customization in QC check
# #
#**
#*
#*
#* <pre>
#* SOFTWARE HISTORY
#* Date Ticket# Engineer Description
#* ------------ ---------- ----------- --------------------------
#* Initial creation.
#* Mar 07, 2013 1735 rferrel Changes to obtain grid data for a list of sites.
##
# #
import logging, os, time, ConfigParser import logging, os, time, ConfigParser
import Avn, AvnLib, AvnParser import Avn, AvnLib, AvnParser, JUtil, cPickle
import PointDataView, GfeValues import PointDataView, GfeValues
_Missing = '' _Missing = ''
@ -157,7 +167,7 @@ _Keys = ['Temp', 'DwptT', 'WDir', 'WSpd', 'WGust', 'Obvis', 'Vsby', \
'Ints2', 'Prob2', 'PTyp3', 'Ints3', 'Prob3'] 'Ints2', 'Prob2', 'PTyp3', 'Ints3', 'Prob3']
_NumHours = 36 _NumHours = 36
Parameters = ['Sky', 'T', 'Td', 'Wind', 'WindGust', 'PoP', 'Wx', 'WindGust'] Parameters = ['Sky', 'T', 'Td', 'Wind', 'WindGust', 'PoP', 'Wx']
Translate = { 'Sky':'Sky', 'Temp':'T', 'DwptT':'Td', 'WDir':'WindDir', 'WSpd':'WindSpd', 'WGust':'WindGust', Translate = { 'Sky':'Sky', 'Temp':'T', 'DwptT':'Td', 'WDir':'WindDir', 'WSpd':'WindSpd', 'WGust':'WindGust',
'PoP1h':'PoP', 'Obvis':'Wx', 'PoP':'PoP', 'Tstm':'Wx', 'Tint':'Wx', 'PTyp1':'Wx', 'Prob1':'Wx', 'Ints1':'Wx', 'PoP1h':'PoP', 'Obvis':'Wx', 'PoP':'PoP', 'Tstm':'Wx', 'Tint':'Wx', 'PTyp1':'Wx', 'Prob1':'Wx', 'Ints1':'Wx',
@ -294,7 +304,6 @@ def _cvt(itime, d):
def _getData(pdc, firstTime): def _getData(pdc, firstTime):
organizedData = {} organizedData = {}
data = [] data = []
pdc = None
if pdc is not None : if pdc is not None :
for i in range(pdc.getCurrentSz()): for i in range(pdc.getCurrentSz()):
jpdv = pdc.readRandom(i) jpdv = pdc.readRandom(i)
@ -446,6 +455,9 @@ def _readPrbConf():
def makeData(siteID, timeSeconds): def makeData(siteID, timeSeconds):
data = retrieveData(siteID, timeSeconds) data = retrieveData(siteID, timeSeconds)
return formatData(siteID, timeSeconds, data)
def formatData(siteID, timeSeconds, data):
if data is None or data['issuetime'] < time.time() - 86400: if data is None or data['issuetime'] < time.time() - 86400:
msg = 'Grid data is not available' msg = 'Grid data is not available'
_Logger.info(msg) _Logger.info(msg)
@ -492,34 +504,51 @@ def makeTable(siteID, timeSeconds):
msg = 'Grid data for %s is not available', siteID msg = 'Grid data for %s is not available', siteID
raise Avn.AvnError(msg) raise Avn.AvnError(msg)
def retrieveData(siteID, timeSeconds, parameters=Parameters):
results = _retrieveMapData([siteID], timeSeconds, parameters)
return results[siteID]
def retrieveData(siteID, timeSeconds): def retrieveMapData(siteIDs, timeSeconds, parameters=Parameters):
r = _retrieveMapData(siteIDs, timeSeconds, parameters=Parameters)
results = {}
for siteID in siteIDs:
results[siteID] = cPickle.dumps(r[siteID])
return JUtil.pyDictToJavaMap(results)
def _retrieveMapData(siteIDs, timeSeconds, parameters=Parameters):
import JUtil
from com.raytheon.uf.common.dataplugin.gfe.request import GetPointDataRequest from com.raytheon.uf.common.dataplugin.gfe.request import GetPointDataRequest
from com.vividsolutions.jts.geom import Coordinate from com.vividsolutions.jts.geom import Coordinate
from com.raytheon.viz.aviation.guidance import GuidanceUtil from com.raytheon.viz.aviation.guidance import GuidanceUtil
from com.raytheon.uf.viz.core.localization import LocalizationManager from com.raytheon.uf.viz.core.localization import LocalizationManager
gfeSiteId = LocalizationManager.getInstance().getCurrentSite()
task = GetPointDataRequest()
task.setSiteID(gfeSiteId);
db = gfeSiteId + '_GRID__Official_00000000_0000'
task.setDatabaseID(db)
for siteID in siteIDs:
config = AvnParser.getTafSiteCfg(siteID) config = AvnParser.getTafSiteCfg(siteID)
lat = config['geography']['lat'] lat = config['geography']['lat']
lon = config['geography']['lon'] lon = config['geography']['lon']
gfeSiteId = LocalizationManager.getInstance().getCurrentSite()
task = GetPointDataRequest()
task.setSiteID(gfeSiteId);
c = Coordinate(float(lon), float(lat)) c = Coordinate(float(lon), float(lat))
task.setCoordinate(c) task.addCoordinate(c)
task.setNumberHours(_NumHours) task.setNumberHours(_NumHours)
task.setStartTime(long(timeSeconds * 1000)) task.setStartTime(long(timeSeconds * 1000))
for p in Parameters: for p in parameters:
task.addParameter(p) task.addParameter(p)
db = gfeSiteId + '_GRID__Official_00000000_0000' pdcs = GuidanceUtil.getGFEPointsData(task)
task.setDatabaseID(db) i = 0
pdc = GuidanceUtil.getGFEPointData(task) results = {}
for siteID in siteIDs:
pdc = pdcs.getContainer(i)
if i < pdcs.getSize() :
++i
data = _getData(pdc, timeSeconds * 1000) data = _getData(pdc, timeSeconds * 1000)
if data is None : if data is None:
_Logger.info('Data not available for %s', siteID) _Logger.info('Data not available for %s', siteID)
return data results[siteID] = data
return results
############################################################################### ###############################################################################
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -125,10 +125,20 @@
# IFPS grids monitoring module # IFPS grids monitoring module
# Author: George Trojan, SAIC/MDL, August 2003 # Author: George Trojan, SAIC/MDL, August 2003
# last update: 04/20/06 # last update: 04/20/06
#**
#*
#*
#* <pre>
#* SOFTWARE HISTORY
#* Date Ticket# Engineer Description
#* ------------ ---------- ----------- --------------------------
#* Initial creation.
#* Mar 07, 2013 1735 rferrel Use SiteGridManger to limit calls to server.
##
import logging, time import logging, time, cPickle
import Avn, AvnLib, Globals, GridData, MonitorP, TafDecoder, TafGen import Avn, AvnLib, Globals, GridData, MonitorP, TafDecoder, TafGen, JUtil
from com.raytheon.viz.aviation.monitor import SiteGridManager
_Logger = logging.getLogger(Avn.CATEGORY) _Logger = logging.getLogger(Avn.CATEGORY)
############################################################################## ##############################################################################
@ -142,7 +152,21 @@ class Monitor(MonitorP.Monitor):
def __makeData(self, t): def __makeData(self, t):
try: try:
data = GridData.makeData(self.info['ident'], t) siteID = self.info['ident']
timeSeconds = long(t)
if SiteGridManager.needData(timeSeconds) :
siteIDs = JUtil.javaStringListToPylist(SiteGridManager.getSiteIDs())
containersMap = GridData.retrieveMapData(siteIDs, timeSeconds)
SiteGridManager.setContainersMap(containersMap)
return None
o = SiteGridManager.getData(siteID, timeSeconds)
if o is None :
return None
ndata = cPickle.loads(o)
data = GridData.formatData(siteID, timeSeconds, ndata)
bbb = 'RRA' bbb = 'RRA'
tc=TafGen.TafGen('grid',data,bbb) tc=TafGen.TafGen('grid',data,bbb)
taf=tc.createTaf(False) taf=tc.createTaf(False)

View file

@ -35,6 +35,7 @@ _Logger = logging.getLogger(Avn.CATEGORY)
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 07/22/09 njensen Initial Creation. # 07/22/09 njensen Initial Creation.
# 02/13/2013 1549 rferrel Change to properly display grid data.
# #
# #
# #
@ -307,6 +308,7 @@ def tafgen(siteObjs, model, format='short', routine = False, highlightFlightCat=
return tafWithHeader return tafWithHeader
def __makeHeader(model, data): def __makeHeader(model, data):
#print '__makeHeader data: ', data
if data and data['itime'] and data['itime']['value']: if data and data['itime'] and data['itime']['value']:
date = time.strftime('%m/%d/%y %H%M UTC', time.gmtime(data['itime']['value'])) date = time.strftime('%m/%d/%y %H%M UTC', time.gmtime(data['itime']['value']))
else: else:
@ -460,12 +462,12 @@ def gridgenRetrieve(siteID):
d = (requestTime, data) d = (requestTime, data)
o['data'] = d o['data'] = d
obj = pickle.dumps(o) obj = pickle.dumps(o)
# print 'return gridgenRetrieve - siteID, data', siteID, d #print 'return gridgenRetrieve - siteID, data', siteID, d
return obj return obj
def gridgen(siteObjs, format='short', routine=False, highlightFlightCat=True): def gridgen(siteObjs, format='short', routine=False, highlightFlightCat=True):
siteObjs = JUtil.javaStringListToPylist(siteObjs) siteObjs = JUtil.javaStringListToPylist(siteObjs)
# print 'GuidanceEntry:gridgen format, highlightFlightCat:', format, highlightFlightCat #print 'GuidanceEntry:gridgen format, highlightFlightCat:', format, highlightFlightCat
currentTime = time.gmtime() currentTime = time.gmtime()
requestTime = time.mktime((currentTime[0], currentTime[1], currentTime[2], currentTime[3], requestTime = time.mktime((currentTime[0], currentTime[1], currentTime[2], currentTime[3],
0, 0, currentTime[6], currentTime[7], currentTime[8])) - time.timezone 0, 0, currentTime[6], currentTime[7], currentTime[8])) - time.timezone
@ -496,9 +498,12 @@ def gridgen(siteObjs, format='short', routine=False, highlightFlightCat=True):
o = pickle.loads(siteObj) o = pickle.loads(siteObj)
siteID = o['siteID'] siteID = o['siteID']
cacheRequestTime, data = o['data'] cacheRequestTime, data = o['data']
if data is not None :
data = data.values()[0]
if not firstSiteID: if not firstSiteID:
firstSiteID = siteID firstSiteID = siteID
# print 'gridgen siteID, cacheRequestTime, data: ', cacheRequestTime, data #print 'gridgen siteID, cacheRequestTime, data: ', siteID, cacheRequestTime, data
if cacheRequestTime != requestTime: if cacheRequestTime != requestTime:
cacheList.append('++Cache out of date :%s' % siteID) cacheList.append('++Cache out of date :%s' % siteID)
if data: if data:

View file

@ -167,30 +167,17 @@ class Procedure (SmartScript.SmartScript):
# any grids. We need to do this because the GFE caches the original # any grids. We need to do this because the GFE caches the original
# version of all grids and there's no way yet to turn this off. # version of all grids and there's no way yet to turn this off.
minTDict = {}
maxTDict = {}
tDict = {}
tdDict = {}
minTRList = self.getWEInventory("MinT") minTRList = self.getWEInventory("MinT")
for tr in minTRList: minTDict = self.getGrids(MODEL, "MinT", LEVEL, minTRList, mode = "First")
grid = self.getGrids(MODEL, "MinT", LEVEL, tr, mode = "First")
minTDict[tr] = grid
maxTRList = self.getWEInventory("MaxT") maxTRList = self.getWEInventory("MaxT")
for tr in maxTRList: maxTDict = self.getGrids(MODEL, "MaxT", LEVEL, maxTRList, mode = "First")
grid = self.getGrids(MODEL, "MaxT", LEVEL, tr, mode = "First")
maxTDict[tr] = grid
TTRList = self.getWEInventory("T") TTRList = self.getWEInventory("T")
for tr in TTRList: tDict = self.getGrids(MODEL, "T", LEVEL, TTRList, mode = "First")
grid = self.getGrids(MODEL, "T", LEVEL, tr, mode = "First")
tDict[tr] = grid
TdTRList = self.getWEInventory("Td") TdTRList = self.getWEInventory("Td")
for tr in TdTRList: tdDict = self.getGrids(MODEL, "Td", LEVEL, TdTRList, mode = "First")
grid = self.getGrids(MODEL, "Td", LEVEL, tr, mode = "First")
tdDict[tr] = grid
# get the all locks by other users, so we can detect they are locked # get the all locks by other users, so we can detect they are locked
# before attempting to modify them # before attempting to modify them

View file

@ -88,11 +88,17 @@ def executeFromJava(databaseID, site, username, dataMgr, forecastList, logFile,
site = str(site) site = str(site)
databaseID = str(databaseID) databaseID = str(databaseID)
username = str(username) username = str(username)
logger.info("TextFormatter Starting")
startTime = time.time()
logger.info("Text Formatter Starting")
forecasts = runFormatter(databaseID=databaseID, site=site, forecastList=forecastList, testMode=testMode, forecasts = runFormatter(databaseID=databaseID, site=site, forecastList=forecastList, testMode=testMode,
cmdLineVarDict=cmdLineVarDict, vtecMode=vtecMode, username=username, cmdLineVarDict=cmdLineVarDict, vtecMode=vtecMode, username=username,
dataMgr=dataMgr, drtTime=drtTime) dataMgr=dataMgr, drtTime=drtTime)
elapsedTime = (time.time() - startTime)*1000
logger.info("Text Formatter Finished, took: %d ms",elapsedTime)
RedirectLogging.restore() RedirectLogging.restore()
return forecasts return forecasts
@ -286,7 +292,6 @@ def runFormatter(databaseID, site, forecastList, cmdLineVarDict, vtecMode,
# This also means that you may not import any new modules after this # This also means that you may not import any new modules after this
# point!!!!!!!!!!!!!!! # point!!!!!!!!!!!!!!!
logger.info("Text Formatter Finished")
return forecasts return forecasts
def getAbsTime(timeStr): def getAbsTime(timeStr):

View file

@ -30,6 +30,8 @@
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 11/05/08 njensen Initial Creation. # 11/05/08 njensen Initial Creation.
# 01/17/13 1486 dgilling Re-factor based on
# RollbackMasterInterface.
# #
# #
# #
@ -37,15 +39,13 @@
import sys import sys
import Exceptions import Exceptions
import MasterInterface import RollbackMasterInterface
from com.raytheon.uf.common.localization import PathManagerFactory
class ProcedureInterface(MasterInterface.MasterInterface): class ProcedureInterface(RollbackMasterInterface.RollbackMasterInterface):
def __init__(self, scriptPath): def __init__(self, scriptPath):
MasterInterface.MasterInterface.__init__(self) super(ProcedureInterface, self).__init__(scriptPath)
self.importModules(scriptPath) self.importModules()
self.pathMgr = PathManagerFactory.getPathManager()
self.menuToProcMap = {} self.menuToProcMap = {}
for script in self.scripts: for script in self.scripts:
@ -72,26 +72,20 @@ class ProcedureInterface(MasterInterface.MasterInterface):
return scriptList return scriptList
def addModule(self, moduleName): def addModule(self, moduleName):
MasterInterface.MasterInterface.addModule(self, moduleName) super(ProcedureInterface, self).addModule(moduleName)
self.__mapMenuList(moduleName) self.__mapMenuList(moduleName)
def removeModule(self, moduleName): def removeModule(self, moduleName):
MasterInterface.MasterInterface.removeModule(self, moduleName) super(ProcedureInterface, self).removeModule(moduleName)
for key in self.menuToProcMap: for key in self.menuToProcMap:
procList = self.menuToProcMap.get(key) procList = self.menuToProcMap.get(key)
if moduleName in procList: if moduleName in procList:
procList.remove(moduleName) procList.remove(moduleName)
self.menuToProcMap[key] = procList self.menuToProcMap[key] = procList
if self.pathMgr.getStaticLocalizationFile("gfe/userPython/procedures/" + moduleName + ".py") is not None: # in-case we removed just an override, let's
self.addModule(moduleName) # check to see if another script with the same name exists
if sys.modules.has_key(moduleName):
self.__mapMenuList(moduleName)
def getStartupErrors(self):
from java.util import ArrayList
errorList = ArrayList()
for err in self.getImportErrors():
errorList.add(str(err))
return errorList
def getMethodArgNames(self, moduleName, className, methodName): def getMethodArgNames(self, moduleName, className, methodName):
from java.util import ArrayList from java.util import ArrayList
@ -133,10 +127,5 @@ class ProcedureInterface(MasterInterface.MasterInterface):
# wasn't in list # wasn't in list
pass pass
MasterInterface.MasterInterface.reloadModule(self, moduleName) super(ProcedureInterface, self).reloadModule(moduleName)
self.__mapMenuList(moduleName) self.__mapMenuList(moduleName)

View file

@ -23,17 +23,24 @@
# any purpose. # any purpose.
# #
# SmartScript -- library of methods for Smart Tools and Procedures # SmartScript -- library of methods for Smart Tools and Procedures
# History #
# Time Ticket# Developer Comments # Author: hansen
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------------
# 01/09/2012 DR15626 J. Zeng Add methods #
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 01/09/13 DR15626 J. Zeng Add methods
# enableISCsend # enableISCsend
# clientISCSendStatus # clientISCSendStatus
# manualSendISC_autoMode # manualSendISC_autoMode
# manualSendISC_manualMode # manualSendISC_manualMode
# 01/30/13 1559 dgilling Fix TypeError in
# getGridCellSwath().
# Mar 13, 2013 1791 bsteffen Implement bulk getGrids to
# improve performance.
# #
# Author: hansen
# ----------------------------------------------------------------------------
######################################################################## ########################################################################
import types, string, time, sys import types, string, time, sys
from math import * from math import *
@ -52,6 +59,7 @@ from java.util import Date
from java.nio import FloatBuffer from java.nio import FloatBuffer
from com.raytheon.uf.common.time import SimulatedTime from com.raytheon.uf.common.time import SimulatedTime
from com.raytheon.uf.common.time import TimeRange as javaTimeRange
from com.raytheon.uf.common.dataplugin.gfe.grid import Grid2DByte from com.raytheon.uf.common.dataplugin.gfe.grid import Grid2DByte
from com.raytheon.uf.common.dataplugin.gfe.grid import Grid2DFloat from com.raytheon.uf.common.dataplugin.gfe.grid import Grid2DFloat
from com.raytheon.uf.common.dataplugin.gfe.discrete import DiscreteKey from com.raytheon.uf.common.dataplugin.gfe.discrete import DiscreteKey
@ -350,7 +358,10 @@ class SmartScript(BaseTool.BaseTool):
# e.g. "SFC", "MB350", "BL030" # e.g. "SFC", "MB350", "BL030"
# x, y: integer coordinates # x, y: integer coordinates
# timeRange: Must be a special time range object such as # timeRange: Must be a special time range object such as
# that passed in the argument list as GridTimeRange # that passed in the argument list as GridTimeRange or a list of time
# range objects. If it is a list than the return value will be a dict
# where the time range objects are keys and the result of getGrids
# for each time range is the value.
# mode: specifies how to handle the situation if multiple grids # mode: specifies how to handle the situation if multiple grids
# are found within the given time range: # are found within the given time range:
# "TimeWtAverage": return time-weighted Average value # "TimeWtAverage": return time-weighted Average value
@ -394,9 +405,18 @@ class SmartScript(BaseTool.BaseTool):
if isinstance(model, DatabaseID.DatabaseID): if isinstance(model, DatabaseID.DatabaseID):
model = model.modelIdentifier() model = model.modelIdentifier()
timeRangeList = None
if isinstance(timeRange, TimeRange.TimeRange): if isinstance(timeRange, TimeRange.TimeRange):
timeRange = timeRange.toJavaObj() timeRange = timeRange.toJavaObj()
elif isinstance(timeRange, list):
timeRangeList = timeRange
timeRangeArray = jep.jarray(len(timeRangeList), javaTimeRange)
for i in xrange(len(timeRangeList)):
tr = timeRangeList[i]
if isinstance(tr, TimeRange.TimeRange):
tr = tr.toJavaObj()
timeRangeArray[i] = tr
timeRange = timeRangeArray
# if cache: # if cache:
# for cModel, cElement, cLevel, cMostRecent, cRange, cMode, cResult in \ # for cModel, cElement, cLevel, cMostRecent, cRange, cMode, cResult in \
# self.__pythonGrids: # self.__pythonGrids:
@ -415,6 +435,16 @@ class SmartScript(BaseTool.BaseTool):
else: else:
return None return None
result = self.__cycler.getCorrespondingResult(parm, timeRange, mode) result = self.__cycler.getCorrespondingResult(parm, timeRange, mode)
if timeRangeList is not None:
retVal = {}
for i in xrange(len(timeRangeList)):
iresult = self._getGridsResult(timeRangeList[i], noDataError, mode, result[i])
retVal[timeRangeList[i]] = iresult
return retVal
else:
return self._getGridsResult(timeRange, noDataError, mode, result)
def _getGridsResult(self, timeRange, noDataError, mode, result):
retVal = None retVal = None
if result is not None: if result is not None:
if len(result) == 0: if len(result) == 0:
@ -1210,7 +1240,6 @@ class SmartScript(BaseTool.BaseTool):
# color. If "on" is 0, turn off the highlight. # color. If "on" is 0, turn off the highlight.
parm = self.getParm(model, element, level) parm = self.getParm(model, element, level)
from com.raytheon.viz.gfe.core.msgs import HighlightMsg from com.raytheon.viz.gfe.core.msgs import HighlightMsg
from com.raytheon.uf.common.time import TimeRange as javaTimeRange
trs = jep.jarray(1, javaTimeRange) trs = jep.jarray(1, javaTimeRange)
trs[0] = timeRange.toJavaObj() trs[0] = timeRange.toJavaObj()
@ -1553,8 +1582,6 @@ class SmartScript(BaseTool.BaseTool):
return self.__dataMgr.getSpatialDisplayManager().getActivatedParm() return self.__dataMgr.getSpatialDisplayManager().getActivatedParm()
def getGridCellSwath(self, editArea, cells): def getGridCellSwath(self, editArea, cells):
from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceID
from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceData
from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceData_CoordinateType as CoordinateType from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceData_CoordinateType as CoordinateType
# Returns an AFPS.ReferenceData swath of the given # Returns an AFPS.ReferenceData swath of the given
# number of cells around the given an edit area. # number of cells around the given an edit area.
@ -1569,10 +1596,10 @@ class SmartScript(BaseTool.BaseTool):
grid2DBit = self.getGridLoc().gridCellSwath( grid2DBit = self.getGridLoc().gridCellSwath(
polygon.getCoordinates(), float(cells), False) polygon.getCoordinates(), float(cells), False)
if grid2DB is not None: if grid2DB is not None:
grid2DB = grid2DB | grid2DBit grid2DB = grid2DB.orEquals(grid2DBit)
else: else:
grid2DB = grid2DBit grid2DB = grid2DBit
return ReferenceData(self.getGridLoc(), ReferenceID("test"), grid2DB) return self.getGridLoc().convertToReferenceData(grid2DB)
def getLatLon(self, x, y): def getLatLon(self, x, y):
# Get the latitude/longitude values for the given grid point # Get the latitude/longitude values for the given grid point

View file

@ -30,6 +30,8 @@
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 10/21/08 njensen Initial Creation. # 10/21/08 njensen Initial Creation.
# 01/17/13 1486 dgilling Re-factor based on
# RollbackMasterInterface.
# #
# #
# #
@ -37,19 +39,17 @@
import sys import sys
import Exceptions import Exceptions
import MasterInterface import RollbackMasterInterface
from com.raytheon.uf.common.localization import PathManagerFactory
class SmartToolInterface(MasterInterface.MasterInterface): class SmartToolInterface(RollbackMasterInterface.RollbackMasterInterface):
def __init__(self, scriptPath): def __init__(self, scriptPath):
MasterInterface.MasterInterface.__init__(self) super(SmartToolInterface, self).__init__(scriptPath)
self.importModules(scriptPath) self.importModules()
self.parmToModuleMap = {'variableElement' : set()} self.parmToModuleMap = {'variableElement' : set()}
for script in self.scripts: for script in self.scripts:
self.__mapDisplayList(script) self.__mapDisplayList(script)
self.pathMgr = PathManagerFactory.getPathManager()
def __mapDisplayList(self, script): def __mapDisplayList(self, script):
if hasattr(sys.modules[script], "WeatherElementEdited"): if hasattr(sys.modules[script], "WeatherElementEdited"):
@ -137,20 +137,21 @@ class SmartToolInterface(MasterInterface.MasterInterface):
return argList return argList
def addModule(self, moduleName): def addModule(self, moduleName):
MasterInterface.MasterInterface.addModule(self, moduleName) super(SmartToolInterface, self).addModule(moduleName)
self.__mapDisplayList(moduleName) self.__mapDisplayList(moduleName)
def reloadModule(self, moduleName): def reloadModule(self, moduleName):
if sys.modules.has_key(moduleName):
self.__removeModuleFromMap(moduleName) self.__removeModuleFromMap(moduleName)
MasterInterface.MasterInterface.reloadModule(self, moduleName) super(SmartToolInterface, self).reloadModule(moduleName)
self.__mapDisplayList(moduleName) self.__mapDisplayList(moduleName)
def removeModule(self, moduleName): def removeModule(self, moduleName):
MasterInterface.MasterInterface.removeModule(self, moduleName) super(SmartToolInterface, self).removeModule(moduleName)
self.__removeModuleFromMap(moduleName) self.__removeModuleFromMap(moduleName)
if self.pathMgr.getStaticLocalizationFile("gfe/userPython/smartTools/" + moduleName + ".py") is not None: # in-case we removed just an override, let's
self.addModule(moduleName) # check to see if another script with the same name exists
if sys.modules.has_key(moduleName):
self.__mapDisplayList(moduleName)
def __removeModuleFromMap(self, moduleName): def __removeModuleFromMap(self, moduleName):
for parm in self.parmToModuleMap: for parm in self.parmToModuleMap:
@ -159,13 +160,6 @@ class SmartToolInterface(MasterInterface.MasterInterface):
toolList.remove(moduleName) toolList.remove(moduleName)
self.parmToModuleMap[parm] = toolList self.parmToModuleMap[parm] = toolList
def getStartupErrors(self):
from java.util import ArrayList
errorList = ArrayList()
for err in self.getImportErrors():
errorList.add(str(err))
return errorList
def runTool(self, moduleName, className, methodName, **kwargs): def runTool(self, moduleName, className, methodName, **kwargs):
try: try:
return self.runMethod(moduleName, className, methodName, **kwargs) return self.runMethod(moduleName, className, methodName, **kwargs)

View file

@ -25,9 +25,7 @@
menuText="Convective SIGMET" id="ConvSigmet"> menuText="Convective SIGMET" id="ConvSigmet">
<dataURI>/convsigmet/%</dataURI> <dataURI>/convsigmet/%</dataURI>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/BufrNcwf.xml" menuText="NCWF" id="NCWF">
<dataURI>/bufrncwf/%</dataURI>
</contribute>
<contribute xsi:type="separator" id="separator1"/> <contribute xsi:type="separator" id="separator1"/>
<contribute xsi:type="titleItem" titleText="------ Icing Products ------" /> <contribute xsi:type="titleItem" titleText="------ Icing Products ------" />

View file

@ -19,6 +19,9 @@ if [ ${RC} -ne 0 ]; then
exit 1 exit 1
fi fi
# Run monitorThreads?
runMonitorThreads=false
# copy the viz shutdown utility if necessary. # copy the viz shutdown utility if necessary.
copyVizShutdownUtilIfNecessary copyVizShutdownUtilIfNecessary
@ -118,6 +121,7 @@ export pid=$$
curTime=`date +%Y%m%d_%H%M%S` curTime=`date +%Y%m%d_%H%M%S`
LOGFILE=${LOGDIR}/cave_${curTime}_pid_${pid}_console.log LOGFILE=${LOGDIR}/cave_${curTime}_pid_${pid}_console.log
export LOGFILE_CAVE=${LOGDIR}/cave_${curTime}_pid_${pid}_alertviz.log export LOGFILE_CAVE=${LOGDIR}/cave_${curTime}_pid_${pid}_alertviz.log
export LOGFILE_PERFORMANCE=${LOGDIR}/cave_${curTime}_pid_${pid}_perf.log
redirect="TRUE" redirect="TRUE"
for flag in $@; do for flag in $@; do
@ -127,11 +131,9 @@ for flag in $@; do
fi fi
done done
if [ ${redirect} == "TRUE" ]; then # can we write to log directory
# can we write to log directory if [ -w ${LOGDIR} ]; then
if [ -w ${LOGDIR} ]; then
touch ${LOGFILE} touch ${LOGFILE}
fi
fi fi
# Special instructions for the 64-bit jvm. # Special instructions for the 64-bit jvm.
@ -141,9 +143,15 @@ if [ -f /awips2/java/jre/lib/amd64/server/libjvm.so ]; then
fi fi
lookupINI $@ lookupINI $@
if ( [ ${redirect} == "TRUE" ] || [ -w ${LOGFILE} ] ); then
exec ${dir}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} $@ > ${LOGFILE} 2>&1 if [[ "${runMonitorThreads}" == "true" ]] ; then
else # nohup to allow tar process to continue after user has logged out
${dir}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} $@ nohup ${dir}/monitorThreads.sh $pid >> /dev/null 2>&1 &
fi
if ( [ ${redirect} == "TRUE" ] ); then
exec ${dir}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} $@ > ${LOGFILE} 2>&1
else
exec ${dir}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} $@ 2>&1 | tee ${LOGFILE}
fi fi

View file

@ -0,0 +1,84 @@
#!/bin/sh
# runs a jstack every X seconds until killed
basePath="/data/fxa/cave"
hostName=`hostname -s`
hostPath="${basePath}/${hostName}"
pid="$1"
sleepTime="$2"
sleep 10 # put in to allow exec of cave jvm
# days worth of jstacks to keep
purge_retention="7"
function purgeJstacks()
{
find $basePath -type f -name "*pid*jstacks.tgz" -mtime +${purge_retention} -exec rm -f {} \; >> /dev/null 2>&1
}
for i in $( ps -p ${pid} -f | grep -v UID ) ; do
if [[ ! "${perspective}" ]] ; then
if [[ "$j" == "-perspective" || "$j" == "-component" ]] ; then
perspective=$i
fi
j=$i
fi
done
if [[ ! "${perspective}" ]] ; then perspective="cave" ; fi
if [ "$pid" == "" ]; then
echo "Usage: continualJstack.sh <PID> <SLEEP_INTERVAL>"
echo " SLEEP_INTERVAL defaults to 2 if not specified"
else
# purge old jstacks
purgeJstacks &
if [ "$sleepTime" == "" ]; then
sleepTime=2
fi
if [[ ! -d ${hostPath} ]] ; then mkdir -p ${hostPath} ; fi
cd ${hostPath}
t1=$( date +"%Y%m%d_%H%M" )
pidPath="${t1}_pid${pid}_${perspective}_jstacks"
mkdir -p ${pidPath}
cd ${pidPath}
prevDatePortion=""
while ps -p ${pid} > /dev/null ; do
t1=$( date +"%Y%m%d_%H%M" )
# strip off the last minute, allowing for tars to be created in 10 minute segments
newDatePortion="${t1%?}"
if [[ $newDatePortion != $prevDatePortion ]]; then
# verify this isn't the first one
if [[ "$prevDatePortion" != "" ]]; then
tar -czf jstack_${prevDatePortion}X_${pid}.log.tgz --remove-files jstack_${prevDatePortion}*${pid}.log &
fi
prevDatePortion="$newDatePortion"
fi
log="jstack_${t1}_${pid}.log"
jstack -l $pid >> $log
echo "" >> $log
echo "" >> $log
sleep $sleepTime
done
tar -czf jstack_${newDatePortion}X_${pid}.log.tgz --remove-files jstack_${newDatePortion}*${pid}.log
# ensure any background threads have finished taring also
wait
cd ..
tar -czf ${pidPath}.tgz --remove-files ${pidPath}/
chmod g+w ${pidPath}.tgz
rm -rf ${pidPath}
echo -e "$pid not detected ... exiting"
fi

View file

@ -761,8 +761,10 @@ public class CollaborationGroupView extends CaveFloatingView implements
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
if (usersTreeViewer.getControl().isDisposed() == false) {
usersTreeViewer.refresh(element); usersTreeViewer.refresh(element);
} }
}
}); });
} }

View file

@ -62,7 +62,6 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IViewSite; import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException; import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
@ -213,10 +212,7 @@ public class SessionView extends AbstractSessionView implements IPrintableView {
}); });
Menu menu = menuManager.createContextMenu(usersTable.getControl()); Menu menu = menuManager.createContextMenu(usersTable.getControl());
usersTable.getControl().setMenu(menu); usersTable.getControl().setMenu(menu);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() getSite().registerContextMenu(menuManager, usersTable);
.getActivePart().getSite()
.registerContextMenu(menuManager, usersTable);
usersTable.getTable().setMenu(menu);
} }
protected void fillContextMenu(IMenuManager manager) { protected void fillContextMenu(IMenuManager manager) {

View file

@ -56,13 +56,6 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.common.datastorage.hdf5"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="com.raytheon.uf.common.derivparam" id="com.raytheon.uf.common.derivparam"
download-size="0" download-size="0"
@ -319,4 +312,18 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.common.image"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.python.concurrent"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature> </feature>

View file

@ -83,7 +83,8 @@ public class CoopPrecipPlotInfoRetriever extends AbstractPlotInfoRetriever {
info.add(stationInfo); info.add(stationInfo);
} }
} }
listener.resourceChanged(ChangeType.DATA_UPDATE, info.toArray()); listener.resourceChanged(ChangeType.DATA_UPDATE,
info.toArray(new PlotInfo[0]));
} }

View file

@ -188,6 +188,13 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.common.dataplugin.maps"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="com.raytheon.uf.viz.core.maps" id="com.raytheon.uf.viz.core.maps"
download-size="0" download-size="0"
@ -238,4 +245,10 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.viz.event"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature> </feature>

View file

@ -18,6 +18,7 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.viz.productbrowser;bundle-version="1.12.1152", com.raytheon.uf.viz.productbrowser;bundle-version="1.12.1152",
com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0", com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0",
com.raytheon.uf.viz.ui.menus;bundle-version="1.12.1174", com.raytheon.uf.viz.ui.menus;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.maps;bundle-version="1.0.0",
com.raytheon.uf.viz.localization;bundle-version="1.12.1174" com.raytheon.uf.viz.localization;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy

View file

@ -20,9 +20,9 @@
package com.raytheon.uf.viz.core.maps.rsc; package com.raytheon.uf.viz.core.maps.rsc;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import com.raytheon.uf.common.dataplugin.maps.dataaccess.util.MapsQueryUtil;
import com.raytheon.uf.common.dataquery.db.QueryResult; import com.raytheon.uf.common.dataquery.db.QueryResult;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage; import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
@ -41,6 +41,7 @@ import com.vividsolutions.jts.geom.Envelope;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 9, 2011 bsteffen Initial creation * Dec 9, 2011 bsteffen Initial creation
* Sep 18, 2012 #1019 randerso cleaned up geometry type query * Sep 18, 2012 #1019 randerso cleaned up geometry type query
* Jan 30, 2013 #1551 bkowal Refactored
* *
* </pre> * </pre>
* *
@ -64,47 +65,12 @@ public class DefaultDbMapQuery implements DbMapQuery {
@Override @Override
public QueryResult queryWithinEnvelope(Envelope env, List<String> columns, public QueryResult queryWithinEnvelope(Envelope env, List<String> columns,
List<String> additionalConstraints) throws VizException { List<String> additionalConstraints) throws VizException {
// add the geospatial constraint
if (env != null) {
// copy before modifying
if (additionalConstraints == null) {
additionalConstraints = new ArrayList<String>();
} else {
additionalConstraints = new ArrayList<String>(
additionalConstraints);
}
// geospatial constraint will be first
additionalConstraints.add(0, String.format(
"%s && ST_SetSrid('BOX3D(%f %f, %f %f)'::box3d,4326)",
geomField, env.getMinX(), env.getMinY(), env.getMaxX(),
env.getMaxY()));
}
StringBuilder query = new StringBuilder("SELECT "); /*
if (columns != null && !columns.isEmpty()) { * Build the query using the common method.
Iterator<String> iter = columns.iterator(); */
query.append(iter.next()); final String query = MapsQueryUtil.assembleMapsTableQuery(env, columns,
while (iter.hasNext()) { additionalConstraints, this.table, this.geomField);
query.append(", ");
query.append(iter.next());
}
}
query.append(" FROM ");
query.append(table);
// add any additional constraints
if (additionalConstraints != null && !additionalConstraints.isEmpty()) {
query.append(" WHERE ");
Iterator<String> iter = additionalConstraints.iterator();
query.append(iter.next());
while (iter.hasNext()) {
query.append(" AND ");
query.append(iter.next());
}
}
query.append(';');
return DirectDbQuery.executeMappedQuery(query.toString(), MAPS, return DirectDbQuery.executeMappedQuery(query.toString(), MAPS,
QueryLanguage.SQL); QueryLanguage.SQL);

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="DEBUG" />
<param name="levelMax" value="INFO" />
</filter>
</appender>
<appender name="errConsole" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.err"/>
<param name="Threshold" value="WARN" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout>
</appender>
<logger name="CaveLogger">
<level value="ALL"/>
</logger>
<logger name="PerformanceLogger">
<level value="ALL"/>
</logger>
<logger name="com.raytheon">
<level value="INFO"/>
</logger>
<logger name="com.tc">
<level value="WARN"/>
</logger>
<logger name="mx4j">
<level value="ERROR"/>
</logger>
<logger name="org.apache">
<level value="INFO"/>
</logger>
<logger name="org.apache.activemq.spring">
<level value="WARN"/>
</logger>
<logger name="org.apache.commons.beanutils">
<level value="WARN"/>
</logger>
<logger name="org.apache.qpid">
<level value="WARN"/>
</logger>
<logger name="org.geotools">
<level value="WARN"/>
</logger>
<logger name="org.apache.xbean.spring">
<level value="WARN"/>
</logger>
<logger name="org.springframework">
<level value="ERROR"/>
</logger>
<logger name="uk.ltd.getahead">
<level value="WARN"/>
</logger>
<root>
<level value="INFO"/>
<appender-ref ref="console"/>
<appender-ref ref="errConsole"/>
</root>
</log4j:configuration>

View file

@ -29,15 +29,36 @@
</layout> </layout>
</appender> </appender>
<appender name="PerformanceLogAppender" class="com.raytheon.uf.viz.alertviz.EnvConfigurableRollingFileAppender">
<param name="envLogVar" value="LOGFILE_PERFORMANCE" />
<param name="maxFileSize" value="2GB"/>
<param name="maxBackupIndex" value="5"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d{dd MMM yyyy HH:mm:ss,SSS} %m%n"/>
</layout>
</appender>
<appender name="AsyncCaveLogAppender" class="org.apache.log4j.AsyncAppender"> <appender name="AsyncCaveLogAppender" class="org.apache.log4j.AsyncAppender">
<param name="BufferSize" value="500"/> <param name="BufferSize" value="500"/>
<appender-ref ref="CaveLogAppender"/> <appender-ref ref="CaveLogAppender"/>
</appender> </appender>
<appender name="AsyncPerfLogAppender" class="org.apache.log4j.AsyncAppender">
<param name="BufferSize" value="500"/>
<appender-ref ref="PerformanceLogAppender"/>
</appender>
<logger name="CaveLogger" additivity="false"> <logger name="CaveLogger" additivity="false">
<level value="ALL"/> <level value="ALL"/>
<appender-ref ref="AsyncCaveLogAppender"/> <appender-ref ref="AsyncCaveLogAppender"/>
</logger> </logger>
<logger name="PerformanceLogger" additivity="false">
<level value="ALL"/>
<appender-ref ref="AsyncPerfLogAppender"/>
</logger>
<logger name="com.raytheon"> <logger name="com.raytheon">
<level value="INFO"/> <level value="INFO"/>
</logger> </logger>

View file

@ -33,6 +33,18 @@ import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore;
/** /**
* The activator class controls the plug-in life cycle * The activator class controls the plug-in life cycle
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* chammack Initial Creation.
* Mar 5, 2013 1753 njensen Added printout to stop()
*
* </pre>
*
* @author chammack
* @version 1
*/ */
public class Activator extends AbstractUIPlugin { public class Activator extends AbstractUIPlugin {
@ -79,6 +91,7 @@ public class Activator extends AbstractUIPlugin {
* ) * )
*/ */
public void stop(BundleContext context) throws Exception { public void stop(BundleContext context) throws Exception {
System.out.println("Stopping " + PLUGIN_ID + " plugin");
plugin = null; plugin = null;
super.stop(context); super.stop(context);
for (IDisposable dispose : disposables) { for (IDisposable dispose : disposables) {

View file

@ -33,6 +33,9 @@ import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 20, 2011 mschenke Initial creation * Jan 20, 2011 mschenke Initial creation
* Feb 14, 2013 1616 bsteffen Add option for interpolation of colormap
* parameters, disable colormap interpolation
* by default.
* *
* </pre> * </pre>
* *
@ -56,9 +59,6 @@ public class DrawableColorMap {
/** The contrast to draw at */ /** The contrast to draw at */
public float contrast = 1.0f; public float contrast = 1.0f;
/** Specify whether the colormap should be interpolated */
public boolean interpolate = true;
/** /**
* Uses the ColorMapParameters passed in for drawing color map * Uses the ColorMapParameters passed in for drawing color map
* *

View file

@ -48,9 +48,8 @@ public class HDF5Util {
String fileName = pathProvider.getHDFFileName( String fileName = pathProvider.getHDFFileName(
object.getPluginName(), persistable); object.getPluginName(), persistable);
file = new File(VizApp.getServerDataDir() + IPathManager.SEPARATOR file = new File(object.getPluginName() + IPathManager.SEPARATOR
+ object.getPluginName() + IPathManager.SEPARATOR + path + path + IPathManager.SEPARATOR + fileName);
+ IPathManager.SEPARATOR + fileName);
} }
return file; return file;

View file

@ -46,6 +46,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 7/24/07 353 bphillip Initial creation * 7/24/07 353 bphillip Initial creation
* 10/8/2008 1532 bphillip Refactored to incorporate annotation support * 10/8/2008 1532 bphillip Refactored to incorporate annotation support
* Mar 5, 2013 1753 njensen Improved debug message
* *
* </pre> * </pre>
* *
@ -96,13 +97,11 @@ public class RecordFactory {
Class<PluginDataObject> clazz = (Class<PluginDataObject>) Class Class<PluginDataObject> clazz = (Class<PluginDataObject>) Class
.forName(record); .forName(record);
defMap.put(pluginName, clazz); defMap.put(pluginName, clazz);
} catch (Exception e) { } catch (ClassNotFoundException e) {
statusHandler.handle(Priority.DEBUG, String msg = "Can't find record class for " + pluginName
"Can't find record class for " + pluginName + " plugin - alerts on " + pluginName
+ " plugin", e); + " data will be ignored";
System.out.println("DEBUG: Can't find record class for " statusHandler.handle(Priority.DEBUG, msg);
+ pluginName + " plugin - alerts on " + pluginName
+ " data will be ignored");
} }
} }
} }

View file

@ -49,6 +49,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 7/1/06 chammack Initial Creation. * 7/1/06 chammack Initial Creation.
* Sep 12, 2012 1167 djohnson Add datadelivery servers. * Sep 12, 2012 1167 djohnson Add datadelivery servers.
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
* *
* </pre> * </pre>
* *
@ -79,8 +80,6 @@ public final class VizApp {
private static String dataDeliveryQueryServer; private static String dataDeliveryQueryServer;
private static String serverDataDir;
static { static {
ManagementFactory.getRuntimeMXBean().getName(); ManagementFactory.getRuntimeMXBean().getName();
} }
@ -257,14 +256,6 @@ public final class VizApp {
VizApp.pypiesServer = pypiesServer; VizApp.pypiesServer = pypiesServer;
} }
public static String getServerDataDir() {
return VizApp.serverDataDir;
}
public static void setServerDataDir(String serverDataDir) {
VizApp.serverDataDir = serverDataDir;
}
private static String host = null; private static String host = null;
/** /**

View file

@ -49,6 +49,8 @@ import com.raytheon.uf.viz.core.status.StatusConstants;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 16, 2008 njensen Initial creation * Jan 16, 2008 njensen Initial creation
* Jan 14, 2013 1469 bkowal The hdf5 root will no longer be appended to the
* beginning of the file name.
* *
* </pre> * </pre>
* *
@ -77,7 +79,7 @@ public class CubeUtil {
if (record != null) { if (record != null) {
File file = HDF5Util.findHDF5Location(record); File file = HDF5Util.findHDF5Location(record);
if (file != null) if (file != null)
filename = file.getAbsolutePath(); filename = file.getPath();
} }
return filename; return filename;
} }

View file

@ -45,6 +45,8 @@ import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jul 3, 2007 chammack Initial Creation. * Jul 3, 2007 chammack Initial Creation.
* Jan 14, 2013 1442 rferrel Added method searchTreeUsingContraints.
* Addition checks on constraints.
* *
* </pre> * </pre>
* *
@ -279,7 +281,41 @@ public class DecisionTree<T> {
insertCriteria(searchCriteria, item, true); insertCriteria(searchCriteria, item, true);
} }
/**
* Search the tree by calling RequestConstraint.evaluate with the map values
* for each level of the tree.
*
* @param searchCriteria
* @return
*/
public List<T> searchTree(Map<String, Object> searchCriteria) { public List<T> searchTree(Map<String, Object> searchCriteria) {
return searchTree(searchCriteria, true);
}
/**
* Search the tree to find entries that were put into the tree using the
* exact same criteria as searchCriteria.
*
* @param searchCriteria
* @return
*/
public List<T> searchTreeUsingContraints(
Map<String, RequestConstraint> searchCriteria) {
return searchTree(searchCriteria, false);
}
/**
* Internal search method
*
* @param searchCriteria
* @param evaluateConstraints
* true if the map values should be passed to
* RequestConstraint.evaluate, false if they chould be passed to
* RequestConstraint.equals
* @return
*/
private List<T> searchTree(Map<String, ?> searchCriteria,
boolean evaluateConstraints) {
synchronized (this) { synchronized (this) {
List<T> lst = new ArrayList<T>(); List<T> lst = new ArrayList<T>();
if (head == null) { if (head == null) {
@ -288,13 +324,13 @@ public class DecisionTree<T> {
Node curNode = head; Node curNode = head;
searchTree(curNode, searchCriteria, lst, 0); searchTree(curNode, searchCriteria, lst, 0, evaluateConstraints);
return lst; return lst;
} }
} }
private void searchTree(Node curNode, Map<String, Object> searchCriteria, private void searchTree(Node curNode, Map<String, ?> searchCriteria,
List<T> resultList, int lvl) { List<T> resultList, int lvl, boolean evaluatedConstraint) {
if (curNode == null) { if (curNode == null) {
return; return;
@ -312,20 +348,30 @@ public class DecisionTree<T> {
Object parsedValue = searchCriteria.get(curNode.decisionAttribute); Object parsedValue = searchCriteria.get(curNode.decisionAttribute);
boolean foundSomething = false; boolean foundSomething = false;
if (evaluatedConstraint) {
// Evaluate through the values: First search for an exact match // Evaluate through the values: First search for an exact match
// of non-null values // of non-null values
for (Node n : curNode.nodeChildren) { for (Node n : curNode.nodeChildren) {
RequestConstraint c = n.decision; RequestConstraint c = n.decision;
if (c == null if (c == null
|| (c == RequestConstraint.WILDCARD || parsedValue == null || c || (c == RequestConstraint.WILDCARD
|| parsedValue == null || c
.evaluate(parsedValue))) { .evaluate(parsedValue))) {
// for (int k = 0; k < lvl; k++) {
// System.out.print(" ");
// }
foundSomething = true; foundSomething = true;
// System.out.println("visit: " + curNode.decisionAttribute searchTree(n, searchCriteria, resultList, lvl + 1,
// + ":: " + c); evaluatedConstraint);
searchTree(n, searchCriteria, resultList, lvl + 1); }
}
} else {
// Evaluate using existing constraints.
for (Node n : curNode.nodeChildren) {
RequestConstraint c = n.decision;
if ((c == null && parsedValue == null)
|| (parsedValue != null && parsedValue.equals(c))) {
foundSomething = true;
searchTree(n, searchCriteria, resultList, lvl + 1,
evaluatedConstraint);
}
} }
} }
@ -467,8 +513,6 @@ public class DecisionTree<T> {
Map<String, Object> dataMap = new HashMap<String, Object>(); Map<String, Object> dataMap = new HashMap<String, Object>();
dataMap.put("pluginName", "grib"); dataMap.put("pluginName", "grib");
dataMap.put("model", "nam12"); dataMap.put("model", "nam12");
// List<Integer> list = iDT.searchTree(dataMap);
// System.out.println(list.get(0));
Map<String, Object> dataMap2 = new HashMap<String, Object>(); Map<String, Object> dataMap2 = new HashMap<String, Object>();
dataMap2.put("pluginName", "grib"); dataMap2.put("pluginName", "grib");

View file

@ -53,6 +53,9 @@ import com.raytheon.uf.viz.core.style.DataMappingPreferences.DataMappingEntry;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jul 24, 2007 chammack Initial Creation. * Jul 24, 2007 chammack Initial Creation.
* Feb 14, 2013 1616 bsteffen Add option for interpolation of
* colormap parameters, disable colormap
* interpolation by default.
* *
* </pre> * </pre>
* *
@ -195,6 +198,9 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
/** Values >0 enable log scaling of the colormap. */ /** Values >0 enable log scaling of the colormap. */
private float logFactor = -1.0f; private float logFactor = -1.0f;
/** Specify whether the colormap should be interpolated */
protected boolean interpolate = false;
public static class LabelEntry { public static class LabelEntry {
private float location; private float location;
@ -933,14 +939,7 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
* @return * @return
*/ */
public RGB getRGBByValue(float value) { public RGB getRGBByValue(float value) {
float index = getIndexByValue(value); return colorToRGB(getColorByValue(value));
if (index < 0.0f) {
index = 0.0f;
} else if (index > 1.0f) {
index = 1.0f;
}
return colorToRGB(colorMap.getColors().get(
(int) (index * (colorMap.getSize()-1))));
} }
/** /**
@ -956,7 +955,25 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
} else if (index > 1.0f) { } else if (index > 1.0f) {
index = 1.0f; index = 1.0f;
} }
return colorMap.getColors().get((int) (index * (colorMap.getSize()-1))); if (isInterpolate()) {
index = 0.5f;
index = (index * (colorMap.getSize() - 1));
int lowIndex = (int) Math.floor(index);
int highIndex = (int) Math.ceil(index);
float lowWeight = highIndex - index;
float highWeight = 1.0f - lowWeight;
Color low = colorMap.getColors().get(lowIndex);
Color high = colorMap.getColors().get(highIndex);
float r = lowWeight * low.getRed() + highWeight * high.getRed();
float g = lowWeight * low.getGreen() + highWeight * high.getGreen();
float b = lowWeight * low.getBlue() + highWeight * high.getBlue();
float a = lowWeight * low.getAlpha() + highWeight * high.getAlpha();
return new Color(r, g, b, a);
} else {
return colorMap.getColors().get(
(int) (index * (colorMap.getSize() - 1)));
}
} }
public static RGB colorToRGB(Color c) { public static RGB colorToRGB(Color c) {
@ -1027,4 +1044,12 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
this.noDataValue = noDataValue; this.noDataValue = noDataValue;
} }
public boolean isInterpolate() {
return interpolate;
}
public void setInterpolate(boolean interpolate) {
this.interpolate = interpolate;
}
} }

View file

@ -42,6 +42,9 @@ import com.raytheon.uf.viz.core.exception.VizException;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jun 26, 2012 bsteffen Initial creation * Jun 26, 2012 bsteffen Initial creation
* Feb 14, 2013 1616 bsteffen Add option for interpolation of colormap
* parameters, disable colormap interpolation
* by default.
* *
* </pre> * </pre>
* *
@ -128,7 +131,6 @@ public class GeneralCanvasRenderingExtension extends
newColorMap.alpha = colorMap.alpha; newColorMap.alpha = colorMap.alpha;
newColorMap.brightness = colorMap.brightness; newColorMap.brightness = colorMap.brightness;
newColorMap.contrast = colorMap.contrast; newColorMap.contrast = colorMap.contrast;
newColorMap.interpolate = colorMap.interpolate;
double x1 = colorMap.extent.getMinX(); double x1 = colorMap.extent.getMinX();
double y1 = colorMap.extent.getMinY(); double y1 = colorMap.extent.getMinY();
double x2 = colorMap.extent.getMaxX(); double x2 = colorMap.extent.getMaxX();

View file

@ -49,6 +49,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 5, 2009 mschenke Initial creation * Nov 5, 2009 mschenke Initial creation
* Sep 12, 2012 1167 djohnson Add datadelivery servers. * Sep 12, 2012 1167 djohnson Add datadelivery servers.
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
* *
* </pre> * </pre>
* *
@ -126,7 +127,6 @@ public class LocalizationInitializer {
VizApp.setHttpServer(resp.getHttpServer()); VizApp.setHttpServer(resp.getHttpServer());
VizApp.setJmsServer(resp.getJmsServer()); VizApp.setJmsServer(resp.getJmsServer());
VizApp.setPypiesServer(resp.getPypiesServer()); VizApp.setPypiesServer(resp.getPypiesServer());
VizApp.setServerDataDir(resp.getServerDataDir());
VizServers.getInstance().setServerLocations(resp.getServerLocations()); VizServers.getInstance().setServerLocations(resp.getServerLocations());
} }
} }

View file

@ -91,6 +91,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* Mar 26, 2008 njensen Added rename() and getFileContents(). * Mar 26, 2008 njensen Added rename() and getFileContents().
* May 19, 2007 #1127 randerso Implemented error handling * May 19, 2007 #1127 randerso Implemented error handling
* Sep 12, 2012 1167 djohnson Add datadelivery servers. * Sep 12, 2012 1167 djohnson Add datadelivery servers.
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
* *
* </pre> * </pre>
* *
@ -223,7 +224,6 @@ public class LocalizationManager implements IPropertyChangeListener {
VizApp.setHttpServer(resp.getHttpServer()); VizApp.setHttpServer(resp.getHttpServer());
VizApp.setJmsServer(resp.getJmsServer()); VizApp.setJmsServer(resp.getJmsServer());
VizApp.setPypiesServer(resp.getPypiesServer()); VizApp.setPypiesServer(resp.getPypiesServer());
VizApp.setServerDataDir(resp.getServerDataDir());
VizServers.getInstance().setServerLocations( VizServers.getInstance().setServerLocations(
resp.getServerLocations()); resp.getServerLocations());
} catch (VizException e) { } catch (VizException e) {

View file

@ -16,10 +16,7 @@ import com.raytheon.uf.common.auth.resp.UserNotAuthenticated;
import com.raytheon.uf.common.auth.resp.UserNotAuthorized; import com.raytheon.uf.common.auth.resp.UserNotAuthorized;
import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.comm.CommunicationException;
import com.raytheon.uf.common.comm.HttpClient; import com.raytheon.uf.common.comm.HttpClient;
import com.raytheon.uf.common.comm.NetworkStatistics;
import com.raytheon.uf.common.serialization.ExceptionWrapper; import com.raytheon.uf.common.serialization.ExceptionWrapper;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.comm.IServerRequest; import com.raytheon.uf.common.serialization.comm.IServerRequest;
import com.raytheon.uf.common.serialization.comm.RemoteServiceRequest; import com.raytheon.uf.common.serialization.comm.RemoteServiceRequest;
import com.raytheon.uf.common.serialization.comm.RequestWrapper; import com.raytheon.uf.common.serialization.comm.RequestWrapper;
@ -64,6 +61,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* Aug 3, 2009 mschenke Initial creation * Aug 3, 2009 mschenke Initial creation
* Jul 24, 2012 njensen Enhanced logging * Jul 24, 2012 njensen Enhanced logging
* Nov 15, 2012 1322 djohnson Publicize ability to specify specific httpAddress. * Nov 15, 2012 1322 djohnson Publicize ability to specify specific httpAddress.
* Jan 24, 2013 1526 njensen Switch from using postBinary() to postDynamicSerialize()
* *
* </pre> * </pre>
* *
@ -126,9 +124,6 @@ public class ThriftClient {
private static INotAuthHandler defaultHandler = UserController private static INotAuthHandler defaultHandler = UserController
.getNotAuthHandler(); .getNotAuthHandler();
private static NetworkStatistics stats = HttpClient.getInstance()
.getStats();
/** /**
* Construct a thrift web service object that sends method calls to the http * Construct a thrift web service object that sends method calls to the http
* server to be executed. EVERY FUNCTION CALL MADE TO INTERFACE MAY THROW A * server to be executed. EVERY FUNCTION CALL MADE TO INTERFACE MAY THROW A
@ -274,24 +269,30 @@ public class ThriftClient {
return sendRequest(request, httpAddress, "/thrift"); return sendRequest(request, httpAddress, "/thrift");
} }
/**
* Sends an IServerRequest to the server at the specified URI.
*
* @param request
* the request to send
* @param httpAddress
* the http address
* @param uri
* the URI at the address
* @return the object the server returns
* @throws VizException
*/
private static Object sendRequest(IServerRequest request, private static Object sendRequest(IServerRequest request,
String httpAddress, String uri) throws VizException { String httpAddress, String uri) throws VizException {
httpAddress += uri; httpAddress += uri;
String uniqueId = UUID.randomUUID().toString(); String uniqueId = UUID.randomUUID().toString();
RequestWrapper wrapper = new RequestWrapper(request, VizApp.getWsId(), RequestWrapper wrapper = new RequestWrapper(request, VizApp.getWsId(),
uniqueId); uniqueId);
byte[] message;
try {
message = SerializationUtil.transformToThrift(wrapper);
} catch (SerializationException e) {
throw new VizException("unable to serialize request object", e);
}
byte[] response = null; Object rval = null;
try { try {
long t0 = System.currentTimeMillis(); long t0 = System.currentTimeMillis();
response = HttpClient.getInstance() rval = HttpClient.getInstance().postDynamicSerialize(httpAddress,
.postBinary(httpAddress, message); wrapper, true);
long time = System.currentTimeMillis() - t0; long time = System.currentTimeMillis() - t0;
if (time >= SIMPLE_LOG_TIME) { if (time >= SIMPLE_LOG_TIME) {
System.out.println("Took " + time + "ms to run request id[" System.out.println("Took " + time + "ms to run request id["
@ -313,14 +314,6 @@ public class ThriftClient {
}.printStackTrace(System.out); }.printStackTrace(System.out);
} }
long responseLen = 0;
if (response != null) {
responseLen = response.length;
}
// Log request stats
stats.log(request.getClass().getSimpleName(), message.length,
responseLen);
} catch (IOException e) { } catch (IOException e) {
throw new VizCommunicationException( throw new VizCommunicationException(
"unable to post request to server", e); "unable to post request to server", e);
@ -330,15 +323,7 @@ public class ThriftClient {
} catch (Exception e) { } catch (Exception e) {
throw new VizException("unable to post request to server", e); throw new VizException("unable to post request to server", e);
} }
Object rval = null;
if (response != null) {
try {
rval = SerializationUtil.transformFromThrift(response);
} catch (SerializationException e) {
throw new VizException(
"unable to transform response to object", e);
}
}
if (rval instanceof ServerErrorResponse) { if (rval instanceof ServerErrorResponse) {
ServerErrorResponse resp = (ServerErrorResponse) rval; ServerErrorResponse resp = (ServerErrorResponse) rval;
Throwable serverException = ExceptionWrapper.unwrapThrowable(resp Throwable serverException = ExceptionWrapper.unwrapThrowable(resp

View file

@ -52,6 +52,7 @@ import com.raytheon.uf.viz.core.rsc.URICatalog.IURIRefreshCallback;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 12, 2007 chammack Initial Creation. * Apr 12, 2007 chammack Initial Creation.
* Jan 14, 2013 1442 rferrel Added query method.
* *
* </pre> * </pre>
* *
@ -70,6 +71,8 @@ public class URICatalog extends DecisionTree<List<IURIRefreshCallback>> {
protected Map<Map<String, RequestConstraint>, List<IURIRefreshCallback>> queuedRCMap = new HashMap<Map<String, RequestConstraint>, List<IURIRefreshCallback>>(); protected Map<Map<String, RequestConstraint>, List<IURIRefreshCallback>> queuedRCMap = new HashMap<Map<String, RequestConstraint>, List<IURIRefreshCallback>>();
private Map<Map<String, RequestConstraint>, List<IURIRefreshCallback>> queryRCMap = new HashMap<Map<String, RequestConstraint>, List<IURIRefreshCallback>>();
/** /**
* Singleton accessor * Singleton accessor
* *
@ -193,14 +196,29 @@ public class URICatalog extends DecisionTree<List<IURIRefreshCallback>> {
do { do {
workingTime = time; workingTime = time;
Map<Map<String, RequestConstraint>, List<IURIRefreshCallback>> runRCList = null; Map<Map<String, RequestConstraint>, List<IURIRefreshCallback>> runRCList = null;
Map<Map<String, RequestConstraint>, List<IURIRefreshCallback>> runQueryList = null;
synchronized (URICatalog.this) { synchronized (URICatalog.this) {
if (queuedRCMap.size() > 0) {
runRCList = queuedRCMap; runRCList = queuedRCMap;
queuedRCMap = new HashMap<Map<String, RequestConstraint>, List<IURIRefreshCallback>>(); queuedRCMap = new HashMap<Map<String, RequestConstraint>, List<IURIRefreshCallback>>();
} }
if (queryRCMap.size() > 0) {
runQueryList = queryRCMap;
queryRCMap = new HashMap<Map<String, RequestConstraint>, List<IURIRefreshCallback>>();
}
}
if (runRCList != null) {
catalogAndQueryDataURIsInternal(runRCList, monitor); catalogAndQueryDataURIsInternal(runRCList, monitor);
}
if (runQueryList != null) {
doQuery(runQueryList, monitor);
}
} while (!monitor.isCanceled() && workingTime != time } while (!monitor.isCanceled() && workingTime != time
&& queuedRCMap.size() > 0); && (queuedRCMap.size() > 0 || queryRCMap.size() > 0));
return Status.OK_STATUS; return Status.OK_STATUS;
} }
} }
@ -245,40 +263,24 @@ public class URICatalog extends DecisionTree<List<IURIRefreshCallback>> {
try { try {
for (Map.Entry<Map<String, RequestConstraint>, List<IURIRefreshCallback>> entry : rcMap for (Map.Entry<Map<String, RequestConstraint>, List<IURIRefreshCallback>> entry : rcMap
.entrySet()) { .entrySet()) {
Map<String, RequestConstraint> map = entry.getKey();
List<IURIRefreshCallback> runnable = entry.getValue();
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
// If we are cancelled add our runnables back into the queue // If we are cancelled add our runnables back into the queue
// instead of requesting times // instead of requesting times
synchronized (this) { synchronized (this) {
List<IURIRefreshCallback> runnables = queuedRCMap List<IURIRefreshCallback> runnables = queuedRCMap
.get(entry.getKey()); .get(map);
if (runnables == null) { if (runnables == null) {
queuedRCMap.put(entry.getKey(), entry.getValue()); queuedRCMap.put(map, runnable);
} else { } else {
runnables.addAll(entry.getValue()); runnables.addAll(runnable);
} }
} }
continue; continue;
} }
Map<String, RequestConstraint> map = entry.getKey(); doCallbacks(map, runnable);
DataTime[] dt = DataCubeContainer.performTimeQuery(map, true);
DataTime newDataTime = null;
if (dt != null && dt.length > 0) {
newDataTime = dt[dt.length - 1];
}
List<IURIRefreshCallback> runnable = entry.getValue();
final DataTime dataTime = newDataTime;
if (runnable != null) {
Iterator<IURIRefreshCallback> iterator = runnable
.iterator();
while (iterator.hasNext()) {
final IURIRefreshCallback r = iterator.next();
r.updateTime(dataTime);
}
}
for (Map<String, RequestConstraint> updateMap : DataCubeContainer for (Map<String, RequestConstraint> updateMap : DataCubeContainer
.getBaseUpdateConstraints(map)) { .getBaseUpdateConstraints(map)) {
insert(updateMap, rcMap.get(map)); insert(updateMap, rcMap.get(map));
@ -297,6 +299,76 @@ public class URICatalog extends DecisionTree<List<IURIRefreshCallback>> {
} }
private void doCallbacks(Map<String, RequestConstraint> map,
List<IURIRefreshCallback> runnable) throws VizException {
DataTime[] dt = DataCubeContainer.performTimeQuery(map, true);
DataTime newDataTime = null;
if (dt != null && dt.length > 0) {
newDataTime = dt[dt.length - 1];
}
final DataTime dataTime = newDataTime;
if (runnable != null) {
Iterator<IURIRefreshCallback> iterator = runnable.iterator();
while (iterator.hasNext()) {
final IURIRefreshCallback r = iterator.next();
r.updateTime(dataTime);
}
}
}
/**
* Perform query using the existing constraints in map.
*
* @param map
*/
public void query(Map<String, RequestConstraint> map) {
synchronized (this) {
List<List<IURIRefreshCallback>> runableList = searchTreeUsingContraints(map);
List<IURIRefreshCallback> runnables = queryRCMap.get(map);
if (runnables == null) {
runnables = new ArrayList<URICatalog.IURIRefreshCallback>();
queryRCMap.put(map, runnables);
}
for (List<IURIRefreshCallback> runnable : runableList) {
runnables.addAll(runnable);
}
rebuildSchedulerJob.schedule();
}
}
private void doQuery(
Map<Map<String, RequestConstraint>, List<IURIRefreshCallback>> queryMap,
IProgressMonitor monitor) {
try {
for (Map.Entry<Map<String, RequestConstraint>, List<IURIRefreshCallback>> entry : queryMap
.entrySet()) {
Map<String, RequestConstraint> map = entry.getKey();
List<IURIRefreshCallback> runnable = entry.getValue();
if (monitor.isCanceled()) {
// If we are cancelled add our runnables back into the queue
// instead of requesting times
synchronized (this) {
List<IURIRefreshCallback> runnables = queryRCMap
.get(map);
if (runnables == null) {
queryRCMap.put(map, runnable);
} else {
runnables.addAll(runnable);
}
}
continue;
}
doCallbacks(map, runnable);
}
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
}
private void insert(Map<String, RequestConstraint> map, private void insert(Map<String, RequestConstraint> map,
List<IURIRefreshCallback> runnables) throws VizException { List<IURIRefreshCallback> runnables) throws VizException {
insertCriteria(map, runnables, false); insertCriteria(map, runnables, false);
@ -306,7 +378,5 @@ public class URICatalog extends DecisionTree<List<IURIRefreshCallback>> {
/** check and update most recent time */ /** check and update most recent time */
public abstract void updateTime(DataTime time); public abstract void updateTime(DataTime time);
} }
} }

View file

@ -29,7 +29,9 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.services.IDisposable; import org.eclipse.ui.services.IDisposable;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.Activator; import com.raytheon.uf.viz.core.Activator;
@ -58,6 +60,9 @@ public class TimeMatchingJob extends Job {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TimeMatchingJob.class); .getHandler(TimeMatchingJob.class);
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("Core:");
static { static {
Activator.getDefault().registerDisposable(new IDisposable() { Activator.getDefault().registerDisposable(new IDisposable() {
@Override @Override
@ -121,8 +126,8 @@ public class TimeMatchingJob extends Job {
long t0 = System.currentTimeMillis(); long t0 = System.currentTimeMillis();
request.getTimeMatcher().redoTimeMatching(request); request.getTimeMatcher().redoTimeMatching(request);
long time = (System.currentTimeMillis() - t0); long time = (System.currentTimeMillis() - t0);
if (time > 0) { if (time > 10) {
System.out.println("time matching took: " + time + "ms"); perfLog.logDuration("time matching", time);
} }
if (!this.keepAround) { if (!this.keepAround) {
map.remove(request); map.remove(request);

View file

@ -42,6 +42,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 12, 2009 mschenke Initial creation * Oct 12, 2009 mschenke Initial creation
* Jan 14, 2013 1469 bkowal The hdf5 root directory is no longer passed
* as an argument to the common TopoQuery constructor.
* *
* </pre> * </pre>
* *
@ -59,8 +61,7 @@ public class TopoQuery implements ITopoQuery {
* @return Initialized TopoQuery instance * @return Initialized TopoQuery instance
*/ */
public static synchronized ITopoQuery getInstance() { public static synchronized ITopoQuery getInstance() {
return com.raytheon.uf.edex.topo.TopoQuery.getInstance( return com.raytheon.uf.edex.topo.TopoQuery.getInstance(0);
VizApp.getServerDataDir(), 0);
} }
/** /**
@ -68,8 +69,7 @@ public class TopoQuery implements ITopoQuery {
*/ */
public static synchronized ITopoQuery getInstance(int topoLevel, public static synchronized ITopoQuery getInstance(int topoLevel,
boolean useCaching) { boolean useCaching) {
return com.raytheon.uf.edex.topo.TopoQuery.getInstance( return com.raytheon.uf.edex.topo.TopoQuery.getInstance(0);
VizApp.getServerDataDir(), 0);
} }
private TopoQuery(int level, boolean useCaching) { private TopoQuery(int level, boolean useCaching) {

View file

@ -120,30 +120,6 @@
version="0.0.0" version="0.0.0"
fragment="true"/> fragment="true"/>
<plugin
id="ncsa.hdf5"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="ncsa.hdf5.linux32"
os="linux"
arch="x86"
download-size="0"
install-size="0"
version="0.0.0"
fragment="true"/>
<plugin
id="ncsa.hdf5.win32"
os="win32"
arch="x86"
download-size="0"
install-size="0"
version="0.0.0"
fragment="true"/>
<plugin <plugin
id="net.sf.cglib" id="net.sf.cglib"
download-size="0" download-size="0"

View file

@ -5,10 +5,11 @@ Bundle-SymbolicName: com.raytheon.uf.viz.cwat;singleton:=true
Bundle-Version: 1.12.1174.qualifier Bundle-Version: 1.12.1174.qualifier
Bundle-Activator: com.raytheon.uf.viz.cwat.Activator Bundle-Activator: com.raytheon.uf.viz.cwat.Activator
Bundle-Vendor: RAYTHEON Bundle-Vendor: RAYTHEON
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Require-Bundle: org.eclipse.ui, Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime, org.eclipse.core.runtime,
com.raytheon.uf.viz.core, com.raytheon.uf.viz.core,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.time;bundle-version="1.11.1", com.raytheon.uf.common.time;bundle-version="1.11.1",
com.raytheon.edex.common;bundle-version="1.11.1", com.raytheon.edex.common;bundle-version="1.11.1",
org.geotools;bundle-version="2.5.2", org.geotools;bundle-version="2.5.2",

View file

@ -33,7 +33,6 @@ import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.HDF5Util; import com.raytheon.uf.viz.core.HDF5Util;
import com.raytheon.uf.viz.core.comm.Loader;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
@ -52,6 +51,8 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 15Mar2009 2037 dhladky Initial Creation. * 15Mar2009 2037 dhladky Initial Creation.
* Feb 28, 2013 1731 bsteffen Remove unneccessary query in
* getDataStore.
* *
* </pre> * </pre>
* *
@ -114,21 +115,7 @@ public class CWATResourceData extends AbstractRequestableResourceData {
* @return * @return
*/ */
private IDataStore getDataStore(CWATRecord record) { private IDataStore getDataStore(CWATRecord record) {
IDataStore dataStore = null;
try {
Map<String, Object> vals = new HashMap<String, Object>();
vals.put("dataURI", record.getDataURI());
vals.put("pluginName", record.getPluginName());
record = (CWATRecord) Loader.loadData(vals);
File loc = HDF5Util.findHDF5Location(record); File loc = HDF5Util.findHDF5Location(record);
dataStore = DataStoreFactory.getDataStore(loc); return DataStoreFactory.getDataStore(loc);
} catch (VizException e) {
e.printStackTrace();
}
return dataStore;
} }
} }

View file

@ -7,17 +7,11 @@ Bundle-Activator: com.raytheon.uf.viz.d2d.gfe.Activator
Bundle-Vendor: RAYTHEON Bundle-Vendor: RAYTHEON
Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.uf.viz.core Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.uf.viz.core
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
com.raytheon.uf.common.serialization;bundle-version="1.12.1174" com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.gfe;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Import-Package: com.raytheon.uf.common.dataplugin, Import-Package: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.gfe,
com.raytheon.uf.common.dataplugin.gfe.db.objects,
com.raytheon.uf.common.dataplugin.gfe.grid,
com.raytheon.uf.common.dataplugin.gfe.request,
com.raytheon.uf.common.dataplugin.gfe.server.message,
com.raytheon.uf.common.dataplugin.gfe.server.request,
com.raytheon.uf.common.dataplugin.gfe.slice,
com.raytheon.uf.common.dataquery.requests, com.raytheon.uf.common.dataquery.requests,
com.raytheon.uf.common.dataquery.responses, com.raytheon.uf.common.dataquery.responses,
com.raytheon.uf.common.datastorage.records, com.raytheon.uf.common.datastorage.records,

View file

@ -1,114 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.d2d.gfe;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridParmInfo;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.gfe.request.GetGridDataRequest;
import com.raytheon.uf.common.dataplugin.gfe.request.GetGridParmInfoRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.dataplugin.gfe.server.request.GetGridRequest;
import com.raytheon.uf.common.dataplugin.gfe.slice.IGridSlice;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
import com.raytheon.uf.viz.core.style.level.Level;
import com.raytheon.uf.viz.core.style.level.SingleLevel;
/**
*
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 9, 2011 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public class GFEUtil {
public static final String PARM_ID_FORMAT = "%s_%s:%s_GRID_%s_%s_%s";
public static final String PARM_ID = "parmId";
public static final String PLUGIN_NAME = "pluginName";
public static GridParmInfo getGridParmInfo(ParmID parmId)
throws VizException {
GetGridParmInfoRequest request = new GetGridParmInfoRequest();
request.setParmIds(Arrays.asList(parmId));
request.setSiteID(parmId.getDbId().getSiteId());
request.setWorkstationID(VizApp.getWsId());
@SuppressWarnings("unchecked")
ServerResponse<List<GridParmInfo>> response = (ServerResponse<List<GridParmInfo>>) ThriftClient
.sendRequest(request);
return response.getPayload().get(0);
}
public static ParamLevelMatchCriteria getMatchCriteria(ParmID parmId) {
ParamLevelMatchCriteria criteria = new ParamLevelMatchCriteria();
criteria.setParameterName(new ArrayList<String>());
criteria.setLevels(new ArrayList<Level>());
criteria.setCreatingEntityNames(new ArrayList<String>());
String parameter = "GFE:" + parmId.getParmName();
SingleLevel level = new SingleLevel(Level.LevelType.SURFACE);
String model = "GFE:" + parmId.getDbId().getModelName();
if (!criteria.getParameterNames().contains(parameter)) {
criteria.getParameterNames().add(parameter);
}
if (!criteria.getLevels().contains(level)) {
criteria.getLevels().add(level);
}
if (!criteria.getCreatingEntityNames().contains(model)) {
criteria.getCreatingEntityNames().add(model);
}
return criteria;
}
public static IGridSlice getSlice(GFERecord gfeRecord) throws VizException {
GetGridRequest gridRequest = new GetGridRequest();
gridRequest.setParmId(gfeRecord.getParmId());
gridRequest.setRecords(Arrays.asList(gfeRecord));
GetGridDataRequest request = new GetGridDataRequest();
request.setSiteID(gfeRecord.getDbId().getSiteId());
request.setWorkstationID(VizApp.getWsId());
request.setRequests(Arrays.asList(gridRequest));
@SuppressWarnings("unchecked")
ServerResponse<List<IGridSlice>> response = (ServerResponse<List<IGridSlice>>) ThriftClient
.sendRequest(request);
return response.getPayload().get(0);
}
}

View file

@ -27,13 +27,12 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import com.raytheon.uf.common.dataplugin.gfe.dataaccess.GFEDataAccessUtil;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability; import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
import com.raytheon.uf.viz.d2d.gfe.GFEUtil;
import com.raytheon.uf.viz.d2d.gfe.rsc.GFEGridResourceData; import com.raytheon.uf.viz.d2d.gfe.rsc.GFEGridResourceData;
import com.raytheon.uf.viz.productbrowser.AbstractRequestableProductBrowserDataDefinition; import com.raytheon.uf.viz.productbrowser.AbstractRequestableProductBrowserDataDefinition;
import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel; import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel;
@ -60,22 +59,11 @@ import com.raytheon.viz.grid.rsc.GridLoadProperties;
public class GFEDataDefinition extends public class GFEDataDefinition extends
AbstractRequestableProductBrowserDataDefinition<GFEGridResourceData> { AbstractRequestableProductBrowserDataDefinition<GFEGridResourceData> {
public static final String SITE_ID = "siteId";
public static final String DB_TYPE = "dbType";
public static final String MODEL_NAME = "modelName";
public static final String MODEL_TIME = "modelTime";
public static final String PARM_NAME = "parmName";
public static final String PARM_LEVEL = "parmLevel";
public GFEDataDefinition() { public GFEDataDefinition() {
productName = "gfe"; productName = "gfe";
displayName = "GFE"; displayName = "GFE";
order = new String[] { SITE_ID, MODEL_NAME, PARM_NAME, PARM_LEVEL }; order = new String[] { GFEDataAccessUtil.SITE_ID, GFEDataAccessUtil.MODEL_NAME,
GFEDataAccessUtil.PARM_NAME, GFEDataAccessUtil.PARM_LEVEL };
order = getOrder(); order = getOrder();
loadProperties = new GridLoadProperties(); loadProperties = new GridLoadProperties();
loadProperties.setResourceType(getResourceType()); loadProperties.setResourceType(getResourceType());
@ -111,7 +99,7 @@ public class GFEDataDefinition extends
*/ */
@Override @Override
public List<String> buildProductList(List<String> historyList) { public List<String> buildProductList(List<String> historyList) {
String[] parameters = queryData(GFEUtil.PARM_ID, String[] parameters = queryData(GFEDataAccessUtil.PARM_ID,
getProductParameters(new String[0], null)); getProductParameters(new String[0], null));
List<String> result = new ArrayList<String>(); List<String> result = new ArrayList<String>();
for (String orderString : order) { for (String orderString : order) {
@ -131,7 +119,7 @@ public class GFEDataDefinition extends
if (!isEnabled()) { if (!isEnabled()) {
return null; return null;
} }
String[] parameters = queryData(GFEUtil.PARM_ID, String[] parameters = queryData(GFEDataAccessUtil.PARM_ID,
getProductParameters(new String[0], null)); getProductParameters(new String[0], null));
if (parameters != null) { if (parameters != null) {
@ -149,7 +137,7 @@ public class GFEDataDefinition extends
@Override @Override
protected String[] queryData(String param, protected String[] queryData(String param,
HashMap<String, RequestConstraint> queryList) { HashMap<String, RequestConstraint> queryList) {
return super.queryData(GFEUtil.PARM_ID, queryList); return super.queryData(GFEDataAccessUtil.PARM_ID, queryList);
} }
@Override @Override
@ -160,17 +148,17 @@ public class GFEDataDefinition extends
String label = value; String label = value;
try { try {
ParmID parmId = new ParmID(value); ParmID parmId = new ParmID(value);
if (param.equals(SITE_ID)) { if (param.equals(GFEDataAccessUtil.SITE_ID)) {
label = parmId.getDbId().getSiteId(); label = parmId.getDbId().getSiteId();
} else if (param.equals(MODEL_NAME)) { } else if (param.equals(GFEDataAccessUtil.MODEL_NAME)) {
label = parmId.getDbId().getModelName(); label = parmId.getDbId().getModelName();
} else if (param.equals(MODEL_TIME)) { } else if (param.equals(GFEDataAccessUtil.MODEL_TIME)) {
label = parmId.getDbId().getModelTime(); label = parmId.getDbId().getModelTime();
} else if (param.equals(DB_TYPE)) { } else if (param.equals(GFEDataAccessUtil.DB_TYPE)) {
label = parmId.getDbId().getDbType(); label = parmId.getDbId().getDbType();
} else if (param.equals(PARM_NAME)) { } else if (param.equals(GFEDataAccessUtil.PARM_NAME)) {
label = parmId.getParmName(); label = parmId.getParmName();
} else if (param.equals(PARM_LEVEL)) { } else if (param.equals(GFEDataAccessUtil.PARM_LEVEL)) {
label = parmId.getParmLevel(); label = parmId.getParmLevel();
} }
} catch (Exception e) { } catch (Exception e) {
@ -190,37 +178,20 @@ public class GFEDataDefinition extends
if (order == null) { if (order == null) {
order = this.order; order = this.order;
} }
String siteId = "%";
String modelName = "%";
String modelTime = "%";
String dbType = "%";
String parmName = "%";
String parmLevel = "%";
HashMap<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>(); Map<String, String> parmIdComponents = new HashMap<String, String>();
queryList.put(PLUGIN_NAME, new RequestConstraint(productName));
if (selection.length > 1) { if (selection.length > 1) {
String[] usedSelection = realignSelection(selection); String[] usedSelection = realignSelection(selection);
for (int i = 0; i < usedSelection.length; i++) { for (int i = 0; i < usedSelection.length; i++) {
if (order[i].equals(SITE_ID)) { parmIdComponents.put(order[i], usedSelection[i]);
siteId = usedSelection[i];
} else if (order[i].equals(MODEL_NAME)) {
modelName = usedSelection[i];
} else if (order[i].equals(MODEL_TIME)) {
modelTime = usedSelection[i];
} else if (order[i].equals(DB_TYPE)) {
dbType = usedSelection[i];
} else if (order[i].equals(PARM_NAME)) {
parmName = usedSelection[i];
} else if (order[i - 1].equals(PARM_LEVEL)) {
parmLevel = usedSelection[i];
} }
} }
}
String parmId = String.format(GFEUtil.PARM_ID_FORMAT, parmName, HashMap<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>();
parmLevel, siteId, dbType, modelName, modelTime); queryList.put(PLUGIN_NAME, new RequestConstraint(productName));
queryList.put(GFEUtil.PARM_ID, new RequestConstraint(parmId,
ConstraintType.LIKE)); queryList.put(GFEDataAccessUtil.PARM_ID,
GFEDataAccessUtil.createParmIdConstraint(parmIdComponents));
return queryList; return queryList;
} }

View file

@ -23,12 +23,13 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.measure.unit.UnitFormat; import javax.measure.unit.UnitFormat;
import com.raytheon.uf.common.dataplugin.gfe.dataaccess.GFEDataAccessUtil;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -43,7 +44,7 @@ import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
import com.raytheon.uf.viz.core.style.StyleManager; import com.raytheon.uf.viz.core.style.StyleManager;
import com.raytheon.uf.viz.core.style.StyleRule; import com.raytheon.uf.viz.core.style.StyleRule;
import com.raytheon.uf.viz.core.style.VizStyleException; import com.raytheon.uf.viz.core.style.VizStyleException;
import com.raytheon.uf.viz.d2d.gfe.GFEUtil; import com.raytheon.uf.viz.d2d.gfe.rsc.GFEGridResource;
import com.raytheon.uf.viz.d2d.gfe.rsc.GFEGridResourceData; import com.raytheon.uf.viz.d2d.gfe.rsc.GFEGridResourceData;
import com.raytheon.viz.volumebrowser.datacatalog.AbstractDataCatalog; import com.raytheon.viz.volumebrowser.datacatalog.AbstractDataCatalog;
import com.raytheon.viz.volumebrowser.datacatalog.AvailableDataRequest; import com.raytheon.viz.volumebrowser.datacatalog.AvailableDataRequest;
@ -54,7 +55,9 @@ import com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu;
/** /**
* *
* TODO Add Description * Data Catalog for using gfe data in the volume browser. This works by using
* selected model, field, and plane to create ParmId LIKE constraints that can
* be used to narrow down the selection.
* *
* <pre> * <pre>
* *
@ -76,10 +79,10 @@ public class GFEVbDataCatalog extends AbstractDataCatalog {
@Override @Override
public IDataCatalogEntry getCatalogEntry(SelectedData selectedData) { public IDataCatalogEntry getCatalogEntry(SelectedData selectedData) {
HashMap<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>(); HashMap<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>();
queryList.put(GFEUtil.PLUGIN_NAME, new RequestConstraint("gfe")); queryList.put(GFEDataAccessUtil.PLUGIN_NAME, new RequestConstraint("gfe"));
queryList.put(GFEUtil.PARM_ID, getParmIdConstraint(selectedData)); queryList.put(GFEDataAccessUtil.PARM_ID, getParmIdConstraint(selectedData));
try { try {
String[] result = CatalogQuery.performQuery(GFEUtil.PARM_ID, String[] result = CatalogQuery.performQuery(GFEDataAccessUtil.PARM_ID,
queryList); queryList);
if (result != null && result.length > 0) { if (result != null && result.length > 0) {
ParmID sampleId = new ParmID(result[0]); ParmID sampleId = new ParmID(result[0]);
@ -204,15 +207,15 @@ public class GFEVbDataCatalog extends AbstractDataCatalog {
@Override @Override
protected void addProductParameters(IDataCatalogEntry catalogEntry, protected void addProductParameters(IDataCatalogEntry catalogEntry,
HashMap<String, RequestConstraint> productParameters) { HashMap<String, RequestConstraint> productParameters) {
productParameters.put(GFEUtil.PARM_ID, productParameters.put(GFEDataAccessUtil.PARM_ID,
getParmIdConstraint(catalogEntry.getSelectedData())); getParmIdConstraint(catalogEntry.getSelectedData()));
} }
private String[] getParmIds() { private String[] getParmIds() {
HashMap<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>(); HashMap<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>();
queryList.put(GFEUtil.PLUGIN_NAME, new RequestConstraint("gfe")); queryList.put(GFEDataAccessUtil.PLUGIN_NAME, new RequestConstraint("gfe"));
try { try {
return CatalogQuery.performQuery(GFEUtil.PARM_ID, queryList); return CatalogQuery.performQuery(GFEDataAccessUtil.PARM_ID, queryList);
} catch (VizException e) { } catch (VizException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -248,7 +251,7 @@ public class GFEVbDataCatalog extends AbstractDataCatalog {
DisplayType displayType) { DisplayType displayType) {
if (catalogEntry instanceof GFECatalogEntry) { if (catalogEntry instanceof GFECatalogEntry) {
ParmID sampleId = ((GFECatalogEntry) catalogEntry).getSampleId(); ParmID sampleId = ((GFECatalogEntry) catalogEntry).getSampleId();
ParamLevelMatchCriteria criteria = GFEUtil ParamLevelMatchCriteria criteria = GFEGridResource
.getMatchCriteria(sampleId); .getMatchCriteria(sampleId);
StyleRule sr = null; StyleRule sr = null;
try { try {
@ -277,8 +280,8 @@ public class GFEVbDataCatalog extends AbstractDataCatalog {
} else { } else {
try { try {
return UnitFormat.getUCUMInstance().format( return UnitFormat.getUCUMInstance().format(
GFEUtil.getGridParmInfo(sampleId).getUnitObject()); GFEDataAccessUtil.getGridParmInfo(sampleId).getUnitObject());
} catch (VizException e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Unable to obtain a unit information for" "Unable to obtain a unit information for"
+ catalogEntry.getSelectedData() + catalogEntry.getSelectedData()
@ -297,9 +300,12 @@ public class GFEVbDataCatalog extends AbstractDataCatalog {
.getGfeLevel(selectedData.getPlanesKey()); .getGfeLevel(selectedData.getPlanesKey());
String modelName = VbGFEMapping.getGfeSource(selectedData String modelName = VbGFEMapping.getGfeSource(selectedData
.getSourcesKey()); .getSourcesKey());
String parmId = String.format(GFEUtil.PARM_ID_FORMAT, parmName,
parmLevel, "%", "%", modelName, "%"); Map<String, String> parmIdComponents = new HashMap<String, String>();
return new RequestConstraint(parmId, ConstraintType.LIKE); parmIdComponents.put(GFEDataAccessUtil.PARM_NAME, parmName);
parmIdComponents.put(GFEDataAccessUtil.PARM_LEVEL, parmLevel);
parmIdComponents.put(GFEDataAccessUtil.MODEL_NAME, modelName);
return GFEDataAccessUtil.createParmIdConstraint(parmIdComponents);
} }
private static class GFECatalogEntry extends DataCatalogEntry { private static class GFECatalogEntry extends DataCatalogEntry {

View file

@ -19,12 +19,14 @@
**/ **/
package com.raytheon.uf.viz.d2d.gfe.rsc; package com.raytheon.uf.viz.d2d.gfe.rsc;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.coverage.grid.GridGeometry2D;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.gfe.dataaccess.GFEDataAccessUtil;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.gfe.slice.IGridSlice; import com.raytheon.uf.common.dataplugin.gfe.slice.IGridSlice;
@ -36,7 +38,8 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
import com.raytheon.uf.viz.d2d.gfe.GFEUtil; import com.raytheon.uf.viz.core.style.level.Level;
import com.raytheon.uf.viz.core.style.level.SingleLevel;
import com.raytheon.viz.grid.rsc.general.AbstractGridResource; import com.raytheon.viz.grid.rsc.general.AbstractGridResource;
import com.raytheon.viz.grid.rsc.general.GeneralGridData; import com.raytheon.viz.grid.rsc.general.GeneralGridData;
@ -90,15 +93,15 @@ public class GFEGridResource extends AbstractGridResource<GFEGridResourceData> {
} }
try { try {
gfeRecord gfeRecord
.setGridInfo(GFEUtil.getGridParmInfo(gfeRecord.getParmId())); .setGridInfo(GFEDataAccessUtil.getGridParmInfo(gfeRecord.getParmId()));
} catch (VizException e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@Override @Override
public ParamLevelMatchCriteria getMatchCriteria() { public ParamLevelMatchCriteria getMatchCriteria() {
return GFEUtil.getMatchCriteria(parmId); return getMatchCriteria(parmId);
} }
@Override @Override
@ -108,7 +111,12 @@ public class GFEGridResource extends AbstractGridResource<GFEGridResourceData> {
return null; return null;
} }
GFERecord gfeRecord = (GFERecord) pdos.get(0); GFERecord gfeRecord = (GFERecord) pdos.get(0);
IGridSlice slice = GFEUtil.getSlice(gfeRecord); IGridSlice slice = null;
try {
slice = GFEDataAccessUtil.getSlice(gfeRecord);
} catch (Exception e) {
throw new VizException(e);
}
populateGridParmInfo(gfeRecord); populateGridParmInfo(gfeRecord);
GridGeometry2D gridGeometry = MapUtil.getGridGeometry(gfeRecord GridGeometry2D gridGeometry = MapUtil.getGridGeometry(gfeRecord
.getGridInfo().getGridLoc()); .getGridInfo().getGridLoc());
@ -160,4 +168,23 @@ public class GFEGridResource extends AbstractGridResource<GFEGridResourceData> {
parmName, displayTypeString, unitLabel); parmName, displayTypeString, unitLabel);
} }
public static ParamLevelMatchCriteria getMatchCriteria(ParmID parmId) {
ParamLevelMatchCriteria criteria = new ParamLevelMatchCriteria();
criteria.setParameterName(new ArrayList<String>());
criteria.setLevels(new ArrayList<Level>());
criteria.setCreatingEntityNames(new ArrayList<String>());
String parameter = "GFE:" + parmId.getParmName();
SingleLevel level = new SingleLevel(Level.LevelType.SURFACE);
String model = "GFE:" + parmId.getDbId().getModelName();
if (!criteria.getParameterNames().contains(parameter)) {
criteria.getParameterNames().add(parameter);
}
if (!criteria.getLevels().contains(level)) {
criteria.getLevels().add(level);
}
if (!criteria.getCreatingEntityNames().contains(model)) {
criteria.getCreatingEntityNames().add(model);
}
return criteria;
}
} }

View file

@ -12,6 +12,7 @@ import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException; import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.gfe.dataaccess.GFEDataAccessUtil;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord;
import com.raytheon.uf.common.dataplugin.gfe.slice.IGridSlice; import com.raytheon.uf.common.dataplugin.gfe.slice.IGridSlice;
import com.raytheon.uf.common.dataplugin.gfe.slice.ScalarGridSlice; import com.raytheon.uf.common.dataplugin.gfe.slice.ScalarGridSlice;
@ -20,7 +21,6 @@ import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.style.level.Level; import com.raytheon.uf.viz.core.style.level.Level;
import com.raytheon.uf.viz.core.style.level.SingleLevel; import com.raytheon.uf.viz.core.style.level.SingleLevel;
import com.raytheon.uf.viz.d2d.gfe.GFEUtil;
import com.raytheon.uf.viz.xy.timeseries.adapter.AbstractTimeSeriesAdapter; import com.raytheon.uf.viz.xy.timeseries.adapter.AbstractTimeSeriesAdapter;
import com.raytheon.viz.core.graphing.xy.XYData; import com.raytheon.viz.core.graphing.xy.XYData;
import com.raytheon.viz.core.graphing.xy.XYDataList; import com.raytheon.viz.core.graphing.xy.XYDataList;
@ -50,7 +50,12 @@ public class GfeTimeSeriesAdapter extends AbstractTimeSeriesAdapter<GFERecord> {
DirectPosition2D point = null; DirectPosition2D point = null;
for (GFERecord gfeRecord : recordsToLoad) { for (GFERecord gfeRecord : recordsToLoad) {
IGridSlice slice = GFEUtil.getSlice(gfeRecord); IGridSlice slice = null;
try {
slice = GFEDataAccessUtil.getSlice(gfeRecord);
} catch (Exception e) {
throw new VizException(e);
}
if (slice != null) { if (slice != null) {
unit = slice.getGridInfo().getUnitObject(); unit = slice.getGridInfo().getUnitObject();
if (point == null) { if (point == null) {

View file

@ -138,7 +138,7 @@ public class D2DNSharpResource extends
D2DNSharpDataObject pdo = dataResponseQueue.poll(); D2DNSharpDataObject pdo = dataResponseQueue.poll();
while (pdo != null) { while (pdo != null) {
if (pdos.get(pdo.getDataTime()) == pdo) { if (pdos.get(pdo.getDataTime()) == pdo) {
if (isValidSounding(pdo)) { if (pdo.getLayers() != null) {
stnInfo = pdo.getStationInfo(); stnInfo = pdo.getStationInfo();
myDataMap.put(stnInfo.getStnDisplayInfo(), myDataMap.put(stnInfo.getStnDisplayInfo(),
pdo.getLayers()); pdo.getLayers());
@ -154,31 +154,6 @@ public class D2DNSharpResource extends
} }
} }
/**
* Determine if a dataObject has enough valid layers to build a sounding
* without freezing or crashing CAVE.
*
* @param pdo
* @return
*/
protected boolean isValidSounding(D2DNSharpDataObject pdo) {
if (pdo.getLayers() == null) {
return false;
}
int numberOfWindLayers = 0;
for (NcSoundingLayer layer : pdo.getLayers()) {
if (layer.getWindSpeed() > 0) {
numberOfWindLayers += 1;
if (numberOfWindLayers >= 2) {
return true;
}
}
}
return false;
}
private NsharpResourceHandler getHandler() throws VizException { private NsharpResourceHandler getHandler() throws VizException {
List<NsharpAbstractPaneResource> paneRscs = descriptor List<NsharpAbstractPaneResource> paneRscs = descriptor
.getResourceList().getResourcesByTypeAsType( .getResourceList().getResourcesByTypeAsType(

View file

@ -157,6 +157,10 @@ public abstract class D2DNSharpResourceData extends
List<NcSoundingLayer> layers = profileList.getSoundingLyLst(); List<NcSoundingLayer> layers = profileList.getSoundingLyLst();
layers = NsharpDataHandling.organizeSoundingDataForShow(layers, layers = NsharpDataHandling.organizeSoundingDataForShow(layers,
profileList.getStationElevation()); profileList.getStationElevation());
if (layers != null && layers.size() < 3) {
// set invalid data to null
layers = null;
}
dataObject.setLayers(layers); dataObject.setLayers(layers);
} }

View file

@ -456,7 +456,7 @@ F | 1.8 |0| 4 | | |..|8000F0FF| | 0 | 1
<parameter>DpTerranl</parameter> <parameter>DpTerranl</parameter>
</paramLevelMatches> </paramLevelMatches>
<contourStyle> <contourStyle>
<displayUnits>F</displayUnits> <displayUnits label="F">°R</displayUnits>
<contourLabeling labelSpacing="4"> <contourLabeling labelSpacing="4">
<increment>1</increment> <increment>1</increment>
</contourLabeling> </contourLabeling>
@ -1163,9 +1163,9 @@ mb | 1 | 0.0 | 4 |2:i4|1:i4|LH|8000F0FF| | 0 | 2
<contourStyle> <contourStyle>
<displayUnits>mb</displayUnits> <displayUnits>mb</displayUnits>
<displayFlags>NoPlane</displayFlags> <displayFlags>NoPlane</displayFlags>
<contourLabeling labelSpacing="4" labelFormat="#" <contourLabeling labelSpacing="4" labelFormat="0000"
labelTrimLeft="1" maxMinTrimLeft="1" labelTrimLeft="2" maxMinTrimLeft="1"
minMaxLabelFormat="#" minLabel="L" maxLabel="H"> minMaxLabelFormat="0000" minLabel="L" maxLabel="H">
<increment>4</increment> <increment>4</increment>
</contourLabeling> </contourLabeling>
</contourStyle> </contourStyle>
@ -1639,6 +1639,7 @@ in | 39.37 | 0 | 4 | | |..|8000F0FF| | 16 | \
<styleRule> <styleRule>
<paramLevelMatches> <paramLevelMatches>
<parameter>TOTSN</parameter> <parameter>TOTSN</parameter>
<parameter>TOTSN6hr</parameter>
<singleLevel units="SURFACE"></singleLevel> <singleLevel units="SURFACE"></singleLevel>
</paramLevelMatches> </paramLevelMatches>
<contourStyle> <contourStyle>
@ -4084,6 +4085,78 @@ in | .03937 | 0 | 4 | | |..|8000F0FF| | 16 | \
</contourStyle> </contourStyle>
</styleRule> </styleRule>
<styleRule>
<paramLevelMatches>
<parameter>PVV</parameter>
<creatingEntity>HiResW-NMM-East</creatingEntity>
<creatingEntity>HiResW-NMM-West</creatingEntity>
<creatingEntity>HiResW-ARW-East</creatingEntity>
<creatingEntity>HiResW-ARW-West</creatingEntity>
<creatingEntity>HiResW-NMM-AK</creatingEntity>
<creatingEntity>HiResW-NMM-PR</creatingEntity>
<creatingEntity>HiResW-NMM-SJU</creatingEntity>
<creatingEntity>HiResW-ARW-AK</creatingEntity>
<creatingEntity>HiResW-ARW-PR</creatingEntity>
<creatingEntity>HiResW-ARW-SJU</creatingEntity>
</paramLevelMatches>
<contourStyle>
<displayUnits label="-ubar/s">(Pa/s)*-0.1</displayUnits>
<contourLabeling labelFormat="#" labelSpacing="4">
<values>-400 -300 -200 -100 -50 -10 10 50 100 200 300 400</values>
</contourLabeling>
</contourStyle>
</styleRule>
<styleRule>
<paramLevelMatches>
<creatingEntity>HiResW-NMM-East</creatingEntity>
<creatingEntity>HiResW-NMM-West</creatingEntity>
<creatingEntity>HiResW-ARW-East</creatingEntity>
<creatingEntity>HiResW-ARW-West</creatingEntity>
<creatingEntity>HiResW-NMM-AK</creatingEntity>
<creatingEntity>HiResW-NMM-PR</creatingEntity>
<creatingEntity>HiResW-NMM-SJU</creatingEntity>
<creatingEntity>HiResW-ARW-AK</creatingEntity>
<creatingEntity>HiResW-ARW-PR</creatingEntity>
<creatingEntity>HiResW-ARW-SJU</creatingEntity>
<parameter>AV</parameter>
<parameter>RV</parameter>
<parameter>geoVort</parameter>
</paramLevelMatches>
<contourStyle>
<displayUnits label="/1e5s">/s*1.0E5</displayUnits>
<smoothingDistance>100</smoothingDistance>
<contourLabeling labelSpacing="4">
<increment>8</increment>
</contourLabeling>
</contourStyle>
</styleRule>
<!-- * VAdv, dVAdv, PIVA
/1e9s | 1e9 | 0.0 | 4 | | |..|8000F0FF|m| 5 | 1 5 10 20 50
-->
<styleRule>
<paramLevelMatches>
<creatingEntity>HiResW-NMM-East</creatingEntity>
<creatingEntity>HiResW-NMM-West</creatingEntity>
<creatingEntity>HiResW-ARW-East</creatingEntity>
<creatingEntity>HiResW-ARW-West</creatingEntity>
<creatingEntity>HiResW-NMM-AK</creatingEntity>
<creatingEntity>HiResW-NMM-PR</creatingEntity>
<creatingEntity>HiResW-NMM-SJU</creatingEntity>
<creatingEntity>HiResW-ARW-AK</creatingEntity>
<creatingEntity>HiResW-ARW-PR</creatingEntity>
<creatingEntity>HiResW-ARW-SJU</creatingEntity>
<parameter>VAdv</parameter>
<parameter>dVAdv</parameter>
<parameter>PIVA</parameter>
</paramLevelMatches>
<contourStyle>
<displayUnits label="/1e9s">/s*1.0E9</displayUnits>
<contourLabeling labelSpacing="4">
<values>-500 -200 -100 -50 -10 10 50 100 200 500</values>
</contourLabeling>
</contourStyle>
</styleRule>
<styleRule> <styleRule>
<paramLevelMatches> <paramLevelMatches>
<parameter>Wind</parameter> <parameter>Wind</parameter>

View file

@ -62,13 +62,13 @@ public class RotatePanelLayoutMenuAction extends AbstractRightClickAction {
*/ */
@Override @Override
public void run() { public void run() {
RotatePanelsHandler handler = new RotatePanelsHandler(); RotatePanelsHandler.rotateToNextPane((IMultiPaneEditor) getContainer(),
if (!(container instanceof IMultiPaneEditor)) { paneWithFocus);
return;
} }
IMultiPaneEditor editor = (IMultiPaneEditor) container;
editor.setSelectedPane(IMultiPaneEditor.IMAGE_ACTION, null); @Override
handler.rotate(getContainer(), paneWithFocus, 1); public boolean isHidden() {
return container instanceof IMultiPaneEditor == false;
} }
} }

View file

@ -27,216 +27,238 @@ import org.eclipse.core.commands.ExecutionException;
import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.capabilities.BlendableCapability; import com.raytheon.uf.viz.core.rsc.capabilities.BlendableCapability;
import com.raytheon.uf.viz.d2d.core.legend.D2DLegendResource; import com.raytheon.uf.viz.d2d.core.legend.D2DLegendResource;
import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.HistoryList;
import com.raytheon.viz.ui.editor.IMultiPaneEditor; import com.raytheon.viz.ui.editor.IMultiPaneEditor;
import com.raytheon.viz.ui.tools.AbstractTool; import com.raytheon.viz.ui.tools.AbstractTool;
/**
*
* Contains logic for rotating panels
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 30, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class RotatePanelsHandler extends AbstractTool { public class RotatePanelsHandler extends AbstractTool {
public Object execute(ExecutionEvent arg0) throws ExecutionException { public Object execute(ExecutionEvent event) throws ExecutionException {
IDisplayPaneContainer container = EditorUtil.getActiveVizContainer(); IDisplayPaneContainer container = EditorUtil.getActiveVizContainer();
if (container == null) { if (container == null || container instanceof IMultiPaneEditor == false) {
return null; return null;
} }
// direction is usually +1 or -1 to specify which direction to rotate
String dirStr = arg0.getParameter("direction"); // Get editor and panes
// start index is the index to start rotating from, for example if you IMultiPaneEditor editor = (IMultiPaneEditor) container;
// want to display pane 3 then you set startIndex to 2 and direction to IDisplayPane[] panes = getEditorPanes(editor);
// +1, this is done so that if pane 3 has no data it will rotate past
// pane 3 and the next available pane with data. // Get direction to rotate
String startStr = arg0.getParameter("startIndex"); String dirStr = event.getParameter("direction");
// hideIndex can be set to 0 or 1 to specify which half of a blended int direction = Integer.parseInt(dirStr);
// images should be hidden.
String hideIndexStr = arg0.getParameter("hideIndex"); // Get pane to start rotation on
boolean toggle = false; IDisplayPane startPane = null;
int dir = Integer.parseInt(dirStr); String startStr = event.getParameter("startIndex");
if (startStr == null) { if (startStr != null) {
// If there is no startIndex rotate from the currently displayed int startIdx = Integer.parseInt(startStr);
// pane if (editor.displayedPaneCount() > 1) {
if (container instanceof IMultiPaneEditor) { // more than one pane so we want to start on resulting pane
// If it is going from multiple panes to a single pain, toggle startPane = panes[getNextIndex(panes, startIdx, direction)];
// the blended image } else {
toggle = ((IMultiPaneEditor) container).displayedPaneCount() > 1; // Get pane specified by startIdx
} startPane = panes[getNextIndex(panes, startIdx, 0)];
if (rotateCurrent(container, dir)) {
// if it wraps around when we rotate, toggle the blended image.
toggle = true;
} }
} else { } else {
int start = Integer.parseInt(startStr); // No startStr, get first visible pane
rotate(container, start, dir); for (IDisplayPane pane : panes) {
if (pane.isVisible()) {
startPane = pane;
break;
}
}
} }
if (startPane != null) {
Integer hideIndex = null; Integer hideIndex = null;
String hideIndexStr = event.getParameter("hideIndex");
if (hideIndexStr != null) { if (hideIndexStr != null) {
hideIndex = Integer.parseInt(hideIndexStr); hideIndex = Integer.parseInt(hideIndexStr);
} }
if (toggle || hideIndex != null) {
for (IDisplayPane pane : container.getDisplayPanes()) { rotateToNextPane(editor, startPane, direction, hideIndex);
}
return null;
}
/**
* Rotates to next pane in container. If container has > 1 pane displayed,
* will rotate to pane passed in, otherwise to next in line
*
* @param container
* @param pane
*/
public static void rotateToNextPane(IMultiPaneEditor editor,
IDisplayPane pane) {
rotateToNextPane(editor, pane, 1, 0);
}
/**
* Rotates to the next panel given the direction
*
* @param editor
* @param pane
* @param direction
*/
private static void rotateToNextPane(IMultiPaneEditor editor,
IDisplayPane pane, int direction, Integer hideIndex) {
boolean wrapped = false;
IDisplayPane paneToRotateTo = pane;
if (editor.displayedPaneCount() == 1) {
IDisplayPane[] panes = getEditorPanes(editor);
int paneIdx = -1;
for (int i = 0; i < panes.length; ++i) {
if (panes[i] == pane) {
paneIdx = i;
break;
}
}
if (paneIdx >= 0) {
int idxToCheck = paneIdx;
boolean done = false;
do {
int tmpIdx = idxToCheck + direction;
idxToCheck = getNextIndex(panes, idxToCheck, direction);
if (idxToCheck != tmpIdx) {
wrapped = true;
}
IDisplayPane next = panes[idxToCheck];
List<D2DLegendResource> rscs = next.getDescriptor()
.getResourceList()
.getResourcesByTypeAsType(D2DLegendResource.class);
for (D2DLegendResource rsc : rscs) {
if (rsc.hasProducts()) {
paneToRotateTo = next;
done = true;
break;
}
}
} while (idxToCheck != paneIdx && !done);
}
}
rotateToPane(editor, paneToRotateTo, hideIndex, wrapped);
}
/**
* Sets container so pane passed in is the only visible pane
*
* @param container
* @param pane
*/
private static void rotateToPane(IMultiPaneEditor editor,
IDisplayPane pane, Integer hideIndex, boolean wrapped) {
IDisplayPane[] panes = getEditorPanes(editor);
boolean found = false;
for (IDisplayPane editorPane : panes) {
if (editorPane == pane) {
found = true;
break;
}
}
if (found) {
for (IDisplayPane editorPane : panes) {
if (editorPane != pane) {
editor.hidePane(editorPane);
}
}
editor.showPane(pane);
editor.setSelectedPane(IMultiPaneEditor.VISIBLE_PANE, pane);
editor.setSelectedPane(IMultiPaneEditor.IMAGE_ACTION, null);
if (hideIndex == null) {
// Search pane for current resource index
hideIndex = 0;
for (ResourcePair rp : pane.getDescriptor().getResourceList()) { for (ResourcePair rp : pane.getDescriptor().getResourceList()) {
if (rp.getResource() != null if (rp.getResource() != null
&& rp.getResource().hasCapability( && rp.getResource().hasCapability(
BlendableCapability.class)) { BlendableCapability.class)) {
BlendableCapability cap = rp.getResource() hideIndex = rp.getResource()
.getCapability(BlendableCapability.class); .getCapability(BlendableCapability.class)
if (hideIndex != null) { .getResourceIndex();
cap.toggle(hideIndex); }
}
if (wrapped) {
// If we wrapped, switch index
if (hideIndex == 0) {
hideIndex = 1;
} else { } else {
cap.toggle(); hideIndex = 0;
}
}
} }
} }
} }
if (container instanceof IMultiPaneEditor) { // Toggle displayed resource
((IMultiPaneEditor) container).setSelectedPane( for (IDisplayPane p : panes) {
IMultiPaneEditor.IMAGE_ACTION, null); for (ResourcePair rp : p.getDescriptor().getResourceList()) {
if (rp.getResource() != null
&& rp.getResource().hasCapability(
BlendableCapability.class)) {
rp.getResource()
.getCapability(BlendableCapability.class)
.toggle(hideIndex);
} }
return null;
} }
/**
* rotate starting from the activeDisplayPane in direction
*
* @param direction
* should be either 1, or -1
* @return true if the data wrapped to the other side of the pane array.
*/
public boolean rotateCurrent(IDisplayPaneContainer container, int direction) {
if (container instanceof IMultiPaneEditor) {
IMultiPaneEditor mEditor = (IMultiPaneEditor) container;
int index = getIndex(container, mEditor.getActiveDisplayPane());
return rotate(container, index, direction);
} }
return false;
}
public void rotate(IDisplayPaneContainer container, IDisplayPane pane,
int direction) {
if (container instanceof IMultiPaneEditor) {
rotate(container, getIndex(container, pane), direction);
} }
} }
/** /**
* rotate starting from a specific index in direction * Gets the editor panes. Will reorder panes to special A1 ordering of
* UL,UR,LR,LL if number of panes is 4
* *
* @param index * @param editor
* the index to start rotating from * @return
* @param direction
* should be either 1, or -1
* @return true if the data wrapped to the other side of the pane array.
*/ */
private boolean rotate(IDisplayPaneContainer container, int index, private static IDisplayPane[] getEditorPanes(IMultiPaneEditor editor) {
int direction) { IDisplayPane[] panes = editor.getDisplayPanes();
boolean wrapped = false;
IMultiPaneEditor mEditor = (IMultiPaneEditor) container;
IDisplayPane[] panes = mEditor.getDisplayPanes();
if (panes.length == 4) { if (panes.length == 4) {
// Pretend the panels are in the order 0, 1, 3, 2 because IDisplayPane[] tmp = new IDisplayPane[panes.length];
// AWIPS I rotates the panes in a weird order = ul, ur, lr, ll tmp[0] = panes[0];
IDisplayPane[] reorderedPanes = new IDisplayPane[4]; tmp[1] = panes[1];
reorderedPanes[0] = panes[0]; tmp[2] = panes[3];
reorderedPanes[1] = panes[1]; tmp[3] = panes[2];
reorderedPanes[2] = panes[3]; panes = tmp;
reorderedPanes[3] = panes[2]; }
panes = reorderedPanes; return panes;
} }
IDisplayPane paneToShow = null; /**
* Gets the next index in line for rotation given panes, curIdx, and
if (panes != null && index < panes.length && panes.length != 1) { * direction
boolean from4To1 = mEditor.displayedPaneCount() > 1; *
boolean hasProducts = false; * @param panes
if (panes[index] != null) { * @param curIdx
List<D2DLegendResource> rscs = panes[index].getDescriptor() * @param direction
.getResourceList() * @return
.getResourcesByTypeAsType(D2DLegendResource.class); */
for (D2DLegendResource rsc : rscs) { private static int getNextIndex(IDisplayPane[] panes, int curIdx,
hasProducts = rsc.hasProducts(); int direction) {
if (hasProducts) { int idxToCheck = curIdx + direction;
break; if (idxToCheck < 0) {
idxToCheck = panes.length - 1;
} else if (idxToCheck >= panes.length) {
idxToCheck = 0;
} }
} return idxToCheck;
}
if (from4To1 && hasProducts) {
paneToShow = panes[index];
} else {
IDisplayPane displayedPane = null;
boolean done = false;
for (int i = index + direction; !done; i = i + direction) {
if (i < 0) {
i += panes.length;
wrapped = true;
} else if (i >= panes.length) {
wrapped = true;
i -= panes.length;
}
IDisplayPane pane = panes[i];
if (i == index) {
done = true;
}
if (pane != panes[index] && pane != null) {
List<D2DLegendResource> rscs = pane
.getDescriptor()
.getResourceList()
.getResourcesByTypeAsType(
D2DLegendResource.class);
for (D2DLegendResource rsc : rscs) {
if (rsc.hasProducts()) {
displayedPane = pane;
done = true;
break;
}
}
}
}
paneToShow = displayedPane != null ? displayedPane
: panes[index];
}
for (IDisplayPane displayPane : panes) {
if (displayPane != paneToShow) {
mEditor.hidePane(displayPane);
}
}
mEditor.showPane(paneToShow);
mEditor.setSelectedPane(IMultiPaneEditor.VISIBLE_PANE, paneToShow);
container.refresh();
}
try {
HistoryList.getInstance().refreshLatestBundle();
} catch (VizException e) {
e.printStackTrace();
}
return wrapped;
}
private int getIndex(IDisplayPaneContainer container, IDisplayPane pane) {
IMultiPaneEditor mEditor = (IMultiPaneEditor) container;
IDisplayPane[] panes = mEditor.getDisplayPanes();
int currentIndex = -1;
for (int i = 0; i < panes.length; i++) {
if (panes[i] == pane) {
currentIndex = i;
}
}
// Pretend the panels are in the order 0, 1, 3, 2 because
// AWIPS I rotates the panes in a wierd order = ul, ur, lr, ll
if (panes.length == 4 && currentIndex == 3) {
currentIndex = 2;
} else if (panes.length == 4 && currentIndex == 2) {
currentIndex = 3;
}
return currentIndex;
} }
} }

View file

@ -7,7 +7,7 @@
<filterId>Data Provider</filterId> <filterId>Data Provider</filterId>
<settings name="availableText" value="Available Providers:"/> <settings name="availableText" value="Available Providers:"/>
<settings name="selectedText" value="Selected Providers:"/> <settings name="selectedText" value="Selected Providers:"/>
<settings name="showMatch" value="true"/> <settings name="showMatch" value="false"/>
<settings name="showDualList" value="true"/> <settings name="showDualList" value="true"/>
</Filter> </Filter>
<Filter> <Filter>
@ -17,7 +17,7 @@
<settings name="availableText" value="Available Data Sets:"/> <settings name="availableText" value="Available Data Sets:"/>
<settings name="selectedText" value="Selected Data Sets:"/> <settings name="selectedText" value="Selected Data Sets:"/>
<settings name="showRegEx" value="true"/> <settings name="showRegEx" value="true"/>
<settings name="showMatch" value="false"/> <settings name="showMatch" value="true"/>
<settings name="showDualList" value="true"/> <settings name="showDualList" value="true"/>
</Filter> </Filter>
<Filter> <Filter>

View file

@ -30,13 +30,12 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.datadelivery.actions.BandwidthScheduleGraphAction;
/** /**
* *
* This is a utility class used to get data for the bandwidth graph it extends * This is a utility class used to get data for the bandwidth graph it
* the Thread class so you can retrieve data on a separate thread to keep the UI * implements {@link Runnable} so you can retrieve data on a separate thread to
* thread from being blocked. * keep the UI thread from being blocked.
* *
* <pre> * <pre>
* *
@ -45,19 +44,20 @@ import com.raytheon.uf.viz.datadelivery.actions.BandwidthScheduleGraphAction;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 12, 2012 1269 lvenable Initial creation * Dec 12, 2012 1269 lvenable Initial creation
* Feb 14, 2013 1596 djohnson Remove sysouts, correct statusHandler class, handle null response.
* *
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
* @version 1.0 * @version 1.0
*/ */
public class GraphDataUtil extends Thread { public class GraphDataUtil implements Runnable {
/** UFStatus handler */ /** UFStatus handler */
private final IUFStatusHandler statusHandler = UFStatus private final IUFStatusHandler statusHandler = UFStatus
.getHandler(BandwidthScheduleGraphAction.class); .getHandler(GraphDataUtil.class);
/** Graph data request object */ /** Graph data request object */
private GraphDataRequest request; private final GraphDataRequest request = new GraphDataRequest();
/** Graph data response object */ /** Graph data response object */
private GraphDataResponse response; private GraphDataResponse response;
@ -79,7 +79,6 @@ public class GraphDataUtil extends Thread {
* thread. * thread.
*/ */
public GraphDataUtil(IDataUpdated dataUpdatedCB) { public GraphDataUtil(IDataUpdated dataUpdatedCB) {
request = new GraphDataRequest();
this.dataUpdatedCB = dataUpdatedCB; this.dataUpdatedCB = dataUpdatedCB;
} }
@ -99,8 +98,11 @@ public class GraphDataUtil extends Thread {
*/ */
public void retrieveData() { public void retrieveData() {
response = sendRequest(request); response = sendRequest(request);
if (response != null) {
graphData = response.getGraphData(); graphData = response.getGraphData();
} }
}
/** /**
* Get the graph data. If the new data flag is set to true then it will do a * Get the graph data. If the new data flag is set to true then it will do a
@ -155,14 +157,13 @@ public class GraphDataUtil extends Thread {
/** /**
* Thread run method to retrieve the graph data. * Thread run method to retrieve the graph data.
*/ */
@Override
public void run() { public void run() {
System.out.println("Thread - retrieving data...");
retrieveData(); retrieveData();
if (dataUpdatedCB != null) { if (dataUpdatedCB != null) {
dataUpdatedCB.dataUpdated(); dataUpdatedCB.dataUpdated();
} }
System.out.println("Thread - DONE retrieving data...");
} }
} }

View file

@ -139,6 +139,9 @@ public class ArealSelectionDlg extends CaveSWTDialog implements IDataSize {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
if (!areaComp.isEnvelopeValid()) { if (!areaComp.isEnvelopeValid()) {
DataDeliveryUtils.showMessage(getShell(), SWT.OK,
"Validation Error",
"The defined area area is invalid\nAdjust the selected area and try again.");
return; return;
} }

View file

@ -0,0 +1,141 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.datadelivery.browser;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
/**
* Data Browser Utility Class.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 25, 2013 1588 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class DataBrowserUtils {
private static final Pattern WILDCARD_PATTERN = Pattern.compile("\\*");
private static final Pattern SPACES_PATTERN = Pattern.compile("\\s+");
/**
* Search a list of items.
*
* @param search
* The search string
* @param fullList
* List of items to search
* @param matchAnyFlag
* The match any/all flag, true for match any
* @param caseSensitiveFlag
* The case sensitive flag, true for case sensitive
* @param excludeSearchFlag
* The excludeSearchFlag, true for an exclude search
* @return List of matching items
*/
public static List<String> search(String search, String[] fullList,
boolean matchAnyFlag, boolean caseSensitiveFlag,
boolean excludeSearchFlag) {
List<String> results = new ArrayList<String>();
if (search == null) {
return results;
}
// this is used for match all, holds the matched terms to see if all get
// matched or not
List<String> holder = new ArrayList<String>();
String testCaseItem;
if (!caseSensitiveFlag) {
search = search.toLowerCase();
}
String[] searchTerms = SPACES_PATTERN.split(search);
for (String item : fullList) {
for (String term : searchTerms) {
if (!caseSensitiveFlag) {
testCaseItem = item.toLowerCase();
} else {
testCaseItem = item;
}
if (term.contains("*")) {
String[] parts = WILDCARD_PATTERN.split(term);
boolean valid = true;
String part;
for (int i = 0; i < parts.length; i++) {
if (valid == false) {
break;
}
part = parts[i];
if (!testCaseItem.contains(part) != excludeSearchFlag) {
valid = false;
continue;
}
if (i > 0) {
if (!excludeSearchFlag) {
// check the order
if (!(testCaseItem.indexOf(parts[i - 1]) < testCaseItem
.indexOf(parts[i]))) {
valid = false;
}
}
}
}
if (valid) {
results.add(item);
}
} else {
if (testCaseItem.contains(term) != excludeSearchFlag) {
if (matchAnyFlag) {
results.add(item);
} else {
holder.add(term);
}
}
}
}
if (!matchAnyFlag) {
if (holder.size() == searchTerms.length) {
results.add(item);
}
holder.clear();
}
}
return results;
}
}

View file

@ -19,7 +19,7 @@
**/ **/
package com.raytheon.uf.viz.datadelivery.browser; package com.raytheon.uf.viz.datadelivery.browser;
import java.util.ArrayList; import java.util.List;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusAdapter;
@ -54,6 +54,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
* Feb 21, 2012 mpduff Initial creation * Feb 21, 2012 mpduff Initial creation
* Aug 08, 2012 863 jpiatt Added new interface method. * Aug 08, 2012 863 jpiatt Added new interface method.
* Jan 07, 2013 1432 mpduff Fix case sensitive and exclude checkboxes. * Jan 07, 2013 1432 mpduff Fix case sensitive and exclude checkboxes.
* Feb 25, 2013 1588 mpduff Fix match any/all.
* *
* </pre> * </pre>
* *
@ -280,80 +281,19 @@ public class FilterComp extends AbstractFilterComp implements IUpdate {
* Handle the search action. * Handle the search action.
*/ */
private void handleSearch() { private void handleSearch() {
boolean excludeSearch = !exclusionBtn.getSelection(); boolean excludeSearch = exclusionBtn.getSelection();
String search = regExTxt.getText(); String search = regExTxt.getText();
ArrayList<String> tmpFilterList = new ArrayList<String>();
if (search != null && search.length() > 0) { if (search != null && search.length() > 0) {
dualConfig.setSearchField(search); dualConfig.setSearchField(search);
String[] parts;
/* Iterate over the filtered list of items */
String[] filteredList = dualConfig.getFullList().toArray( String[] filteredList = dualConfig.getFullList().toArray(
new String[dualConfig.getFullList().size()]); new String[dualConfig.getFullList().size()]);
// Search contains 1 or more * List<String> tmpFilterList = DataBrowserUtils.search(search,
if (search.contains("*")) { filteredList, matchAnyFlag, caseBtn.getSelection(),
parts = search.split("\\*"); excludeSearch);
if (parts.length > 0) {
ITEM: for (String item : filteredList) {
for (String part : parts) {
if (part.length() > 0) {
if (caseBtn.getSelection()) {
if (item.contains(part) == excludeSearch) {
continue ITEM;
}
} else {
if (!item.toLowerCase().contains(
part.toLowerCase()) == excludeSearch) {
continue ITEM;
}
}
}
}
// all parts are contained in the item, now figure
// out if they are in the right order
int idx = item.indexOf(parts[0]);
for (int i = 1; i < parts.length; i++) {
int curIdx = 0;
if (caseBtn.getSelection()) {
curIdx = item.indexOf(parts[i]);
} else {
curIdx = item.toLowerCase().indexOf(
parts[i].toLowerCase());
}
if (curIdx > idx) {
idx = curIdx;
} else {
break ITEM;
}
}
// Made it this far so item is in list
tmpFilterList.add(item);
}
dualList.clearAvailableList(false);
dualList.setAvailableItems(tmpFilterList);
}
return;
} else {
// No * in search
for (String item : filteredList) {
if (caseBtn.getSelection()) {
if (item.contains(search) == excludeSearch) {
tmpFilterList.add(item);
}
} else {
if (item.toLowerCase().contains(search.toLowerCase()) == excludeSearch) {
tmpFilterList.add(item);
}
}
}
}
// Clear the list and add the newly filtered items // Clear the list and add the newly filtered items
dualList.clearAvailableList(false); dualList.clearAvailableList(false);

View file

@ -805,29 +805,48 @@ public class AreaComp extends Composite implements ISubset {
lr, 0.05); lr, 0.05);
envelopeValid = ulValid && lrValid; envelopeValid = ulValid && lrValid;
int lrColor = SWT.COLOR_WHITE;
int ulColor = SWT.COLOR_WHITE;
StringBuilder errorText = null;
if (envelopeValid) { if (envelopeValid) {
subEnvelope = EnvelopeUtils.createSubenvelopeFromLatLon( subEnvelope = EnvelopeUtils.createSubenvelopeFromLatLon(
fullEnvelope, ul, lr); fullEnvelope, ul, lr);
updateDataSize(); updateDataSize();
} else { } else {
StringBuilder errorText = new StringBuilder(); errorText = new StringBuilder();
errorText.append("The "); errorText.append("The ");
if (ulValid) { if (ulValid) {
errorText.append("Lower Right Coordinate is"); errorText.append("Lower Right Coordinate is");
lrColor = SWT.COLOR_RED;
} else if (lrValid) { } else if (lrValid) {
errorText.append("Upper Left Coordinate is"); errorText.append("Upper Left Coordinate is");
ulColor = SWT.COLOR_RED;
} else { } else {
lrColor = SWT.COLOR_RED;
ulColor = SWT.COLOR_RED;
errorText.append("Lower Right and Upper Left Coordinates are"); errorText.append("Lower Right and Upper Left Coordinates are");
} }
errorText.append(" not within the dataset area."); errorText.append(" not within the dataset area.");
}
// Set the background color before displaying an error message.
Color color = getDisplay().getSystemColor(lrColor);
lowerRightLatTxt.setBackground(color);
lowerRightLonTxt.setBackground(color);
if (lrColor != ulColor) {
color = getDisplay().getSystemColor(ulColor);
}
upperLeftLatTxt.setBackground(color);
upperLeftLonTxt.setBackground(color);
if (errorText != null) {
DataDeliveryUtils.showMessage(getShell(), SWT.OK, DataDeliveryUtils.showMessage(getShell(), SWT.OK,
"Validation Error", errorText.toString()); "Validation Error", errorText.toString());
} }
// Entries are valid so save them off. return envelopeValid;
this.envelopeValid = true;
return true;
} }
/** /**

View file

@ -79,13 +79,16 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
* Dec 18, 2012 1436 bgonzale When creating the filter dialogs, use the loaded * Dec 18, 2012 1436 bgonzale When creating the filter dialogs, use the loaded
* configuration when populating the filters. Fixed selection * configuration when populating the filters. Fixed selection
* icon update when loading from a file. * icon update when loading from a file.
* Feb 24, 2013 1620 mpduff Fixed set clean issue when loading configurations. Set clean
* needs to be called after the data load job is complete.
* *
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
* @version 1.0 * @version 1.0
*/ */
public class FilterExpandBar extends Composite implements IFilterUpdate, IExpandControlAction { public class FilterExpandBar extends Composite implements IFilterUpdate,
IExpandControlAction {
/** /**
* Filter expand bar. * Filter expand bar.
@ -158,7 +161,8 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
gd.widthHint = 600; gd.widthHint = 600;
expandBar.setLayoutData(gd); expandBar.setLayoutData(gd);
FilterDefinitionManager filterMan = FilterDefinitionManager.getInstance(); FilterDefinitionManager filterMan = FilterDefinitionManager
.getInstance();
dataTypeFilterXml = filterMan.getDataTypeXml(); dataTypeFilterXml = filterMan.getDataTypeXml();
filterXml = filterMan.getFilterXml(); filterXml = filterMan.getFilterXml();
@ -174,7 +178,8 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
layout.marginHeight = 0; layout.marginHeight = 0;
layout.marginWidth = 0; layout.marginWidth = 0;
composite.setLayout(layout); composite.setLayout(layout);
composite.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false)); composite
.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
ExpandBarControlsConfig expBarConfig = new ExpandBarControlsConfig(); ExpandBarControlsConfig expBarConfig = new ExpandBarControlsConfig();
expBarConfig.setCollapseAll(true); expBarConfig.setCollapseAll(true);
@ -240,6 +245,7 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
notifyListeners(SWT.SetData, new Event()); notifyListeners(SWT.SetData, new Event());
DataDeliveryGUIUtils DataDeliveryGUIUtils
.markNotBusyInUIThread(jobParent); .markNotBusyInUIThread(jobParent);
setClean();
} }
}); });
} }
@ -256,7 +262,7 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
String displayName = data.getDisplayName(); String displayName = data.getDisplayName();
String filterID = data.getId(); String filterID = data.getId();
// String clazz = data.getClazz(); // String clazz = data.getClazz();
ArrayList<SettingsXML> settingsList = data.getSettingsList(); ArrayList<SettingsXML> settingsList = data.getSettingsList();
DualListConfig dualConfig = new DualListConfig(); DualListConfig dualConfig = new DualListConfig();
@ -266,26 +272,20 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
for (SettingsXML setting : settingsList) { for (SettingsXML setting : settingsList) {
if (setting.getName().equalsIgnoreCase("availableText")) { if (setting.getName().equalsIgnoreCase("availableText")) {
dualConfig.setAvailableListLabel(setting.getValue()); dualConfig.setAvailableListLabel(setting.getValue());
} } else if (setting.getName().equalsIgnoreCase("selectedText")) {
else if (setting.getName().equalsIgnoreCase("selectedText")) {
dualConfig.setSelectedListLabel(setting.getValue()); dualConfig.setSelectedListLabel(setting.getValue());
} } else if (setting.getName().equalsIgnoreCase("showUpDownBtns")) {
else if (setting.getName().equalsIgnoreCase("showUpDownBtns")) {
dualConfig.setShowUpDownBtns(getBoolean(setting.getValue())); dualConfig.setShowUpDownBtns(getBoolean(setting.getValue()));
} } else if (setting.getName().equalsIgnoreCase("listWidth")) {
else if (setting.getName().equalsIgnoreCase("listWidth")) {
dualConfig.setShowUpDownBtns(getBoolean(setting.getValue())); dualConfig.setShowUpDownBtns(getBoolean(setting.getValue()));
} } else if (setting.getName().equalsIgnoreCase("listHeight")) {
else if (setting.getName().equalsIgnoreCase("listHeight")) {
dualConfig.setShowUpDownBtns(getBoolean(setting.getValue())); dualConfig.setShowUpDownBtns(getBoolean(setting.getValue()));
} } else if (setting.getName().equalsIgnoreCase("showRegex")) {
else if (setting.getName().equalsIgnoreCase("showRegex")) {
filterConfig.setRegExVisible(getBoolean(setting.getValue())); filterConfig.setRegExVisible(getBoolean(setting.getValue()));
} } else if (setting.getName().equalsIgnoreCase("showMatch")) {
else if (setting.getName().equalsIgnoreCase("showMatch")) { filterConfig.setMatchControlVisible(getBoolean(setting
filterConfig.setMatchControlVisible(getBoolean(setting.getValue())); .getValue()));
} } else if (setting.getName().equalsIgnoreCase("showDualList")) {
else if (setting.getName().equalsIgnoreCase("showDualList")) {
filterConfig.setDualListVisible(getBoolean(setting.getValue())); filterConfig.setDualListVisible(getBoolean(setting.getValue()));
} }
} }
@ -324,7 +324,8 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
filterConfig.setFilterID(filterID); filterConfig.setFilterID(filterID);
expItem.setText(displayName); expItem.setText(displayName);
FilterComp filterComp = new FilterComp(expandBar, SWT.NONE, this, filterConfig, idx); FilterComp filterComp = new FilterComp(expandBar, SWT.NONE, this,
filterConfig, idx);
expItem.setHeight(filterComp.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); expItem.setHeight(filterComp.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
expItem.setControl(filterComp); expItem.setControl(filterComp);
@ -355,7 +356,7 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
* Parent component. * Parent component.
*/ */
private void addSeparator(Composite parentComp) { private void addSeparator(Composite parentComp) {
GridLayout gl = (GridLayout)parentComp.getLayout(); GridLayout gl = (GridLayout) parentComp.getLayout();
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
gd.horizontalSpan = gl.numColumns; gd.horizontalSpan = gl.numColumns;
@ -381,7 +382,8 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
private void displayEnableFilterDialog() { private void displayEnableFilterDialog() {
if (expandBar.getItemCount() == 0) { if (expandBar.getItemCount() == 0) {
MessageBox mb = new MessageBox(this.getShell(), SWT.ICON_ERROR | SWT.OK); MessageBox mb = new MessageBox(this.getShell(), SWT.ICON_ERROR
| SWT.OK);
mb.setText("Warning"); mb.setText("Warning");
mb.setMessage("No filters are available to enable/disable."); mb.setMessage("No filters are available to enable/disable.");
mb.open(); mb.open();
@ -389,14 +391,15 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
} }
if (enableFilterDlg == null || enableFilterDlg.isDisposed()) { if (enableFilterDlg == null || enableFilterDlg.isDisposed()) {
enableFilterDlg = new EnableFilterDlg(this.getShell(), getFilterNames(), getEnabledFilters()); enableFilterDlg = new EnableFilterDlg(this.getShell(),
getFilterNames(), getEnabledFilters());
enableFilterDlg.open(); enableFilterDlg.open();
if (enableFilterDlg.getReturnValue() != null && (Boolean)enableFilterDlg.getReturnValue() == true) { if (enableFilterDlg.getReturnValue() != null
&& (Boolean) enableFilterDlg.getReturnValue() == true) {
this.enableFilters(enableFilterDlg.getSelectedIndexes()); this.enableFilters(enableFilterDlg.getSelectedIndexes());
} }
} } else {
else {
enableFilterDlg.bringToTop(); enableFilterDlg.bringToTop();
} }
} }
@ -463,7 +466,8 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
ArrayList<Integer> enabledIndexes = new ArrayList<Integer>(); ArrayList<Integer> enabledIndexes = new ArrayList<Integer>();
for (int i = 0; i < expandBar.getItems().length; i++) { for (int i = 0; i < expandBar.getItems().length; i++) {
AbstractFilterComp afc = (AbstractFilterComp)(expandBar.getItem(i).getControl()); AbstractFilterComp afc = (AbstractFilterComp) (expandBar.getItem(i)
.getControl());
if (afc.isEnabled()) { if (afc.isEnabled()) {
enabledIndexes.add(i); enabledIndexes.add(i);
} }
@ -480,11 +484,12 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
*/ */
public void enableFilters(ArrayList<Integer> indexes) { public void enableFilters(ArrayList<Integer> indexes) {
for (ExpandItem ei : expandBar.getItems()) { for (ExpandItem ei : expandBar.getItems()) {
((AbstractFilterComp)ei.getControl()).setEnabled(false); ((AbstractFilterComp) ei.getControl()).setEnabled(false);
} }
for (int idx : indexes) { for (int idx : indexes) {
((AbstractFilterComp)(expandBar.getItem(idx).getControl())).setEnabled(true); ((AbstractFilterComp) (expandBar.getItem(idx).getControl()))
.setEnabled(true);
} }
} }
@ -551,7 +556,8 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
@Override @Override
public void clearAllAction() { public void clearAllAction() {
MessageBox mb = new MessageBox(this.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); MessageBox mb = new MessageBox(this.getShell(), SWT.ICON_QUESTION
| SWT.YES | SWT.NO);
mb.setText("Clear All Filters"); mb.setText("Clear All Filters");
mb.setMessage("You are about to clear all of your filter settings. This\n" mb.setMessage("You are about to clear all of your filter settings. This\n"
+ "cannot be undone.\n\nDo you wish to continue?"); + "cannot be undone.\n\nDo you wish to continue?");
@ -563,7 +569,7 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
for (ExpandItem ei : expandBar.getItems()) { for (ExpandItem ei : expandBar.getItems()) {
if (ei.getControl() instanceof FilterComp) { if (ei.getControl() instanceof FilterComp) {
((FilterComp)ei.getControl()).resetControls(); ((FilterComp) ei.getControl()).resetControls();
} }
} }
} }
@ -600,7 +606,8 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
} }
private void updateFilterSettings() { private void updateFilterSettings() {
ArrayList<FilterTypeXML> filterTypeList = filterSettingsXml.getFilterTypeList(); ArrayList<FilterTypeXML> filterTypeList = filterSettingsXml
.getFilterTypeList();
if (filterTypeList != null && filterTypeList.size() > 0) { if (filterTypeList != null && filterTypeList.size() > 0) {
for (FilterTypeXML ftx : filterTypeList) { for (FilterTypeXML ftx : filterTypeList) {
if (ftx.getFilterType().equals("Data Type")) { if (ftx.getFilterType().equals("Data Type")) {
@ -627,12 +634,18 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
if (ei.getText().equals(filter)) { if (ei.getText().equals(filter)) {
Control control = ei.getControl(); Control control = ei.getControl();
if (control instanceof FilterComp) { if (control instanceof FilterComp) {
FilterComp fc = (FilterComp)control; FilterComp fc = (FilterComp) control;
String[] items = filterTypeXml.getValues().toArray( String[] items = filterTypeXml
new String[filterTypeXml.getValues().size()]); .getValues()
if (items != null && items.length > 0) { .toArray(
new String[filterTypeXml
.getValues()
.size()]);
if (items != null
&& items.length > 0) {
fc.selectItems(items); fc.selectItems(items);
ei.setImage(filterImgs.getExpandItemImage(ExpandItemState.Entries)); ei.setImage(filterImgs
.getExpandItemImage(ExpandItemState.Entries));
} }
} }
} }
@ -646,14 +659,17 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
} }
/** /**
* Populate the filters.
*
* @param filterSettingsXml * @param filterSettingsXml
* Settings to populate
*/ */
public void populateFilterSettingsXml(FilterSettingsXML filterSettingsXml) { public void populateFilterSettingsXml(FilterSettingsXML filterSettingsXml) {
ExpandItem[] items = expandBar.getItems(); ExpandItem[] items = expandBar.getItems();
for (ExpandItem item : items) { for (ExpandItem item : items) {
Control control = item.getControl(); Control control = item.getControl();
if (control instanceof FilterComp) { if (control instanceof FilterComp) {
FilterComp fc = (FilterComp)control; FilterComp fc = (FilterComp) control;
String[] selectedItems = fc.getSelectedListItems(); String[] selectedItems = fc.getSelectedListItems();
ArrayList<String> values = new ArrayList<String>(); ArrayList<String> values = new ArrayList<String>();
for (String selectedItem : selectedItems) { for (String selectedItem : selectedItems) {
@ -687,7 +703,7 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
public boolean isDirty() { public boolean isDirty() {
ExpandItem[] items = expandBar.getItems(); ExpandItem[] items = expandBar.getItems();
for (ExpandItem item : items) { for (ExpandItem item : items) {
FilterComp comp = (FilterComp)item.getControl(); FilterComp comp = (FilterComp) item.getControl();
if (comp != null) { if (comp != null) {
if (comp.isDirty()) { if (comp.isDirty()) {
return true; return true;
@ -704,16 +720,20 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
public void setClean() { public void setClean() {
ExpandItem[] items = expandBar.getItems(); ExpandItem[] items = expandBar.getItems();
for (ExpandItem item : items) { for (ExpandItem item : items) {
FilterComp comp = (FilterComp)item.getControl(); FilterComp comp = (FilterComp) item.getControl();
if (comp != null) { if (comp != null) {
comp.setDirty(false); comp.setDirty(false);
} }
} }
} }
/**
* Set the referenced envelope.
*
* @param envelope
* The ReferencedEnvelope
*/
public void setEnvelope(ReferencedEnvelope envelope) { public void setEnvelope(ReferencedEnvelope envelope) {
this.envelope = envelope; this.envelope = envelope;
} }
} }

View file

@ -30,7 +30,6 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.service.IGroupDefinitionService; import com.raytheon.uf.common.datadelivery.service.IGroupDefinitionService;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -51,6 +50,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 2, 2013 1441 djohnson Initial creation * Jan 2, 2013 1441 djohnson Initial creation
* Jan 18, 2013 1441 djohnson Use group definition service. * Jan 18, 2013 1441 djohnson Use group definition service.
* Feb 26, 2013 1643 djohnson Catch any exception.
* *
* </pre> * </pre>
* *
@ -157,7 +157,7 @@ public class DeleteGroupDlg extends CaveSWTDialog {
.getByName(groupName)); .getByName(groupName));
groupAction.loadGroupNames(); groupAction.loadGroupNames();
return true; return true;
} catch (RegistryHandlerException e) { } catch (Exception e) {
statusHandler.handle(Priority.ERROR, statusHandler.handle(Priority.ERROR,
"Unable to delete a group.", e); "Unable to delete a group.", e);
} }

View file

@ -19,13 +19,13 @@
**/ **/
package com.raytheon.uf.viz.datadelivery.subscription; package com.raytheon.uf.viz.datadelivery.subscription;
import com.raytheon.uf.common.auth.resp.SuccessfulExecution; import java.rmi.RemoteException;
import com.raytheon.uf.common.auth.user.IUser; import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest; import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission; import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.serialization.comm.RequestRouter; import com.raytheon.uf.common.datadelivery.service.BasePrivilegedDataDeliveryService;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
/** /**
@ -40,6 +40,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 04, 2013 1441 djohnson Initial creation * Jan 04, 2013 1441 djohnson Initial creation
* Jan 21, 2013 1441 djohnson Use RequestRouter. * Jan 21, 2013 1441 djohnson Use RequestRouter.
* Feb 26, 2013 1643 djohnson Extends base class.
* *
* </pre> * </pre>
* *
@ -47,7 +48,9 @@ import com.raytheon.uf.viz.core.exception.VizException;
* @version 1.0 * @version 1.0
*/ */
public class RequestFromServerPermissionsService implements IPermissionsService { public class RequestFromServerPermissionsService extends
BasePrivilegedDataDeliveryService<DataDeliveryAuthRequest> implements
IPermissionsService {
/** /**
* Adapts the {@link DataDeliveryAuthRequestAdapter} to match the * Adapts the {@link DataDeliveryAuthRequestAdapter} to match the
@ -84,27 +87,6 @@ public class RequestFromServerPermissionsService implements IPermissionsService
} }
} }
/**
* Send an authorization request. Private because the method of constructing
* an authorization request and processing the response should remain
* isolated to this utility class.
*
* @param request
* The request object
* @return DataDeliveryAuthReqeust object
* @throws VizException
*/
private DataDeliveryAuthRequest sendAuthorizationRequest(
DataDeliveryAuthRequest request) throws VizException {
try {
return (DataDeliveryAuthRequest) ((SuccessfulExecution) RequestRouter
.route(request, DataDeliveryConstants.DATA_DELIVERY_SERVER))
.getResponse();
} catch (Exception e) {
throw new VizException(e);
}
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -165,8 +147,13 @@ public class RequestFromServerPermissionsService implements IPermissionsService
request.addRequestedPermissions(permissions); request.addRequestedPermissions(permissions);
request.setNotAuthorizedMessage(notAuthorizedMessage); request.setNotAuthorizedMessage(notAuthorizedMessage);
DataDeliveryAuthRequest r = sendAuthorizationRequest(request);
try {
DataDeliveryAuthRequest r = sendRequest(request,
DataDeliveryAuthRequest.class);
return new DataDeliveryAuthRequestAdapter(r); return new DataDeliveryAuthRequestAdapter(r);
} catch (RemoteException e) {
throw new VizException(e);
}
} }
} }

View file

@ -53,6 +53,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Sep 24, 2012 1157 mpduff Use InitialPendingSubsription. * Sep 24, 2012 1157 mpduff Use InitialPendingSubsription.
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes. * Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
* Jan 25, 2013 1528 djohnson Compare priorities as primitive ints. * Jan 25, 2013 1528 djohnson Compare priorities as primitive ints.
* Jan 30, 2013 1543 djohnson Use List instead of ArrayList.
* *
* </pre> * </pre>
* *
@ -239,8 +240,8 @@ public class SubscriptionDiff {
diffMap.put("coverage", true); diffMap.put("coverage", true);
} }
ArrayList<Parameter> subParamList = sub.getParameter(); List<Parameter> subParamList = sub.getParameter();
ArrayList<Parameter> pendingSubParamList = pendingSub.getParameter(); List<Parameter> pendingSubParamList = pendingSub.getParameter();
ArrayList<String> subParams = new ArrayList<String>(); ArrayList<String> subParams = new ArrayList<String>();
ArrayList<String> pendingSubParams = new ArrayList<String>(); ArrayList<String> pendingSubParams = new ArrayList<String>();

View file

@ -24,6 +24,8 @@ import java.util.Set;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
@ -57,6 +59,7 @@ import com.raytheon.viz.ui.presenter.components.ListConf;
* Nov 20, 2012 1286 djohnson Implement displayYesNoPopup. * Nov 20, 2012 1286 djohnson Implement displayYesNoPopup.
* Jan 04, 2013 1420 mpduff Add Priority Composite. * Jan 04, 2013 1420 mpduff Add Priority Composite.
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum. * Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
* Feb 26, 2013 1592 djohnson When the shell is closed, don't submit the query.
* *
* </pre> * </pre>
* *
@ -240,6 +243,13 @@ public class GriddedTimingSelectionDlg extends CaveSWTDialog implements
cancelBtnConf.getOnClickAction().run(); cancelBtnConf.getOnClickAction().run();
} }
}); });
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent event) {
cancelBtnConf.getOnClickAction().run();
}
});
} }
/** /**

View file

@ -58,6 +58,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Dec 07, 2012 1278 bgonzale additional param to AreaComp ctor. * Dec 07, 2012 1278 bgonzale additional param to AreaComp ctor.
* Dec 18, 2012 1439 mpduff Redo subset name validation. * Dec 18, 2012 1439 mpduff Redo subset name validation.
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes. * Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
* Feb 20, 2013 1589 mpduff Fix to allow saving custom areas.
* *
* </pre> * </pre>
* *
@ -251,7 +252,6 @@ public class SpatialSubsetTab extends SubsetTab implements IDataSize {
return; return;
} }
AreaXML area = getSaveInfo(); AreaXML area = getSaveInfo();
SubsetFileManager.getInstance() SubsetFileManager.getInstance()
@ -346,7 +346,7 @@ public class SpatialSubsetTab extends SubsetTab implements IDataSize {
*/ */
public AreaXML getSaveInfo() { public AreaXML getSaveInfo() {
ReferencedEnvelope envelope = null; ReferencedEnvelope envelope = null;
if(useDataSetSize){ if (useDataSetSize) {
envelope = fullEnvelope; envelope = fullEnvelope;
} else { } else {
envelope = areaComp.getEnvelope(); envelope = areaComp.getEnvelope();
@ -362,6 +362,8 @@ public class SpatialSubsetTab extends SubsetTab implements IDataSize {
if (areaComp.selectCombo.getEnabled()) { if (areaComp.selectCombo.getEnabled()) {
area.setRegionName(name); area.setRegionName(name);
} else {
area.setRegionName(getRegionSaveText());
} }
return area; return area;
} }

View file

@ -126,6 +126,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Jan 04, 2012 1420 mpduff Pass the subscription in to the GriddedTimingSelectionDlg. * Jan 04, 2012 1420 mpduff Pass the subscription in to the GriddedTimingSelectionDlg.
* Jan 10, 2013 1444 mpduff Fix the loading of saved subsets from the saved subset tab. * Jan 10, 2013 1444 mpduff Fix the loading of saved subsets from the saved subset tab.
* Jan 28, 2013 1530 djohnson Break out long method chaining into local variables for debugging. * Jan 28, 2013 1530 djohnson Break out long method chaining into local variables for debugging.
* Jan 30, 2013 1543 djohnson Use List instead of ArrayList.
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -887,7 +888,7 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
// Vertical/Parameters // Vertical/Parameters
Map<String, VerticalXML> levelMap = new HashMap<String, VerticalXML>(); Map<String, VerticalXML> levelMap = new HashMap<String, VerticalXML>();
ArrayList<Parameter> paramaterList = this.subscription.getParameter(); List<Parameter> paramaterList = this.subscription.getParameter();
for (Parameter p : paramaterList) { for (Parameter p : paramaterList) {
for (DataLevelType levelType : p.getLevelType()) { for (DataLevelType levelType : p.getLevelType()) {

View file

@ -63,6 +63,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jan 10, 2013 1420 mdpuff Added getMaxLatency(). * Jan 10, 2013 1420 mdpuff Added getMaxLatency().
* Jan 14, 2013 1286 djohnson Fix IndexOutOfBounds exception from getMaxLatency. * Jan 14, 2013 1286 djohnson Fix IndexOutOfBounds exception from getMaxLatency.
* Jan 22, 2013 1519 djohnson Correct getMaxLatency() calculations. * Jan 22, 2013 1519 djohnson Correct getMaxLatency() calculations.
* Jan 30, 2013 1543 djohnson Use List instead of ArrayList.
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -515,7 +516,7 @@ public class DataDeliveryUtils {
} }
fmtStr.append("Parameters:").append(newline); fmtStr.append("Parameters:").append(newline);
ArrayList<Parameter> parmArray = sub.getParameter(); List<Parameter> parmArray = sub.getParameter();
for (Parameter p : parmArray) { for (Parameter p : parmArray) {
fmtStr.append("------ Name: ").append(p.getName()).append(newline); fmtStr.append("------ Name: ").append(p.getName()).append(newline);
fmtStr.append("------ Provider Name: ").append(p.getProviderName()) fmtStr.append("------ Provider Name: ").append(p.getProviderName())

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter abbreviation="HAILPROB" name="Hail Probability" unit="%"/>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter abbreviation="PRSIGSV" name="Total Probability of Extreme Severe Thunderstorms" unit="%"/>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter abbreviation="PRSVR" name="Total Probability of Severe Thunderstorms" unit="%"/>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter abbreviation="SIGHAILPROB" name="Significant Hail Probability" unit="%"/>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter abbreviation="SIGTRNDPROB" name="Significant Tornado Probability" unit="%"/>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter abbreviation="SIGWINDPROB" name="Significant Wind Probability" unit="%"/>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter abbreviation="WINDPROB" name="Wind Probability" unit="%"/>

View file

@ -60,6 +60,8 @@ import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableNode;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 30, 2012 mschenke Initial creation * Jan 30, 2012 mschenke Initial creation
* Feb 25, 2013 1659 bsteffen Stop derived parameters from sending
* empty requests for cached times
* *
* </pre> * </pre>
* *
@ -120,11 +122,14 @@ public abstract class AbstractDataCubeAdapter implements IDataCubeAdapter {
} }
// bulk up all the requests. // bulk up all the requests.
DbQueryResponse[] responses = new DbQueryResponse[0];
if (!fullList.isEmpty()) {
DbQueryRequestSet requestSet = new DbQueryRequestSet(); DbQueryRequestSet requestSet = new DbQueryRequestSet();
requestSet.setQueries(fullList.toArray(new DbQueryRequest[0])); requestSet.setQueries(fullList.toArray(new DbQueryRequest[0]));
DbQueryResponseSet responseSet = (DbQueryResponseSet) ThriftClient DbQueryResponseSet responseSet = (DbQueryResponseSet) ThriftClient
.sendRequest(requestSet); .sendRequest(requestSet);
DbQueryResponse[] responses = responseSet.getResults(); responses = responseSet.getResults();
}
int responseIndex = 0; int responseIndex = 0;
List<List<DataTime>> finalResponse = new ArrayList<List<DataTime>>( List<List<DataTime>> finalResponse = new ArrayList<List<DataTime>>(
requests.size()); requests.size());

View file

@ -54,6 +54,8 @@ import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableNode.Dependency;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 11, 2012 bsteffen Initial creation * Apr 11, 2012 bsteffen Initial creation
* Feb 25, 2013 1659 bsteffen Stop derived parameters from sending
* empty requests for cached times
* *
* </pre> * </pre>
* *
@ -171,16 +173,19 @@ public class AvailabilityContainer {
*/ */
protected void processRequests() throws VizException { protected void processRequests() throws VizException {
List<DbQueryRequest> requests = getAvailabilityRequests(); List<DbQueryRequest> requests = getAvailabilityRequests();
Map<DbQueryRequest, DbQueryResponse> responseMap = new HashMap<DbQueryRequest, DbQueryResponse>(
(int) (requests.size() / 0.75) + 1, 0.75f);
if (!requests.isEmpty()) {
DbQueryRequestSet requestSet = new DbQueryRequestSet(); DbQueryRequestSet requestSet = new DbQueryRequestSet();
requestSet.setQueries(requests.toArray(new DbQueryRequest[0])); requestSet.setQueries(requests.toArray(new DbQueryRequest[0]));
DbQueryResponseSet responseSet = (DbQueryResponseSet) ThriftClient DbQueryResponseSet responseSet = (DbQueryResponseSet) ThriftClient
.sendRequest(requestSet); .sendRequest(requestSet);
DbQueryResponse[] responses = responseSet.getResults(); DbQueryResponse[] responses = responseSet.getResults();
Map<DbQueryRequest, DbQueryResponse> responseMap = new HashMap<DbQueryRequest, DbQueryResponse>(
(int) (responses.length / 0.75) + 1, 0.75f);
for (int i = 0; i < responses.length; i++) { for (int i = 0; i < responses.length; i++) {
responseMap.put(requests.get(i), responses[i]); responseMap.put(requests.get(i), responses[i]);
} }
}
setAvailabilityResponses(responseMap); setAvailabilityResponses(responseMap);
} }

View file

@ -26,7 +26,8 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import javax.measure.unit.Unit; import javax.measure.unit.Unit;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
@ -155,7 +156,7 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
private Map<String, DerivParamDesc> derParLibrary; private Map<String, DerivParamDesc> derParLibrary;
private ArrayBlockingQueue<DerivedParameterRequest> toDoList; private BlockingQueue<DerivedParameterRequest> toDoList;
private static int numJobs = 2; private static int numJobs = 2;
@ -233,7 +234,7 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
} }
} }
toDoList = new ArrayBlockingQueue<DerivedParameterRequest>(50); toDoList = new LinkedBlockingQueue<DerivedParameterRequest>();
LocalizationFile dir = PathManagerFactory.getPathManager() LocalizationFile dir = PathManagerFactory.getPathManager()
.getStaticLocalizationFile(DERIV_PARAM_DIR); .getStaticLocalizationFile(DERIV_PARAM_DIR);
if (dir != null) { if (dir != null) {

View file

@ -2,5 +2,6 @@
<classpath> <classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>ncsa.hdf5.linux32</name> <name>com.raytheon.uf.viz.event</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>

View file

@ -1,5 +1,6 @@
#Thu Mar 26 11:23:11 CDT 2009 #Tue Feb 05 09:52:42 CST 2013
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

View file

@ -0,0 +1,18 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Event
Bundle-SymbolicName: com.raytheon.uf.viz.event
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.event.Activator
Bundle-Vendor: RAYTHEON
Require-Bundle: org.eclipse.core.runtime,
com.raytheon.uf.common.event;bundle-version="1.0.0",
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.status;bundle-version="1.12.1174",
org.eclipse.ui;bundle-version="3.6.1",
org.apache.log4j;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.event
Eclipse-BuddyPolicy: ext, registered, global
Eclipse-RegisterBuddy: com.raytheon.uf.common.event

View file

@ -0,0 +1 @@
com.raytheon.uf.viz.event.CaveEventBusHandler

View file

@ -0,0 +1,83 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.event;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.raytheon.uf.viz.event";
// The shared instance
private static Activator plugin;
private BundleContext ctx;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
* )
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
this.ctx = context;
plugin = this;
}
public BundleContext getContext() {
return ctx;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
* )
*/
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
}

View file

@ -0,0 +1,104 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.event;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import com.raytheon.uf.common.event.Event;
import com.raytheon.uf.common.event.EventPublishRequest;
import com.raytheon.uf.common.event.IEventBusHandler;
import com.raytheon.uf.common.serialization.comm.RequestRouter;
/**
* Cave implementation of the {@link IEventBusHandler}
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 5, 2013 1580 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class CaveEventBusHandler implements IEventBusHandler {
/** Core pool size */
private final int corePoolSize = 1;
/** Max pool size */
private final int maxPoolSize = 3;
/** Time for threads to live */
private final int keepAliveTime = 1;
/** Max queue size */
private final int maxQueueSize = 10;
/** Thread pool executor */
private final ThreadPoolExecutor executor = new ThreadPoolExecutor(
corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.MINUTES,
new ArrayBlockingQueue<Runnable>(maxQueueSize));
{
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
}
/**
* {@inheritDoc}
*/
@Override
public void publish(final Event event) {
executor.execute(new Runnable() {
@Override
public void run() {
EventPublishRequest request = new EventPublishRequest(event);
try {
RequestRouter.route(request);
} catch (Exception e) {
// ignore failed
}
}
});
}
/**
* This method is not supported in CAVE and will throw and
* UnsupportedOperationException.
*/
@Override
public void register(Object subscriber) {
throw new UnsupportedOperationException();
}
/**
* This method is not supported in CAVE and will throw and
* UnsupportedOperationException.
*/
@Override
public void unregister(Object subscriber) {
throw new UnsupportedOperationException();
}
}

View file

@ -251,12 +251,6 @@
install-size="0" install-size="0"
version="0.0.0"/> version="0.0.0"/>
<plugin
id="ncsa.hdf5"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin <plugin
id="com.raytheon.uf.common.message" id="com.raytheon.uf.common.message"
download-size="0" download-size="0"
@ -271,13 +265,6 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.common.datastorage.hdf5"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="com.raytheon.uf.common.geospatial" id="com.raytheon.uf.common.geospatial"
download-size="0" download-size="0"

View file

@ -130,6 +130,8 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 26, 2010 mnash Initial creation * May 26, 2010 mnash Initial creation
* Feb 13, 2013 1610 mschenke Fixed null pointer by repopulating LocalizationFileGroupData
* objects even if they weren't expanded
* *
* </pre> * </pre>
* *
@ -591,14 +593,18 @@ public class FileTreeView extends ViewPart implements IPartListener2,
} }
private void expand(Map<FileTreeEntryData, Boolean> map, TreeItem item) { private void expand(Map<FileTreeEntryData, Boolean> map, TreeItem item) {
if (map.containsKey(item.getData()) && map.get(item.getData())) { boolean wasExpanded = map.containsKey(item.getData())
&& map.get(item.getData());
if (wasExpanded || item.getData() instanceof LocalizationFileGroupData) {
populateNode(item); populateNode(item);
if (wasExpanded) {
item.setExpanded(true); item.setExpanded(true);
for (TreeItem child : item.getItems()) { for (TreeItem child : item.getItems()) {
expand(map, child); expand(map, child);
} }
} }
} }
}
/** /**
* Initial population of the tree. * Initial population of the tree.

View file

@ -20,7 +20,12 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.viz.localization, com.raytheon.uf.viz.localization,
javax.measure;bundle-version="1.0.0", javax.measure;bundle-version="1.0.0",
com.raytheon.uf.common.ohd;bundle-version="1.12.1174", com.raytheon.uf.common.ohd;bundle-version="1.12.1174",
com.raytheon.uf.common.cache;bundle-version="1.12.1174" com.raytheon.uf.common.cache;bundle-version="1.12.1174",
com.raytheon.uf.common.stats;bundle-version="1.0.0",
com.raytheon.uf.viz.stats;bundle-version="1.0.0",
com.raytheon.uf.common.event;bundle-version="1.0.0",
com.raytheon.uf.common.dataaccess;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Import-Package: com.raytheon.uf.common.colormap, Import-Package: com.raytheon.uf.common.colormap,

View file

@ -11,25 +11,22 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.NavigableMap; import java.util.NavigableMap;
import java.util.Set;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentNavigableMap; import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPAggregateRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPAggregateRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPCacheRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord; import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
@ -59,7 +56,6 @@ import com.raytheon.uf.viz.core.HDF5Util;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage; import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
import com.raytheon.uf.viz.core.comm.Loader;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.monitor.IMonitor; import com.raytheon.uf.viz.monitor.IMonitor;
import com.raytheon.uf.viz.monitor.ResourceMonitor; import com.raytheon.uf.viz.monitor.ResourceMonitor;
@ -92,6 +88,11 @@ import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
* 12/07/12 1353 rferrel Changes for non-blocking FFMPSplash. * 12/07/12 1353 rferrel Changes for non-blocking FFMPSplash.
* 01/10/13 1475 D. Hladky Cleaned up some logging. * 01/10/13 1475 D. Hladky Cleaned up some logging.
* 01/27/13 1478 D. Hladky revamped cache file format, removed duplicate times * 01/27/13 1478 D. Hladky revamped cache file format, removed duplicate times
* 02/01/13 1569 D. Hladky updated constants
* 02/01/13 1627 D. Hladky removed unused(useless) db load method
* 02/19/13 1639 njensen Replaced ConcurrentHashMaps with data structures
* 02/20/13 1635 D. Hladky Fixed multi guidance sources
* Mar 6, 2013 1769 dhladky Changed threading to use count down latch.
* *
* </pre> * </pre>
* *
@ -118,17 +119,7 @@ public class FFMPMonitor extends ResourceMonitor {
/** Pattern for dates in radar */ /** Pattern for dates in radar */
public static String datePattern = "yyyy-MM-dd HH:mm:ss"; public static String datePattern = "yyyy-MM-dd HH:mm:ss";
/** FFMP Records indexed by site, times and field **/ private FFMPSiteDataContainer siteDataMap = new FFMPSiteDataContainer();
public ConcurrentHashMap<String, ConcurrentHashMap<String, FFMPCacheRecord>> ffmpData = null;
// list of earliest available date queried by site, sourceName
public ConcurrentHashMap<String, ConcurrentHashMap<String, Date>> ffmpAvailableUriQueryDates = null;
// map by site, sourceName, Date
public ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentSkipListMap<Date, List<String>>>> ffmpAvailableUris = null;
// map by field, huc, and the URIs that have been loaded for
public ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>> ffmpLoadedUris = null;
// Interpolation Guidance Sources // Interpolation Guidance Sources
public FFMPGuidanceInterpolation interpolation = null; public FFMPGuidanceInterpolation interpolation = null;
@ -184,19 +175,7 @@ public class FFMPMonitor extends ResourceMonitor {
} }
// clear all remaining data // clear all remaining data
if (ffmpData != null) { siteDataMap.clear();
for (String key : ffmpData.keySet()) {
for (Entry<String, FFMPCacheRecord> entry : ffmpData.get(key)
.entrySet()) {
entry.getValue().closeCache();
}
}
}
ffmpData = null;
ffmpAvailableUriQueryDates = null;
ffmpAvailableUris = null;
ffmpLoadedUris = null;
// kill this monitor // kill this monitor
monitor = null; monitor = null;
@ -250,7 +229,6 @@ public class FFMPMonitor extends ResourceMonitor {
public static synchronized FFMPMonitor getInstance() { public static synchronized FFMPMonitor getInstance() {
if (monitor == null) { if (monitor == null) {
monitor = new FFMPMonitor(); monitor = new FFMPMonitor();
monitor.createDataStructures();
isInitialized = true; isInitialized = true;
} }
@ -310,16 +288,6 @@ public class FFMPMonitor extends ResourceMonitor {
return ffmpConfig; return ffmpConfig;
} }
/**
* Creates the linked maps
*/
private void createDataStructures() {
ffmpData = new ConcurrentHashMap<String, ConcurrentHashMap<String, FFMPCacheRecord>>();
ffmpAvailableUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentSkipListMap<Date, List<String>>>>();
ffmpAvailableUriQueryDates = new ConcurrentHashMap<String, ConcurrentHashMap<String, Date>>();
ffmpLoadedUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>>();
}
/** /**
* gets the URI's by field type and site * gets the URI's by field type and site
* *
@ -328,69 +296,11 @@ public class FFMPMonitor extends ResourceMonitor {
* @param phuc * @param phuc
* @return * @return
*/ */
private ConcurrentHashMap<String, String> getUriMap(String siteKey, private List<String> getLoadedUris(String siteKey, String source,
String source, String phuc) { String phuc) {
FFMPSiteData siteData = siteDataMap.get(siteKey);
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> siteLoadedUris = null; FFMPSourceData sourceData = siteData.getSourceData(source);
return sourceData.getLoadedUris(phuc);
if (ffmpLoadedUris != null) {
siteLoadedUris = ffmpLoadedUris.get(siteKey);
}
if (siteLoadedUris == null) {
siteLoadedUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>();
ffmpLoadedUris.put(siteKey, siteLoadedUris);
}
ConcurrentHashMap<String, ConcurrentHashMap<String, String>> sourceLoadedUris = null;
if (ffmpLoadedUris != null) {
sourceLoadedUris = ffmpLoadedUris.get(siteKey).get(source);
}
if (sourceLoadedUris == null) {
sourceLoadedUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>();
ffmpLoadedUris.get(siteKey).put(source, sourceLoadedUris);
}
ConcurrentHashMap<String, String> hucLoadedUris = null;
if (ffmpLoadedUris != null) {
hucLoadedUris = ffmpLoadedUris.get(siteKey).get(source).get(phuc);
}
if (hucLoadedUris == null) {
hucLoadedUris = new ConcurrentHashMap<String, String>(200, 0.75f, 4);
if (ffmpLoadedUris != null) {
ffmpLoadedUris.get(siteKey).get(source)
.put(phuc, hucLoadedUris);
}
}
return hucLoadedUris;
}
/**
* Static to make it fast, at least that's the idea.
*
* @param uri
* @return
* @throws VizException
*/
private static FFMPRecord loadRecordFromDatabase(String uri)
throws VizException {
FFMPRecord ffmpRec = null;
if (uri != null) {
Map<String, Object> vals = new HashMap<String, Object>();
vals.put("pluginName", "ffmp");
vals.put("dataURI", uri);
ffmpRec = (FFMPRecord) Loader.loadData(vals);
}
return ffmpRec;
} }
/** /**
@ -427,12 +337,11 @@ public class FFMPMonitor extends ResourceMonitor {
for (String uri : uris) { for (String uri : uris) {
if (uri != null) { if (uri != null) {
if (dupOverride if (dupOverride
|| !getUriMap(siteKey, source, phuc) || !getLoadedUris(siteKey, source, phuc)
.containsKey(uri)) { .contains(uri)) {
try { try {
populateFFMPRecord(isProductLoad, siteKey, populateFFMPRecord(isProductLoad, siteKey,
loadRecordFromDatabase(uri), new FFMPRecord(uri), source, phuc);
source, phuc);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"FFMP Can't retrieve FFMP URI, " "FFMP Can't retrieve FFMP URI, "
@ -455,19 +364,18 @@ public class FFMPMonitor extends ResourceMonitor {
* @return * @return
* @throws VizException * @throws VizException
*/ */
public FFMPCacheRecord populateFFMPRecord(boolean isProductLoad, public FFMPRecord populateFFMPRecord(boolean isProductLoad, String uri,
String uri, String siteKey, String source, String phuc) String siteKey, String source, String phuc) throws Exception {
throws Exception {
try { try {
populateFFMPRecord(isProductLoad, siteKey, populateFFMPRecord(isProductLoad, siteKey, new FFMPRecord(uri),
loadRecordFromDatabase(uri), source, phuc); source, phuc);
} catch (VizException e) { } catch (VizException e) {
statusHandler.handle(Priority.INFO, statusHandler.handle(Priority.INFO,
"FFMP Can't retrieve FFMP URI, " + uri, e); "FFMP Can't retrieve FFMP URI, " + uri, e);
} }
return ffmpData.get(siteKey).get(source); return siteDataMap.get(siteKey).getSourceData(source).getRecord();
} }
/** /**
@ -480,15 +388,14 @@ public class FFMPMonitor extends ResourceMonitor {
*/ */
public void insertFFMPData(FFMPAggregateRecord data, String siteKey, public void insertFFMPData(FFMPAggregateRecord data, String siteKey,
String source) { String source) {
// TODO do we need this method if we're no longer supporting cache
if (ffmpData.containsKey(siteKey)) { // records?
if (ffmpData.get(siteKey).containsKey(source)) { if (siteDataMap.containsSite(siteKey)) {
if (siteDataMap.get(siteKey).containsSource(source)) {
for (Entry<String, FFMPBasinData> entry : data.getBasinsMap() for (Entry<String, FFMPBasinData> entry : data.getBasinsMap()
.entrySet()) { .entrySet()) {
FFMPBasinData basinData = entry.getValue(); FFMPBasinData basinData = entry.getValue();
basinData.populate(data.getTimes()); basinData.populate(data.getTimes());
ffmpData.get(siteKey).get(source)
.setCacheData(basinData, basinData.getHucLevel());
} }
} }
} }
@ -526,19 +433,18 @@ public class FFMPMonitor extends ResourceMonitor {
String source, String phuc, FFMPBasin basin) throws VizException { String source, String phuc, FFMPBasin basin) throws VizException {
if (dataUri != null) { if (dataUri != null) {
ConcurrentMap<String, String> uris = getUriMap(siteKey, source, List<String> uris = getLoadedUris(siteKey, source, phuc);
phuc); if (!uris.contains(dataUri)) {
if (!uris.containsKey(dataUri)) {
try { try {
SourceXML sourceXML = fscm.getSource(source); SourceXML sourceXML = fscm.getSource(source);
FFMPCacheRecord ffmpRec = populateFFMPRecord(true, dataUri, FFMPRecord ffmpRec = populateFFMPRecord(true, dataUri,
siteKey, source, phuc); siteKey, source, phuc);
File loc = HDF5Util.findHDF5Location(ffmpRec); File loc = HDF5Util.findHDF5Location(ffmpRec);
IDataStore dataStore = DataStoreFactory.getDataStore(loc); IDataStore dataStore = DataStoreFactory.getDataStore(loc);
if (sourceXML.getSourceType().equals( if (sourceXML.getSourceType().equals(
SOURCE_TYPE.GAGE.getSourceType()) SOURCE_TYPE.GAGE.getSourceType())
&& phuc.equals("ALL")) { && phuc.equals(FFMPRecord.ALL)) {
ffmpRec.retrieveVirtualBasinFromDataStore(dataStore, ffmpRec.retrieveVirtualBasinFromDataStore(dataStore,
dataUri, getTemplates(siteKey), ffmpRec dataUri, getTemplates(siteKey), ffmpRec
.getDataTime().getRefTime(), basin); .getDataTime().getRefTime(), basin);
@ -619,34 +525,10 @@ public class FFMPMonitor extends ResourceMonitor {
public ConcurrentNavigableMap<Date, List<String>> getAvailableUris( public ConcurrentNavigableMap<Date, List<String>> getAvailableUris(
String siteKey, String dataKey, String sourceName, Date time, String siteKey, String dataKey, String sourceName, Date time,
boolean retrieveNew) { boolean retrieveNew) {
ConcurrentNavigableMap<Date, List<String>> sortedUris = siteDataMap
if (!ffmpAvailableUris.containsKey(siteKey)) { .get(siteKey).getSourceData(sourceName).getAvailableUris();
ConcurrentHashMap<String, ConcurrentSkipListMap<Date, List<String>>> tempUriList = new ConcurrentHashMap<String, ConcurrentSkipListMap<Date, List<String>>>( Date previousQueryTime = siteDataMap.get(siteKey)
16, 0.75f, 4); .getSourceData(sourceName).getPreviousUriQueryDate();
ffmpAvailableUris.put(siteKey, tempUriList);
}
ConcurrentSkipListMap<Date, List<String>> sortedUris = ffmpAvailableUris
.get(siteKey).get(sourceName);
if (sortedUris == null) {
synchronized (ffmpAvailableUris) {
// double check in case another thread created in the mean time
sortedUris = ffmpAvailableUris.get(siteKey).get(sourceName);
if (sortedUris == null) {
sortedUris = new ConcurrentSkipListMap<Date, List<String>>();
ffmpAvailableUris.get(siteKey).put(sourceName, sortedUris);
}
}
}
if (!ffmpAvailableUriQueryDates.containsKey(siteKey)) {
ConcurrentHashMap<String, Date> tempUriQueryDates = new ConcurrentHashMap<String, Date>(
16, 0.75f, 4);
ffmpAvailableUriQueryDates.put(siteKey, tempUriQueryDates);
}
Date previousQueryTime = ffmpAvailableUriQueryDates.get(siteKey).get(
sourceName);
SourceXML source = getSourceConfig().getSource(sourceName); SourceXML source = getSourceConfig().getSource(sourceName);
if (source.getSourceType().equals(SOURCE_TYPE.GUIDANCE.getSourceType())) { if (source.getSourceType().equals(SOURCE_TYPE.GUIDANCE.getSourceType())) {
@ -672,7 +554,8 @@ public class FFMPMonitor extends ResourceMonitor {
if (source.getSourceType().equals( if (source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) { SOURCE_TYPE.GUIDANCE.getSourceType())) {
long timeOffset = source.getExpirationMinutes(siteKey) * TimeUtil.MILLIS_PER_MINUTE; long timeOffset = source.getExpirationMinutes(siteKey)
* TimeUtil.MILLIS_PER_MINUTE;
earliestTime = new Date(time.getTime() - timeOffset); earliestTime = new Date(time.getTime() - timeOffset);
} }
@ -731,7 +614,8 @@ public class FFMPMonitor extends ResourceMonitor {
} }
} }
ffmpAvailableUriQueryDates.get(siteKey).put(sourceName, time); siteDataMap.get(siteKey).getSourceData(sourceName)
.setPreviousUriQueryDate(time);
} catch (VizException e) { } catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
@ -763,11 +647,12 @@ public class FFMPMonitor extends ResourceMonitor {
* @return * @return
* *
*/ */
public FFMPCacheRecord getFFMPData(ProductXML product, String siteKey, public FFMPRecord getFFMPData(ProductXML product, String siteKey,
String dataKey, String sourceName, Date ptime, String phuc, String dataKey, String sourceName, Date ptime, String phuc,
boolean retrieveNew) { boolean retrieveNew) {
FFMPCacheRecord record = ffmpData.get(siteKey).get(sourceName); FFMPRecord record = siteDataMap.get(siteKey).getSourceData(sourceName)
.getRecord();
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData() String guidSrc = FFMPConfig.getInstance().getFFMPConfigData()
.getGuidSrc(); .getGuidSrc();
@ -791,8 +676,9 @@ public class FFMPMonitor extends ResourceMonitor {
for (SourceXML source : productRun.getGuidanceSources( for (SourceXML source : productRun.getGuidanceSources(
product, guidSrc)) { product, guidSrc)) {
if (ffmpLoadedUris.get(siteKey).containsKey( if (siteDataMap.get(siteKey)
source.getSourceName())) { .getSourceData(source.getSourceName())
.hasLoadedAnyUris()) {
continue; continue;
} else { } else {
populateFFMPRecord(product, siteKey, dataKey, populateFFMPRecord(product, siteKey, dataKey,
@ -802,13 +688,15 @@ public class FFMPMonitor extends ResourceMonitor {
} }
} else { } else {
// FFG is the primary if // FFG is the primary if
if (!ffmpLoadedUris.get(siteKey).containsKey(sourceName)) { if (!siteDataMap.get(siteKey).getSourceData(sourceName)
.hasLoadedAnyUris()) {
populateFFMPRecord(product, siteKey, dataKey, populateFFMPRecord(product, siteKey, dataKey,
sourceName, ptime, phuc, retrieveNew); sourceName, ptime, phuc, retrieveNew);
} }
} }
record = ffmpData.get(siteKey).get(sourceName); record = siteDataMap.get(siteKey).getSourceData(sourceName)
.getRecord();
} else { } else {
populateFFMPRecord(product, siteKey, dataKey, sourceName, populateFFMPRecord(product, siteKey, dataKey, sourceName,
@ -865,7 +753,8 @@ public class FFMPMonitor extends ResourceMonitor {
} }
record = ffmpData.get(siteKey).get(sourceName); record = siteDataMap.get(siteKey).getSourceData(sourceName)
.getRecord();
} }
return record; return record;
@ -946,14 +835,12 @@ public class FFMPMonitor extends ResourceMonitor {
FFMPResourceData frd = resource.getResourceData(); FFMPResourceData frd = resource.getResourceData();
if (loadType == LOADER_TYPE.SECONDARY) { if (loadType == LOADER_TYPE.SECONDARY) {
// hucsToLoad.remove("ALL");
// hucsToLoad.remove(getConfig().getFFMPConfigData().getLayer());
timeBack = new Date(resource.getMostRecentTime().getTime() timeBack = new Date(resource.getMostRecentTime().getTime()
- (6 * 1000 * 24)); - (6 * TimeUtil.MILLIS_PER_HOUR));
frd.timeBack = timeBack; frd.timeBack = timeBack;
} else if (loadType == LOADER_TYPE.TERTIARY) { } else if (loadType == LOADER_TYPE.TERTIARY) {
hucsToLoad.clear(); hucsToLoad.clear();
hucsToLoad.add("ALL"); hucsToLoad.add(FFMPRecord.ALL);
timeBack = new Date(resource.getMostRecentTime().getTime() timeBack = new Date(resource.getMostRecentTime().getTime()
- (TimeUtil.MILLIS_PER_HOUR * 24)); - (TimeUtil.MILLIS_PER_HOUR * 24));
} }
@ -988,7 +875,7 @@ public class FFMPMonitor extends ResourceMonitor {
ffmpSplash.close(); ffmpSplash.close();
break; break;
} }
Thread.sleep(1000); Thread.sleep(100);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
if (ffmpSplash != null) { if (ffmpSplash != null) {
@ -1127,21 +1014,13 @@ public class FFMPMonitor extends ResourceMonitor {
res.getResourceData().floader = null; res.getResourceData().floader = null;
int val = siteCount.get(res.getSiteKey()); int val = siteCount.get(res.getSiteKey());
// never opened a cache
if (ffmpData.get(res.getSiteKey()) != null) {
// clear out the cache
for (Entry<String, FFMPCacheRecord> entry : ffmpData.get(
res.getSiteKey()).entrySet()) {
entry.getValue().closeCache();
}
}
if ((val == 1) && (siteCount.size() > 1)) { if ((val == 1) && (siteCount.size() > 1)) {
ffmpData.remove(res.getSiteKey()); FFMPSiteData siteData = siteDataMap
ffmpAvailableUriQueryDates.remove(res.getSiteKey()); .removeSite(res.getSiteKey());
ffmpAvailableUris.remove(res.getSiteKey()); if (siteData != null) {
ffmpLoadedUris.remove(res.getSiteKey()); siteData.clear();
}
} }
} }
@ -1200,7 +1079,7 @@ public class FFMPMonitor extends ResourceMonitor {
* @param retrieveNew * @param retrieveNew
* @return * @return
*/ */
public FFMPCacheRecord getQPERecord(ProductXML product, String siteKey, public FFMPRecord getQPERecord(ProductXML product, String siteKey,
String dataKey, String sourceName, Date date, String phuc, String dataKey, String sourceName, Date date, String phuc,
boolean retrieveNew) { boolean retrieveNew) {
@ -1241,7 +1120,7 @@ public class FFMPMonitor extends ResourceMonitor {
* @param retrieveNew * @param retrieveNew
* @return * @return
*/ */
public FFMPCacheRecord getRateRecord(ProductXML product, String siteKey, public FFMPRecord getRateRecord(ProductXML product, String siteKey,
String dataKey, String sourceName, Date date, String phuc, String dataKey, String sourceName, Date date, String phuc,
boolean retrieveNew) { boolean retrieveNew) {
@ -1283,7 +1162,7 @@ public class FFMPMonitor extends ResourceMonitor {
* @param retrieveNew * @param retrieveNew
* @return * @return
*/ */
public FFMPCacheRecord getQPFRecord(ProductXML product, String siteKey, public FFMPRecord getQPFRecord(ProductXML product, String siteKey,
String dataKey, String sourceName, Date date, String phuc, String dataKey, String sourceName, Date date, String phuc,
boolean retrieveNew) { boolean retrieveNew) {
@ -1337,9 +1216,8 @@ public class FFMPMonitor extends ResourceMonitor {
* @param phuc * @param phuc
* @return * @return
*/ */
public FFMPCacheRecord getGuidanceRecord(ProductXML product, public FFMPRecord getGuidanceRecord(ProductXML product, String siteKey,
String siteKey, String sourceName, Date date, String phuc, String sourceName, Date date, String phuc, boolean isStandAlone) {
boolean isStandAlone) {
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData() String guidSrc = FFMPConfig.getInstance().getFFMPConfigData()
.getGuidSrc(); .getGuidSrc();
if (!isStandAlone && guidSrc.startsWith("xxx")) { if (!isStandAlone && guidSrc.startsWith("xxx")) {
@ -1368,18 +1246,17 @@ public class FFMPMonitor extends ResourceMonitor {
* @param retrieveNew * @param retrieveNew
* @return * @return
*/ */
public HashMap<String, FFMPCacheRecord> getGuidanceRecords( public HashMap<String, FFMPRecord> getGuidanceRecords(ProductXML product,
ProductXML product, String siteKey, Date date, String phuc, String siteKey, Date date, String phuc, boolean retrieveNew) {
boolean retrieveNew) {
HashMap<String, FFMPCacheRecord> guidRecs = new HashMap<String, FFMPCacheRecord>(); HashMap<String, FFMPRecord> guidRecs = new HashMap<String, FFMPRecord>();
ProductRunXML productRun = FFMPRunConfigurationManager.getInstance() ProductRunXML productRun = FFMPRunConfigurationManager.getInstance()
.getProduct(siteKey); .getProduct(siteKey);
ArrayList<String> guidTypes = productRun.getGuidanceTypes(product); ArrayList<String> guidTypes = productRun.getGuidanceTypes(product);
for (String type : guidTypes) { for (String type : guidTypes) {
FFMPCacheRecord guidRec = getFFMPData(product, siteKey, null, type, FFMPRecord guidRec = getFFMPData(product, siteKey, null, type,
date, phuc, retrieveNew); date, phuc, retrieveNew);
guidRecs.put(type, guidRec); guidRecs.put(type, guidRec);
} }
@ -1418,7 +1295,7 @@ public class FFMPMonitor extends ResourceMonitor {
* @param retrieveNew * @param retrieveNew
* @return * @return
*/ */
public FFMPCacheRecord getVirtualRecord(ProductXML product, String siteKey, public FFMPRecord getVirtualRecord(ProductXML product, String siteKey,
String dataKey, String sourceName, Date date, String phuc, String dataKey, String sourceName, Date date, String phuc,
boolean retrieveNew) { boolean retrieveNew) {
// comparisons done with table display // comparisons done with table display
@ -1446,7 +1323,8 @@ public class FFMPMonitor extends ResourceMonitor {
Long pfaf) throws VizException { Long pfaf) throws VizException {
FFMPBasin basin = null; FFMPBasin basin = null;
// check for already loaded records // check for already loaded records
FFMPCacheRecord record = ffmpData.get(siteKey).get(sourceName); FFMPRecord record = siteDataMap.get(siteKey).getSourceData(sourceName)
.getRecord();
if (record != null) { if (record != null) {
FFMPBasinData basinData = record.getBasinData(phuc); FFMPBasinData basinData = record.getBasinData(phuc);
if (basinData != null) { if (basinData != null) {
@ -1466,7 +1344,7 @@ public class FFMPMonitor extends ResourceMonitor {
if (basin != null) { if (basin != null) {
fgb = (FFMPGuidanceBasin) basin; fgb = (FFMPGuidanceBasin) basin;
} else { } else {
fgb = new FFMPGuidanceBasin(pfaf, !phuc.equals("ALL")); fgb = new FFMPGuidanceBasin(pfaf, !phuc.equals(FFMPRecord.ALL));
basin = fgb; basin = fgb;
} }
@ -1489,22 +1367,11 @@ public class FFMPMonitor extends ResourceMonitor {
POINT_RETRIVAL: for (List<String> uris : availableUris POINT_RETRIVAL: for (List<String> uris : availableUris
.values()) { .values()) {
for (String uri : uris) { for (String uri : uris) {
if (!siteDataMap
if (!ffmpLoadedUris.containsKey(siteKey)) { .get(siteKey)
.getSourceData(
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> tempLoadedUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>(); source.getSourceName())
tempLoadedUris .getLoadedUris(phuc).contains(uri)) {
.put(source.getSourceName(),
new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>(
16, 0.75f, 4));
ffmpLoadedUris.put(siteKey,
tempLoadedUris);
}
if (!ffmpLoadedUris.get(siteKey)
.get(source).get(phuc)
.containsKey(uri)) {
// populate point only // populate point only
populateFFMPBasin(uri, siteKey, populateFFMPBasin(uri, siteKey,
source.getSourceName(), phuc, source.getSourceName(), phuc,
@ -1528,22 +1395,9 @@ public class FFMPMonitor extends ResourceMonitor {
POINT_RETRIVAL: for (List<String> uris : availableUris POINT_RETRIVAL: for (List<String> uris : availableUris
.values()) { .values()) {
for (String uri : uris) { for (String uri : uris) {
if (!siteDataMap.get(siteKey)
if (!ffmpLoadedUris.containsKey(siteKey)) { .getSourceData(sourceName)
.getLoadedUris(phuc).contains(uri)) {
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> tempLoadedUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>();
tempLoadedUris
.put(sourceName,
new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>(
16, 0.75f, 4));
ffmpLoadedUris.put(siteKey, tempLoadedUris);
}
if (!ffmpLoadedUris.get(siteKey)
.get(sourceName).get(phuc)
.containsKey(uri)) {
// populate point only // populate point only
populateFFMPBasin(uri, siteKey, sourceName, populateFFMPBasin(uri, siteKey, sourceName,
phuc, fgb); phuc, fgb);
@ -1563,52 +1417,8 @@ public class FFMPMonitor extends ResourceMonitor {
if ((availableUris != null) && (availableUris.size() > 0)) { if ((availableUris != null) && (availableUris.size() > 0)) {
POINT_RETRIVAL: for (List<String> uris : availableUris.values()) { POINT_RETRIVAL: for (List<String> uris : availableUris.values()) {
for (String uri : uris) { for (String uri : uris) {
if (!siteDataMap.get(siteKey).getSourceData(sourceName)
if (!ffmpLoadedUris.containsKey(siteKey)) { .getLoadedUris(phuc).contains(uri)) {
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> tempLoadedUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>();
if (product != null) {
for (String source : product.getSources()) {
tempLoadedUris
.put(source,
new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>(
16, 0.75f, 4));
}
ffmpLoadedUris.put(siteKey, tempLoadedUris);
} else {
tempLoadedUris
.put(sourceName,
new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>(
16, 0.75f, 4));
ffmpLoadedUris.put(siteKey, tempLoadedUris);
}
}
if (!ffmpLoadedUris.get(siteKey)
.containsKey(sourceName)) {
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> tempLoadedUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>();
tempLoadedUris
.put(sourceName,
new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>(
16, 0.75f, 4));
ffmpLoadedUris.put(siteKey, tempLoadedUris);
}
if (!ffmpLoadedUris.get(siteKey).get(sourceName)
.containsKey(phuc)) {
ffmpLoadedUris
.get(siteKey)
.get(sourceName)
.put(phuc,
new ConcurrentHashMap<String, String>());
}
if (!ffmpLoadedUris.get(siteKey).get(sourceName)
.get(phuc).containsKey(uri)) {
// populate point only // populate point only
populateFFMPBasin(uri, siteKey, sourceName, phuc, populateFFMPBasin(uri, siteKey, sourceName, phuc,
basin); basin);
@ -1765,10 +1575,10 @@ public class FFMPMonitor extends ResourceMonitor {
sourceName = SOURCE_TYPE.GUIDANCE.getSourceType(); sourceName = SOURCE_TYPE.GUIDANCE.getSourceType();
} }
if (ffmpData != null) { if (siteDataMap != null) {
if (ffmpData.containsKey(fsiteKey)) { if (siteDataMap.containsSite(fsiteKey)) {
FFMPCacheRecord record = ffmpData.get(fsiteKey) FFMPRecord record = siteDataMap.get(fsiteKey)
.get(sourceName); .getSourceData(sourceName).getRecord();
if (record != null) { if (record != null) {
record.purgeData(fdate); record.purgeData(fdate);
} }
@ -1778,10 +1588,10 @@ public class FFMPMonitor extends ResourceMonitor {
} }
} else { } else {
if (ffmpData != null) { if (siteDataMap != null) {
if (ffmpData.containsKey(fsiteKey)) { if (siteDataMap.containsSite(fsiteKey)) {
FFMPCacheRecord record = ffmpData.get(fsiteKey).get( FFMPRecord record = siteDataMap.get(fsiteKey)
fsource); .getSourceData(fsource).getRecord();
if (record != null) { if (record != null) {
record.purgeData(fdate); record.purgeData(fdate);
} }
@ -1789,11 +1599,11 @@ public class FFMPMonitor extends ResourceMonitor {
} }
} }
if (ffmpAvailableUris != null) { FFMPSiteData siteData = siteDataMap.get(fsiteKey);
for (Entry<String, ConcurrentSkipListMap<Date, List<String>>> entry : ffmpAvailableUris for (String sourceEntry : siteData.getSources()) {
.get(fsiteKey).entrySet()) { ConcurrentNavigableMap<Date, List<String>> oldUris = siteData
ConcurrentNavigableMap<Date, List<String>> oldUris = entry .getSourceData(sourceEntry).getAvailableUris()
.getValue().headMap(fdate); .headMap(fdate);
for (List<String> uris : oldUris.headMap(fdate).values()) { for (List<String> uris : oldUris.headMap(fdate).values()) {
for (String uri : uris) { for (String uri : uris) {
@ -1801,19 +1611,24 @@ public class FFMPMonitor extends ResourceMonitor {
for (String sourceName : purgeSources) { for (String sourceName : purgeSources) {
if (ffmpLoadedUris.get(fsiteKey) if (siteData.getSourceData(sourceName)
.containsKey(sourceName)) { .hasLoadedAnyUris()) {
for (ConcurrentHashMap<String, String> loadedUris : ffmpLoadedUris FFMPSourceData sourceData = siteData
.get(fsiteKey).get(sourceName) .getSourceData(sourceName);
.values()) { Set<String> hucs = sourceData
loadedUris.remove(uri); .getLoadedHucs();
for (String huc : hucs) {
sourceData.getLoadedUris(huc).remove(
uri);
} }
} }
} }
} else { } else {
for (ConcurrentHashMap<String, String> loadedUris : ffmpLoadedUris FFMPSourceData sourceData = siteData
.get(fsiteKey).get(fsource).values()) { .getSourceData(fsource);
loadedUris.remove(uri); Set<String> hucs = sourceData.getLoadedHucs();
for (String huc : hucs) {
sourceData.getLoadedUris(huc).remove(uri);
} }
} }
} }
@ -1823,7 +1638,6 @@ public class FFMPMonitor extends ResourceMonitor {
} }
} }
} }
}
/** /**
* Process an individual URI * Process an individual URI
@ -1841,11 +1655,9 @@ public class FFMPMonitor extends ResourceMonitor {
SourceXML source = getSourceConfig().getSource(sourceName); SourceXML source = getSourceConfig().getSource(sourceName);
if (uri != null) { if (uri != null) {
FFMPRecord record = new FFMPRecord(uri);
try { try {
record = populateFFMPRecord(isProductLoad, uri, siteKey, FFMPRecord record = populateFFMPRecord(isProductLoad, uri,
sourceName, phuc); siteKey, sourceName, phuc);
if ((record != null) && (source != null)) { if ((record != null) && (source != null)) {
record.setExpiration(source.getExpirationMinutes(siteKey)); record.setExpiration(source.getExpirationMinutes(siteKey));
record.setRate(source.isRate()); record.setRate(source.isRate());
@ -2311,7 +2123,8 @@ public class FFMPMonitor extends ResourceMonitor {
* @return * @return
*/ */
public Date getPreviousQueryTime(String siteKey, String sourceName) { public Date getPreviousQueryTime(String siteKey, String sourceName) {
return ffmpAvailableUriQueryDates.get(siteKey).get(sourceName); return siteDataMap.get(siteKey).getSourceData(sourceName)
.getPreviousUriQueryDate();
} }
/** /**
@ -2351,18 +2164,13 @@ public class FFMPMonitor extends ResourceMonitor {
if (fffmpRec != null) { if (fffmpRec != null) {
ConcurrentMap<String, String> uris = getUriMap(fsiteKey, List<String> uris = getLoadedUris(fsiteKey, fsource, fhuc);
fsource, fhuc);
String dataUri = fffmpRec.getDataURI(); String dataUri = fffmpRec.getDataURI();
if (!uris.containsKey(dataUri)) { if (!uris.contains(dataUri)) {
File loc = HDF5Util.findHDF5Location(fffmpRec); File loc = HDF5Util.findHDF5Location(fffmpRec);
IDataStore dataStore = DataStoreFactory.getDataStore(loc); IDataStore dataStore = DataStoreFactory.getDataStore(loc);
if (!ffmpData.containsKey(fsiteKey)) { FFMPSiteData siteData = siteDataMap.get(fsiteKey);
ConcurrentHashMap<String, FFMPCacheRecord> fieldRecs = new ConcurrentHashMap<String, FFMPCacheRecord>();
ffmpData.put(fsiteKey, fieldRecs);
}
String mySource = fsource; String mySource = fsource;
SourceXML source = fscm.getSource(fsource); SourceXML source = fscm.getSource(fsource);
@ -2371,17 +2179,19 @@ public class FFMPMonitor extends ResourceMonitor {
mySource = source.getDisplayName(); mySource = source.getDisplayName();
} }
FFMPCacheRecord curRecord = ffmpData.get(fsiteKey).get( FFMPSourceData sourceData = siteData
mySource); .getSourceData(mySource);
FFMPRecord curRecord = sourceData.getRecord();
if (curRecord == null) { if (curRecord == null) {
// ensure the record can only be set once // ensure the record can only be set once
synchronized (ffmpData) { synchronized (siteDataMap) {
curRecord = ffmpData.get(fsiteKey).get(mySource); curRecord = siteDataMap.get(fsiteKey)
.getSourceData(mySource).getRecord();
if (curRecord == null) { if (curRecord == null) {
curRecord = new FFMPCacheRecord(fffmpRec, curRecord = new FFMPRecord(dataUri);
mySource, getRunConfig().getRunner(wfo) siteDataMap.get(fsiteKey)
.getCacheDir()); .getSourceData(mySource)
ffmpData.get(fsiteKey).put(mySource, curRecord); .setRecord(curRecord);
} }
} }
} }
@ -2391,7 +2201,7 @@ public class FFMPMonitor extends ResourceMonitor {
if ((sourceXML != null) if ((sourceXML != null)
&& sourceXML.getSourceType().equals( && sourceXML.getSourceType().equals(
SOURCE_TYPE.GAGE.getSourceType()) SOURCE_TYPE.GAGE.getSourceType())
&& fhuc.equals("ALL")) { && fhuc.equals(FFMPRecord.ALL)) {
try { try {
curRecord.retrieveVirtualMapFromDataStore( curRecord.retrieveVirtualMapFromDataStore(
dataStore, dataUri, getTemplates(fsiteKey), dataStore, dataUri, getTemplates(fsiteKey),
@ -2424,40 +2234,7 @@ public class FFMPMonitor extends ResourceMonitor {
} }
} }
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> siteLoadedUris = ffmpLoadedUris sourceData.addLoadedUri(fhuc, dataUri);
.get(fsiteKey);
if (siteLoadedUris == null) {
siteLoadedUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>();
ffmpLoadedUris.put(fsiteKey, siteLoadedUris);
}
ConcurrentHashMap<String, ConcurrentHashMap<String, String>> sourceLoadedUris = ffmpLoadedUris
.get(fsiteKey).get(fsource);
if (sourceLoadedUris == null) {
sourceLoadedUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>();
ffmpLoadedUris.get(fsiteKey).put(fsource,
sourceLoadedUris);
}
ConcurrentHashMap<String, String> hucLoadedUris = ffmpLoadedUris
.get(fsiteKey).get(fsource).get(fhuc);
if (hucLoadedUris == null) {
hucLoadedUris = new ConcurrentHashMap<String, String>();
ffmpLoadedUris.get(fsiteKey).get(fsource)
.put(fhuc, hucLoadedUris);
}
synchronized (hucLoadedUris) {
// ensure not created by another thread
ffmpLoadedUris.get(fsiteKey).get(fsource).get(fhuc)
.put(dataUri, dataUri);
}
} }
} }
} }
@ -2513,8 +2290,8 @@ public class FFMPMonitor extends ResourceMonitor {
.getSourceType())) { .getSourceType())) {
try { try {
if (!getUriMap(fsiteKey, fsourceName, fhuc) if (!getLoadedUris(fsiteKey, fsourceName,
.containsKey(uri)) { fhuc).contains(uri)) {
record = populateFFMPRecord( record = populateFFMPRecord(
fisProductLoad, uri, fsiteKey, fisProductLoad, uri, fsiteKey,

View file

@ -0,0 +1,97 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.monitor.ffmp;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* A data container that holds the site's FFMPSourceData for each source.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 18, 2013 njensen Initial creation
* Feb 28, 2013 1729 dhladky Sped up, synch blocks were hanging it.
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class FFMPSiteData {
private ConcurrentMap<String, FFMPSourceData> sourceMap = new ConcurrentHashMap<String, FFMPSourceData>();
/**
* Gets the data of the specified source
*
* @param source
* @return
*/
public FFMPSourceData getSourceData(String source) {
FFMPSourceData sourceData = sourceMap.get(source);
if (sourceData == null) {
sourceData = new FFMPSourceData();
FFMPSourceData previous = sourceMap.putIfAbsent(source, sourceData);
if (previous != null) {
return previous;
}
}
return sourceData;
}
/**
* Clears all the data for the site
*/
public void clear() {
for (FFMPSourceData source : sourceMap.values()) {
source.clear();
}
}
/**
* Checks if there is a data object for the source
*
* @param source
* @return
*/
public boolean containsSource(String source) {
return sourceMap.containsKey(source);
}
/**
* Gets the sources that have data objects
*
* @return
*/
public Set<String> getSources() {
return sourceMap.keySet();
}
}

View file

@ -0,0 +1,81 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.monitor.ffmp;
import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* FFMP data container that holds the FFMPSiteData for each site.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 19, 2013 njensen Initial creation
* Feb 28, 2013 1729 dhladky Sped up, synch blocks were hanging it.
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class FFMPSiteDataContainer {
private ConcurrentMap<String, FFMPSiteData> siteDataMap = new ConcurrentHashMap<String, FFMPSiteData>();
public FFMPSiteData get(String siteKey) {
FFMPSiteData data = siteDataMap.get(siteKey);
if (data == null) {
data = new FFMPSiteData();
FFMPSiteData previous = siteDataMap.putIfAbsent(siteKey, data);
if (previous != null) {
return previous;
}
}
return data;
}
public void clear() {
Collection<FFMPSiteData> vals = siteDataMap.values();
for (FFMPSiteData data : vals) {
data.clear();
}
siteDataMap.clear();
}
public FFMPSiteData removeSite(String siteKey) {
return siteDataMap.remove(siteKey);
}
public boolean containsSite(String siteKey) {
return siteDataMap.containsKey(siteKey);
}
}

View file

@ -0,0 +1,181 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.monitor.ffmp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
/**
* A data container that holds FFMPRecords, the previousUriQueryDate, and the
* available and loaded URIs for the particular source associated with a site.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 18, 2013 njensen Initial creation
* Feb 28, 2013 1729 dhladky Sped up, synch blocks were hanging it.
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class FFMPSourceData {
private FFMPRecord ffmpData;
/** earliest available date queried **/
private Date previousUriQueryDate;
private ConcurrentNavigableMap<Date, List<String>> availableUris = new ConcurrentSkipListMap<Date, List<String>>();
/** map of huc to list of loaded URIs **/
private ConcurrentMap<String, List<String>> loadedUris = new ConcurrentHashMap<String, List<String>>();
/**
* Clears the data
*/
public void clear() {
ffmpData = null;
previousUriQueryDate = null;
availableUris.clear();
loadedUris.clear();
}
/**
* Gets the FFMPRecord. Possibly null.
*
* @return
*/
public FFMPRecord getRecord() {
return ffmpData;
}
/**
* Sets the FFMPRecord.
*
* @param record
*/
public void setRecord(FFMPRecord record) {
ffmpData = record;
}
/**
* Gets the previous time that URIs were queried for for this site and
* source.
*
* @return
*/
public Date getPreviousUriQueryDate() {
return previousUriQueryDate;
}
/**
* Sets the previous time that URIs were queried for for this site and
* source.
*
* @param previousUriQueryDate
*/
public void setPreviousUriQueryDate(Date previousUriQueryDate) {
this.previousUriQueryDate = previousUriQueryDate;
}
/**
* Gets the URIs associated with a HUC that have been loaded.
*
* @param huc
* @return
*/
public List<String> getLoadedUris(String huc) {
List<String> loaded = loadedUris.get(huc);
if (loaded == null) {
loaded = new ArrayList<String>();
List<String> previous = loadedUris.putIfAbsent(huc, loaded);
if (previous != null) {
return previous;
}
}
return loaded;
}
/**
* Tracks a URI associated with a HUC as loaded.
*
* @param huc
* @param uri
*/
public void addLoadedUri(String huc, String uri) {
List<String> uriList = loadedUris.get(huc);
if (uriList == null) {
uriList = new ArrayList<String>();
List<String> previous = loadedUris.putIfAbsent(huc, uriList);
if (previous != null) {
uriList = previous;
}
}
uriList.add(uri);
}
/**
* Checks if this site and source has loaded any URIs yet.
*
* @return
*/
public boolean hasLoadedAnyUris() {
return !loadedUris.isEmpty();
}
/**
* Gets the set of HUCs that have loaded some URIs.
*
* @return
*/
public Set<String> getLoadedHucs() {
return loadedUris.keySet();
}
/**
* Gets the Available URIs based on time.
*
* @return
*/
public ConcurrentNavigableMap<Date, List<String>> getAvailableUris() {
return availableUris;
}
}

View file

@ -42,6 +42,10 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.xml.ProductRunXML; import com.raytheon.uf.common.monitor.xml.ProductRunXML;
import com.raytheon.uf.common.monitor.xml.ProductXML; import com.raytheon.uf.common.monitor.xml.ProductXML;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.RGBColors; import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor; import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.BasinTrendCommon.PlotItems; import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.BasinTrendCommon.PlotItems;
@ -65,6 +69,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Initial creation * Initial creation
* Dec 6, 2012 1353 rferrel Code clean up for non-blocking dialog. * Dec 6, 2012 1353 rferrel Code clean up for non-blocking dialog.
* Feb 10, 2013 1584 mpduff Add performance logging.
* *
* </pre> * </pre>
* *
@ -72,6 +77,13 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* @version 1.0 * @version 1.0
*/ */
public class BasinTrendDlg extends CaveSWTDialog { public class BasinTrendDlg extends CaveSWTDialog {
/** Performance log message prefix */
private final String prefix = "FFMP Basin Trend:";
/** Performance logger */
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler(prefix);
/** /**
* Main composite. * Main composite.
*/ */
@ -141,12 +153,12 @@ public class BasinTrendDlg extends CaveSWTDialog {
/** /**
* QPFSCAN radio button. * QPFSCAN radio button.
*/ */
private List<Button> qpfRdos = new ArrayList<Button>(); private final List<Button> qpfRdos = new ArrayList<Button>();
/** /**
* RFCFFG radio button. * RFCFFG radio button.
*/ */
private List<Button> ffgRdos = new ArrayList<Button>(); private final List<Button> ffgRdos = new ArrayList<Button>();
/** /**
* Background color for controls and graph. * Background color for controls and graph.
@ -221,7 +233,8 @@ public class BasinTrendDlg extends CaveSWTDialog {
/** /**
* Date/Time format. * Date/Time format.
*/ */
private SimpleDateFormat sdf = new SimpleDateFormat("MMM dd yy HH:mm z"); private final SimpleDateFormat sdf = new SimpleDateFormat(
"MMM dd yy HH:mm z");
private boolean vgb = false; private boolean vgb = false;
@ -229,7 +242,8 @@ public class BasinTrendDlg extends CaveSWTDialog {
private Date currentDate; private Date currentDate;
private FFMPResource resource; /** The FFMP Resource */
private final FFMPResource resource;
private final List<ISourceUpdate> sourceListeners = new ArrayList<ISourceUpdate>(); private final List<ISourceUpdate> sourceListeners = new ArrayList<ISourceUpdate>();
@ -238,6 +252,14 @@ public class BasinTrendDlg extends CaveSWTDialog {
* *
* @param parent * @param parent
* Parent shell. * Parent shell.
* @param resource
* The Resource
* @param date
* The Date
* @param pfaf
* The pfaf
* @param vgb
* The VGB
* @param graphData * @param graphData
* Graph data. * Graph data.
*/ */
@ -1000,6 +1022,9 @@ public class BasinTrendDlg extends CaveSWTDialog {
*/ */
private void updatePlotSelection(Button plotBtn, private void updatePlotSelection(Button plotBtn,
boolean updateLegendAndGraph) { boolean updateLegendAndGraph) {
ITimer timer = TimeUtil.getTimer();
timer.start();
PlotItems plotItem = (PlotItems) plotBtn.getData(); PlotItems plotItem = (PlotItems) plotBtn.getData();
if (plotItem == PlotItems.RATE) { if (plotItem == PlotItems.RATE) {
@ -1056,6 +1081,9 @@ public class BasinTrendDlg extends CaveSWTDialog {
updateColorLegend(); updateColorLegend();
updateGraph(); updateGraph();
} }
timer.stop();
perfLog.logDuration("Graph update", timer.getElapsedTime());
} }
/** /**

View file

@ -57,9 +57,15 @@ import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFMPTemplateConfigurationManager; import com.raytheon.uf.common.monitor.config.FFMPTemplateConfigurationManager;
import com.raytheon.uf.common.monitor.xml.DomainXML; import com.raytheon.uf.common.monitor.xml.DomainXML;
import com.raytheon.uf.common.monitor.xml.FFMPRunXML; import com.raytheon.uf.common.monitor.xml.FFMPRunXML;
import com.raytheon.uf.common.stats.LoadEvent;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
@ -85,6 +91,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPResource;
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataLoader; import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataLoader;
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataUpdate; import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataUpdate;
import com.raytheon.uf.viz.monitor.listeners.IMonitorListener; import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
import com.raytheon.uf.viz.stats.collector.StatsCollector;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.dialogs.ICloseCallback;
@ -106,6 +113,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Changes for non-blocking AttributeThresholdDlg. * Changes for non-blocking AttributeThresholdDlg.
* Changes for non-blocking LoadSaveConfigDlg. * Changes for non-blocking LoadSaveConfigDlg.
* Jan 23, 2013 14907 gzhang GUID not in Thresholds menu even ColorCell true * Jan 23, 2013 14907 gzhang GUID not in Thresholds menu even ColorCell true
* Feb 10, 2013 1584 mpduff Add performance logging.
* Feb 28, 2013 1729 dhladky Adjusted the way in which the dialog load thread rejoins the main GUI thread.
* Mar 01, 2013 13228 gzhang Adding field rowName for VGB in County * Mar 01, 2013 13228 gzhang Adding field rowName for VGB in County
* </pre> * </pre>
* @author lvenable * @author lvenable
@ -118,11 +127,21 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
private final IUFStatusHandler statusHandler = UFStatus private final IUFStatusHandler statusHandler = UFStatus
.getHandler(FfmpBasinTableDlg.class); .getHandler(FfmpBasinTableDlg.class);
/** Performance message prefix */
private final String prefix = "FFMP Basin Table:";
/** Performance logger */
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler(prefix);
private final String initialLoadKey = "FFMP Basin Table Initial Load";
private LoadSaveConfigDlg loadDlg; private LoadSaveConfigDlg loadDlg;
private LoadSaveConfigDlg saveDlg; private LoadSaveConfigDlg saveDlg;
private List<FFMPTableDataLoader> retrievalQueue = new ArrayList<FFMPTableDataLoader>(); /** Retrieval queue */
private final List<FFMPTableDataLoader> retrievalQueue = new ArrayList<FFMPTableDataLoader>();
private MenuItem linkToFrameMI; private MenuItem linkToFrameMI;
@ -199,7 +218,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
private final List<String> cwas = new ArrayList<String>(); private final List<String> cwas = new ArrayList<String>();
private List<MenuItem> sourceMenuItems = new ArrayList<MenuItem>(); /** Source menu item list */
private final List<MenuItem> sourceMenuItems = new ArrayList<MenuItem>();
private Date date = null; private Date date = null;
@ -237,6 +257,17 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
private boolean groupLabelFlag = true; private boolean groupLabelFlag = true;
private String rowName="";// DR 13228 private String rowName="";// DR 13228
/**
* Statistics load event.
*/
private LoadEvent loadEvent;
/**
* Previously selected HUC level
*/
private String previousHuc;
private FFMPLoaderStatus loadStatus;
public FfmpBasinTableDlg(Shell parent, FFMPTableData tData, public FfmpBasinTableDlg(Shell parent, FFMPTableData tData,
FFMPResource resource) { FFMPResource resource) {
@ -300,6 +331,13 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
// Load time stat
loadEvent = new LoadEvent();
loadEvent.setType("FFMP Initial Load");
loadEvent.setMessage("FFMP Basin Table Initial Load");
StatsCollector.start(initialLoadKey, loadEvent);
perfLog.log("Launched");
shell.addShellListener(new ShellAdapter() { shell.addShellListener(new ShellAdapter() {
@Override @Override
public void shellClosed(ShellEvent e) { public void shellClosed(ShellEvent e) {
@ -339,7 +377,10 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
refreshDisplay(true); refreshDisplay(true);
} }
public void createMenus() { /**
* Create the menus.
*/
private void createMenus() {
Menu menuBar = new Menu(shell, SWT.BAR); Menu menuBar = new Menu(shell, SWT.BAR);
createFileMenu(menuBar); createFileMenu(menuBar);
@ -752,6 +793,9 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
cwaMI.addSelectionListener(new SelectionAdapter() { cwaMI.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
MenuItem mi = (MenuItem) event.getSource();
perfLog.log("CWA " + mi.getText()
+ (mi.getSelection() ? " selected" : " unselected"));
updateD2DRefresh(); updateD2DRefresh();
updateCWA(event); updateCWA(event);
} }
@ -1083,9 +1127,10 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
private void updateGapValueLabel(double gapVal) { private void updateGapValueLabel(double gapVal) {
if (gapValueLbl != null) {
if (gapVal > 0.75) { if (gapVal > 0.75) {
gapValueLbl.setBackground(getDisplay() gapValueLbl.setBackground(getDisplay().getSystemColor(
.getSystemColor(SWT.COLOR_RED)); SWT.COLOR_RED));
} else if (gapVal > 0.30) { } else if (gapVal > 0.30) {
gapValueLbl.setBackground(getDisplay().getSystemColor( gapValueLbl.setBackground(getDisplay().getSystemColor(
SWT.COLOR_YELLOW)); SWT.COLOR_YELLOW));
@ -1097,6 +1142,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
String str = String.format("%2.2f ", gapVal); String str = String.format("%2.2f ", gapVal);
gapValueLbl.setText(str); gapValueLbl.setText(str);
} }
}
private void initTimeDuration() { private void initTimeDuration() {
double tf = ffmpConfig.getTimeFrame(); double tf = ffmpConfig.getTimeFrame();
@ -1280,6 +1326,9 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
public void attributeDisplayAction(boolean updateData, public void attributeDisplayAction(boolean updateData,
AttributesDlgData attrData) { AttributesDlgData attrData) {
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
ITimer timer = TimeUtil.getTimer();
timer.start();
this.attrData = attrData; this.attrData = attrData;
// Update the data in the FFMPConfig with the selections // Update the data in the FFMPConfig with the selections
@ -1313,6 +1362,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
shell.pack(); shell.pack();
shell.redraw(); shell.redraw();
resetCursor(); resetCursor();
timer.stop();
perfLog.logDuration("Column Add/Remove time", timer.getElapsedTime());
} }
@Override @Override
@ -1568,15 +1619,19 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
fireCWAChangedEvent(mi.getText(), mi.getSelection()); fireCWAChangedEvent(mi.getText(), mi.getSelection());
} }
/**
* Update the layer.
*/
private void updateLayer(SelectionEvent event) { private void updateLayer(SelectionEvent event) {
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
updateD2DRefresh(); updateD2DRefresh();
MenuItem mi = (MenuItem) event.getSource(); MenuItem mi = (MenuItem) event.getSource();
String huc = (String) mi.getData(); String msg = previousHuc + " to " + mi.getText();
perfLog.log("Update Layer Called, " + msg);
String huc = (String) mi.getData();
previousHuc = mi.getText();
ffmpConfig.getFFMPConfigData().setLayer(huc); ffmpConfig.getFFMPConfigData().setLayer(huc);
fireHucChangedEvent(huc); fireHucChangedEvent(huc);
} }
@ -1613,6 +1668,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
* Fire Table reload event * Fire Table reload event
*/ */
private void fireTableRestoreEvent() { private void fireTableRestoreEvent() {
perfLog.log("Table Restore Called");
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
groupLbl.setText(""); groupLbl.setText("");
@ -1637,6 +1693,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
this); this);
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
Display.getDefault().asyncExec(new Runnable() { Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() { public void run() {
FFMPMonitor.getInstance().configUpdate(me); FFMPMonitor.getInstance().configUpdate(me);
} }
@ -1663,6 +1720,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
try { try {
setGraphData(resource.getGraphData(pfaf), pfaf, setGraphData(resource.getGraphData(pfaf), pfaf,
differentPfaf, ffmpDate); differentPfaf, ffmpDate);
perfLog.log("Graph Display Complete");
} catch (VizException e) { } catch (VizException e) {
shell.setCursor(null); shell.setCursor(null);
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
@ -1682,27 +1740,30 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
public void resetData(FFMPTableData tData) { public void resetData(FFMPTableData tData) {
if (!ffmpTable.isDisposed()) { if (!ffmpTable.isDisposed()) {
this.mainTableData = tData; this.mainTableData = tData;
// System.out.println("---" + tData.getTableRows().size());
ffmpTable.clearTableSelection(); ffmpTable.clearTableSelection();
// long time = System.currentTimeMillis();
ffmpTable ffmpTable
.setCenteredAggregationKey(resource.centeredAggregationKey); .setCenteredAggregationKey(resource.centeredAggregationKey);
ffmpTable.setTableData(mainTableData); ffmpTable.setTableData(mainTableData);
// long time1 = System.currentTimeMillis();
resetCursor(); resetCursor();
shell.pack(); shell.pack();
shell.redraw(); shell.redraw();
if (loadEvent != null) {
// System.out StatsCollector.stop(initialLoadKey);
// .println("Time to load Data into table " + (time1 - time)); loadEvent = null;
}
perfLog.log("Table update complete");
} }
} }
/**
* {@inheritDoc}
*/
@Override @Override
public void tableSelection(String pfaf, String name) { public void tableSelection(String pfaf, String name) {
if (groupLbl.getText().length() > 0) { if (groupLbl.getText().length() > 0) {
groupLabelFlag = false; groupLabelFlag = false;
} else {
perfLog.log("Table Selection");
} }
if ((groupLbl.getText().length() == 0) if ((groupLbl.getText().length() == 0)
@ -1714,10 +1775,14 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
fireScreenRecenterEvent(pfaf, 1); fireScreenRecenterEvent(pfaf, 1);
} }
/**
* {@inheritDoc}
*/
@Override @Override
public void displayBasinTrend(String pfaf) { public void displayBasinTrend(String pfaf) {
if (pfaf != null) { if (pfaf != null) {
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
perfLog.log("Basin Trend Graph Launch");
fireGraphDataEvent(pfaf, true, this.date); fireGraphDataEvent(pfaf, true, this.date);
} }
} }
@ -1824,6 +1889,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
if (menuDataType.compareTo(layer) == 0) { if (menuDataType.compareTo(layer) == 0) {
mi.setSelection(true); mi.setSelection(true);
this.previousHuc = mi.getText();
break; break;
} }
} }
@ -2022,14 +2088,14 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
} }
public void updateLoadingLabel(FFMPLoaderStatus status) { public void updateLoadingLabel(FFMPLoaderStatus status) {
this.loadStatus = status;
if (dataLoadComp == null) { if (dataLoadComp == null) {
return; return;
} }
GridData gd = (GridData) dataLoadComp.getLayoutData(); GridData gd = (GridData) dataLoadComp.getLayoutData();
// System.out.println("Status message...");
if (gd.exclude == true) { if (gd.exclude == true) {
((GridData) dataLoadComp.getLayoutData()).exclude = false; ((GridData) dataLoadComp.getLayoutData()).exclude = false;
dataLoadComp.setVisible(true); dataLoadComp.setVisible(true);
@ -2057,13 +2123,13 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
dataLoadComp.setVisible(false); dataLoadComp.setVisible(false);
shell.pack(); shell.pack();
} }
resource.manageLoaders(status);
} }
/**
* {@inheritDoc}
*/
@Override @Override
public void notify(IMonitorEvent me) { public void notify(IMonitorEvent me) {
if (!this.isDisposed()) { if (!this.isDisposed()) {
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
FFMPTableDataLoader tableLoader = new FFMPTableDataLoader(me, FFMPTableDataLoader tableLoader = new FFMPTableDataLoader(me,
@ -2126,7 +2192,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
if (!this.isDisposed()) { if (!this.isDisposed()) {
Display.getDefault().asyncExec(new Runnable() { VizApp.runAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
processUpdate(fupdateData); processUpdate(fupdateData);
@ -2163,10 +2229,14 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
resetCursor(); resetCursor();
// start tertiary loader if not run yet
if (loadStatus != null) {
resource.manageLoaders(loadStatus);
}
} }
/** /**
* used to blank the group label when channging HUC while in an aggregate. * used to blank the group label when changing HUC while in an aggregate.
*/ */
public void blankGroupLabel() { public void blankGroupLabel() {
if (groupLbl != null) { if (groupLbl != null) {

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.monitor.ffmp.ui.dialogs; package com.raytheon.uf.viz.monitor.ffmp.ui.dialogs;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
@ -46,8 +47,10 @@ import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 8, 2011 lvenable Initial creation * Mar 8, 2011 lvenable Initial creation
* Mar 8, 2012 DR 14406 gzhang Fixing QPF Column Title Missing * Mar 8, 2012 DR 14406 gzhang Fixing QPF Column Title Missing
* Feb 19, 2013 1635 dhladky Fixed multiple guidance displays
* </pre> * </pre>
* *
*
* @author lvenable * @author lvenable
* @version 1.0 * @version 1.0
*/ */
@ -261,6 +264,7 @@ public class FfmpTableConfigData {
} }
ArrayList<String> guidTypes = productXml.getAvailableGuidanceTypes(); ArrayList<String> guidTypes = productXml.getAvailableGuidanceTypes();
Collections.sort(guidTypes);
ffmpTableColMap.put(COLUMN_NAME.NAME.getColumnName(), ffmpTableColMap.put(COLUMN_NAME.NAME.getColumnName(),
COLUMN_NAME.NAME.getColumnName()); COLUMN_NAME.NAME.getColumnName());

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.monitor.ffmp.ui.rsc; package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
@ -39,6 +40,7 @@ import com.raytheon.uf.common.monitor.xml.SourceXML;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jul 20, 2011 mpduff Initial creation * Jul 20, 2011 mpduff Initial creation
* 01/14/13 1569 dhladky changed arraylist to list
* *
* </pre> * </pre>
* *
@ -49,9 +51,9 @@ import com.raytheon.uf.common.monitor.xml.SourceXML;
public class FFFGForceUtil { public class FFFGForceUtil {
private boolean forced = false; private boolean forced = false;
private ArrayList<Long> forcedPfafList = new ArrayList<Long>(); private List<Long> forcedPfafList = new ArrayList<Long>();
private ArrayList<Long> pfafList = new ArrayList<Long>(); private List<Long> pfafList = new ArrayList<Long>();
private FFMPResource resource; private FFMPResource resource;
@ -115,7 +117,7 @@ public class FFFGForceUtil {
forceIt(ft, cBasin); forceIt(ft, cBasin);
} }
public void calculateForcings(ArrayList<Long> pfafList, FFMPTemplates ft, public void calculateForcings(List<Long> pfafList, FFMPTemplates ft,
FFMPBasin cBasin) { FFMPBasin cBasin) {
this.pfafList = pfafList; this.pfafList = pfafList;
forceIt(ft, cBasin); forceIt(ft, cBasin);
@ -213,15 +215,15 @@ public class FFFGForceUtil {
} }
private ArrayList<Long> getForcedBasins(String source, private ArrayList<Long> getForcedBasins(String source,
ArrayList<Long> pfafList, FFMPTemplates ft) { List<Long> pfafList2, FFMPTemplates ft) {
FFFGDataMgr fdm = FFFGDataMgr.getInstance(); FFFGDataMgr fdm = FFFGDataMgr.getInstance();
ArrayList<Long> forcedList = new ArrayList<Long>(); ArrayList<Long> forcedList = new ArrayList<Long>();
long prevCtyFips = 0l; long prevCtyFips = 0l;
for (int i = 0; i < pfafList.size(); i++) { for (int i = 0; i < pfafList2.size(); i++) {
if (pfafList.get(i) == null) { if (pfafList2.get(i) == null) {
continue; continue;
} }
long pfaf = pfafList.get(i); long pfaf = pfafList2.get(i);
long countyFips = ft.getCountyFipsByPfaf(pfaf); long countyFips = ft.getCountyFipsByPfaf(pfaf);
if (countyFips != prevCtyFips) { if (countyFips != prevCtyFips) {
@ -240,8 +242,8 @@ public class FFFGForceUtil {
return forcedList; return forcedList;
} }
public float getAvgForcedValue(ArrayList<Long> pfafList, public float getAvgForcedValue(List<Long> pfafList,
ArrayList<Long> forcedPfafs, List<Long> forcedPfafs,
FFMPGuidanceInterpolation interpolation, FFMPGuidanceInterpolation interpolation,
long expiration, FFMPTemplates templates) { long expiration, FFMPTemplates templates) {
float tvalue = 0.0f; float tvalue = 0.0f;
@ -283,7 +285,7 @@ public class FFFGForceUtil {
/** /**
* @return the forcedPfafList * @return the forcedPfafList
*/ */
public ArrayList<Long> getForcedPfafList() { public List<Long> getForcedPfafList() {
return forcedPfafList; return forcedPfafList;
} }
@ -298,7 +300,7 @@ public class FFFGForceUtil {
/** /**
* @return the pfafList * @return the pfafList
*/ */
public ArrayList<Long> getPfafList() { public List<Long> getPfafList() {
return pfafList; return pfafList;
} }

View file

@ -22,13 +22,14 @@ package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinMetaData; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinMetaData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPCacheRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS; import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates; import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils; import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils;
@ -44,6 +45,7 @@ import com.raytheon.uf.common.monitor.xml.SourceXML;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor; import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig; import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig;
@ -65,6 +67,10 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
* Jul 20, 2009 dhladky Initial creation * Jul 20, 2009 dhladky Initial creation
* Jan 25, 2012 DR 13839 gzhang Use paintTime for QPF * Jan 25, 2012 DR 13839 gzhang Use paintTime for QPF
* Mar 01, 2013 DR 13228 gzhang Get VGB county info for row name * Mar 01, 2013 DR 13228 gzhang Get VGB county info for row name
* Feb 1, 2013 DR 1569 dhladky Switched to using pypies records instead of files
* Feb 19, 2013 1639 njensen Replaced FFMPCacheRecord with FFMPRecord
* feb 20, 2013 1635 dhladky Fixed multi guidance displays
* Feb 28, 2013 1729 dhladky General enhancements for speed.
* </pre> * </pre>
* @author dhladky * @author dhladky
* @version 1.0 * @version 1.0
@ -76,19 +82,28 @@ public class FFMPDataGenerator {
private static final IUFStatusHandler statusHandler = UFStatus private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPDataGenerator.class); .getHandler(FFMPDataGenerator.class);
private final String ALL = "ALL"; private final String ALL = FFMPRecord.ALL;
private final String NA = "NA"; private final String NA = "NA";
private String siteKey; private String siteKey;
private String dataKey; private String dataKey;
private ProductXML product; private ProductXML product;
private Date paintRefTime; private Date paintRefTime;
private Date tableTime; private Date tableTime;
private Object centeredAggregationKey; private Object centeredAggregationKey;
private String huc; private String huc;
private ArrayList<DomainXML> domains; private ArrayList<DomainXML> domains;
private double sliderTime; private double sliderTime;
private boolean isWorstCase = false; private boolean isWorstCase = false;
FFMPConfig ffmpCfg = FFMPConfig.getInstance(); FFMPConfig ffmpCfg = FFMPConfig.getInstance();
@ -109,21 +124,17 @@ public class FFMPDataGenerator {
FFMPBasinData virtualBasin = null; FFMPBasinData virtualBasin = null;
FFMPCacheRecord rateRecord = null; FFMPRecord rateRecord = null;
FFMPCacheRecord qpeRecord = null; FFMPRecord qpeRecord = null;
FFMPCacheRecord qpfRecord = null; FFMPRecord qpfRecord = null;
HashMap<String, FFMPCacheRecord> guidRecords = null; HashMap<String, FFMPRecord> guidRecords = null;
FFMPCacheRecord virtualRecord = null; FFMPRecord virtualRecord = null;
FFMPCacheRecord baseRec = null; FFMPRecord baseRec = null;
// Date time = null;
// Date recentTime = null;
SourceXML primarySource = null; SourceXML primarySource = null;
@ -158,9 +169,8 @@ public class FFMPDataGenerator {
this.primarySource = resource.getResourceData().getPrimarySourceXML(); this.primarySource = resource.getResourceData().getPrimarySourceXML();
this.isRate = primarySource.isRate(); this.isRate = primarySource.isRate();
this.expirationTime = primarySource.getExpirationMinutes(resource this.expirationTime = primarySource.getExpirationMinutes(resource
.getSiteKey()) * 60 * 1000; .getSiteKey()) * TimeUtil.MILLIS_PER_MINUTE;
ffmpTableCfgData = tableConfig ffmpTableCfgData = tableConfig.getTableConfigData(siteKey);
.getTableConfigData(siteKey);
} }
public FFMPTableData generateFFMPData() throws Exception { public FFMPTableData generateFFMPData() throws Exception {
@ -171,7 +181,9 @@ public class FFMPDataGenerator {
tData = new FFMPTableData(); tData = new FFMPTableData();
try { try {
FIELDS field = getBaseField(); FIELDS field = getBaseField();
if (field != null) { if (field != null) {
if (baseRec != null) { if (baseRec != null) {
FFMPBasinData fbd = null; FFMPBasinData fbd = null;
@ -181,9 +193,8 @@ public class FFMPDataGenerator {
fbd = baseRec.getBasinData(huc); fbd = baseRec.getBasinData(huc);
} }
if (fbd.getBasins().size() > 0) { if (!fbd.getBasins().isEmpty()) {
if ((centeredAggregationKey == null) if ((centeredAggregationKey == null) || huc.equals(ALL)) {
|| huc.equals(ALL)) {
// System.out.println(fbd.getBasins().keySet().size() // System.out.println(fbd.getBasins().keySet().size()
// + " rows in the table"); // + " rows in the table");
for (Long key : fbd.getBasins().keySet()) { for (Long key : fbd.getBasins().keySet()) {
@ -192,24 +203,28 @@ public class FFMPDataGenerator {
FFMPBasinMetaData fmdb = ft.getBasin( FFMPBasinMetaData fmdb = ft.getBasin(
siteKey, key); siteKey, key);
String cwa = domain.getCwa();
if (fmdb == null) { if (fmdb == null) {
continue; continue;
} }
if ((domain.getCwa().equals(fmdb if ((cwa.equals(fmdb
.getCwa())) .getCwa()))
|| (domain.isPrimary() && fmdb || (domain.isPrimary() && fmdb
.isPrimaryCwa())) { .isPrimaryCwa())) {
setFFMPRow(fbd.get(key), tData, setFFMPRow(fbd.get(key), tData,
false, domain.getCwa()); false, cwa);
if (virtualBasin != null) { if (virtualBasin != null) {
for (Long id : ft for (Long id : ft
.getVirtualGageBasinLookupIds( .getVirtualGageBasinLookupIds(
siteKey, siteKey,
key,huc,resource.basinTableDlg.getRowName()/* DR 13228 */)) { key,
huc,
resource.basinTableDlg
.getRowName())) {
setFFMPRow( setFFMPRow(
virtualBasin virtualBasin
.get(id), .get(id),
@ -227,24 +242,20 @@ public class FFMPDataGenerator {
*/ */
ArrayList<Long> pfafs = ft ArrayList<Long> pfafs = ft
.getAggregatePfafs(key, .getAggregatePfafs(key, siteKey,
siteKey,
huc); huc);
boolean isVGB = false; boolean isVGB = false;
if (ft.checkVGBsInAggregate(key, if (ft.checkVGBsInAggregate(key, siteKey,
siteKey,
huc)) { huc)) {
isVGB = true; isVGB = true;
} }
if (pfafs.size() > 0) { if (!pfafs.isEmpty()) {
FFMPBasinMetaData fmdb = ft FFMPBasinMetaData fmdb = ft
.getBasinInDomains( .getBasinInDomains(siteKey,
siteKey, domains, pfafs);
domains,
pfafs);
if (fmdb != null) { if (fmdb != null) {
try { try {
@ -263,8 +274,8 @@ public class FFMPDataGenerator {
for (Long key : resource for (Long key : resource
.getCenteredAggregatePfafs()) { .getCenteredAggregatePfafs()) {
FFMPBasinMetaData fmdb = ft.getBasin( FFMPBasinMetaData fmdb = ft.getBasin(siteKey,
siteKey, key); key);
if (fmdb != null) { if (fmdb != null) {
for (DomainXML domain : domains) { for (DomainXML domain : domains) {
@ -281,7 +292,10 @@ public class FFMPDataGenerator {
for (Long id : ft for (Long id : ft
.getVirtualGageBasinLookupIds( .getVirtualGageBasinLookupIds(
siteKey, siteKey,
key,huc,resource.basinTableDlg.getRowName()/* DR 13228 */)) { key,
huc,
resource.basinTableDlg
.getRowName())) {
setFFMPRow( setFFMPRow(
virtualBasin virtualBasin
.get(id), .get(id),
@ -293,19 +307,18 @@ public class FFMPDataGenerator {
} }
} }
} }
tData.sortData(); tData.sortData();
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); statusHandler.handle(Priority.PROBLEM, "Failed to load FFMP table data!", e);
} }
return tData; return tData;
} }
private void setFFMPRow(/*FFMPVirtualGageBasinMetaData md,*/FFMPBasin cBasin, FFMPTableData tData, private void setFFMPRow(FFMPBasin cBasin, FFMPTableData tData,
boolean isVGB, String domain) { boolean isVGB, String domain) {
try { try {
if (cBasin instanceof FFMPVirtualGageBasin) { if (cBasin instanceof FFMPVirtualGageBasin) {
@ -342,35 +355,38 @@ public class FFMPDataGenerator {
rowField = FIELDS.VIRTUAL; rowField = FIELDS.VIRTUAL;
displayName = ((FFMPVirtualGageBasin) cBasin).getLid();
if (displayName != null) { String lid = ((FFMPVirtualGageBasin) cBasin).getLid();
if (lid != null) {
StringBuilder sb = new StringBuilder(lid);
// in this special case it is actually the LID // in this special case it is actually the LID
trd.setPfaf(((FFMPVirtualGageBasin) cBasin).getLid()); trd.setPfaf(((FFMPVirtualGageBasin) cBasin).getLid());
FFMPVirtualGageBasinMetaData fvgmbd = ft FFMPVirtualGageBasinMetaData fvgmbd = ft
.getVirtualGageBasinMetaData(siteKey, .getVirtualGageBasinMetaData(siteKey,
((FFMPVirtualGageBasin) cBasin).getLid()); ((FFMPVirtualGageBasin) cBasin).getLid());
FFMPBasinMetaData metabasin = ft.getBasin( FFMPBasinMetaData metabasin = ft.getBasin(siteKey,
siteKey, fvgmbd.getParentPfaf()); fvgmbd.getParentPfaf());
Long parentBasinPfaf = fvgmbd.getParentPfaf(); Long parentBasinPfaf = fvgmbd.getParentPfaf();
if (fvgmbd != null) { if (fvgmbd != null) {
mouseOverText = metabasin.getBasinId() + "\n" mouseOverText = metabasin.getBasinId() + "\n"
+ fvgmbd.getLid() + "-" + fvgmbd.getName(); + fvgmbd.getLid() + "-" + fvgmbd.getName();
if (!huc.equals(ALL)) { if (!huc.equals(ALL)) {
displayName += "-" + fvgmbd.getName(); sb.append("-").append(fvgmbd.getName());
} }
} }
trd.setTableCellData(0, new FFMPTableCellData(rowField, trd.setTableCellData(0, new FFMPTableCellData(rowField,
displayName, mouseOverText)); sb.toString(), mouseOverText));
if (!isWorstCase || huc.equals(ALL) if (!isWorstCase || huc.equals(ALL)
|| (centeredAggregationKey != null)) { || (centeredAggregationKey != null)) {
if (cBasin.getValues().size() > 0) { if (!cBasin.getValues().isEmpty()) {
rate = ((FFMPVirtualGageBasin) cBasin) rate = ((FFMPVirtualGageBasin) cBasin)
.getValue(paintRefTime); .getValue(paintRefTime);
trd.setTableCellData(1, new FFMPTableCellData( trd.setTableCellData(1, new FFMPTableCellData(
@ -379,7 +395,7 @@ public class FFMPDataGenerator {
trd.setTableCellData(1, new FFMPTableCellData( trd.setTableCellData(1, new FFMPTableCellData(
FIELDS.RATE, Float.NaN)); FIELDS.RATE, Float.NaN));
} }
if (cBasin.getValues().size() > 0) { if (!cBasin.getValues().isEmpty()) {
if (sliderTime > 0.00) { if (sliderTime > 0.00) {
qpe = cBasin.getAccumValue(monitor.getQpeWindow() qpe = cBasin.getAccumValue(monitor.getQpeWindow()
@ -412,8 +428,8 @@ public class FFMPDataGenerator {
int i = 0; int i = 0;
for (String guidType : guidBasins.keySet()) { for (String guidType : guidBasins.keySet()) {
ArrayList<Long> pfafList = new ArrayList<Long>(); List<Long> pfafList = new ArrayList<Long>();
ArrayList<Long> forcedPfafs = new ArrayList<Long>(); List<Long> forcedPfafs = new ArrayList<Long>();
guidance = Float.NaN; guidance = Float.NaN;
boolean forced = false; boolean forced = false;
FFFGForceUtil forceUtil = forceUtils.get(guidType); FFFGForceUtil forceUtil = forceUtils.get(guidType);
@ -430,27 +446,20 @@ public class FFMPDataGenerator {
if (cBasin.getAggregated()) { if (cBasin.getAggregated()) {
if (domain == null) { if (domain == null) {
pfafList = ft.getAggregatePfafs( pfafList = ft.getAggregatePfafs(
cBasin.getPfaf(), cBasin.getPfaf(), siteKey, huc);
siteKey,
huc);
} else if (!domain.equals(NA)) { } else if (!domain.equals(NA)) {
if (!huc.equals(ALL)) { if (!huc.equals(ALL)) {
pfafList = ft pfafList = ft
.getAggregatePfafsByDomain( .getAggregatePfafsByDomain(
parentBasinPfaf, parentBasinPfaf,
siteKey, siteKey, domain, huc);
domain,
huc);
} }
} else { } else {
pfafList = ft.getAggregatePfafsByDomain( pfafList = ft.getAggregatePfafsByDomain(
parentBasinPfaf, parentBasinPfaf, siteKey, domain,
siteKey, domain,
huc); huc);
pfafList.add(ft.getAggregatedPfaf( pfafList.add(ft.getAggregatedPfaf(
cBasin.getPfaf(), cBasin.getPfaf(), siteKey, huc));
siteKey,
huc));
} }
} }
@ -465,7 +474,7 @@ public class FFMPDataGenerator {
forced = forceUtil.isForced(); forced = forceUtil.isForced();
} }
if (((forcedPfafs.size() > 1)) && forced) { if ((!forcedPfafs.isEmpty()) && forced) {
// Recalculate the guidance using the forced // Recalculate the guidance using the forced
// value(s) // value(s)
guidance = guidRecords guidance = guidRecords
@ -477,8 +486,8 @@ public class FFMPDataGenerator {
.get(guidType), .get(guidType),
guidance, guidance,
forcedPfafs, forcedPfafs,
resource.getGuidSourceExpiration()); resource.getGuidSourceExpiration(guidType));
} else if (forcedPfafs.size() > 1) { } else if (!forcedPfafs.isEmpty()) {
guidance = guidRecords guidance = guidRecords
.get(guidType) .get(guidType)
.getBasinData(ALL) .getBasinData(ALL)
@ -488,9 +497,9 @@ public class FFMPDataGenerator {
.get(guidType), .get(guidType),
Float.NaN, Float.NaN,
forcedPfafs, forcedPfafs,
resource.getGuidSourceExpiration()); resource.getGuidSourceExpiration(guidType));
forced = true; forced = true;
} else if (pfafList.size() > 1) { } else if (!pfafList.isEmpty()) {
guidance = guidRecords guidance = guidRecords
.get(guidType) .get(guidType)
.getBasinData(ALL) .getBasinData(ALL)
@ -500,7 +509,7 @@ public class FFMPDataGenerator {
.get(guidType), .get(guidType),
Float.NaN, Float.NaN,
forcedPfafs, forcedPfafs,
resource.getGuidSourceExpiration()); resource.getGuidSourceExpiration(guidType));
} else { } else {
guidance = resource.getGuidanceValue( guidance = resource.getGuidanceValue(
ffmpGuidBasin, paintRefTime, guidType); ffmpGuidBasin, paintRefTime, guidType);
@ -548,16 +557,19 @@ public class FFMPDataGenerator {
displayName = getDisplayName(cBasin); displayName = getDisplayName(cBasin);
if (displayName != null) { if (displayName != null) {
trd.setPfaf(cBasin.getPfaf().toString()); String cbasinPfaf = cBasin.getPfaf().toString();
StringBuilder sb = new StringBuilder(cbasinPfaf);
sb.append(cbasinPfaf).append("\n").append(displayName);
trd.setPfaf(cbasinPfaf);
trd.setTableCellData(0, new FFMPTableCellData(rowField, trd.setTableCellData(0, new FFMPTableCellData(rowField,
displayName, cBasin.getPfaf().toString() + "\n" displayName, sb.toString()));
+ displayName));
if (!isWorstCase || huc.equals(ALL) if (!isWorstCase || huc.equals(ALL)
|| (centeredAggregationKey != null)) { || (centeredAggregationKey != null)) {
if ((rateBasin != null) if ((rateBasin != null)
&& (rateBasin.get(cBasin.getPfaf()) != null)) { && (rateBasin.get(cBasin.getPfaf()) != null)) {
rate = rateBasin.get(cBasin.getPfaf()).getValue(paintRefTime); rate = rateBasin.get(cBasin.getPfaf()).getValue(
paintRefTime);
trd.setTableCellData(1, new FFMPTableCellData( trd.setTableCellData(1, new FFMPTableCellData(
FIELDS.RATE, rate)); FIELDS.RATE, rate));
// System.out.println("rate: "+rate); // System.out.println("rate: "+rate);
@ -596,8 +608,8 @@ public class FFMPDataGenerator {
// run over each guidance type // run over each guidance type
int i = 0; int i = 0;
for (String guidType : guidBasins.keySet()) { for (String guidType : guidBasins.keySet()) {
ArrayList<Long> pfafList = new ArrayList<Long>(); List<Long> pfafList = new ArrayList<Long>();
ArrayList<Long> forcedPfafs = new ArrayList<Long>(); List<Long> forcedPfafs = new ArrayList<Long>();
guidance = Float.NaN; guidance = Float.NaN;
boolean forced = false; boolean forced = false;
FFFGForceUtil forceUtil = forceUtils.get(guidType); FFFGForceUtil forceUtil = forceUtils.get(guidType);
@ -614,27 +626,20 @@ public class FFMPDataGenerator {
if (cBasin.getAggregated()) { if (cBasin.getAggregated()) {
if (domain == null) { if (domain == null) {
pfafList = ft.getAggregatePfafs( pfafList = ft.getAggregatePfafs(
cBasin.getPfaf(), cBasin.getPfaf(), siteKey, huc);
siteKey,
huc);
} else if (!domain.equals(NA)) { } else if (!domain.equals(NA)) {
if (!huc.equals(ALL)) { if (!huc.equals(ALL)) {
pfafList = ft pfafList = ft
.getAggregatePfafsByDomain( .getAggregatePfafsByDomain(
cBasin.getPfaf(), cBasin.getPfaf(),
siteKey, siteKey, domain, huc);
domain,
huc);
} }
} else { } else {
pfafList = ft.getAggregatePfafsByDomain( pfafList = ft.getAggregatePfafsByDomain(
cBasin.getPfaf(), cBasin.getPfaf(), siteKey, domain,
siteKey, domain,
huc); huc);
pfafList.add(ft.getAggregatedPfaf( pfafList.add(ft.getAggregatedPfaf(
cBasin.getPfaf(), cBasin.getPfaf(), siteKey, huc));
siteKey,
huc));
} }
} }
@ -646,7 +651,7 @@ public class FFMPDataGenerator {
forced = forceUtil.isForced(); forced = forceUtil.isForced();
} }
if (((forcedPfafs.size() > 1)) && forced) { if ((!forcedPfafs.isEmpty()) && forced) {
// Recalculate the guidance using the forced // Recalculate the guidance using the forced
// value(s) // value(s)
guidance = guidRecords guidance = guidRecords
@ -658,8 +663,8 @@ public class FFMPDataGenerator {
.get(guidType), .get(guidType),
guidance, guidance,
forcedPfafs, forcedPfafs,
resource.getGuidSourceExpiration()); resource.getGuidSourceExpiration(guidType));
} else if (forcedPfafs.size() > 1) { } else if (!forcedPfafs.isEmpty()) {
guidance = guidRecords guidance = guidRecords
.get(guidType) .get(guidType)
.getBasinData(ALL) .getBasinData(ALL)
@ -669,9 +674,9 @@ public class FFMPDataGenerator {
.get(guidType), .get(guidType),
Float.NaN, Float.NaN,
forcedPfafs, forcedPfafs,
resource.getGuidSourceExpiration()); resource.getGuidSourceExpiration(guidType));
forced = true; forced = true;
} else if (pfafList.size() > 1) { } else if (!pfafList.isEmpty()) {
guidance = guidRecords guidance = guidRecords
.get(guidType) .get(guidType)
.getBasinData(ALL) .getBasinData(ALL)
@ -681,8 +686,8 @@ public class FFMPDataGenerator {
.get(guidType), .get(guidType),
Float.NaN, Float.NaN,
forcedPfafs, forcedPfafs,
resource.getGuidSourceExpiration()); resource.getGuidSourceExpiration(guidType));
if (forcedPfafs.size() > 0) { if (!forcedPfafs.isEmpty()) {
forced = true; forced = true;
} }
} else { } else {
@ -743,8 +748,8 @@ public class FFMPDataGenerator {
private float getForcedAvg(FFFGForceUtil forceUtil, String domain, private float getForcedAvg(FFFGForceUtil forceUtil, String domain,
FFMPBasin cBasin, String guidType) { FFMPBasin cBasin, String guidType) {
FFFGDataMgr fdm = FFFGDataMgr.getInstance(); FFFGDataMgr fdm = FFFGDataMgr.getInstance();
ArrayList<Long> forcedPfafs; List<Long> forcedPfafs;
ArrayList<Long> pfafList = new ArrayList<Long>(); List<Long> pfafList = new ArrayList<Long>();
float guidance = Float.NaN; float guidance = Float.NaN;
boolean forced = false; boolean forced = false;
@ -761,8 +766,7 @@ public class FFMPDataGenerator {
if (cBasin.getAggregated()) { if (cBasin.getAggregated()) {
if (domain == null) { if (domain == null) {
pfafList = ft.getAggregatePfafs(cBasin.getPfaf(), pfafList = ft.getAggregatePfafs(cBasin.getPfaf(), siteKey, huc);
siteKey, huc);
} else if (!domain.equals(NA)) { } else if (!domain.equals(NA)) {
if (!huc.equals(ALL)) { if (!huc.equals(ALL)) {
pfafList = ft.getAggregatePfafsByDomain(cBasin.getPfaf(), pfafList = ft.getAggregatePfafsByDomain(cBasin.getPfaf(),
@ -771,18 +775,17 @@ public class FFMPDataGenerator {
} else { } else {
pfafList = ft.getAggregatePfafsByDomain(cBasin.getPfaf(), pfafList = ft.getAggregatePfafsByDomain(cBasin.getPfaf(),
siteKey, domain, huc); siteKey, domain, huc);
pfafList.add(ft.getAggregatedPfaf(cBasin.getPfaf(), pfafList.add(ft.getAggregatedPfaf(cBasin.getPfaf(), siteKey,
siteKey, huc)); huc));
} }
} }
if (!isWorstCase || huc.equals(ALL) if (!isWorstCase || huc.equals(ALL) || (centeredAggregationKey != null)) {
|| (centeredAggregationKey != null)) {
if (((forcedPfafs.size() > 1)) || forced) { if (((forcedPfafs.size() > 1)) || forced) {
// Calculate an average // Calculate an average
guidance = forceUtil.getAvgForcedValue(pfafList, forcedPfafs, guidance = forceUtil.getAvgForcedValue(pfafList, forcedPfafs,
resource.getGuidanceInterpolators().get(guidType), resource.getGuidanceInterpolators().get(guidType),
resource.getGuidSourceExpiration(), ft); resource.getGuidSourceExpiration(guidType), ft);
// } else if (forcedPfafs.size() > 1) { // } else if (forcedPfafs.size() > 1) {
// guidance = forceUtil.getAvgForcedValue(pfafList, // guidance = forceUtil.getAvgForcedValue(pfafList,
// forcedPfafs, // forcedPfafs,
@ -808,26 +811,22 @@ public class FFMPDataGenerator {
String name = null; String name = null;
try { try {
if (huc.equals(ALL) if (huc.equals(ALL) || (centeredAggregationKey != null)) {
|| (centeredAggregationKey != null)) { name = ft.getBasin(siteKey, basin.getPfaf()).getStreamName();
name = ft.getBasin(siteKey, basin.getPfaf())
.getStreamName();
} }
// aggregations // aggregations
else { else {
ArrayList<Long> pfafs = ft.getAggregatePfafs(basin.getPfaf(), ArrayList<Long> pfafs = ft.getAggregatePfafs(basin.getPfaf(),
siteKey, huc); siteKey, huc);
if (pfafs.size() > 0) { if (!pfafs.isEmpty()) {
if (huc.equals("COUNTY")) { if (huc.equals("COUNTY")) {
name = ft.getCountyStateName(siteKey, name = ft.getCountyStateName(siteKey, basin.getPfaf());
basin.getPfaf());
} else { } else {
for (int i = 0; i < pfafs.size(); i++) { for (int i = 0; i < pfafs.size(); i++) {
if (ft.getBasin(siteKey, pfafs.get(0)) if (ft.getBasin(siteKey, pfafs.get(0)).getHucName() != null) {
.getHucName() != null) { name = ft.getBasin(siteKey, pfafs.get(0))
name = ft.getBasin(siteKey, .getHucName();
pfafs.get(0)).getHucName();
break; break;
} }
} }
@ -854,8 +853,8 @@ public class FFMPDataGenerator {
} }
} }
ArrayList<Long> pfafs = ft.getAggregatePfafs(cBasin.getPfaf(), ArrayList<Long> pfafs = ft.getAggregatePfafs(cBasin.getPfaf(), siteKey,
siteKey, huc, activeDomains); huc, activeDomains);
trd.setPfaf(cBasin.getPfaf().toString()); trd.setPfaf(cBasin.getPfaf().toString());
Float qpe = Float.NaN; Float qpe = Float.NaN;
Float guidance = Float.NaN; Float guidance = Float.NaN;
@ -863,7 +862,7 @@ public class FFMPDataGenerator {
Float qpf = Float.NaN; Float qpf = Float.NaN;
if (cBasin instanceof FFMPVirtualGageBasin) { if (cBasin instanceof FFMPVirtualGageBasin) {
if (pfafs.size() == 0) { if (!pfafs.isEmpty()) {
if (virtualBasin != null) { if (virtualBasin != null) {
trd.setTableCellData( trd.setTableCellData(
1, 1,
@ -923,13 +922,12 @@ public class FFMPDataGenerator {
forceUtil.calculateForcings(pfafs, ft, cBasin); forceUtil.calculateForcings(pfafs, ft, cBasin);
ArrayList<Long> forcedPfafs = forceUtil List<Long> forcedPfafs = forceUtil.getForcedPfafList();
.getForcedPfafList();
boolean forced = forceUtil.isForced(); boolean forced = forceUtil.isForced();
if (!forced) { if (!forced) {
if ((forcedPfafs != null) if ((forcedPfafs != null)
&& (forcedPfafs.size() > 0)) { && (!forcedPfafs.isEmpty())) {
forced = true; forced = true;
} }
} }
@ -962,7 +960,7 @@ public class FFMPDataGenerator {
} }
} else { } else {
if (pfafs.size() > 0) { if (!pfafs.isEmpty()) {
if (rateBasin != null) { if (rateBasin != null) {
rate = rateBasin.getMaxValue(pfafs, paintRefTime); rate = rateBasin.getMaxValue(pfafs, paintRefTime);
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE, trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
@ -983,9 +981,9 @@ public class FFMPDataGenerator {
Float.NaN)); Float.NaN));
} }
if (qpfBasin != null) { if (qpfBasin != null) {
qpf = qpfBasin.getAverageMaxValue(pfafs, monitor.getQpfWindow() qpf = qpfBasin.getAverageMaxValue(pfafs, monitor
.getAfterTime(), monitor.getQpfWindow() .getQpfWindow().getAfterTime(), monitor
.getBeforeTime()); .getQpfWindow().getBeforeTime());
// qpf = getQPFValue(true, new Long(0l), pfafs);/* DR13839 // qpf = getQPFValue(true, new Long(0l), pfafs);/* DR13839
// */ // */
@ -1004,9 +1002,9 @@ public class FFMPDataGenerator {
FFMPBasinData guidBasin = guidBasins.get(guidType); FFMPBasinData guidBasin = guidBasins.get(guidType);
ArrayList<Long> pfafList = new ArrayList<Long>(); List<Long> pfafList = new ArrayList<Long>();
if ((guidBasin != null) if ((guidBasin != null)
&& (guidBasin.getBasins().size() > 0)) { && (!guidBasin.getBasins().isEmpty())) {
if (cBasin.getAggregated()) { if (cBasin.getAggregated()) {
pfafList = ft.getAggregatePfafs(cBasin.getPfaf(), pfafList = ft.getAggregatePfafs(cBasin.getPfaf(),
siteKey, huc); siteKey, huc);
@ -1015,7 +1013,7 @@ public class FFMPDataGenerator {
} }
boolean forced = false; boolean forced = false;
ArrayList<Long> forcedPfafs = new ArrayList<Long>(); List<Long> forcedPfafs = new ArrayList<Long>();
FFFGDataMgr fdm = FFFGDataMgr.getInstance(); FFFGDataMgr fdm = FFFGDataMgr.getInstance();
if (fdm.isForcingConfigured()) { if (fdm.isForcingConfigured()) {
@ -1026,7 +1024,7 @@ public class FFMPDataGenerator {
if (!forced) { if (!forced) {
if ((forcedPfafs != null) if ((forcedPfafs != null)
&& (forcedPfafs.size() > 0)) { && (!forcedPfafs.isEmpty())) {
forced = true; forced = true;
} }
} }
@ -1039,12 +1037,11 @@ public class FFMPDataGenerator {
pfafs, pfafs,
resource.getGuidanceInterpolators() resource.getGuidanceInterpolators()
.get(guidType), .get(guidType),
resource.getGuidSourceExpiration(), resource.getGuidSourceExpiration(guidType),
cBasin.getPfaf()); cBasin.getPfaf());
} else { } else {
FFMPGuidanceBasin basin = (FFMPGuidanceBasin) guidRecords FFMPGuidanceBasin basin = (FFMPGuidanceBasin) guidRecords
.get(guidType) .get(guidType).getBasinData(huc)
.getBasinData(huc)
.get(cBasin.getPfaf()); .get(cBasin.getPfaf());
guidance = resource.getGuidanceValue(basin, monitor guidance = resource.getGuidanceValue(basin, monitor
.getQpeWindow().getBeforeTime(), guidType); .getQpeWindow().getBeforeTime(), guidType);
@ -1058,19 +1055,19 @@ public class FFMPDataGenerator {
} }
if (!qpe.isNaN() && (guidance > 0.0f)) { if (!qpe.isNaN() && (guidance > 0.0f)) {
ArrayList<Float> qpes = qpeBasin.getAccumValues(pfafs, List<Float> qpes = qpeBasin.getAccumValues(pfafs,
monitor.getQpeWindow().getAfterTime(), monitor monitor.getQpeWindow().getAfterTime(), monitor
.getQpeWindow().getBeforeTime(), .getQpeWindow().getBeforeTime(),
expirationTime, isRate); expirationTime, isRate);
ArrayList<Float> guids = null; List<Float> guids = null;
if (guidBasin != null) { if (guidBasin != null) {
guids = guidBasin.getGuidanceValues(pfafs, resource guids = guidBasin.getGuidanceValues(pfafs, resource
.getGuidanceInterpolators().get(guidType), .getGuidanceInterpolators().get(guidType),
resource.getGuidSourceExpiration()); resource.getGuidSourceExpiration(guidType));
} }
if ((qpes.size() > 0) if ((!qpes.isEmpty())
&& ((guids != null) && (guids.size() > 0))) { && ((guids != null) && (!guids.isEmpty()))) {
trd.setTableCellData( trd.setTableCellData(
i + 5, i + 5,
@ -1158,13 +1155,12 @@ public class FFMPDataGenerator {
forceUtil.calculateForcings(pfafs, ft, cBasin); forceUtil.calculateForcings(pfafs, ft, cBasin);
ArrayList<Long> forcedPfafs = forceUtil List<Long> forcedPfafs = forceUtil.getForcedPfafList();
.getForcedPfafList();
boolean forced = forceUtil.isForced(); boolean forced = forceUtil.isForced();
if (!forced) { if (!forced) {
if ((forcedPfafs != null) if ((forcedPfafs != null)
&& (forcedPfafs.size() > 0)) { && (!forcedPfafs.isEmpty())) {
forced = true; forced = true;
} }
} }
@ -1208,37 +1204,35 @@ public class FFMPDataGenerator {
* @throws VizException * @throws VizException
*/ */
private FIELDS getBaseField() { private FIELDS getBaseField() {
System.out.println("Paint/Table Time: " + paintRefTime + "/" + tableTime);
FIELDS field = null; FIELDS field = null;
String localHuc = null; String localHuc = null;
dman = FFFGDataMgr.getInstance(); dman = FFFGDataMgr.getInstance();
FfmpTableConfigData ffmpTableCfgData = FfmpTableConfig.getInstance() FfmpTableConfigData ffmpTableCfgData = FfmpTableConfig.getInstance()
.getTableConfigData(siteKey); .getTableConfigData(siteKey);
String qpfType = ffmpTableCfgData.getQpfType(); String qpfType = ffmpTableCfgData.getQpfType();
ProductRunXML productRun = FFMPRunConfigurationManager.getInstance() ProductRunXML productRun = FFMPRunConfigurationManager.getInstance()
.getProduct(siteKey); .getProduct(siteKey);
String qpfSource = productRun String qpfSource = productRun.getQpfSources(product, qpfType).get(0)
.getQpfSources(product, qpfType).get(0)
.getSourceName(); .getSourceName();
FFMPConfig config = FFMPConfig.getInstance(); FFMPConfig config = FFMPConfig.getInstance();
String includedCWAs = config.getFFMPConfigData().getIncludedCWAs(); String includedCWAs = config.getFFMPConfigData().getIncludedCWAs();
cwaArr = includedCWAs.split(","); cwaArr = includedCWAs.split(",");
monitor.setQpfWindow(monitor.getTimeWindow(qpfSource, paintRefTime, siteKey)); monitor.setQpfWindow(monitor.getTimeWindow(qpfSource, paintRefTime,
siteKey));
Date qpeTime = paintRefTime; Date qpeTime = paintRefTime;
if (resource.isSplit()) { if (resource.isSplit()) {
// hack off the QPF duration for the table values of QPE (Split // hack off the QPF duration for the table values of QPE (Split
// Window) // Window)
double duration = FFMPSourceConfigurationManager.getInstance() double duration = FFMPSourceConfigurationManager.getInstance()
.getSource(qpfSource).getDurationHour(); .getSource(qpfSource).getDurationHour();
qpeTime = new Date((long) (qpeTime.getTime() - (duration * 3600 * 1000))); qpeTime = new Date(
(long) (qpeTime.getTime() - (duration * TimeUtil.MILLIS_PER_HOUR)));
} }
monitor.setQpeWindow(new FFMPTimeWindow(tableTime, monitor.setQpeWindow(new FFMPTimeWindow(tableTime, qpeTime));
qpeTime));
if (isWorstCase || (centeredAggregationKey != null)) { if (isWorstCase || (centeredAggregationKey != null)) {
// make sure that "ALL" is loaded // make sure that "ALL" is loaded
@ -1264,8 +1258,7 @@ System.out.println("Paint/Table Time: " + paintRefTime + "/" + tableTime);
tableTime, huc, true); tableTime, huc, true);
if (huc.equals(ALL)) { if (huc.equals(ALL)) {
virtualRecord = monitor.getVirtualRecord(product, siteKey, virtualRecord = monitor.getVirtualRecord(product, siteKey,
dataKey, product.getVirtual(), tableTime, dataKey, product.getVirtual(), tableTime, huc, true);
huc, true);
} }
localHuc = huc; localHuc = huc;
} }
@ -1273,14 +1266,14 @@ System.out.println("Paint/Table Time: " + paintRefTime + "/" + tableTime);
try { try {
if (rateRecord != null) { if (rateRecord != null) {
rateBasin = rateRecord.getBasinData(localHuc); rateBasin = rateRecord.getBasinData(localHuc);
if (rateBasin.getBasins().size() > 0) { if (!rateBasin.getBasins().isEmpty()) {
field = FIELDS.RATE; field = FIELDS.RATE;
baseRec = rateRecord; baseRec = rateRecord;
} }
} }
if (qpeRecord != null) { if (qpeRecord != null) {
qpeBasin = qpeRecord.getBasinData(localHuc); qpeBasin = qpeRecord.getBasinData(localHuc);
if (qpeBasin.getBasins().size() > 0) { if (!qpeBasin.getBasins().isEmpty()) {
field = FIELDS.QPE; field = FIELDS.QPE;
if (baseRec == null) { if (baseRec == null) {
baseRec = qpeRecord; baseRec = qpeRecord;
@ -1308,7 +1301,7 @@ System.out.println("Paint/Table Time: " + paintRefTime + "/" + tableTime);
// Get interpolators // Get interpolators
HashMap<String, FFMPGuidanceInterpolation> interpolators = resource HashMap<String, FFMPGuidanceInterpolation> interpolators = resource
.getGuidanceInterpolators(); .getGuidanceInterpolators();
if ((forceUtils == null) || (forceUtils.size() == 0)) { if ((forceUtils == null) || (forceUtils.isEmpty())) {
forceUtils = new HashMap<String, FFFGForceUtil>(); forceUtils = new HashMap<String, FFFGForceUtil>();
for (String guidType : interpolators.keySet()) { for (String guidType : interpolators.keySet()) {
@ -1318,7 +1311,6 @@ System.out.println("Paint/Table Time: " + paintRefTime + "/" + tableTime);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
statusHandler.handle(Priority.WARN, "field Not Available"); statusHandler.handle(Priority.WARN, "field Not Available");
} }

View file

@ -19,9 +19,7 @@
**/ **/
package com.raytheon.uf.viz.monitor.ffmp.ui.rsc; package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -29,23 +27,26 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.NavigableMap; import java.util.NavigableMap;
import java.util.zip.GZIPInputStream; import java.util.concurrent.CountDownLatch;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPAggregateRecord; import com.raytheon.uf.common.dataplugin.ffmp.FFMPAggregateRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils;
import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.monitor.config.FFMPRunConfigurationManager; import com.raytheon.uf.common.monitor.config.FFMPRunConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
import com.raytheon.uf.common.monitor.xml.FFMPRunXML; import com.raytheon.uf.common.monitor.xml.FFMPRunXML;
import com.raytheon.uf.common.monitor.xml.ProductRunXML; import com.raytheon.uf.common.monitor.xml.ProductRunXML;
import com.raytheon.uf.common.monitor.xml.ProductXML; import com.raytheon.uf.common.monitor.xml.ProductXML;
import com.raytheon.uf.common.monitor.xml.SourceXML; import com.raytheon.uf.common.monitor.xml.SourceXML;
import com.raytheon.uf.common.ohd.AppsDefaults; import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.DynamicSerializationManager;
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor; import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig; import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig;
import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPLoadListener; import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPLoadListener;
@ -63,6 +64,9 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPLoaderEvent;
* 28 Feb, 2011 7587 dhladky Initial creation * 28 Feb, 2011 7587 dhladky Initial creation
* 25 Jan, 2012 DR13839 gzhang Handle Uris and Huc processing * 25 Jan, 2012 DR13839 gzhang Handle Uris and Huc processing
* 01/27/13 1478 D. Hladky revamped the cache file format to help NAS overloading * 01/27/13 1478 D. Hladky revamped the cache file format to help NAS overloading
* 02/01/13 1569 D. Hladky Changed to reading aggregate records from pypies
* Feb 28, 2013 1729 dhladky Changed the way status messages are sent to the FFMP Dialog.
* Mar 6, 2013 1769 dhladky Changed threading to use count down latch.
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -72,8 +76,6 @@ public class FFMPDataLoader extends Thread {
private static final IUFStatusHandler statusHandler = UFStatus.getHandler(FFMPDataLoader.class); private static final IUFStatusHandler statusHandler = UFStatus.getHandler(FFMPDataLoader.class);
private String sharePath = null;
private ProductXML product = null; private ProductXML product = null;
private FFMPRunXML runner = null; private FFMPRunXML runner = null;
@ -82,8 +84,6 @@ public class FFMPDataLoader extends Thread {
private Date mostRecentTime = null; private Date mostRecentTime = null;
public boolean isDone = false;
public LOADER_TYPE loadType = null; public LOADER_TYPE loadType = null;
private String siteKey = null; private String siteKey = null;
@ -100,13 +100,12 @@ public class FFMPDataLoader extends Thread {
private ArrayList<FFMPLoadListener> loadListeners = new ArrayList<FFMPLoadListener>(); private ArrayList<FFMPLoadListener> loadListeners = new ArrayList<FFMPLoadListener>();
private CountDownLatch latch;
public FFMPDataLoader(FFMPResourceData resourceData, Date timeBack, public FFMPDataLoader(FFMPResourceData resourceData, Date timeBack,
Date mostRecentTime, LOADER_TYPE loadType, Date mostRecentTime, LOADER_TYPE loadType,
ArrayList<String> hucsToLoad) { ArrayList<String> hucsToLoad) {
sharePath = AppsDefaults.getInstance().getToken("apps_dir")
+ File.separator + "ffmp" + File.separator;
this.product = resourceData.getProduct(); this.product = resourceData.getProduct();
this.siteKey = resourceData.siteKey; this.siteKey = resourceData.siteKey;
this.dataKey = resourceData.dataKey; this.dataKey = resourceData.dataKey;
@ -118,6 +117,7 @@ public class FFMPDataLoader extends Thread {
this.resourceData = resourceData; this.resourceData = resourceData;
this.runner = FFMPRunConfigurationManager.getInstance().getRunner(wfo); this.runner = FFMPRunConfigurationManager.getInstance().getRunner(wfo);
this.config = FFMPConfig.getInstance(); this.config = FFMPConfig.getInstance();
this.latch = new CountDownLatch(1);
if ((loadType == LOADER_TYPE.INITIAL) if ((loadType == LOADER_TYPE.INITIAL)
|| (loadType == LOADER_TYPE.GENERAL)) { || (loadType == LOADER_TYPE.GENERAL)) {
@ -127,6 +127,10 @@ public class FFMPDataLoader extends Thread {
} }
} }
public void waitFor() throws InterruptedException {
latch.await();
}
/** /**
* Add listener * Add listener
* *
@ -147,15 +151,18 @@ public class FFMPDataLoader extends Thread {
// kills the loader // kills the loader
public void kill() { public void kill() {
isDone = true; latch.countDown();
} }
@Override @Override
public void run() { public void run() {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
try { try {
resourceData.setLoader(loadType); resourceData.setLoader(loadType);
FFMPMonitor monitor = getMonitor();
FFMPSourceConfigurationManager sourceConfig = monitor.getSourceConfig();
ProductRunXML productRun = runner.getProduct(siteKey); ProductRunXML productRun = runner.getProduct(siteKey);
ArrayList<String> qpfSources = new ArrayList<String>(); ArrayList<String> qpfSources = new ArrayList<String>();
@ -165,11 +172,11 @@ public class FFMPDataLoader extends Thread {
if ((loadType == LOADER_TYPE.INITIAL) if ((loadType == LOADER_TYPE.INITIAL)
|| (loadType == LOADER_TYPE.GENERAL)) { || (loadType == LOADER_TYPE.GENERAL)) {
rateURI = getMonitor().getAvailableUri(siteKey, dataKey, rateURI = monitor.getAvailableUri(siteKey, dataKey,
product.getRate(), mostRecentTime); product.getRate(), mostRecentTime);
} }
NavigableMap<Date, List<String>> qpeURIs = getMonitor() NavigableMap<Date, List<String>> qpeURIs = monitor
.getAvailableUris(siteKey, dataKey, product.getQpe(), .getAvailableUris(siteKey, dataKey, product.getQpe(),
timeBack); timeBack);
@ -183,11 +190,11 @@ public class FFMPDataLoader extends Thread {
Date qpfTime = timeBack; Date qpfTime = timeBack;
if (loadType == LOADER_TYPE.GENERAL) { if (loadType == LOADER_TYPE.GENERAL) {
qpfTime = getMonitor().getPreviousQueryTime(siteKey, qpfTime = monitor.getPreviousQueryTime(siteKey,
qpfSource.getSourceName()); qpfSource.getSourceName());
} }
qpfURIs = getMonitor().getAvailableUris(siteKey, dataKey, qpfURIs = monitor.getAvailableUris(siteKey, dataKey,
qpfSource.getSourceName(), qpfTime); qpfSource.getSourceName(), qpfTime);
if (qpfURIs != null && !qpfURIs.isEmpty()) { if (qpfURIs != null && !qpfURIs.isEmpty()) {
@ -197,7 +204,7 @@ public class FFMPDataLoader extends Thread {
} }
} }
NavigableMap<Date, List<String>> virtualURIs = getMonitor() NavigableMap<Date, List<String>> virtualURIs = monitor
.getAvailableUris(siteKey, dataKey, product.getVirtual(), .getAvailableUris(siteKey, dataKey, product.getVirtual(),
timeBack); timeBack);
@ -211,11 +218,11 @@ public class FFMPDataLoader extends Thread {
Date guidTime = timeBack; Date guidTime = timeBack;
if (loadType == LOADER_TYPE.GENERAL) { if (loadType == LOADER_TYPE.GENERAL) {
guidTime = getMonitor().getPreviousQueryTime(siteKey, guidTime = monitor.getPreviousQueryTime(siteKey,
guidSource.getSourceName()); guidSource.getSourceName());
} }
iguidURIs = getMonitor().getAvailableUris(siteKey, dataKey, iguidURIs = monitor.getAvailableUris(siteKey, dataKey,
guidSource.getSourceName(), guidTime); guidSource.getSourceName(), guidTime);
if (iguidURIs != null && !iguidURIs.isEmpty()) { if (iguidURIs != null && !iguidURIs.isEmpty()) {
@ -227,37 +234,37 @@ public class FFMPDataLoader extends Thread {
// range // range
if (loadType == LOADER_TYPE.TERTIARY) { if (loadType == LOADER_TYPE.TERTIARY) {
hucsToLoad.clear(); hucsToLoad.clear();
hucsToLoad.add("ALL"); hucsToLoad.add(FFMPRecord.ALL);
} }
if (isDone) { if (isDone()) {
return; return;
} }
// rate // rate
if (rateURI != null) { if (rateURI != null) {
fireLoaderEvent(loadType, "Processing " + product.getRate(), fireLoaderEvent(loadType, "Processing " + product.getRate(),
isDone); isDone());
for (String phuc : hucsToLoad) { for (String phuc : hucsToLoad) {
getMonitor().processUri(isProductLoad, rateURI, siteKey, monitor.processUri(isProductLoad, rateURI, siteKey,
product.getRate(), timeBack, phuc); product.getRate(), timeBack, phuc);
} }
fireLoaderEvent(loadType, product.getRate(), isDone); fireLoaderEvent(loadType, product.getRate(), isDone());
} }
// qpes // qpes
fireLoaderEvent(loadType, "Processing " + product.getQpe(), isDone); fireLoaderEvent(loadType, "Processing " + product.getQpe(), isDone());
FFMPAggregateRecord qpeCache = null; FFMPAggregateRecord qpeCache = null;
if (loadType == LOADER_TYPE.INITIAL) { if (loadType == LOADER_TYPE.INITIAL) {
SourceXML source = getMonitor().getSourceConfig().getSource( SourceXML source = sourceConfig.getSource(
product.getQpe()); product.getQpe());
qpeCache = readCacheFile(source, dataKey, wfo); qpeCache = readAggregateRecord(source, dataKey, wfo);
if (qpeCache != null) { if (qpeCache != null) {
getMonitor().insertFFMPData(qpeCache, siteKey, monitor.insertFFMPData(qpeCache, siteKey,
product.getQpe()); product.getQpe());
} }
} }
@ -266,40 +273,41 @@ public class FFMPDataLoader extends Thread {
if (!qpeURIs.isEmpty() && qpeCache == null) { if (!qpeURIs.isEmpty() && qpeCache == null) {
for (String phuc : hucsToLoad) { for (String phuc : hucsToLoad) {
if (phuc.equals(layer) if (phuc.equals(layer)
|| phuc.equals("ALL")) { || phuc.equals(FFMPRecord.ALL)) {
getMonitor().processUris(qpeURIs, isProductLoad, monitor.processUris(qpeURIs, isProductLoad,
siteKey, product.getQpe(), timeBack, phuc); siteKey, product.getQpe(), timeBack, phuc);
} }
} }
} }
fireLoaderEvent(loadType, product.getQpe(), isDone); fireLoaderEvent(loadType, product.getQpe(), isDone());
int i = 0; int i = 0;
for (NavigableMap<Date, List<String>> qpfURIs : qpfs) { for (NavigableMap<Date, List<String>> qpfURIs : qpfs) {
// qpf // qpf
fireLoaderEvent(loadType, "Processing " + product.getQpf(i), fireLoaderEvent(loadType, "Processing " + product.getQpf(i),
isDone); isDone());
FFMPAggregateRecord qpfCache = null; FFMPAggregateRecord qpfCache = null;
if (loadType == LOADER_TYPE.INITIAL) { if (loadType == LOADER_TYPE.INITIAL) {
SourceXML source = getMonitor().getSourceConfig()
SourceXML source = sourceConfig
.getSource(qpfSources.get(i)); .getSource(qpfSources.get(i));
String pdataKey = findQPFHomeDataKey(source); String pdataKey = findQPFHomeDataKey(source);
qpfCache = readCacheFile(source, pdataKey, wfo); qpfCache = readAggregateRecord(source, pdataKey, wfo);
if (qpfCache != null) { if (qpfCache != null) {
for (String phuc : hucsToLoad) { for (String phuc : hucsToLoad) {
if ((phuc.equals(layer) || phuc.equals("ALL")) if ((phuc.equals(layer) || phuc.equals(FFMPRecord.ALL))
&& loadType == LOADER_TYPE.INITIAL && loadType == LOADER_TYPE.INITIAL
&& source.getSourceName().equals( && source.getSourceName().equals(
config.getFFMPConfigData() config.getFFMPConfigData()
.getIncludedQPF())) { .getIncludedQPF())) {
if (!qpfURIs.isEmpty()) { if (!qpfURIs.isEmpty()) {
getMonitor().processUris(qpfURIs, monitor.processUris(qpfURIs,
isProductLoad, siteKey, isProductLoad, siteKey,
source.getSourceName(), timeBack, source.getSourceName(), timeBack,
phuc); phuc);
@ -307,7 +315,7 @@ public class FFMPDataLoader extends Thread {
} }
} }
getMonitor().insertFFMPData(qpfCache, siteKey, monitor.insertFFMPData(qpfCache, siteKey,
source.getSourceName()); source.getSourceName());
} }
} }
@ -317,48 +325,48 @@ public class FFMPDataLoader extends Thread {
if ((qpfCache == null) && !qpfURIs.isEmpty()) { if ((qpfCache == null) && !qpfURIs.isEmpty()) {
for (String phuc : hucsToLoad) { for (String phuc : hucsToLoad) {
if (phuc.equals(layer) if (phuc.equals(layer)
|| phuc.equals("ALL")) { // old || phuc.equals(FFMPRecord.ALL)) { // old
// code: // code:
// keep // keep
// for // for
// reference*/ // reference*/
// if (isHucProcessNeeded(phuc)) {/*DR13839*/ // if (isHucProcessNeeded(phuc)) {/*DR13839*/
getMonitor().processUris(qpfURIs, isProductLoad, monitor.processUris(qpfURIs, isProductLoad,
siteKey, product.getQpf(i), timeBack, phuc); siteKey, product.getQpf(i), timeBack, phuc);
} }
} }
} }
fireLoaderEvent(loadType, product.getQpf(i), isDone); fireLoaderEvent(loadType, product.getQpf(i), isDone());
i++; i++;
} }
fireLoaderEvent(loadType, "Processing " + product.getVirtual(), fireLoaderEvent(loadType, "Processing " + product.getVirtual(),
isDone); isDone());
FFMPAggregateRecord vgbCache = null; FFMPAggregateRecord vgbCache = null;
if (loadType == LOADER_TYPE.INITIAL) { if (loadType == LOADER_TYPE.INITIAL) {
SourceXML source = getMonitor().getSourceConfig().getSource( SourceXML source = sourceConfig.getSource(
product.getVirtual()); product.getVirtual());
vgbCache = readCacheFile(source, dataKey, wfo); vgbCache = readAggregateRecord(source, dataKey, wfo);
if (vgbCache != null) { if (vgbCache != null) {
getMonitor().insertFFMPData(vgbCache, siteKey, monitor.insertFFMPData(vgbCache, siteKey,
product.getVirtual()); product.getVirtual());
} }
} }
// Use this method of Virtual data retrieval if you don't have cache files // Use this method of Virtual data retrieval if you don't have cache files
if ((vgbCache == null) && !virtualURIs.isEmpty()) { if ((vgbCache == null) && !virtualURIs.isEmpty()) {
getMonitor().processUris(virtualURIs, isProductLoad, siteKey, monitor.processUris(virtualURIs, isProductLoad, siteKey,
product.getVirtual(), timeBack, "ALL"); product.getVirtual(), timeBack, FFMPRecord.ALL);
} }
fireLoaderEvent(loadType, product.getVirtual(), isDone); fireLoaderEvent(loadType, product.getVirtual(), isDone());
// process guidance all for all only, never uses cache files // process guidance all for all only, never uses cache files
for (String type : productRun.getGuidanceTypes(product)) { for (String type : productRun.getGuidanceTypes(product)) {
@ -371,20 +379,23 @@ public class FFMPDataLoader extends Thread {
.get(guidSource.getSourceName()); .get(guidSource.getSourceName());
fireLoaderEvent(loadType, fireLoaderEvent(loadType,
"Processing " + guidSource.getSourceName(), isDone); "Processing " + guidSource.getSourceName(), isDone());
getMonitor().processUris(iguidURIs, isProductLoad, siteKey, monitor.processUris(iguidURIs, isProductLoad, siteKey,
guidSource.getSourceName(), timeBack, "ALL"); guidSource.getSourceName(), timeBack, FFMPRecord.ALL);
fireLoaderEvent(loadType, guidSource.getSourceName(), fireLoaderEvent(loadType, guidSource.getSourceName(),
isDone); isDone());
} }
} }
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,"General Problem in Loading FFMP Data", e); statusHandler.handle(Priority.PROBLEM,"General Problem in Loading FFMP Data", e);
} finally { } finally {
isDone = true; latch.countDown();
synchronized(this) {
this.notifyAll();
}
} }
String message = null; String message = null;
@ -396,8 +407,7 @@ public class FFMPDataLoader extends Thread {
long endTime = (System.currentTimeMillis()) - time; long endTime = (System.currentTimeMillis()) - time;
System.out.println(loadType.loaderType + " Loader took: " + endTime / 1000 + " seconds"); System.out.println(loadType.loaderType + " Loader took: " + endTime / 1000 + " seconds");
fireLoaderEvent(loadType, message, isDone());
fireLoaderEvent(loadType, message, isDone);
} }
/** /**
@ -408,11 +418,9 @@ public class FFMPDataLoader extends Thread {
public void fireLoaderEvent(LOADER_TYPE ltype, String lmessage, public void fireLoaderEvent(LOADER_TYPE ltype, String lmessage,
boolean lstatus) { boolean lstatus) {
final FFMPLoaderStatus sstatus = new FFMPLoaderStatus(ltype, lmessage, FFMPLoaderStatus sstatus = new FFMPLoaderStatus(ltype, lmessage,
lstatus); lstatus);
VizApp.runAsync(new Runnable() {
public void run() {
FFMPLoaderEvent fle = new FFMPLoaderEvent(sstatus); FFMPLoaderEvent fle = new FFMPLoaderEvent(sstatus);
Iterator<FFMPLoadListener> iter = loadListeners.iterator(); Iterator<FFMPLoadListener> iter = loadListeners.iterator();
@ -420,17 +428,14 @@ public class FFMPDataLoader extends Thread {
FFMPLoadListener listener = iter.next(); FFMPLoadListener listener = iter.next();
listener.loadStatus(fle); listener.loadStatus(fle);
} }
}
});
} }
private FFMPMonitor getMonitor() { private FFMPMonitor getMonitor() {
if (FFMPMonitor.isRunning()) { if (FFMPMonitor.isRunning()) {
// System.out.println("Monitor is running...");
return FFMPMonitor.getInstance(); return FFMPMonitor.getInstance();
} else { } else {
// System.out.println("Monitor is dead..."); latch.countDown();
isDone = true;
return null; return null;
} }
} }
@ -459,83 +464,27 @@ public class FFMPDataLoader extends Thread {
* @param wfo * @param wfo
* @return * @return
*/ */
private FFMPAggregateRecord readCacheFile(SourceXML source, String pdataKey, String wfo) { private FFMPAggregateRecord readAggregateRecord(SourceXML source,
String pdataKey, String wfo) throws Exception {
long time = System.currentTimeMillis(); FFMPAggregateRecord record = null;
String sourceName = source.getSourceName(); String sourceSiteDataKey = getSourceSiteDataKey(source, pdataKey);
File file = new File(sharePath + wfo + File.separator + sourceName
+ "-" + siteKey + "-" + pdataKey + ".bin");
File lockFile = new File(sharePath + wfo + File.separator + sourceName
+ "-" + siteKey + "-" + pdataKey + ".lock");
while (lockFile.exists()) {
for (int i = 0; i < 4; i++) {
try {
sleep(100);
i++;
} catch (InterruptedException e) {
statusHandler.handle(Priority.ERROR,"Took to long to load Cache Record", e);
}
}
break;
}
System.out.println("Cache File expected path: "
+ file.getAbsolutePath());
FFMPAggregateRecord cacheRecord = null;
if (file.exists()) {
System.out.println("Last mod: " + new Date(file.lastModified()));
if (file.lastModified() > (System.currentTimeMillis() - (6 * TimeUtil.MILLIS_PER_HOUR))) {
while (lockFile.exists()) {
for (int i = 0; i < 4; i++) {
try {
System.out.println("Waiting for new file: "
+ file.getAbsolutePath());
sleep(100);
i++;
} catch (InterruptedException e) {
statusHandler.handle(Priority.ERROR,"ERROR in Loading Cache Record", e);
}
}
break;
}
GZIPInputStream gis = null;
try { try {
System.out.println("Loading file: " + file.getName()); File hdf5File = FFMPUtils.getHdf5File(wfo, sourceSiteDataKey);
gis = new GZIPInputStream(new BufferedInputStream(new FileInputStream(file))); IDataStore dataStore = DataStoreFactory.getDataStore(hdf5File);
DynamicSerializationManager dsm = DynamicSerializationManager IDataRecord rec = dataStore.retrieve(wfo, sourceSiteDataKey,
.getManager(SerializationType.Thrift); Request.ALL);
cacheRecord = (FFMPAggregateRecord) dsm.deserialize(gis); byte[] bytes = ((ByteDataRecord) rec).getByteData();
} catch (SerializationException e) { record = SerializationUtil.transformFromThrift(
statusHandler.handle(Priority.ERROR,"Serialization ERROR in Loading Cache Record", e); FFMPAggregateRecord.class, bytes);
} catch (IOException e) { } catch (Exception e) {
statusHandler.handle(Priority.ERROR,"IO ERROR in Loading Cache Record", e); statusHandler.handle(Priority.WARN,
} finally { "Couldn't read Aggregate Record" + sourceSiteDataKey);
if (gis != null) {
try {
gis.close();
} catch (IOException e) {
statusHandler.handle(Priority.ERROR,"GENRAL ERROR in Loading Cache Record", e);
}
}
}
}
} }
long time2 = System.currentTimeMillis(); return record;
System.out.println("FFMP Cache file Load took: "+ (time2 - time) + " ms");
return cacheRecord;
} }
/** /**
@ -550,16 +499,37 @@ public class FFMPDataLoader extends Thread {
.getInstance(); .getInstance();
for (ProductRunXML product : runManager.getProducts()) { for (ProductRunXML product : runManager.getProducts()) {
File file = new File(sharePath + wfo + File.separator
+ source.getSourceName() + "-" + siteKey + "-"
+ product.getProductKey() + ".bin");
if (file.exists()) { try {
return product.getProductKey(); // we are just checking if it exists or not
String pdataKey = product.getProductKey();
String sourceSiteDataKey = getSourceSiteDataKey(source, pdataKey);
File hdf5File = FFMPUtils.getHdf5File(wfo, sourceSiteDataKey);
DataStoreFactory.getDataStore(hdf5File);
return pdataKey;
} catch (Exception e) {
// not the right key, doesn't exist
continue;
} }
} }
return siteKey; return siteKey;
} }
/**
* Get the sourceSiteDataKey for this piece of data
* @param source
* @param pdataKey
* @return
*/
private String getSourceSiteDataKey(SourceXML source, String pdataKey) {
return source.getSourceName() + "-" + siteKey + "-"
+ pdataKey;
}
public boolean isDone() {
return latch.getCount() == 0;
}
} }

View file

@ -1,5 +1,25 @@
package com.raytheon.uf.viz.monitor.ffmp.ui.rsc; package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -25,6 +45,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPTableData;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 04/23/10 4494 D. Hladky Initial release * 04/23/10 4494 D. Hladky Initial release
* 02/01/13 1569 D. Hladky Added constants
* *
* </pre> * </pre>
* *

View file

@ -26,6 +26,24 @@ import java.util.Set;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
/**
* Graph data object used to display 24 hour graph info
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/23/10 4494 D. Hladky Initial release
* 02/01/13 1569 D. Hladky Added constants
*
* </pre>
*
* @author dhladky
* @version 1
*/
public class FFMPGraphData { public class FFMPGraphData {
private HashMap<Double, Double> qpes = new HashMap<Double, Double>(); private HashMap<Double, Double> qpes = new HashMap<Double, Double>();

View file

@ -23,16 +23,10 @@ package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord; import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils; import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
import com.raytheon.uf.viz.core.exception.VizException;
import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.GeometryFactory;
/** /**
@ -45,6 +39,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 08/29/09 2152 D. Hladky Initial release * 08/29/09 2152 D. Hladky Initial release
* 02/01/13 1569 D. Hladky Added constants
* *
* </pre> * </pre>
* *
@ -56,76 +51,6 @@ public class FFMPGuiUtils {
public static GeometryFactory factory = new GeometryFactory(); public static GeometryFactory factory = new GeometryFactory();
/**
* Gets the upstream basins for the visualization
*
* @param cwa
* @return
*/
public static Set<Integer> getUpStreamBasins(Long pfaf) {
String sql = "select upstream1, upstream2, upstream3, upstream4, upstream5, upstream6 from "
+ FFMPUtils.FFMP_TABLE + " where pfaf_id = '" + pfaf + "'";
Set<Integer> basinIds = null;
try {
List<Object[]> results = DirectDbQuery.executeQuery(sql,
FFMPUtils.MAPS_DB, QueryLanguage.SQL);
if (results.size() > 0) {
basinIds = new HashSet<Integer>(
(int) (results.size() * 1.3) + 1);
Object[] results2 = results.get(0);
for (int i = 0; i < results2.length; i++) {
if (((Long) results2[i]).intValue() != 0) {
basinIds.add(((Long) results2[i]).intValue());
}
}
}
} catch (VizException e) {
e.printStackTrace();
}
return basinIds;
}
/**
* Gets the downstream basins for the visualization
*
* @param cwa
* @return
*/
public static Set<Long> getDownStreamBasins(int basin_id) {
String sql = "select pfaf_id from " + FFMPUtils.FFMP_TABLE
+ " where upstream1 = '" + basin_id + "' OR upstream2 = '"
+ basin_id + "' OR upstream3 = '" + basin_id
+ "' OR upstream4 = '" + basin_id + "' OR upstream5 = '"
+ basin_id + "' OR upstream6 = '" + basin_id + "'";
Set<Long> pfafIds = null;
try {
List<Object[]> results = DirectDbQuery.executeQuery(sql,
FFMPUtils.MAPS_DB, QueryLanguage.SQL);
if (results.size() > 0) {
pfafIds = new HashSet<Long>((int) (results.size() * 1.3) + 1);
Object[] results2 = results.get(0);
for (int i = 0; i < results2.length; i++) {
if (((String) results2[i]) != null) {
pfafIds.add(Long.parseLong((String) results2[i]));
}
}
}
} catch (VizException e) {
e.printStackTrace();
}
return pfafIds;
}
public static HashMap<Double, Integer> getTimeOffsets( public static HashMap<Double, Integer> getTimeOffsets(
ArrayList<FFMPRecord> records) { ArrayList<FFMPRecord> records) {
HashMap<Double, Integer> ctimes = new HashMap<Double, Integer>(); HashMap<Double, Integer> ctimes = new HashMap<Double, Integer>();
@ -176,7 +101,7 @@ public class FFMPGuiUtils {
* @return * @return
*/ */
public static Date get1HourForward(Date timeIn) { public static Date get1HourForward(Date timeIn) {
return new Date(timeIn.getTime() + (3600 * 1000)); return new Date(timeIn.getTime() + (TimeUtil.MILLIS_PER_HOUR));
} }
/** /**
@ -186,7 +111,7 @@ public class FFMPGuiUtils {
* @return * @return
*/ */
public static Date getHourDisplacement(Date timeIn, double hour) { public static Date getHourDisplacement(Date timeIn, double hour) {
return new Date(timeIn.getTime() - (int) (3600 * 1000 * hour)); return new Date(timeIn.getTime() - (int) (TimeUtil.MILLIS_PER_HOUR * hour));
} }
} }

View file

@ -1,7 +1,45 @@
package com.raytheon.uf.viz.monitor.ffmp.ui.rsc; package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPDataLoader.LOADER_TYPE; import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPDataLoader.LOADER_TYPE;
/**
* Loader status for FFMP
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/23/10 4494 D. Hladky Initial release
* 02/01/13 1569 D. Hladky Added constants
*
* </pre>
*
* @author dhladky
* @version 1
*/
public class FFMPLoaderStatus { public class FFMPLoaderStatus {
private LOADER_TYPE loaderType = null; private LOADER_TYPE loaderType = null;

Some files were not shown because too many files have changed in this diff Show more