13.3.1-12 baseline

Former-commit-id: 6f374b35d0 [formerly be96282207] [formerly 0be473728a] [formerly 6f374b35d0 [formerly be96282207] [formerly 0be473728a] [formerly aaac0b51e5 [formerly 0be473728a [formerly 1f109861760e5fbc9d7a13cc4f518341cbc31276]]]]
Former-commit-id: aaac0b51e5
Former-commit-id: bb30a41300 [formerly f80f98cee2] [formerly 4cfa5d11d7d7059b88534daa18142d24f3a6f481 [formerly bc439aee4f]]
Former-commit-id: 5c941816ce99cd7acc86ec8198a9c8d060f02007 [formerly f1d156779a]
Former-commit-id: 120fc26670
This commit is contained in:
Steve Harris 2013-03-25 13:27:13 -05:00
parent 5475d95f5f
commit fd735b8ff8
1086 changed files with 56383 additions and 29194 deletions

View file

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

View file

@ -60,9 +60,6 @@
# Status: TEST
# 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 Avn, AvnLib, Globals, MonitorP
@ -71,10 +68,10 @@ import CCFPData
_Logger = logging.getLogger(__name__)
_Code = { \
'tops': {1: '400+ ', 2: '350-390', 3: '300-340', 4: '250-290'}, \
'gwth': {1: '+ ', 2: 'NC', 3: '- '}, \
'tops': {1: '370+ ', 2: '310-370', 3: '250-310'}, \
'gwth': {1: '++', 2: '+ ', 3: 'NC', 4: '- '}, \
'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):
# 6 hour forecast
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)]
fcst, text = {}, []
try:

View file

@ -1,19 +1,19 @@
##
# 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
# 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
#
# 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.
##
@ -140,10 +140,20 @@
# Relationship Type: In Response to
# Status: TEST
# 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 Avn, AvnLib, AvnParser
import Avn, AvnLib, AvnParser, JUtil, cPickle
import PointDataView, GfeValues
_Missing = ''
@ -157,7 +167,7 @@ _Keys = ['Temp', 'DwptT', 'WDir', 'WSpd', 'WGust', 'Obvis', 'Vsby', \
'Ints2', 'Prob2', 'PTyp3', 'Ints3', 'Prob3']
_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',
'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):
organizedData = {}
data = []
pdc = None
if pdc is not None :
for i in range(pdc.getCurrentSz()):
jpdv = pdc.readRandom(i)
@ -444,8 +453,11 @@ def _readPrbConf():
prb_conf['after9hr'][wx] = conf.getint('after9hr',wx)
return prb_conf
def makeData(siteID, timeSeconds):
def makeData(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:
msg = 'Grid data is not available'
_Logger.info(msg)
@ -492,34 +504,51 @@ def makeTable(siteID, timeSeconds):
msg = 'Grid data for %s is not available', siteID
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.vividsolutions.jts.geom import Coordinate
from com.raytheon.viz.aviation.guidance import GuidanceUtil
from com.raytheon.uf.viz.core.localization import LocalizationManager
config = AvnParser.getTafSiteCfg(siteID)
lat = config['geography']['lat']
lon = config['geography']['lon']
gfeSiteId = LocalizationManager.getInstance().getCurrentSite()
task = GetPointDataRequest()
task.setSiteID(gfeSiteId);
c = Coordinate(float(lon), float(lat))
task.setCoordinate(c)
task.setNumberHours(_NumHours)
task.setStartTime(long(timeSeconds * 1000))
for p in Parameters:
task.addParameter(p)
db = gfeSiteId + '_GRID__Official_00000000_0000'
task.setDatabaseID(db)
pdc = GuidanceUtil.getGFEPointData(task)
data = _getData(pdc, timeSeconds * 1000)
if data is None :
_Logger.info('Data not available for %s', siteID)
return data
for siteID in siteIDs:
config = AvnParser.getTafSiteCfg(siteID)
lat = config['geography']['lat']
lon = config['geography']['lon']
c = Coordinate(float(lon), float(lat))
task.addCoordinate(c)
task.setNumberHours(_NumHours)
task.setStartTime(long(timeSeconds * 1000))
for p in parameters:
task.addParameter(p)
pdcs = GuidanceUtil.getGFEPointsData(task)
i = 0
results = {}
for siteID in siteIDs:
pdc = pdcs.getContainer(i)
if i < pdcs.getSize() :
++i
data = _getData(pdc, timeSeconds * 1000)
if data is None:
_Logger.info('Data not available for %s', siteID)
results[siteID] = data
return results
###############################################################################
if __name__ == '__main__':

View file

@ -1,19 +1,19 @@
##
# 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
# 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
#
# 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.
##
@ -125,10 +125,20 @@
# IFPS grids monitoring module
# Author: George Trojan, SAIC/MDL, August 2003
# 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 Avn, AvnLib, Globals, GridData, MonitorP, TafDecoder, TafGen
import logging, time, cPickle
import Avn, AvnLib, Globals, GridData, MonitorP, TafDecoder, TafGen, JUtil
from com.raytheon.viz.aviation.monitor import SiteGridManager
_Logger = logging.getLogger(Avn.CATEGORY)
##############################################################################
@ -142,7 +152,21 @@ class Monitor(MonitorP.Monitor):
def __makeData(self, t):
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'
tc=TafGen.TafGen('grid',data,bbb)
taf=tc.createTaf(False)

View file

@ -35,6 +35,7 @@ _Logger = logging.getLogger(Avn.CATEGORY)
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 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
def __makeHeader(model, data):
#print '__makeHeader data: ', data
if data and data['itime'] and data['itime']['value']:
date = time.strftime('%m/%d/%y %H%M UTC', time.gmtime(data['itime']['value']))
else:
@ -460,12 +462,12 @@ def gridgenRetrieve(siteID):
d = (requestTime, data)
o['data'] = d
obj = pickle.dumps(o)
# print 'return gridgenRetrieve - siteID, data', siteID, d
#print 'return gridgenRetrieve - siteID, data', siteID, d
return obj
def gridgen(siteObjs, format='short', routine=False, highlightFlightCat=True):
siteObjs = JUtil.javaStringListToPylist(siteObjs)
# print 'GuidanceEntry:gridgen format, highlightFlightCat:', format, highlightFlightCat
#print 'GuidanceEntry:gridgen format, highlightFlightCat:', format, highlightFlightCat
currentTime = time.gmtime()
requestTime = time.mktime((currentTime[0], currentTime[1], currentTime[2], currentTime[3],
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)
siteID = o['siteID']
cacheRequestTime, data = o['data']
if data is not None :
data = data.values()[0]
if not firstSiteID:
firstSiteID = siteID
# print 'gridgen siteID, cacheRequestTime, data: ', cacheRequestTime, data
#print 'gridgen siteID, cacheRequestTime, data: ', siteID, cacheRequestTime, data
if cacheRequestTime != requestTime:
cacheList.append('++Cache out of date :%s' % siteID)
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
# version of all grids and there's no way yet to turn this off.
minTDict = {}
maxTDict = {}
tDict = {}
tdDict = {}
minTRList = self.getWEInventory("MinT")
for tr in minTRList:
grid = self.getGrids(MODEL, "MinT", LEVEL, tr, mode = "First")
minTDict[tr] = grid
minTDict = self.getGrids(MODEL, "MinT", LEVEL, minTRList, mode = "First")
maxTRList = self.getWEInventory("MaxT")
for tr in maxTRList:
grid = self.getGrids(MODEL, "MaxT", LEVEL, tr, mode = "First")
maxTDict[tr] = grid
maxTDict = self.getGrids(MODEL, "MaxT", LEVEL, maxTRList, mode = "First")
TTRList = self.getWEInventory("T")
for tr in TTRList:
grid = self.getGrids(MODEL, "T", LEVEL, tr, mode = "First")
tDict[tr] = grid
tDict = self.getGrids(MODEL, "T", LEVEL, TTRList, mode = "First")
TdTRList = self.getWEInventory("Td")
for tr in TdTRList:
grid = self.getGrids(MODEL, "Td", LEVEL, tr, mode = "First")
tdDict[tr] = grid
tdDict = self.getGrids(MODEL, "Td", LEVEL, TdTRList, mode = "First")
# get the all locks by other users, so we can detect they are locked
# before attempting to modify them

View file

@ -88,11 +88,17 @@ def executeFromJava(databaseID, site, username, dataMgr, forecastList, logFile,
site = str(site)
databaseID = str(databaseID)
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,
cmdLineVarDict=cmdLineVarDict, vtecMode=vtecMode, username=username,
dataMgr=dataMgr, drtTime=drtTime)
elapsedTime = (time.time() - startTime)*1000
logger.info("Text Formatter Finished, took: %d ms",elapsedTime)
RedirectLogging.restore()
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
# point!!!!!!!!!!!!!!!
logger.info("Text Formatter Finished")
return forecasts
def getAbsTime(timeStr):

View file

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

View file

@ -23,17 +23,24 @@
# any purpose.
#
# SmartScript -- library of methods for Smart Tools and Procedures
# History
# Time Ticket# Developer Comments
# ----------------------------------------------------------------------
# 01/09/2012 DR15626 J. Zeng Add methods
# enableISCsend
# clientISCSendStatus
# manualSendISC_autoMode
# manualSendISC_manualMode
#
# Author: hansen
# ----------------------------------------------------------------------------
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 01/09/13 DR15626 J. Zeng Add methods
# enableISCsend
# clientISCSendStatus
# manualSendISC_autoMode
# manualSendISC_manualMode
# 01/30/13 1559 dgilling Fix TypeError in
# getGridCellSwath().
# Mar 13, 2013 1791 bsteffen Implement bulk getGrids to
# improve performance.
#
########################################################################
import types, string, time, sys
from math import *
@ -52,6 +59,7 @@ from java.util import Date
from java.nio import FloatBuffer
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 Grid2DFloat
from com.raytheon.uf.common.dataplugin.gfe.discrete import DiscreteKey
@ -350,7 +358,10 @@ class SmartScript(BaseTool.BaseTool):
# e.g. "SFC", "MB350", "BL030"
# x, y: integer coordinates
# 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
# are found within the given time range:
# "TimeWtAverage": return time-weighted Average value
@ -393,10 +404,19 @@ class SmartScript(BaseTool.BaseTool):
if isinstance(model, DatabaseID.DatabaseID):
model = model.modelIdentifier()
timeRangeList = None
if isinstance(timeRange, TimeRange.TimeRange):
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:
# for cModel, cElement, cLevel, cMostRecent, cRange, cMode, cResult in \
# self.__pythonGrids:
@ -414,7 +434,17 @@ class SmartScript(BaseTool.BaseTool):
"NoData", "No Weather Element for " + exprName)
else:
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
if result is not None:
if len(result) == 0:
@ -1210,7 +1240,6 @@ class SmartScript(BaseTool.BaseTool):
# color. If "on" is 0, turn off the highlight.
parm = self.getParm(model, element, level)
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[0] = timeRange.toJavaObj()
@ -1553,8 +1582,6 @@ class SmartScript(BaseTool.BaseTool):
return self.__dataMgr.getSpatialDisplayManager().getActivatedParm()
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
# Returns an AFPS.ReferenceData swath of the given
# number of cells around the given an edit area.
@ -1569,10 +1596,10 @@ class SmartScript(BaseTool.BaseTool):
grid2DBit = self.getGridLoc().gridCellSwath(
polygon.getCoordinates(), float(cells), False)
if grid2DB is not None:
grid2DB = grid2DB | grid2DBit
grid2DB = grid2DB.orEquals(grid2DBit)
else:
grid2DB = grid2DBit
return ReferenceData(self.getGridLoc(), ReferenceID("test"), grid2DB)
return self.getGridLoc().convertToReferenceData(grid2DB)
def getLatLon(self, x, y):
# Get the latitude/longitude values for the given grid point

View file

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

View file

@ -25,9 +25,7 @@
menuText="Convective SIGMET" id="ConvSigmet">
<dataURI>/convsigmet/%</dataURI>
</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="titleItem" titleText="------ Icing Products ------" />

View file

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

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,7 +761,9 @@ public class CollaborationGroupView extends CaveFloatingView implements
VizApp.runAsync(new Runnable() {
@Override
public void run() {
usersTreeViewer.refresh(element);
if (usersTreeViewer.getControl().isDisposed() == false) {
usersTreeViewer.refresh(element);
}
}
});
}

View file

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

View file

@ -56,13 +56,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.datastorage.hdf5"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.derivparam"
download-size="0"
@ -82,7 +75,7 @@
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.common.units"
download-size="0"
@ -220,7 +213,7 @@
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.spatial"
download-size="0"
@ -319,4 +312,18 @@
version="0.0.0"
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>

View file

@ -83,7 +83,8 @@ public class CoopPrecipPlotInfoRetriever extends AbstractPlotInfoRetriever {
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"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.dataplugin.maps"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.viz.core.maps"
download-size="0"
@ -238,4 +245,10 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.viz.event"
download-size="0"
install-size="0"
version="0.0.0"/>
</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.core.rsc;bundle-version="1.0.0",
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"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy

View file

@ -20,9 +20,9 @@
package com.raytheon.uf.viz.core.maps.rsc;
import java.util.ArrayList;
import java.util.Iterator;
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.viz.core.catalog.DirectDbQuery;
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
* Sep 18, 2012 #1019 randerso cleaned up geometry type query
* Jan 30, 2013 #1551 bkowal Refactored
*
* </pre>
*
@ -64,47 +65,12 @@ public class DefaultDbMapQuery implements DbMapQuery {
@Override
public QueryResult queryWithinEnvelope(Envelope env, List<String> columns,
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()) {
Iterator<String> iter = columns.iterator();
query.append(iter.next());
while (iter.hasNext()) {
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(';');
/*
* Build the query using the common method.
*/
final String query = MapsQueryUtil.assembleMapsTableQuery(env, columns,
additionalConstraints, this.table, this.geomField);
return DirectDbQuery.executeMappedQuery(query.toString(), MAPS,
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>
</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">
<param name="BufferSize" value="500"/>
<appender-ref ref="CaveLogAppender"/>
</appender>
<appender name="AsyncPerfLogAppender" class="org.apache.log4j.AsyncAppender">
<param name="BufferSize" value="500"/>
<appender-ref ref="PerformanceLogAppender"/>
</appender>
<logger name="CaveLogger" additivity="false">
<level value="ALL"/>
<appender-ref ref="AsyncCaveLogAppender"/>
</logger>
<logger name="PerformanceLogger" additivity="false">
<level value="ALL"/>
<appender-ref ref="AsyncPerfLogAppender"/>
</logger>
<logger name="com.raytheon">
<level value="INFO"/>
</logger>

View file

@ -33,6 +33,18 @@ import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore;
/**
* 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 {
@ -79,6 +91,7 @@ public class Activator extends AbstractUIPlugin {
* )
*/
public void stop(BundleContext context) throws Exception {
System.out.println("Stopping " + PLUGIN_ID + " plugin");
plugin = null;
super.stop(context);
for (IDisposable dispose : disposables) {

View file

@ -33,6 +33,9 @@ import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 20, 2011 mschenke Initial creation
* Feb 14, 2013 1616 bsteffen Add option for interpolation of colormap
* parameters, disable colormap interpolation
* by default.
*
* </pre>
*
@ -56,9 +59,6 @@ public class DrawableColorMap {
/** The contrast to draw at */
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
*

View file

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

View file

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

View file

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

View file

@ -49,6 +49,8 @@ import com.raytheon.uf.viz.core.status.StatusConstants;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 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>
*
@ -77,7 +79,7 @@ public class CubeUtil {
if (record != null) {
File file = HDF5Util.findHDF5Location(record);
if (file != null)
filename = file.getAbsolutePath();
filename = file.getPath();
}
return filename;
}

View file

@ -45,6 +45,8 @@ import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 3, 2007 chammack Initial Creation.
* Jan 14, 2013 1442 rferrel Added method searchTreeUsingContraints.
* Addition checks on constraints.
*
* </pre>
*
@ -279,7 +281,41 @@ public class DecisionTree<T> {
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) {
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) {
List<T> lst = new ArrayList<T>();
if (head == null) {
@ -288,13 +324,13 @@ public class DecisionTree<T> {
Node curNode = head;
searchTree(curNode, searchCriteria, lst, 0);
searchTree(curNode, searchCriteria, lst, 0, evaluateConstraints);
return lst;
}
}
private void searchTree(Node curNode, Map<String, Object> searchCriteria,
List<T> resultList, int lvl) {
private void searchTree(Node curNode, Map<String, ?> searchCriteria,
List<T> resultList, int lvl, boolean evaluatedConstraint) {
if (curNode == null) {
return;
@ -312,20 +348,30 @@ public class DecisionTree<T> {
Object parsedValue = searchCriteria.get(curNode.decisionAttribute);
boolean foundSomething = false;
// Evaluate through the values: First search for an exact match
// of non-null values
for (Node n : curNode.nodeChildren) {
RequestConstraint c = n.decision;
if (c == null
|| (c == RequestConstraint.WILDCARD || parsedValue == null || c
.evaluate(parsedValue))) {
// for (int k = 0; k < lvl; k++) {
// System.out.print(" ");
// }
foundSomething = true;
// System.out.println("visit: " + curNode.decisionAttribute
// + ":: " + c);
searchTree(n, searchCriteria, resultList, lvl + 1);
if (evaluatedConstraint) {
// Evaluate through the values: First search for an exact match
// of non-null values
for (Node n : curNode.nodeChildren) {
RequestConstraint c = n.decision;
if (c == null
|| (c == RequestConstraint.WILDCARD
|| parsedValue == null || c
.evaluate(parsedValue))) {
foundSomething = true;
searchTree(n, searchCriteria, resultList, lvl + 1,
evaluatedConstraint);
}
}
} 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>();
dataMap.put("pluginName", "grib");
dataMap.put("model", "nam12");
// List<Integer> list = iDT.searchTree(dataMap);
// System.out.println(list.get(0));
Map<String, Object> dataMap2 = new HashMap<String, Object>();
dataMap2.put("pluginName", "grib");

View file

@ -53,6 +53,9 @@ import com.raytheon.uf.viz.core.style.DataMappingPreferences.DataMappingEntry;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 24, 2007 chammack Initial Creation.
* Feb 14, 2013 1616 bsteffen Add option for interpolation of
* colormap parameters, disable colormap
* interpolation by default.
*
* </pre>
*
@ -195,6 +198,9 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
/** Values >0 enable log scaling of the colormap. */
private float logFactor = -1.0f;
/** Specify whether the colormap should be interpolated */
protected boolean interpolate = false;
public static class LabelEntry {
private float location;
@ -933,14 +939,7 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
* @return
*/
public RGB getRGBByValue(float value) {
float index = getIndexByValue(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))));
return colorToRGB(getColorByValue(value));
}
/**
@ -956,7 +955,25 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
} else if (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) {
@ -1027,4 +1044,12 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
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
* ------------ ---------- ----------- --------------------------
* Jun 26, 2012 bsteffen Initial creation
* Feb 14, 2013 1616 bsteffen Add option for interpolation of colormap
* parameters, disable colormap interpolation
* by default.
*
* </pre>
*
@ -128,7 +131,6 @@ public class GeneralCanvasRenderingExtension extends
newColorMap.alpha = colorMap.alpha;
newColorMap.brightness = colorMap.brightness;
newColorMap.contrast = colorMap.contrast;
newColorMap.interpolate = colorMap.interpolate;
double x1 = colorMap.extent.getMinX();
double y1 = colorMap.extent.getMinY();
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
* Sep 12, 2012 1167 djohnson Add datadelivery servers.
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
*
* </pre>
*
@ -126,7 +127,6 @@ public class LocalizationInitializer {
VizApp.setHttpServer(resp.getHttpServer());
VizApp.setJmsServer(resp.getJmsServer());
VizApp.setPypiesServer(resp.getPypiesServer());
VizApp.setServerDataDir(resp.getServerDataDir());
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().
* May 19, 2007 #1127 randerso Implemented error handling
* Sep 12, 2012 1167 djohnson Add datadelivery servers.
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
*
* </pre>
*
@ -223,7 +224,6 @@ public class LocalizationManager implements IPropertyChangeListener {
VizApp.setHttpServer(resp.getHttpServer());
VizApp.setJmsServer(resp.getJmsServer());
VizApp.setPypiesServer(resp.getPypiesServer());
VizApp.setServerDataDir(resp.getServerDataDir());
VizServers.getInstance().setServerLocations(
resp.getServerLocations());
} 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.comm.CommunicationException;
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.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
import com.raytheon.uf.common.serialization.comm.RemoteServiceRequest;
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
* Jul 24, 2012 njensen Enhanced logging
* Nov 15, 2012 1322 djohnson Publicize ability to specify specific httpAddress.
* Jan 24, 2013 1526 njensen Switch from using postBinary() to postDynamicSerialize()
*
* </pre>
*
@ -126,9 +124,6 @@ public class ThriftClient {
private static INotAuthHandler defaultHandler = UserController
.getNotAuthHandler();
private static NetworkStatistics stats = HttpClient.getInstance()
.getStats();
/**
* 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
@ -274,24 +269,30 @@ public class ThriftClient {
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,
String httpAddress, String uri) throws VizException {
httpAddress += uri;
String uniqueId = UUID.randomUUID().toString();
RequestWrapper wrapper = new RequestWrapper(request, VizApp.getWsId(),
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 {
long t0 = System.currentTimeMillis();
response = HttpClient.getInstance()
.postBinary(httpAddress, message);
rval = HttpClient.getInstance().postDynamicSerialize(httpAddress,
wrapper, true);
long time = System.currentTimeMillis() - t0;
if (time >= SIMPLE_LOG_TIME) {
System.out.println("Took " + time + "ms to run request id["
@ -313,14 +314,6 @@ public class ThriftClient {
}.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) {
throw new VizCommunicationException(
"unable to post request to server", e);
@ -330,15 +323,7 @@ public class ThriftClient {
} catch (Exception 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) {
ServerErrorResponse resp = (ServerErrorResponse) rval;
Throwable serverException = ExceptionWrapper.unwrapThrowable(resp

View file

@ -52,6 +52,7 @@ import com.raytheon.uf.viz.core.rsc.URICatalog.IURIRefreshCallback;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 12, 2007 chammack Initial Creation.
* Jan 14, 2013 1442 rferrel Added query method.
*
* </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>>();
private Map<Map<String, RequestConstraint>, List<IURIRefreshCallback>> queryRCMap = new HashMap<Map<String, RequestConstraint>, List<IURIRefreshCallback>>();
/**
* Singleton accessor
*
@ -193,14 +196,29 @@ public class URICatalog extends DecisionTree<List<IURIRefreshCallback>> {
do {
workingTime = time;
Map<Map<String, RequestConstraint>, List<IURIRefreshCallback>> runRCList = null;
Map<Map<String, RequestConstraint>, List<IURIRefreshCallback>> runQueryList = null;
synchronized (URICatalog.this) {
runRCList = queuedRCMap;
queuedRCMap = new HashMap<Map<String, RequestConstraint>, List<IURIRefreshCallback>>();
}
if (queuedRCMap.size() > 0) {
runRCList = queuedRCMap;
queuedRCMap = new HashMap<Map<String, RequestConstraint>, List<IURIRefreshCallback>>();
}
catalogAndQueryDataURIsInternal(runRCList, monitor);
if (queryRCMap.size() > 0) {
runQueryList = queryRCMap;
queryRCMap = new HashMap<Map<String, RequestConstraint>, List<IURIRefreshCallback>>();
}
}
if (runRCList != null) {
catalogAndQueryDataURIsInternal(runRCList, monitor);
}
if (runQueryList != null) {
doQuery(runQueryList, monitor);
}
} while (!monitor.isCanceled() && workingTime != time
&& queuedRCMap.size() > 0);
&& (queuedRCMap.size() > 0 || queryRCMap.size() > 0));
return Status.OK_STATUS;
}
}
@ -245,40 +263,24 @@ public class URICatalog extends DecisionTree<List<IURIRefreshCallback>> {
try {
for (Map.Entry<Map<String, RequestConstraint>, List<IURIRefreshCallback>> entry : rcMap
.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 = queuedRCMap
.get(entry.getKey());
.get(map);
if (runnables == null) {
queuedRCMap.put(entry.getKey(), entry.getValue());
queuedRCMap.put(map, runnable);
} else {
runnables.addAll(entry.getValue());
runnables.addAll(runnable);
}
}
continue;
}
Map<String, RequestConstraint> map = entry.getKey();
DataTime[] dt = DataCubeContainer.performTimeQuery(map, true);
DataTime newDataTime = null;
if (dt != null && dt.length > 0) {
newDataTime = dt[dt.length - 1];
}
doCallbacks(map, runnable);
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
.getBaseUpdateConstraints(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,
List<IURIRefreshCallback> runnables) throws VizException {
insertCriteria(map, runnables, false);
@ -306,7 +378,5 @@ public class URICatalog extends DecisionTree<List<IURIRefreshCallback>> {
/** check and update most recent 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.services.IDisposable;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
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.Priority;
import com.raytheon.uf.viz.core.Activator;
@ -58,6 +60,9 @@ public class TimeMatchingJob extends Job {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TimeMatchingJob.class);
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("Core:");
static {
Activator.getDefault().registerDisposable(new IDisposable() {
@Override
@ -121,8 +126,8 @@ public class TimeMatchingJob extends Job {
long t0 = System.currentTimeMillis();
request.getTimeMatcher().redoTimeMatching(request);
long time = (System.currentTimeMillis() - t0);
if (time > 0) {
System.out.println("time matching took: " + time + "ms");
if (time > 10) {
perfLog.logDuration("time matching", time);
}
if (!this.keepAround) {
map.remove(request);

View file

@ -42,6 +42,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 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>
*
@ -59,8 +61,7 @@ public class TopoQuery implements ITopoQuery {
* @return Initialized TopoQuery instance
*/
public static synchronized ITopoQuery getInstance() {
return com.raytheon.uf.edex.topo.TopoQuery.getInstance(
VizApp.getServerDataDir(), 0);
return com.raytheon.uf.edex.topo.TopoQuery.getInstance(0);
}
/**
@ -68,8 +69,7 @@ public class TopoQuery implements ITopoQuery {
*/
public static synchronized ITopoQuery getInstance(int topoLevel,
boolean useCaching) {
return com.raytheon.uf.edex.topo.TopoQuery.getInstance(
VizApp.getServerDataDir(), 0);
return com.raytheon.uf.edex.topo.TopoQuery.getInstance(0);
}
private TopoQuery(int level, boolean useCaching) {

View file

@ -120,30 +120,6 @@
version="0.0.0"
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
id="net.sf.cglib"
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-Activator: com.raytheon.uf.viz.cwat.Activator
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,
org.eclipse.core.runtime,
com.raytheon.uf.viz.core,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.time;bundle-version="1.11.1",
com.raytheon.edex.common;bundle-version="1.11.1",
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.time.DataTime;
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.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
@ -52,6 +51,8 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 15Mar2009 2037 dhladky Initial Creation.
* Feb 28, 2013 1731 bsteffen Remove unneccessary query in
* getDataStore.
*
* </pre>
*
@ -114,21 +115,7 @@ public class CWATResourceData extends AbstractRequestableResourceData {
* @return
*/
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);
dataStore = DataStoreFactory.getDataStore(loc);
} catch (VizException e) {
e.printStackTrace();
}
return dataStore;
File loc = HDF5Util.findHDF5Location(record);
return DataStoreFactory.getDataStore(loc);
}
}

View file

@ -7,17 +7,11 @@ Bundle-Activator: com.raytheon.uf.viz.d2d.gfe.Activator
Bundle-Vendor: RAYTHEON
Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.uf.viz.core
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-ActivationPolicy: lazy
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.responses,
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.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.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.ResourceType;
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.productbrowser.AbstractRequestableProductBrowserDataDefinition;
import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel;
@ -60,22 +59,11 @@ import com.raytheon.viz.grid.rsc.GridLoadProperties;
public class GFEDataDefinition extends
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() {
productName = "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();
loadProperties = new GridLoadProperties();
loadProperties.setResourceType(getResourceType());
@ -111,7 +99,7 @@ public class GFEDataDefinition extends
*/
@Override
public List<String> buildProductList(List<String> historyList) {
String[] parameters = queryData(GFEUtil.PARM_ID,
String[] parameters = queryData(GFEDataAccessUtil.PARM_ID,
getProductParameters(new String[0], null));
List<String> result = new ArrayList<String>();
for (String orderString : order) {
@ -131,7 +119,7 @@ public class GFEDataDefinition extends
if (!isEnabled()) {
return null;
}
String[] parameters = queryData(GFEUtil.PARM_ID,
String[] parameters = queryData(GFEDataAccessUtil.PARM_ID,
getProductParameters(new String[0], null));
if (parameters != null) {
@ -149,7 +137,7 @@ public class GFEDataDefinition extends
@Override
protected String[] queryData(String param,
HashMap<String, RequestConstraint> queryList) {
return super.queryData(GFEUtil.PARM_ID, queryList);
return super.queryData(GFEDataAccessUtil.PARM_ID, queryList);
}
@Override
@ -160,17 +148,17 @@ public class GFEDataDefinition extends
String label = value;
try {
ParmID parmId = new ParmID(value);
if (param.equals(SITE_ID)) {
if (param.equals(GFEDataAccessUtil.SITE_ID)) {
label = parmId.getDbId().getSiteId();
} else if (param.equals(MODEL_NAME)) {
} else if (param.equals(GFEDataAccessUtil.MODEL_NAME)) {
label = parmId.getDbId().getModelName();
} else if (param.equals(MODEL_TIME)) {
} else if (param.equals(GFEDataAccessUtil.MODEL_TIME)) {
label = parmId.getDbId().getModelTime();
} else if (param.equals(DB_TYPE)) {
} else if (param.equals(GFEDataAccessUtil.DB_TYPE)) {
label = parmId.getDbId().getDbType();
} else if (param.equals(PARM_NAME)) {
} else if (param.equals(GFEDataAccessUtil.PARM_NAME)) {
label = parmId.getParmName();
} else if (param.equals(PARM_LEVEL)) {
} else if (param.equals(GFEDataAccessUtil.PARM_LEVEL)) {
label = parmId.getParmLevel();
}
} catch (Exception e) {
@ -190,37 +178,20 @@ public class GFEDataDefinition extends
if (order == null) {
order = this.order;
}
String siteId = "%";
String modelName = "%";
String modelTime = "%";
String dbType = "%";
String parmName = "%";
String parmLevel = "%";
HashMap<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>();
queryList.put(PLUGIN_NAME, new RequestConstraint(productName));
Map<String, String> parmIdComponents = new HashMap<String, String>();
if (selection.length > 1) {
String[] usedSelection = realignSelection(selection);
for (int i = 0; i < usedSelection.length; i++) {
if (order[i].equals(SITE_ID)) {
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];
}
parmIdComponents.put(order[i], usedSelection[i]);
}
}
String parmId = String.format(GFEUtil.PARM_ID_FORMAT, parmName,
parmLevel, siteId, dbType, modelName, modelTime);
queryList.put(GFEUtil.PARM_ID, new RequestConstraint(parmId,
ConstraintType.LIKE));
HashMap<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>();
queryList.put(PLUGIN_NAME, new RequestConstraint(productName));
queryList.put(GFEDataAccessUtil.PARM_ID,
GFEDataAccessUtil.createParmIdConstraint(parmIdComponents));
return queryList;
}

View file

@ -23,12 +23,13 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.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.UFStatus;
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.StyleRule;
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.viz.volumebrowser.datacatalog.AbstractDataCatalog;
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>
*
@ -76,10 +79,10 @@ public class GFEVbDataCatalog extends AbstractDataCatalog {
@Override
public IDataCatalogEntry getCatalogEntry(SelectedData selectedData) {
HashMap<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>();
queryList.put(GFEUtil.PLUGIN_NAME, new RequestConstraint("gfe"));
queryList.put(GFEUtil.PARM_ID, getParmIdConstraint(selectedData));
queryList.put(GFEDataAccessUtil.PLUGIN_NAME, new RequestConstraint("gfe"));
queryList.put(GFEDataAccessUtil.PARM_ID, getParmIdConstraint(selectedData));
try {
String[] result = CatalogQuery.performQuery(GFEUtil.PARM_ID,
String[] result = CatalogQuery.performQuery(GFEDataAccessUtil.PARM_ID,
queryList);
if (result != null && result.length > 0) {
ParmID sampleId = new ParmID(result[0]);
@ -204,15 +207,15 @@ public class GFEVbDataCatalog extends AbstractDataCatalog {
@Override
protected void addProductParameters(IDataCatalogEntry catalogEntry,
HashMap<String, RequestConstraint> productParameters) {
productParameters.put(GFEUtil.PARM_ID,
productParameters.put(GFEDataAccessUtil.PARM_ID,
getParmIdConstraint(catalogEntry.getSelectedData()));
}
private String[] getParmIds() {
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 {
return CatalogQuery.performQuery(GFEUtil.PARM_ID, queryList);
return CatalogQuery.performQuery(GFEDataAccessUtil.PARM_ID, queryList);
} catch (VizException e) {
throw new RuntimeException(e);
}
@ -248,7 +251,7 @@ public class GFEVbDataCatalog extends AbstractDataCatalog {
DisplayType displayType) {
if (catalogEntry instanceof GFECatalogEntry) {
ParmID sampleId = ((GFECatalogEntry) catalogEntry).getSampleId();
ParamLevelMatchCriteria criteria = GFEUtil
ParamLevelMatchCriteria criteria = GFEGridResource
.getMatchCriteria(sampleId);
StyleRule sr = null;
try {
@ -277,8 +280,8 @@ public class GFEVbDataCatalog extends AbstractDataCatalog {
} else {
try {
return UnitFormat.getUCUMInstance().format(
GFEUtil.getGridParmInfo(sampleId).getUnitObject());
} catch (VizException e) {
GFEDataAccessUtil.getGridParmInfo(sampleId).getUnitObject());
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to obtain a unit information for"
+ catalogEntry.getSelectedData()
@ -297,9 +300,12 @@ public class GFEVbDataCatalog extends AbstractDataCatalog {
.getGfeLevel(selectedData.getPlanesKey());
String modelName = VbGFEMapping.getGfeSource(selectedData
.getSourcesKey());
String parmId = String.format(GFEUtil.PARM_ID_FORMAT, parmName,
parmLevel, "%", "%", modelName, "%");
return new RequestConstraint(parmId, ConstraintType.LIKE);
Map<String, String> parmIdComponents = new HashMap<String, String>();
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 {

View file

@ -19,12 +19,14 @@
**/
package com.raytheon.uf.viz.d2d.gfe.rsc;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.geotools.coverage.grid.GridGeometry2D;
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.ParmID;
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.LoadProperties;
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.GeneralGridData;
@ -90,15 +93,15 @@ public class GFEGridResource extends AbstractGridResource<GFEGridResourceData> {
}
try {
gfeRecord
.setGridInfo(GFEUtil.getGridParmInfo(gfeRecord.getParmId()));
} catch (VizException e) {
.setGridInfo(GFEDataAccessUtil.getGridParmInfo(gfeRecord.getParmId()));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public ParamLevelMatchCriteria getMatchCriteria() {
return GFEUtil.getMatchCriteria(parmId);
return getMatchCriteria(parmId);
}
@Override
@ -108,7 +111,12 @@ public class GFEGridResource extends AbstractGridResource<GFEGridResourceData> {
return null;
}
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);
GridGeometry2D gridGeometry = MapUtil.getGridGeometry(gfeRecord
.getGridInfo().getGridLoc());
@ -160,4 +168,23 @@ public class GFEGridResource extends AbstractGridResource<GFEGridResourceData> {
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 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.slice.IGridSlice;
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.style.level.Level;
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.viz.core.graphing.xy.XYData;
import com.raytheon.viz.core.graphing.xy.XYDataList;
@ -50,7 +50,12 @@ public class GfeTimeSeriesAdapter extends AbstractTimeSeriesAdapter<GFERecord> {
DirectPosition2D point = null;
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) {
unit = slice.getGridInfo().getUnitObject();
if (point == null) {

View file

@ -138,7 +138,7 @@ public class D2DNSharpResource extends
D2DNSharpDataObject pdo = dataResponseQueue.poll();
while (pdo != null) {
if (pdos.get(pdo.getDataTime()) == pdo) {
if (isValidSounding(pdo)) {
if (pdo.getLayers() != null) {
stnInfo = pdo.getStationInfo();
myDataMap.put(stnInfo.getStnDisplayInfo(),
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 {
List<NsharpAbstractPaneResource> paneRscs = descriptor
.getResourceList().getResourcesByTypeAsType(

View file

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

View file

@ -456,7 +456,7 @@ F | 1.8 |0| 4 | | |..|8000F0FF| | 0 | 1
<parameter>DpTerranl</parameter>
</paramLevelMatches>
<contourStyle>
<displayUnits>F</displayUnits>
<displayUnits label="F">°R</displayUnits>
<contourLabeling labelSpacing="4">
<increment>1</increment>
</contourLabeling>
@ -1163,9 +1163,9 @@ mb | 1 | 0.0 | 4 |2:i4|1:i4|LH|8000F0FF| | 0 | 2
<contourStyle>
<displayUnits>mb</displayUnits>
<displayFlags>NoPlane</displayFlags>
<contourLabeling labelSpacing="4" labelFormat="#"
labelTrimLeft="1" maxMinTrimLeft="1"
minMaxLabelFormat="#" minLabel="L" maxLabel="H">
<contourLabeling labelSpacing="4" labelFormat="0000"
labelTrimLeft="2" maxMinTrimLeft="1"
minMaxLabelFormat="0000" minLabel="L" maxLabel="H">
<increment>4</increment>
</contourLabeling>
</contourStyle>
@ -1639,6 +1639,7 @@ in | 39.37 | 0 | 4 | | |..|8000F0FF| | 16 | \
<styleRule>
<paramLevelMatches>
<parameter>TOTSN</parameter>
<parameter>TOTSN6hr</parameter>
<singleLevel units="SURFACE"></singleLevel>
</paramLevelMatches>
<contourStyle>
@ -4084,6 +4085,78 @@ in | .03937 | 0 | 4 | | |..|8000F0FF| | 16 | \
</contourStyle>
</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>
<paramLevelMatches>
<parameter>Wind</parameter>

View file

@ -62,13 +62,13 @@ public class RotatePanelLayoutMenuAction extends AbstractRightClickAction {
*/
@Override
public void run() {
RotatePanelsHandler handler = new RotatePanelsHandler();
if (!(container instanceof IMultiPaneEditor)) {
return;
}
IMultiPaneEditor editor = (IMultiPaneEditor) container;
editor.setSelectedPane(IMultiPaneEditor.IMAGE_ACTION, null);
handler.rotate(getContainer(), paneWithFocus, 1);
RotatePanelsHandler.rotateToNextPane((IMultiPaneEditor) getContainer(),
paneWithFocus);
}
@Override
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.IDisplayPaneContainer;
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.d2d.core.legend.D2DLegendResource;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.HistoryList;
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
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 Object execute(ExecutionEvent arg0) throws ExecutionException {
public Object execute(ExecutionEvent event) throws ExecutionException {
IDisplayPaneContainer container = EditorUtil.getActiveVizContainer();
if (container == null) {
if (container == null || container instanceof IMultiPaneEditor == false) {
return null;
}
// direction is usually +1 or -1 to specify which direction to rotate
String dirStr = arg0.getParameter("direction");
// start index is the index to start rotating from, for example if you
// want to display pane 3 then you set startIndex to 2 and direction to
// +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.
String startStr = arg0.getParameter("startIndex");
// hideIndex can be set to 0 or 1 to specify which half of a blended
// images should be hidden.
String hideIndexStr = arg0.getParameter("hideIndex");
boolean toggle = false;
int dir = Integer.parseInt(dirStr);
if (startStr == null) {
// If there is no startIndex rotate from the currently displayed
// pane
if (container instanceof IMultiPaneEditor) {
// If it is going from multiple panes to a single pain, toggle
// the blended image
toggle = ((IMultiPaneEditor) container).displayedPaneCount() > 1;
}
if (rotateCurrent(container, dir)) {
// if it wraps around when we rotate, toggle the blended image.
toggle = true;
// Get editor and panes
IMultiPaneEditor editor = (IMultiPaneEditor) container;
IDisplayPane[] panes = getEditorPanes(editor);
// Get direction to rotate
String dirStr = event.getParameter("direction");
int direction = Integer.parseInt(dirStr);
// Get pane to start rotation on
IDisplayPane startPane = null;
String startStr = event.getParameter("startIndex");
if (startStr != null) {
int startIdx = Integer.parseInt(startStr);
if (editor.displayedPaneCount() > 1) {
// more than one pane so we want to start on resulting pane
startPane = panes[getNextIndex(panes, startIdx, direction)];
} else {
// Get pane specified by startIdx
startPane = panes[getNextIndex(panes, startIdx, 0)];
}
} else {
int start = Integer.parseInt(startStr);
rotate(container, start, dir);
}
Integer hideIndex = null;
if (hideIndexStr != null) {
hideIndex = Integer.parseInt(hideIndexStr);
}
if (toggle || hideIndex != null) {
for (IDisplayPane pane : container.getDisplayPanes()) {
for (ResourcePair rp : pane.getDescriptor().getResourceList()) {
if (rp.getResource() != null
&& rp.getResource().hasCapability(
BlendableCapability.class)) {
BlendableCapability cap = rp.getResource()
.getCapability(BlendableCapability.class);
if (hideIndex != null) {
cap.toggle(hideIndex);
} else {
cap.toggle();
}
}
// No startStr, get first visible pane
for (IDisplayPane pane : panes) {
if (pane.isVisible()) {
startPane = pane;
break;
}
}
}
if (container instanceof IMultiPaneEditor) {
((IMultiPaneEditor) container).setSelectedPane(
IMultiPaneEditor.IMAGE_ACTION, null);
}
if (startPane != null) {
Integer hideIndex = null;
String hideIndexStr = event.getParameter("hideIndex");
if (hideIndexStr != null) {
hideIndex = Integer.parseInt(hideIndexStr);
}
rotateToNextPane(editor, startPane, direction, hideIndex);
}
return null;
}
/**
* rotate starting from the activeDisplayPane in direction
* Rotates to next pane in container. If container has > 1 pane displayed,
* will rotate to pane passed in, otherwise to next in line
*
* @param direction
* should be either 1, or -1
* @return true if the data wrapped to the other side of the pane array.
* @param container
* @param pane
*/
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 static void rotateToNextPane(IMultiPaneEditor editor,
IDisplayPane pane) {
rotateToNextPane(editor, pane, 1, 0);
}
public void rotate(IDisplayPaneContainer container, IDisplayPane pane,
int direction) {
if (container instanceof IMultiPaneEditor) {
rotate(container, getIndex(container, pane), direction);
/**
* 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()) {
if (rp.getResource() != null
&& rp.getResource().hasCapability(
BlendableCapability.class)) {
hideIndex = rp.getResource()
.getCapability(BlendableCapability.class)
.getResourceIndex();
}
}
if (wrapped) {
// If we wrapped, switch index
if (hideIndex == 0) {
hideIndex = 1;
} else {
hideIndex = 0;
}
}
}
// Toggle displayed resource
for (IDisplayPane p : panes) {
for (ResourcePair rp : p.getDescriptor().getResourceList()) {
if (rp.getResource() != null
&& rp.getResource().hasCapability(
BlendableCapability.class)) {
rp.getResource()
.getCapability(BlendableCapability.class)
.toggle(hideIndex);
}
}
}
}
}
/**
* 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
* the index to start rotating from
* @param direction
* should be either 1, or -1
* @return true if the data wrapped to the other side of the pane array.
* @param editor
* @return
*/
private boolean rotate(IDisplayPaneContainer container, int index,
int direction) {
boolean wrapped = false;
IMultiPaneEditor mEditor = (IMultiPaneEditor) container;
IDisplayPane[] panes = mEditor.getDisplayPanes();
private static IDisplayPane[] getEditorPanes(IMultiPaneEditor editor) {
IDisplayPane[] panes = editor.getDisplayPanes();
if (panes.length == 4) {
// Pretend the panels are in the order 0, 1, 3, 2 because
// AWIPS I rotates the panes in a weird order = ul, ur, lr, ll
IDisplayPane[] reorderedPanes = new IDisplayPane[4];
reorderedPanes[0] = panes[0];
reorderedPanes[1] = panes[1];
reorderedPanes[2] = panes[3];
reorderedPanes[3] = panes[2];
panes = reorderedPanes;
IDisplayPane[] tmp = new IDisplayPane[panes.length];
tmp[0] = panes[0];
tmp[1] = panes[1];
tmp[2] = panes[3];
tmp[3] = panes[2];
panes = tmp;
}
IDisplayPane paneToShow = null;
if (panes != null && index < panes.length && panes.length != 1) {
boolean from4To1 = mEditor.displayedPaneCount() > 1;
boolean hasProducts = false;
if (panes[index] != null) {
List<D2DLegendResource> rscs = panes[index].getDescriptor()
.getResourceList()
.getResourcesByTypeAsType(D2DLegendResource.class);
for (D2DLegendResource rsc : rscs) {
hasProducts = rsc.hasProducts();
if (hasProducts) {
break;
}
}
}
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;
return panes;
}
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;
}
/**
* Gets the next index in line for rotation given panes, curIdx, and
* direction
*
* @param panes
* @param curIdx
* @param direction
* @return
*/
private static int getNextIndex(IDisplayPane[] panes, int curIdx,
int direction) {
int idxToCheck = curIdx + direction;
if (idxToCheck < 0) {
idxToCheck = panes.length - 1;
} else if (idxToCheck >= panes.length) {
idxToCheck = 0;
}
// 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;
return idxToCheck;
}
}

View file

@ -7,7 +7,7 @@
<filterId>Data Provider</filterId>
<settings name="availableText" value="Available Providers:"/>
<settings name="selectedText" value="Selected Providers:"/>
<settings name="showMatch" value="true"/>
<settings name="showMatch" value="false"/>
<settings name="showDualList" value="true"/>
</Filter>
<Filter>
@ -17,7 +17,7 @@
<settings name="availableText" value="Available Data Sets:"/>
<settings name="selectedText" value="Selected Data Sets:"/>
<settings name="showRegEx" value="true"/>
<settings name="showMatch" value="false"/>
<settings name="showMatch" value="true"/>
<settings name="showDualList" value="true"/>
</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.viz.core.exception.VizException;
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
* the Thread class so you can retrieve data on a separate thread to keep the UI
* thread from being blocked.
* This is a utility class used to get data for the bandwidth graph it
* implements {@link Runnable} so you can retrieve data on a separate thread to
* keep the UI thread from being blocked.
*
* <pre>
*
@ -45,19 +44,20 @@ import com.raytheon.uf.viz.datadelivery.actions.BandwidthScheduleGraphAction;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 12, 2012 1269 lvenable Initial creation
* Feb 14, 2013 1596 djohnson Remove sysouts, correct statusHandler class, handle null response.
*
* </pre>
*
* @author lvenable
* @version 1.0
*/
public class GraphDataUtil extends Thread {
public class GraphDataUtil implements Runnable {
/** UFStatus handler */
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(BandwidthScheduleGraphAction.class);
.getHandler(GraphDataUtil.class);
/** Graph data request object */
private GraphDataRequest request;
private final GraphDataRequest request = new GraphDataRequest();
/** Graph data response object */
private GraphDataResponse response;
@ -79,7 +79,6 @@ public class GraphDataUtil extends Thread {
* thread.
*/
public GraphDataUtil(IDataUpdated dataUpdatedCB) {
request = new GraphDataRequest();
this.dataUpdatedCB = dataUpdatedCB;
}
@ -99,7 +98,10 @@ public class GraphDataUtil extends Thread {
*/
public void retrieveData() {
response = sendRequest(request);
graphData = response.getGraphData();
if (response != null) {
graphData = response.getGraphData();
}
}
/**
@ -155,14 +157,13 @@ public class GraphDataUtil extends Thread {
/**
* Thread run method to retrieve the graph data.
*/
@Override
public void run() {
System.out.println("Thread - retrieving data...");
retrieveData();
if (dataUpdatedCB != null) {
dataUpdatedCB.dataUpdated();
}
System.out.println("Thread - DONE retrieving data...");
}
}

View file

@ -139,6 +139,9 @@ public class ArealSelectionDlg extends CaveSWTDialog implements IDataSize {
@Override
public void widgetSelected(SelectionEvent e) {
if (!areaComp.isEnvelopeValid()) {
DataDeliveryUtils.showMessage(getShell(), SWT.OK,
"Validation Error",
"The defined area area is invalid\nAdjust the selected area and try again.");
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;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusAdapter;
@ -54,6 +54,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
* Feb 21, 2012 mpduff Initial creation
* Aug 08, 2012 863 jpiatt Added new interface method.
* Jan 07, 2013 1432 mpduff Fix case sensitive and exclude checkboxes.
* Feb 25, 2013 1588 mpduff Fix match any/all.
*
* </pre>
*
@ -280,80 +281,19 @@ public class FilterComp extends AbstractFilterComp implements IUpdate {
* Handle the search action.
*/
private void handleSearch() {
boolean excludeSearch = !exclusionBtn.getSelection();
boolean excludeSearch = exclusionBtn.getSelection();
String search = regExTxt.getText();
ArrayList<String> tmpFilterList = new ArrayList<String>();
if (search != null && search.length() > 0) {
dualConfig.setSearchField(search);
String[] parts;
/* Iterate over the filtered list of items */
String[] filteredList = dualConfig.getFullList().toArray(
new String[dualConfig.getFullList().size()]);
// Search contains 1 or more *
if (search.contains("*")) {
parts = search.split("\\*");
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);
}
}
}
}
List<String> tmpFilterList = DataBrowserUtils.search(search,
filteredList, matchAnyFlag, caseBtn.getSelection(),
excludeSearch);
// Clear the list and add the newly filtered items
dualList.clearAvailableList(false);

View file

@ -805,29 +805,48 @@ public class AreaComp extends Composite implements ISubset {
lr, 0.05);
envelopeValid = ulValid && lrValid;
int lrColor = SWT.COLOR_WHITE;
int ulColor = SWT.COLOR_WHITE;
StringBuilder errorText = null;
if (envelopeValid) {
subEnvelope = EnvelopeUtils.createSubenvelopeFromLatLon(
fullEnvelope, ul, lr);
updateDataSize();
} else {
StringBuilder errorText = new StringBuilder();
errorText = new StringBuilder();
errorText.append("The ");
if (ulValid) {
errorText.append("Lower Right Coordinate is");
lrColor = SWT.COLOR_RED;
} else if (lrValid) {
errorText.append("Upper Left Coordinate is");
ulColor = SWT.COLOR_RED;
} else {
lrColor = SWT.COLOR_RED;
ulColor = SWT.COLOR_RED;
errorText.append("Lower Right and Upper Left Coordinates are");
}
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,
"Validation Error", errorText.toString());
}
// Entries are valid so save them off.
this.envelopeValid = true;
return true;
return envelopeValid;
}
/**

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
* configuration when populating the filters. Fixed selection
* 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>
*
* @author lvenable
* @version 1.0
*/
public class FilterExpandBar extends Composite implements IFilterUpdate, IExpandControlAction {
public class FilterExpandBar extends Composite implements IFilterUpdate,
IExpandControlAction {
/**
* Filter expand bar.
@ -126,10 +129,10 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
private ReferencedEnvelope envelope;
/**
* Constructor.
* Constructor.
*
* @param parent
* The parent composite
* @param parent
* The parent composite
*/
public FilterExpandBar(Composite parent) {
super(parent, SWT.NONE);
@ -158,7 +161,8 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
gd.widthHint = 600;
expandBar.setLayoutData(gd);
FilterDefinitionManager filterMan = FilterDefinitionManager.getInstance();
FilterDefinitionManager filterMan = FilterDefinitionManager
.getInstance();
dataTypeFilterXml = filterMan.getDataTypeXml();
filterXml = filterMan.getFilterXml();
@ -174,7 +178,8 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
layout.marginHeight = 0;
layout.marginWidth = 0;
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();
expBarConfig.setCollapseAll(true);
@ -240,6 +245,7 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
notifyListeners(SWT.SetData, new Event());
DataDeliveryGUIUtils
.markNotBusyInUIThread(jobParent);
setClean();
}
});
}
@ -256,7 +262,7 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
String displayName = data.getDisplayName();
String filterID = data.getId();
// String clazz = data.getClazz();
// String clazz = data.getClazz();
ArrayList<SettingsXML> settingsList = data.getSettingsList();
DualListConfig dualConfig = new DualListConfig();
@ -266,26 +272,20 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
for (SettingsXML setting : settingsList) {
if (setting.getName().equalsIgnoreCase("availableText")) {
dualConfig.setAvailableListLabel(setting.getValue());
}
else if (setting.getName().equalsIgnoreCase("selectedText")) {
} else if (setting.getName().equalsIgnoreCase("selectedText")) {
dualConfig.setSelectedListLabel(setting.getValue());
}
else if (setting.getName().equalsIgnoreCase("showUpDownBtns")) {
} else if (setting.getName().equalsIgnoreCase("showUpDownBtns")) {
dualConfig.setShowUpDownBtns(getBoolean(setting.getValue()));
}
else if (setting.getName().equalsIgnoreCase("listWidth")) {
} else if (setting.getName().equalsIgnoreCase("listWidth")) {
dualConfig.setShowUpDownBtns(getBoolean(setting.getValue()));
}
else if (setting.getName().equalsIgnoreCase("listHeight")) {
} else if (setting.getName().equalsIgnoreCase("listHeight")) {
dualConfig.setShowUpDownBtns(getBoolean(setting.getValue()));
}
else if (setting.getName().equalsIgnoreCase("showRegex")) {
} else if (setting.getName().equalsIgnoreCase("showRegex")) {
filterConfig.setRegExVisible(getBoolean(setting.getValue()));
}
else if (setting.getName().equalsIgnoreCase("showMatch")) {
filterConfig.setMatchControlVisible(getBoolean(setting.getValue()));
}
else if (setting.getName().equalsIgnoreCase("showDualList")) {
} else if (setting.getName().equalsIgnoreCase("showMatch")) {
filterConfig.setMatchControlVisible(getBoolean(setting
.getValue()));
} else if (setting.getName().equalsIgnoreCase("showDualList")) {
filterConfig.setDualListVisible(getBoolean(setting.getValue()));
}
}
@ -324,7 +324,8 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
filterConfig.setFilterID(filterID);
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.setControl(filterComp);
@ -355,7 +356,7 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
* Parent component.
*/
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);
gd.horizontalSpan = gl.numColumns;
@ -381,7 +382,8 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
private void displayEnableFilterDialog() {
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.setMessage("No filters are available to enable/disable.");
mb.open();
@ -389,14 +391,15 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
}
if (enableFilterDlg == null || enableFilterDlg.isDisposed()) {
enableFilterDlg = new EnableFilterDlg(this.getShell(), getFilterNames(), getEnabledFilters());
enableFilterDlg = new EnableFilterDlg(this.getShell(),
getFilterNames(), getEnabledFilters());
enableFilterDlg.open();
if (enableFilterDlg.getReturnValue() != null && (Boolean)enableFilterDlg.getReturnValue() == true) {
if (enableFilterDlg.getReturnValue() != null
&& (Boolean) enableFilterDlg.getReturnValue() == true) {
this.enableFilters(enableFilterDlg.getSelectedIndexes());
}
}
else {
} else {
enableFilterDlg.bringToTop();
}
}
@ -463,7 +466,8 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
ArrayList<Integer> enabledIndexes = new ArrayList<Integer>();
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()) {
enabledIndexes.add(i);
}
@ -480,11 +484,12 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
*/
public void enableFilters(ArrayList<Integer> indexes) {
for (ExpandItem ei : expandBar.getItems()) {
((AbstractFilterComp)ei.getControl()).setEnabled(false);
((AbstractFilterComp) ei.getControl()).setEnabled(false);
}
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
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.setMessage("You are about to clear all of your filter settings. This\n"
+ "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()) {
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() {
ArrayList<FilterTypeXML> filterTypeList = filterSettingsXml.getFilterTypeList();
ArrayList<FilterTypeXML> filterTypeList = filterSettingsXml
.getFilterTypeList();
if (filterTypeList != null && filterTypeList.size() > 0) {
for (FilterTypeXML ftx : filterTypeList) {
if (ftx.getFilterType().equals("Data Type")) {
@ -613,12 +620,12 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
break;
}
}
if (filterList != null) {
// createExpandItems();
for (FilterTypeXML filterTypeXml : filterTypeList) {
String filterType = filterTypeXml.getFilterType();
if (filterList.contains(filterType)) {
for (String filter : filterList) {
if (filter.equals(filterType)) {
@ -627,12 +634,18 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
if (ei.getText().equals(filter)) {
Control control = ei.getControl();
if (control instanceof FilterComp) {
FilterComp fc = (FilterComp)control;
String[] items = filterTypeXml.getValues().toArray(
new String[filterTypeXml.getValues().size()]);
if (items != null && items.length > 0) {
FilterComp fc = (FilterComp) control;
String[] items = filterTypeXml
.getValues()
.toArray(
new String[filterTypeXml
.getValues()
.size()]);
if (items != null
&& items.length > 0) {
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
}
/**
* @param filterSettingsXml
* Populate the filters.
*
* @param filterSettingsXml
* Settings to populate
*/
public void populateFilterSettingsXml(FilterSettingsXML filterSettingsXml) {
ExpandItem[] items = expandBar.getItems();
for (ExpandItem item : items) {
Control control = item.getControl();
if (control instanceof FilterComp) {
FilterComp fc = (FilterComp)control;
FilterComp fc = (FilterComp) control;
String[] selectedItems = fc.getSelectedListItems();
ArrayList<String> values = new ArrayList<String>();
for (String selectedItem : selectedItems) {
@ -687,7 +703,7 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
public boolean isDirty() {
ExpandItem[] items = expandBar.getItems();
for (ExpandItem item : items) {
FilterComp comp = (FilterComp)item.getControl();
FilterComp comp = (FilterComp) item.getControl();
if (comp != null) {
if (comp.isDirty()) {
return true;
@ -704,16 +720,20 @@ public class FilterExpandBar extends Composite implements IFilterUpdate, IExpand
public void setClean() {
ExpandItem[] items = expandBar.getItems();
for (ExpandItem item : items) {
FilterComp comp = (FilterComp)item.getControl();
FilterComp comp = (FilterComp) item.getControl();
if (comp != null) {
comp.setDirty(false);
}
}
}
/**
* Set the referenced envelope.
*
* @param envelope
* The ReferencedEnvelope
*/
public void setEnvelope(ReferencedEnvelope 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.service.IGroupDefinitionService;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
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 18, 2013 1441 djohnson Use group definition service.
* Feb 26, 2013 1643 djohnson Catch any exception.
*
* </pre>
*
@ -157,7 +157,7 @@ public class DeleteGroupDlg extends CaveSWTDialog {
.getByName(groupName));
groupAction.loadGroupNames();
return true;
} catch (RegistryHandlerException e) {
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"Unable to delete a group.", e);
}

View file

@ -19,13 +19,13 @@
**/
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.datadelivery.registry.Subscription;
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.serialization.comm.RequestRouter;
import com.raytheon.uf.common.datadelivery.service.BasePrivilegedDataDeliveryService;
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 21, 2013 1441 djohnson Use RequestRouter.
* Feb 26, 2013 1643 djohnson Extends base class.
*
* </pre>
*
@ -47,7 +48,9 @@ import com.raytheon.uf.viz.core.exception.VizException;
* @version 1.0
*/
public class RequestFromServerPermissionsService implements IPermissionsService {
public class RequestFromServerPermissionsService extends
BasePrivilegedDataDeliveryService<DataDeliveryAuthRequest> implements
IPermissionsService {
/**
* 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}
*/
@ -165,8 +147,13 @@ public class RequestFromServerPermissionsService implements IPermissionsService
request.addRequestedPermissions(permissions);
request.setNotAuthorizedMessage(notAuthorizedMessage);
DataDeliveryAuthRequest r = sendAuthorizationRequest(request);
return new DataDeliveryAuthRequestAdapter(r);
try {
DataDeliveryAuthRequest r = sendRequest(request,
DataDeliveryAuthRequest.class);
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.
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
* Jan 25, 2013 1528 djohnson Compare priorities as primitive ints.
* Jan 30, 2013 1543 djohnson Use List instead of ArrayList.
*
* </pre>
*
@ -239,8 +240,8 @@ public class SubscriptionDiff {
diffMap.put("coverage", true);
}
ArrayList<Parameter> subParamList = sub.getParameter();
ArrayList<Parameter> pendingSubParamList = pendingSub.getParameter();
List<Parameter> subParamList = sub.getParameter();
List<Parameter> pendingSubParamList = pendingSub.getParameter();
ArrayList<String> subParams = 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.events.SelectionAdapter;
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.GridLayout;
import org.eclipse.swt.widgets.Button;
@ -56,7 +58,8 @@ import com.raytheon.viz.ui.presenter.components.ListConf;
* Oct 11, 2012 1263 jpiatt Modified for cancel button
* Nov 20, 2012 1286 djohnson Implement displayYesNoPopup.
* 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>
*
@ -240,6 +243,13 @@ public class GriddedTimingSelectionDlg extends CaveSWTDialog implements
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 18, 2012 1439 mpduff Redo subset name validation.
* 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>
*
@ -251,7 +252,6 @@ public class SpatialSubsetTab extends SubsetTab implements IDataSize {
return;
}
AreaXML area = getSaveInfo();
SubsetFileManager.getInstance()
@ -346,12 +346,12 @@ public class SpatialSubsetTab extends SubsetTab implements IDataSize {
*/
public AreaXML getSaveInfo() {
ReferencedEnvelope envelope = null;
if(useDataSetSize){
if (useDataSetSize) {
envelope = fullEnvelope;
} else {
envelope = areaComp.getEnvelope();
}
AreaXML area = new AreaXML();
if (envelope != null) {
@ -362,6 +362,8 @@ public class SpatialSubsetTab extends SubsetTab implements IDataSize {
if (areaComp.selectCombo.getEnabled()) {
area.setRegionName(name);
} else {
area.setRegionName(getRegionSaveText());
}
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 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 30, 2013 1543 djohnson Use List instead of ArrayList.
* </pre>
*
* @author mpduff
@ -887,7 +888,7 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
// Vertical/Parameters
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 (DataLevelType levelType : p.getLevelType()) {

View file

@ -63,6 +63,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jan 10, 2013 1420 mdpuff Added getMaxLatency().
* Jan 14, 2013 1286 djohnson Fix IndexOutOfBounds exception from getMaxLatency.
* Jan 22, 2013 1519 djohnson Correct getMaxLatency() calculations.
* Jan 30, 2013 1543 djohnson Use List instead of ArrayList.
* </pre>
*
* @author mpduff
@ -515,7 +516,7 @@ public class DataDeliveryUtils {
}
fmtStr.append("Parameters:").append(newline);
ArrayList<Parameter> parmArray = sub.getParameter();
List<Parameter> parmArray = sub.getParameter();
for (Parameter p : parmArray) {
fmtStr.append("------ Name: ").append(p.getName()).append(newline);
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
* ------------ ---------- ----------- --------------------------
* Jan 30, 2012 mschenke Initial creation
* Feb 25, 2013 1659 bsteffen Stop derived parameters from sending
* empty requests for cached times
*
* </pre>
*
@ -120,11 +122,14 @@ public abstract class AbstractDataCubeAdapter implements IDataCubeAdapter {
}
// bulk up all the requests.
DbQueryRequestSet requestSet = new DbQueryRequestSet();
requestSet.setQueries(fullList.toArray(new DbQueryRequest[0]));
DbQueryResponseSet responseSet = (DbQueryResponseSet) ThriftClient
.sendRequest(requestSet);
DbQueryResponse[] responses = responseSet.getResults();
DbQueryResponse[] responses = new DbQueryResponse[0];
if (!fullList.isEmpty()) {
DbQueryRequestSet requestSet = new DbQueryRequestSet();
requestSet.setQueries(fullList.toArray(new DbQueryRequest[0]));
DbQueryResponseSet responseSet = (DbQueryResponseSet) ThriftClient
.sendRequest(requestSet);
responses = responseSet.getResults();
}
int responseIndex = 0;
List<List<DataTime>> finalResponse = new ArrayList<List<DataTime>>(
requests.size());

View file

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

View file

@ -26,7 +26,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
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.xml.bind.JAXBException;
@ -155,7 +156,7 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
private Map<String, DerivParamDesc> derParLibrary;
private ArrayBlockingQueue<DerivedParameterRequest> toDoList;
private BlockingQueue<DerivedParameterRequest> toDoList;
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()
.getStaticLocalizationFile(DERIV_PARAM_DIR);
if (dir != null) {

View file

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

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ncsa.hdf5.linux32</name>
<name>com.raytheon.uf.viz.event</name>
<comment></comment>
<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
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
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"
version="0.0.0"/>
<plugin
id="ncsa.hdf5"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.common.message"
download-size="0"
@ -271,13 +265,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.datastorage.hdf5"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.geospatial"
download-size="0"

View file

@ -130,6 +130,8 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 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>
*
@ -591,11 +593,15 @@ public class FileTreeView extends ViewPart implements IPartListener2,
}
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);
item.setExpanded(true);
for (TreeItem child : item.getItems()) {
expand(map, child);
if (wasExpanded) {
item.setExpanded(true);
for (TreeItem child : item.getItems()) {
expand(map, child);
}
}
}
}

View file

@ -20,7 +20,12 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.viz.localization,
javax.measure;bundle-version="1.0.0",
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-ActivationPolicy: lazy
Import-Package: com.raytheon.uf.common.colormap,

View file

@ -11,25 +11,22 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.Set;
import java.util.SortedMap;
import java.util.TimeZone;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
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.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.FFMPGuidanceInterpolation;
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.catalog.DirectDbQuery;
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.monitor.IMonitor;
import com.raytheon.uf.viz.monitor.ResourceMonitor;
@ -91,7 +87,12 @@ import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
* 04/03/10 4494 D. Hladky Initial release
* 12/07/12 1353 rferrel Changes for non-blocking FFMPSplash.
* 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>
*
@ -118,17 +119,7 @@ public class FFMPMonitor extends ResourceMonitor {
/** Pattern for dates in radar */
public static String datePattern = "yyyy-MM-dd HH:mm:ss";
/** FFMP Records indexed by site, times and field **/
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;
private FFMPSiteDataContainer siteDataMap = new FFMPSiteDataContainer();
// Interpolation Guidance Sources
public FFMPGuidanceInterpolation interpolation = null;
@ -184,19 +175,7 @@ public class FFMPMonitor extends ResourceMonitor {
}
// clear all remaining data
if (ffmpData != null) {
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;
siteDataMap.clear();
// kill this monitor
monitor = null;
@ -250,7 +229,6 @@ public class FFMPMonitor extends ResourceMonitor {
public static synchronized FFMPMonitor getInstance() {
if (monitor == null) {
monitor = new FFMPMonitor();
monitor.createDataStructures();
isInitialized = true;
}
@ -310,16 +288,6 @@ public class FFMPMonitor extends ResourceMonitor {
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
*
@ -328,69 +296,11 @@ public class FFMPMonitor extends ResourceMonitor {
* @param phuc
* @return
*/
private ConcurrentHashMap<String, String> getUriMap(String siteKey,
String source, String phuc) {
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> siteLoadedUris = null;
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;
private List<String> getLoadedUris(String siteKey, String source,
String phuc) {
FFMPSiteData siteData = siteDataMap.get(siteKey);
FFMPSourceData sourceData = siteData.getSourceData(source);
return sourceData.getLoadedUris(phuc);
}
/**
@ -427,12 +337,11 @@ public class FFMPMonitor extends ResourceMonitor {
for (String uri : uris) {
if (uri != null) {
if (dupOverride
|| !getUriMap(siteKey, source, phuc)
.containsKey(uri)) {
|| !getLoadedUris(siteKey, source, phuc)
.contains(uri)) {
try {
populateFFMPRecord(isProductLoad, siteKey,
loadRecordFromDatabase(uri),
source, phuc);
new FFMPRecord(uri), source, phuc);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"FFMP Can't retrieve FFMP URI, "
@ -455,19 +364,18 @@ public class FFMPMonitor extends ResourceMonitor {
* @return
* @throws VizException
*/
public FFMPCacheRecord populateFFMPRecord(boolean isProductLoad,
String uri, String siteKey, String source, String phuc)
throws Exception {
public FFMPRecord populateFFMPRecord(boolean isProductLoad, String uri,
String siteKey, String source, String phuc) throws Exception {
try {
populateFFMPRecord(isProductLoad, siteKey,
loadRecordFromDatabase(uri), source, phuc);
populateFFMPRecord(isProductLoad, siteKey, new FFMPRecord(uri),
source, phuc);
} catch (VizException e) {
statusHandler.handle(Priority.INFO,
"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,
String source) {
if (ffmpData.containsKey(siteKey)) {
if (ffmpData.get(siteKey).containsKey(source)) {
// TODO do we need this method if we're no longer supporting cache
// records?
if (siteDataMap.containsSite(siteKey)) {
if (siteDataMap.get(siteKey).containsSource(source)) {
for (Entry<String, FFMPBasinData> entry : data.getBasinsMap()
.entrySet()) {
FFMPBasinData basinData = entry.getValue();
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 {
if (dataUri != null) {
ConcurrentMap<String, String> uris = getUriMap(siteKey, source,
phuc);
if (!uris.containsKey(dataUri)) {
List<String> uris = getLoadedUris(siteKey, source, phuc);
if (!uris.contains(dataUri)) {
try {
SourceXML sourceXML = fscm.getSource(source);
FFMPCacheRecord ffmpRec = populateFFMPRecord(true, dataUri,
FFMPRecord ffmpRec = populateFFMPRecord(true, dataUri,
siteKey, source, phuc);
File loc = HDF5Util.findHDF5Location(ffmpRec);
IDataStore dataStore = DataStoreFactory.getDataStore(loc);
if (sourceXML.getSourceType().equals(
SOURCE_TYPE.GAGE.getSourceType())
&& phuc.equals("ALL")) {
&& phuc.equals(FFMPRecord.ALL)) {
ffmpRec.retrieveVirtualBasinFromDataStore(dataStore,
dataUri, getTemplates(siteKey), ffmpRec
.getDataTime().getRefTime(), basin);
@ -619,34 +525,10 @@ public class FFMPMonitor extends ResourceMonitor {
public ConcurrentNavigableMap<Date, List<String>> getAvailableUris(
String siteKey, String dataKey, String sourceName, Date time,
boolean retrieveNew) {
if (!ffmpAvailableUris.containsKey(siteKey)) {
ConcurrentHashMap<String, ConcurrentSkipListMap<Date, List<String>>> tempUriList = new ConcurrentHashMap<String, ConcurrentSkipListMap<Date, List<String>>>(
16, 0.75f, 4);
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);
ConcurrentNavigableMap<Date, List<String>> sortedUris = siteDataMap
.get(siteKey).getSourceData(sourceName).getAvailableUris();
Date previousQueryTime = siteDataMap.get(siteKey)
.getSourceData(sourceName).getPreviousUriQueryDate();
SourceXML source = getSourceConfig().getSource(sourceName);
if (source.getSourceType().equals(SOURCE_TYPE.GUIDANCE.getSourceType())) {
@ -672,7 +554,8 @@ public class FFMPMonitor extends ResourceMonitor {
if (source.getSourceType().equals(
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);
}
@ -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) {
statusHandler.handle(Priority.PROBLEM,
@ -763,11 +647,12 @@ public class FFMPMonitor extends ResourceMonitor {
* @return
*
*/
public FFMPCacheRecord getFFMPData(ProductXML product, String siteKey,
public FFMPRecord getFFMPData(ProductXML product, String siteKey,
String dataKey, String sourceName, Date ptime, String phuc,
boolean retrieveNew) {
FFMPCacheRecord record = ffmpData.get(siteKey).get(sourceName);
FFMPRecord record = siteDataMap.get(siteKey).getSourceData(sourceName)
.getRecord();
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData()
.getGuidSrc();
@ -791,8 +676,9 @@ public class FFMPMonitor extends ResourceMonitor {
for (SourceXML source : productRun.getGuidanceSources(
product, guidSrc)) {
if (ffmpLoadedUris.get(siteKey).containsKey(
source.getSourceName())) {
if (siteDataMap.get(siteKey)
.getSourceData(source.getSourceName())
.hasLoadedAnyUris()) {
continue;
} else {
populateFFMPRecord(product, siteKey, dataKey,
@ -802,13 +688,15 @@ public class FFMPMonitor extends ResourceMonitor {
}
} else {
// FFG is the primary if
if (!ffmpLoadedUris.get(siteKey).containsKey(sourceName)) {
if (!siteDataMap.get(siteKey).getSourceData(sourceName)
.hasLoadedAnyUris()) {
populateFFMPRecord(product, siteKey, dataKey,
sourceName, ptime, phuc, retrieveNew);
}
}
record = ffmpData.get(siteKey).get(sourceName);
record = siteDataMap.get(siteKey).getSourceData(sourceName)
.getRecord();
} else {
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;
@ -946,14 +835,12 @@ public class FFMPMonitor extends ResourceMonitor {
FFMPResourceData frd = resource.getResourceData();
if (loadType == LOADER_TYPE.SECONDARY) {
// hucsToLoad.remove("ALL");
// hucsToLoad.remove(getConfig().getFFMPConfigData().getLayer());
timeBack = new Date(resource.getMostRecentTime().getTime()
- (6 * 1000 * 24));
- (6 * TimeUtil.MILLIS_PER_HOUR));
frd.timeBack = timeBack;
} else if (loadType == LOADER_TYPE.TERTIARY) {
hucsToLoad.clear();
hucsToLoad.add("ALL");
hucsToLoad.add(FFMPRecord.ALL);
timeBack = new Date(resource.getMostRecentTime().getTime()
- (TimeUtil.MILLIS_PER_HOUR * 24));
}
@ -988,7 +875,7 @@ public class FFMPMonitor extends ResourceMonitor {
ffmpSplash.close();
break;
}
Thread.sleep(1000);
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
if (ffmpSplash != null) {
@ -1127,21 +1014,13 @@ public class FFMPMonitor extends ResourceMonitor {
res.getResourceData().floader = null;
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)) {
ffmpData.remove(res.getSiteKey());
ffmpAvailableUriQueryDates.remove(res.getSiteKey());
ffmpAvailableUris.remove(res.getSiteKey());
ffmpLoadedUris.remove(res.getSiteKey());
FFMPSiteData siteData = siteDataMap
.removeSite(res.getSiteKey());
if (siteData != null) {
siteData.clear();
}
}
}
@ -1200,7 +1079,7 @@ public class FFMPMonitor extends ResourceMonitor {
* @param retrieveNew
* @return
*/
public FFMPCacheRecord getQPERecord(ProductXML product, String siteKey,
public FFMPRecord getQPERecord(ProductXML product, String siteKey,
String dataKey, String sourceName, Date date, String phuc,
boolean retrieveNew) {
@ -1241,7 +1120,7 @@ public class FFMPMonitor extends ResourceMonitor {
* @param retrieveNew
* @return
*/
public FFMPCacheRecord getRateRecord(ProductXML product, String siteKey,
public FFMPRecord getRateRecord(ProductXML product, String siteKey,
String dataKey, String sourceName, Date date, String phuc,
boolean retrieveNew) {
@ -1283,7 +1162,7 @@ public class FFMPMonitor extends ResourceMonitor {
* @param retrieveNew
* @return
*/
public FFMPCacheRecord getQPFRecord(ProductXML product, String siteKey,
public FFMPRecord getQPFRecord(ProductXML product, String siteKey,
String dataKey, String sourceName, Date date, String phuc,
boolean retrieveNew) {
@ -1337,9 +1216,8 @@ public class FFMPMonitor extends ResourceMonitor {
* @param phuc
* @return
*/
public FFMPCacheRecord getGuidanceRecord(ProductXML product,
String siteKey, String sourceName, Date date, String phuc,
boolean isStandAlone) {
public FFMPRecord getGuidanceRecord(ProductXML product, String siteKey,
String sourceName, Date date, String phuc, boolean isStandAlone) {
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData()
.getGuidSrc();
if (!isStandAlone && guidSrc.startsWith("xxx")) {
@ -1368,18 +1246,17 @@ public class FFMPMonitor extends ResourceMonitor {
* @param retrieveNew
* @return
*/
public HashMap<String, FFMPCacheRecord> getGuidanceRecords(
ProductXML product, String siteKey, Date date, String phuc,
boolean retrieveNew) {
public HashMap<String, FFMPRecord> getGuidanceRecords(ProductXML product,
String siteKey, Date date, String phuc, boolean retrieveNew) {
HashMap<String, FFMPCacheRecord> guidRecs = new HashMap<String, FFMPCacheRecord>();
HashMap<String, FFMPRecord> guidRecs = new HashMap<String, FFMPRecord>();
ProductRunXML productRun = FFMPRunConfigurationManager.getInstance()
.getProduct(siteKey);
ArrayList<String> guidTypes = productRun.getGuidanceTypes(product);
for (String type : guidTypes) {
FFMPCacheRecord guidRec = getFFMPData(product, siteKey, null, type,
FFMPRecord guidRec = getFFMPData(product, siteKey, null, type,
date, phuc, retrieveNew);
guidRecs.put(type, guidRec);
}
@ -1418,7 +1295,7 @@ public class FFMPMonitor extends ResourceMonitor {
* @param retrieveNew
* @return
*/
public FFMPCacheRecord getVirtualRecord(ProductXML product, String siteKey,
public FFMPRecord getVirtualRecord(ProductXML product, String siteKey,
String dataKey, String sourceName, Date date, String phuc,
boolean retrieveNew) {
// comparisons done with table display
@ -1446,7 +1323,8 @@ public class FFMPMonitor extends ResourceMonitor {
Long pfaf) throws VizException {
FFMPBasin basin = null;
// check for already loaded records
FFMPCacheRecord record = ffmpData.get(siteKey).get(sourceName);
FFMPRecord record = siteDataMap.get(siteKey).getSourceData(sourceName)
.getRecord();
if (record != null) {
FFMPBasinData basinData = record.getBasinData(phuc);
if (basinData != null) {
@ -1466,7 +1344,7 @@ public class FFMPMonitor extends ResourceMonitor {
if (basin != null) {
fgb = (FFMPGuidanceBasin) basin;
} else {
fgb = new FFMPGuidanceBasin(pfaf, !phuc.equals("ALL"));
fgb = new FFMPGuidanceBasin(pfaf, !phuc.equals(FFMPRecord.ALL));
basin = fgb;
}
@ -1489,22 +1367,11 @@ public class FFMPMonitor extends ResourceMonitor {
POINT_RETRIVAL: for (List<String> uris : availableUris
.values()) {
for (String uri : uris) {
if (!ffmpLoadedUris.containsKey(siteKey)) {
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> tempLoadedUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>();
tempLoadedUris
.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)) {
if (!siteDataMap
.get(siteKey)
.getSourceData(
source.getSourceName())
.getLoadedUris(phuc).contains(uri)) {
// populate point only
populateFFMPBasin(uri, siteKey,
source.getSourceName(), phuc,
@ -1528,22 +1395,9 @@ public class FFMPMonitor extends ResourceMonitor {
POINT_RETRIVAL: for (List<String> uris : availableUris
.values()) {
for (String uri : uris) {
if (!ffmpLoadedUris.containsKey(siteKey)) {
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)) {
if (!siteDataMap.get(siteKey)
.getSourceData(sourceName)
.getLoadedUris(phuc).contains(uri)) {
// populate point only
populateFFMPBasin(uri, siteKey, sourceName,
phuc, fgb);
@ -1563,52 +1417,8 @@ public class FFMPMonitor extends ResourceMonitor {
if ((availableUris != null) && (availableUris.size() > 0)) {
POINT_RETRIVAL: for (List<String> uris : availableUris.values()) {
for (String uri : uris) {
if (!ffmpLoadedUris.containsKey(siteKey)) {
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)) {
if (!siteDataMap.get(siteKey).getSourceData(sourceName)
.getLoadedUris(phuc).contains(uri)) {
// populate point only
populateFFMPBasin(uri, siteKey, sourceName, phuc,
basin);
@ -1765,10 +1575,10 @@ public class FFMPMonitor extends ResourceMonitor {
sourceName = SOURCE_TYPE.GUIDANCE.getSourceType();
}
if (ffmpData != null) {
if (ffmpData.containsKey(fsiteKey)) {
FFMPCacheRecord record = ffmpData.get(fsiteKey)
.get(sourceName);
if (siteDataMap != null) {
if (siteDataMap.containsSite(fsiteKey)) {
FFMPRecord record = siteDataMap.get(fsiteKey)
.getSourceData(sourceName).getRecord();
if (record != null) {
record.purgeData(fdate);
}
@ -1778,10 +1588,10 @@ public class FFMPMonitor extends ResourceMonitor {
}
} else {
if (ffmpData != null) {
if (ffmpData.containsKey(fsiteKey)) {
FFMPCacheRecord record = ffmpData.get(fsiteKey).get(
fsource);
if (siteDataMap != null) {
if (siteDataMap.containsSite(fsiteKey)) {
FFMPRecord record = siteDataMap.get(fsiteKey)
.getSourceData(fsource).getRecord();
if (record != null) {
record.purgeData(fdate);
}
@ -1789,38 +1599,42 @@ public class FFMPMonitor extends ResourceMonitor {
}
}
if (ffmpAvailableUris != null) {
for (Entry<String, ConcurrentSkipListMap<Date, List<String>>> entry : ffmpAvailableUris
.get(fsiteKey).entrySet()) {
ConcurrentNavigableMap<Date, List<String>> oldUris = entry
.getValue().headMap(fdate);
for (List<String> uris : oldUris.headMap(fdate).values()) {
for (String uri : uris) {
FFMPSiteData siteData = siteDataMap.get(fsiteKey);
for (String sourceEntry : siteData.getSources()) {
ConcurrentNavigableMap<Date, List<String>> oldUris = siteData
.getSourceData(sourceEntry).getAvailableUris()
.headMap(fdate);
for (List<String> uris : oldUris.headMap(fdate).values()) {
for (String uri : uris) {
if (fproduct != null) {
if (fproduct != null) {
for (String sourceName : purgeSources) {
for (String sourceName : purgeSources) {
if (ffmpLoadedUris.get(fsiteKey)
.containsKey(sourceName)) {
for (ConcurrentHashMap<String, String> loadedUris : ffmpLoadedUris
.get(fsiteKey).get(sourceName)
.values()) {
loadedUris.remove(uri);
}
if (siteData.getSourceData(sourceName)
.hasLoadedAnyUris()) {
FFMPSourceData sourceData = siteData
.getSourceData(sourceName);
Set<String> hucs = sourceData
.getLoadedHucs();
for (String huc : hucs) {
sourceData.getLoadedUris(huc).remove(
uri);
}
}
} else {
for (ConcurrentHashMap<String, String> loadedUris : ffmpLoadedUris
.get(fsiteKey).get(fsource).values()) {
loadedUris.remove(uri);
}
}
} else {
FFMPSourceData sourceData = siteData
.getSourceData(fsource);
Set<String> hucs = sourceData.getLoadedHucs();
for (String huc : hucs) {
sourceData.getLoadedUris(huc).remove(uri);
}
}
}
oldUris.clear();
}
oldUris.clear();
}
}
}
@ -1841,11 +1655,9 @@ public class FFMPMonitor extends ResourceMonitor {
SourceXML source = getSourceConfig().getSource(sourceName);
if (uri != null) {
FFMPRecord record = new FFMPRecord(uri);
try {
record = populateFFMPRecord(isProductLoad, uri, siteKey,
sourceName, phuc);
FFMPRecord record = populateFFMPRecord(isProductLoad, uri,
siteKey, sourceName, phuc);
if ((record != null) && (source != null)) {
record.setExpiration(source.getExpirationMinutes(siteKey));
record.setRate(source.isRate());
@ -2311,7 +2123,8 @@ public class FFMPMonitor extends ResourceMonitor {
* @return
*/
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) {
ConcurrentMap<String, String> uris = getUriMap(fsiteKey,
fsource, fhuc);
List<String> uris = getLoadedUris(fsiteKey, fsource, fhuc);
String dataUri = fffmpRec.getDataURI();
if (!uris.containsKey(dataUri)) {
if (!uris.contains(dataUri)) {
File loc = HDF5Util.findHDF5Location(fffmpRec);
IDataStore dataStore = DataStoreFactory.getDataStore(loc);
if (!ffmpData.containsKey(fsiteKey)) {
ConcurrentHashMap<String, FFMPCacheRecord> fieldRecs = new ConcurrentHashMap<String, FFMPCacheRecord>();
ffmpData.put(fsiteKey, fieldRecs);
}
FFMPSiteData siteData = siteDataMap.get(fsiteKey);
String mySource = fsource;
SourceXML source = fscm.getSource(fsource);
@ -2371,17 +2179,19 @@ public class FFMPMonitor extends ResourceMonitor {
mySource = source.getDisplayName();
}
FFMPCacheRecord curRecord = ffmpData.get(fsiteKey).get(
mySource);
FFMPSourceData sourceData = siteData
.getSourceData(mySource);
FFMPRecord curRecord = sourceData.getRecord();
if (curRecord == null) {
// ensure the record can only be set once
synchronized (ffmpData) {
curRecord = ffmpData.get(fsiteKey).get(mySource);
synchronized (siteDataMap) {
curRecord = siteDataMap.get(fsiteKey)
.getSourceData(mySource).getRecord();
if (curRecord == null) {
curRecord = new FFMPCacheRecord(fffmpRec,
mySource, getRunConfig().getRunner(wfo)
.getCacheDir());
ffmpData.get(fsiteKey).put(mySource, curRecord);
curRecord = new FFMPRecord(dataUri);
siteDataMap.get(fsiteKey)
.getSourceData(mySource)
.setRecord(curRecord);
}
}
}
@ -2391,7 +2201,7 @@ public class FFMPMonitor extends ResourceMonitor {
if ((sourceXML != null)
&& sourceXML.getSourceType().equals(
SOURCE_TYPE.GAGE.getSourceType())
&& fhuc.equals("ALL")) {
&& fhuc.equals(FFMPRecord.ALL)) {
try {
curRecord.retrieveVirtualMapFromDataStore(
dataStore, dataUri, getTemplates(fsiteKey),
@ -2409,8 +2219,8 @@ public class FFMPMonitor extends ResourceMonitor {
try {
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
statusHandler.handle(Priority.DEBUG,
"Retrieving and Populating URI: , "
+ dataUri);
"Retrieving and Populating URI: , "
+ dataUri);
}
curRecord.retrieveMapFromDataStore(dataStore,
dataUri,
@ -2424,40 +2234,7 @@ public class FFMPMonitor extends ResourceMonitor {
}
}
ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>> siteLoadedUris = ffmpLoadedUris
.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);
}
sourceData.addLoadedUri(fhuc, dataUri);
}
}
}
@ -2513,8 +2290,8 @@ public class FFMPMonitor extends ResourceMonitor {
.getSourceType())) {
try {
if (!getUriMap(fsiteKey, fsourceName, fhuc)
.containsKey(uri)) {
if (!getLoadedUris(fsiteKey, fsourceName,
fhuc).contains(uri)) {
record = populateFFMPRecord(
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.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.monitor.ffmp.FFMPMonitor;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.BasinTrendCommon.PlotItems;
@ -65,6 +69,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- --------------------------
* Initial creation
* Dec 6, 2012 1353 rferrel Code clean up for non-blocking dialog.
* Feb 10, 2013 1584 mpduff Add performance logging.
*
* </pre>
*
@ -72,6 +77,13 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* @version 1.0
*/
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.
*/
@ -141,12 +153,12 @@ public class BasinTrendDlg extends CaveSWTDialog {
/**
* QPFSCAN radio button.
*/
private List<Button> qpfRdos = new ArrayList<Button>();
private final List<Button> qpfRdos = new ArrayList<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.
@ -221,7 +233,8 @@ public class BasinTrendDlg extends CaveSWTDialog {
/**
* 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;
@ -229,7 +242,8 @@ public class BasinTrendDlg extends CaveSWTDialog {
private Date currentDate;
private FFMPResource resource;
/** The FFMP Resource */
private final FFMPResource resource;
private final List<ISourceUpdate> sourceListeners = new ArrayList<ISourceUpdate>();
@ -238,6 +252,14 @@ public class BasinTrendDlg extends CaveSWTDialog {
*
* @param parent
* Parent shell.
* @param resource
* The Resource
* @param date
* The Date
* @param pfaf
* The pfaf
* @param vgb
* The VGB
* @param graphData
* Graph data.
*/
@ -1000,6 +1022,9 @@ public class BasinTrendDlg extends CaveSWTDialog {
*/
private void updatePlotSelection(Button plotBtn,
boolean updateLegendAndGraph) {
ITimer timer = TimeUtil.getTimer();
timer.start();
PlotItems plotItem = (PlotItems) plotBtn.getData();
if (plotItem == PlotItems.RATE) {
@ -1056,6 +1081,9 @@ public class BasinTrendDlg extends CaveSWTDialog {
updateColorLegend();
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.xml.DomainXML;
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.PerformanceStatus;
import com.raytheon.uf.common.status.UFStatus;
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.localization.LocalizationManager;
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.FFMPTableDataUpdate;
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.ICloseCallback;
@ -106,6 +113,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Changes for non-blocking AttributeThresholdDlg.
* Changes for non-blocking LoadSaveConfigDlg.
* 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
* </pre>
* @author lvenable
@ -118,11 +127,21 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
private final IUFStatusHandler statusHandler = UFStatus
.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 saveDlg;
private List<FFMPTableDataLoader> retrievalQueue = new ArrayList<FFMPTableDataLoader>();
/** Retrieval queue */
private final List<FFMPTableDataLoader> retrievalQueue = new ArrayList<FFMPTableDataLoader>();
private MenuItem linkToFrameMI;
@ -199,7 +218,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
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;
@ -237,7 +257,18 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
private boolean groupLabelFlag = true;
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,
FFMPResource resource) {
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.INDEPENDENT_SHELL
@ -300,6 +331,13 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
@Override
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() {
@Override
public void shellClosed(ShellEvent e) {
@ -339,7 +377,10 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
refreshDisplay(true);
}
public void createMenus() {
/**
* Create the menus.
*/
private void createMenus() {
Menu menuBar = new Menu(shell, SWT.BAR);
createFileMenu(menuBar);
@ -752,6 +793,9 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
cwaMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
MenuItem mi = (MenuItem) event.getSource();
perfLog.log("CWA " + mi.getText()
+ (mi.getSelection() ? " selected" : " unselected"));
updateD2DRefresh();
updateCWA(event);
}
@ -1083,19 +1127,21 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
private void updateGapValueLabel(double gapVal) {
if (gapVal > 0.75) {
gapValueLbl.setBackground(getDisplay()
.getSystemColor(SWT.COLOR_RED));
} else if (gapVal > 0.30) {
gapValueLbl.setBackground(getDisplay().getSystemColor(
SWT.COLOR_YELLOW));
} else {
gapValueLbl.setBackground(getDisplay().getSystemColor(
SWT.COLOR_GREEN));
}
if (gapValueLbl != null) {
if (gapVal > 0.75) {
gapValueLbl.setBackground(getDisplay().getSystemColor(
SWT.COLOR_RED));
} else if (gapVal > 0.30) {
gapValueLbl.setBackground(getDisplay().getSystemColor(
SWT.COLOR_YELLOW));
} else {
gapValueLbl.setBackground(getDisplay().getSystemColor(
SWT.COLOR_GREEN));
}
String str = String.format("%2.2f ", gapVal);
gapValueLbl.setText(str);
String str = String.format("%2.2f ", gapVal);
gapValueLbl.setText(str);
}
}
private void initTimeDuration() {
@ -1280,6 +1326,9 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
public void attributeDisplayAction(boolean updateData,
AttributesDlgData attrData) {
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
ITimer timer = TimeUtil.getTimer();
timer.start();
this.attrData = attrData;
// Update the data in the FFMPConfig with the selections
@ -1313,6 +1362,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
shell.pack();
shell.redraw();
resetCursor();
timer.stop();
perfLog.logDuration("Column Add/Remove time", timer.getElapsedTime());
}
@Override
@ -1568,15 +1619,19 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
fireCWAChangedEvent(mi.getText(), mi.getSelection());
}
/**
* Update the layer.
*/
private void updateLayer(SelectionEvent event) {
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
updateD2DRefresh();
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);
fireHucChangedEvent(huc);
}
@ -1613,6 +1668,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
* Fire Table reload event
*/
private void fireTableRestoreEvent() {
perfLog.log("Table Restore Called");
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
groupLbl.setText("");
@ -1637,6 +1693,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
this);
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
FFMPMonitor.getInstance().configUpdate(me);
}
@ -1663,6 +1720,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
try {
setGraphData(resource.getGraphData(pfaf), pfaf,
differentPfaf, ffmpDate);
perfLog.log("Graph Display Complete");
} catch (VizException e) {
shell.setCursor(null);
statusHandler.handle(Priority.PROBLEM,
@ -1682,27 +1740,30 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
public void resetData(FFMPTableData tData) {
if (!ffmpTable.isDisposed()) {
this.mainTableData = tData;
// System.out.println("---" + tData.getTableRows().size());
ffmpTable.clearTableSelection();
// long time = System.currentTimeMillis();
ffmpTable
.setCenteredAggregationKey(resource.centeredAggregationKey);
ffmpTable.setTableData(mainTableData);
// long time1 = System.currentTimeMillis();
resetCursor();
shell.pack();
shell.redraw();
// System.out
// .println("Time to load Data into table " + (time1 - time));
if (loadEvent != null) {
StatsCollector.stop(initialLoadKey);
loadEvent = null;
}
perfLog.log("Table update complete");
}
}
/**
* {@inheritDoc}
*/
@Override
public void tableSelection(String pfaf, String name) {
if (groupLbl.getText().length() > 0) {
groupLabelFlag = false;
} else {
perfLog.log("Table Selection");
}
if ((groupLbl.getText().length() == 0)
@ -1714,10 +1775,14 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
fireScreenRecenterEvent(pfaf, 1);
}
/**
* {@inheritDoc}
*/
@Override
public void displayBasinTrend(String pfaf) {
if (pfaf != null) {
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
perfLog.log("Basin Trend Graph Launch");
fireGraphDataEvent(pfaf, true, this.date);
}
}
@ -1824,6 +1889,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
if (menuDataType.compareTo(layer) == 0) {
mi.setSelection(true);
this.previousHuc = mi.getText();
break;
}
}
@ -2022,14 +2088,14 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
}
public void updateLoadingLabel(FFMPLoaderStatus status) {
this.loadStatus = status;
if (dataLoadComp == null) {
return;
}
GridData gd = (GridData) dataLoadComp.getLayoutData();
// System.out.println("Status message...");
if (gd.exclude == true) {
((GridData) dataLoadComp.getLayoutData()).exclude = false;
dataLoadComp.setVisible(true);
@ -2057,13 +2123,13 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
dataLoadComp.setVisible(false);
shell.pack();
}
resource.manageLoaders(status);
}
/**
* {@inheritDoc}
*/
@Override
public void notify(IMonitorEvent me) {
if (!this.isDisposed()) {
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
FFMPTableDataLoader tableLoader = new FFMPTableDataLoader(me,
@ -2126,7 +2192,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
if (!this.isDisposed()) {
Display.getDefault().asyncExec(new Runnable() {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
processUpdate(fupdateData);
@ -2163,10 +2229,14 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
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() {
if (groupLbl != null) {

View file

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

View file

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

View file

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

View file

@ -26,6 +26,24 @@ import java.util.Set;
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 {
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.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils;
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.raytheon.uf.common.time.util.TimeUtil;
import com.vividsolutions.jts.geom.GeometryFactory;
/**
@ -45,6 +39,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 08/29/09 2152 D. Hladky Initial release
* 02/01/13 1569 D. Hladky Added constants
*
* </pre>
*
@ -55,77 +50,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
public class FFMPGuiUtils {
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(
ArrayList<FFMPRecord> records) {
HashMap<Double, Integer> ctimes = new HashMap<Double, Integer>();
@ -176,7 +101,7 @@ public class FFMPGuiUtils {
* @return
*/
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
*/
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;
/**
* 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;
/**
* 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 {
private LOADER_TYPE loaderType = null;

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