Merge branch 'master_14.2.1' into ncep_14.2.1

Former-commit-id: 4b01c57c0a [formerly 505bcf7b47aac1344bb46bac690ce83591b8e554]
Former-commit-id: 167ce61d6c
This commit is contained in:
Steve Harris 2014-03-05 13:00:23 -06:00
commit 1a666f9f71
655 changed files with 22836 additions and 11387 deletions

View file

@ -107,6 +107,40 @@
</max-perm>
</ini-substitutions>
</memory-setting>
<memory-setting>
<command-line-args>
<first-arg>-component</first-arg>
<second-arg>servicebackup</second-arg>
</command-line-args>
<ini-substitutions>
<max-memory>
<value>256M</value>
</max-memory>
<max-perm>
<value>128m</value>
</max-perm>
</ini-substitutions>
</memory-setting>
<memory-setting>
<command-line-args>
<first-arg>-perspective</first-arg>
<second-arg>National Centers</second-arg>
</command-line-args>
<ini-substitutions>
<max-memory>
<value>1536M</value>
</max-memory>
<max-perm>
<value>DEFAULT</value>
</max-perm>
</ini-substitutions>
</memory-setting>
</arch.x86>
<arch.x86_64>
@ -182,6 +216,40 @@
</max-perm>
</ini-substitutions>
</memory-setting>
</arch.x86_64>
<memory-setting>
<command-line-args>
<first-arg>-component</first-arg>
<second-arg>servicebackup</second-arg>
</command-line-args>
<ini-substitutions>
<max-memory>
<value>256M</value>
</max-memory>
<max-perm>
<value>128m</value>
</max-perm>
</ini-substitutions>
</memory-setting>
<memory-setting>
<command-line-args>
<first-arg>-perspective</first-arg>
<second-arg>National Centers</second-arg>
</command-line-args>
<ini-substitutions>
<max-memory>
<value>2048M</value>
</max-memory>
<max-perm>
<value>DEFAULT</value>
</max-perm>
</ini-substitutions>
</memory-setting>
</arch.x86_64>
</cave-memory-settings>

View file

@ -0,0 +1,48 @@
<?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.
-->
<bundle>
<displayList>
<displays xsi:type="d2DMapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties loadWithoutData="true">
</loadProperties>
<properties isSystemResource="false"
isBlinking="false" isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="lightningResourceData"
isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true"
handlingPositiveStrikes="true" handlingNegativeStrikes="true">
<binOffset posOffset="0" negOffset="900" virtualOffset="0"/>
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="binlightning" constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,70 @@
<?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.
-->
<bundle>
<displayList>
<displays xsi:type="d2DMapRenderableDisplay"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties loadWithoutData="true">
</loadProperties>
<properties isSystemResource="false" isBlinking="false"
isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="lightningResourceData"
isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true"
handlingPositiveStrikes="true" handlingNegativeStrikes="false">
<binOffset posOffset="0" negOffset="900" virtualOffset="0" />
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
<resource>
<loadProperties loadWithoutData="true"/>
<properties isSystemResource="false" isBlinking="false"
isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="lightningResourceData"
isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true"
handlingPositiveStrikes="false" handlingNegativeStrikes="true">
<binOffset posOffset="0" negOffset="900" virtualOffset="0" />
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,48 @@
<?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.
-->
<bundle>
<displayList>
<displays xsi:type="d2DMapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties loadWithoutData="true">
</loadProperties>
<properties isSystemResource="false"
isBlinking="false" isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="lightningResourceData"
isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true"
handlingPositiveStrikes="true" handlingNegativeStrikes="true">
<binOffset posOffset="0" negOffset="300" virtualOffset="0"/>
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="binlightning" constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,48 @@
<?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.
-->
<bundle>
<displayList>
<displays xsi:type="d2DMapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties loadWithoutData="true">
</loadProperties>
<properties isSystemResource="false"
isBlinking="false" isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="lightningResourceData"
isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true"
handlingPositiveStrikes="true" handlingNegativeStrikes="true">
<binOffset posOffset="0" negOffset="3600" virtualOffset="0"/>
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="binlightning" constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,185 @@
<?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.
-->
<bundle>
<displayList>
<displays xsi:type="d2DMapRenderableDisplay"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties loadWithoutData="true">
<capabilities>
<capability xsi:type="colorableCapability"
colorAsString="#ffffff" />
</capabilities>
<resourceType>PLAN_VIEW</resourceType>
</loadProperties>
<properties isSystemResource="false" isBlinking="false"
isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="lightningResourceData"
isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true"
handlingPositiveStrikes="true" handlingNegativeStrikes="true">
<binOffset posOffset="0" negOffset="60" virtualOffset="0" />
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
<resource>
<loadProperties loadWithoutData="true">
<capabilities>
<capability xsi:type="colorableCapability"
colorAsString="#ffff9c" />
</capabilities>
<resourceType>PLAN_VIEW</resourceType>
</loadProperties>
<properties isSystemResource="false" isBlinking="false"
isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="lightningResourceData"
isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true"
handlingPositiveStrikes="true" handlingNegativeStrikes="true">
<binOffset posOffset="0" negOffset="60" virtualOffset="-60" />
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
<resource>
<loadProperties loadWithoutData="true">
<capabilities>
<capability xsi:type="colorableCapability"
colorAsString="#ffff00" />
</capabilities>
<resourceType>PLAN_VIEW</resourceType>
</loadProperties>
<properties isSystemResource="false" isBlinking="false"
isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="lightningResourceData"
isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true"
handlingPositiveStrikes="true" handlingNegativeStrikes="true">
<binOffset posOffset="0" negOffset="60" virtualOffset="-120" />
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
<resource>
<loadProperties loadWithoutData="true">
<capabilities>
<capability xsi:type="colorableCapability"
colorAsString="#ffa600" />
</capabilities>
<resourceType>PLAN_VIEW</resourceType>
</loadProperties>
<properties isSystemResource="false" isBlinking="false"
isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="lightningResourceData"
isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true"
handlingPositiveStrikes="true" handlingNegativeStrikes="true">
<binOffset posOffset="0" negOffset="60" virtualOffset="-180" />
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
<resource>
<loadProperties loadWithoutData="true">
<capabilities>
<capability xsi:type="colorableCapability"
colorAsString="#ff7900" />
</capabilities>
<resourceType>PLAN_VIEW</resourceType>
</loadProperties>
<properties isSystemResource="false" isBlinking="false"
isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="lightningResourceData"
isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true"
handlingPositiveStrikes="true" handlingNegativeStrikes="true">
<binOffset posOffset="0" negOffset="60" virtualOffset="-240" />
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
<resource>
<loadProperties loadWithoutData="true">
<capabilities>
<capability xsi:type="colorableCapability"
colorAsString="#ff0000" />
</capabilities>
<resourceType>PLAN_VIEW</resourceType>
</loadProperties>
<properties isSystemResource="false" isBlinking="false"
isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="lightningResourceData"
isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true"
handlingPositiveStrikes="true" handlingNegativeStrikes="true">
<binOffset posOffset="0" negOffset="60" virtualOffset="-300" />
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -85,8 +85,10 @@ if [ -f /awips2/java/jre/lib/amd64/server/libjvm.so ]; then
fi
#run a loop for alertviz
while [ $exitVal -ne 0 ]
count=0
while [ $exitVal -ne 0 -a $count -lt 10 ]
do
count=`expr $count + 1`
curTime=`date +%Y%m%d_%H%M%S`
LOGFILE=${LOGDIR}/alertviz_${curTime}_console.log
export LOGFILE_ALERTVIZ=${LOGDIR}/alertviz_${curTime}_admin.log

View file

@ -28,6 +28,8 @@
# cave sessions.
# Dec 05, 2013 #2590 dgilling Modified so gfeclient.sh can be wrapped
# around this script.
# Jan 24, 2014 #2739 bsteffen Log exit status
# Jan 30, 2014 #2593 bclement warns based on memory usage, fixed for INI files with spaces
#
#
@ -45,6 +47,8 @@ JAVA_INSTALL="/awips2/java"
PYTHON_INSTALL="/awips2/python"
export AWIPS_INSTALL_DIR="${CAVE_INSTALL}"
MAX_MEM_PROPORTION="0.9"
source ${CAVE_INSTALL}/caveUtil.sh
RC=$?
if [ ${RC} -ne 0 ]; then
@ -61,6 +65,9 @@ copyVizShutdownUtilIfNecessary
# delete any old disk caches in the background
deleteOldCaveDiskCaches &
# Enable core dumps
ulimit -c unlimited
export LD_LIBRARY_PATH=${JAVA_INSTALL}/lib:${PYTHON_INSTALL}/lib:$LD_LIBRARY_PATH
export LD_PRELOAD=libpython.so
if [[ -z "$CALLED_EXTEND_LIB_PATH" ]]; then
@ -109,20 +116,39 @@ export TEXTWS=`hostname | sed -e 's/lx/xt/g'`
hostName=`hostname -s`
if [[ $hostName =~ xt.* ]]; then
export IGNORE_NUM_CAVES=1
fi
# check number of running caves
if [[ -z $IGNORE_NUM_CAVES ]]; then
# free usually reports below on G threshold (11 instead of 12G), giving the 3 cave recommended in field
mem=( `free -g | grep "Mem:"` )
# get total memory on system in bytes
mem=( `free -b | grep "Mem:"` )
mem=${mem[1]}
let _maxCaves=mem/3
getPidsOfMyRunningCaves
if [[ "$_numPids" -ge "$_maxCaves" ]]; then
zenity --question --title "Max CAVE sessions already running" --text "$_numPids CAVE sessions already running. Starting more may impact system performance and stability.\n\nProceed?"
# get max amount of system memory used before we warn
memThreshold=$(echo "$mem * $MAX_MEM_PROPORTION" | bc)
# remove decimal
printf -v memThreshold "%.0f" "$memThreshold"
# get launcher.ini argument determined by user arguments
lookupINI "$@"
launcherRegex='--launcher.ini\s(.+\.ini)'
# default to cave.ini
targetIni="/awips2/cave/cave.ini"
if [[ $CAVE_INI_ARG =~ $launcherRegex ]]
then
targetIni="${BASH_REMATCH[1]}"
fi
# read max memory that could be used by this instance
memOfLaunchingCave=$(readMemFromIni "$targetIni")
# read total max memory of caves already running
getTotalMemOfRunningCaves
# add them together
_totalAfterStart=$(($memOfLaunchingCave + $_totalRunningMem))
if [[ "$_totalAfterStart" -ge "$memThreshold" ]]; then
# convert to megs for display
memOfLaunchingCave=$(($memOfLaunchingCave / $BYTES_IN_MB))
_totalRunningMem=$(($_totalRunningMem / $BYTES_IN_MB))
getPidsOfMyRunningCaves
memMsg="$_numPids CAVE applications already running with a combined max memory of ${_totalRunningMem}MB. "
memMsg+="The requested application has a max memory requirement of ${memOfLaunchingCave}MB. "
memMsg+="Starting may impact system performance and stability.\n\nProceed?"
zenity --question --title "Low Available Memory for Application" --text "$memMsg"
cancel="$?"
if [[ "$cancel" == "1" ]]; then
@ -172,49 +198,59 @@ if [ ! -d $LOGDIR ]; then
mkdir -p $LOGDIR
fi
export pid=$$
curTime=`date +%Y%m%d_%H%M%S`
LOGFILE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_console.log"
export LOGFILE_CAVE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_alertviz.log"
export LOGFILE_PERFORMANCE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_perf.log"
# can we write to log directory
if [ -w ${LOGDIR} ]; then
touch ${LOGFILE}
fi
# At this point fork so that log files can be set up with the process pid and
# this process can log the exit status of cave.
(
export pid=`/bin/bash -c 'echo $PPID'`
# remove "-noredirect" flag from command-line if set so it doesn't confuse any
# commands we call later.
redirect="true"
USER_ARGS=()
while [[ $1 ]]
do
LOGFILE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_console.log"
export LOGFILE_CAVE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_alertviz.log"
export LOGFILE_PERFORMANCE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_perf.log"
# can we write to log directory
if [ -w ${LOGDIR} ]; then
touch ${LOGFILE}
fi
# remove "-noredirect" flag from command-line if set so it doesn't confuse any
# commands we call later.
redirect="true"
USER_ARGS=()
while [[ $1 ]]
do
if [[ "$1" == "-noredirect" ]]
then
redirect="false"
redirect="false"
else
USER_ARGS+=("$1")
USER_ARGS+=("$1")
fi
shift
done
done
# Special instructions for the 64-bit jvm.
ARCH_ARGS=""
if [ -f /awips2/java/jre/lib/amd64/server/libjvm.so ]; then
ARCH_ARGS="-vm /awips2/java/jre/lib/amd64/server/libjvm.so"
fi
# Special instructions for the 64-bit jvm.
ARCH_ARGS=""
if [ -f /awips2/java/jre/lib/amd64/server/libjvm.so ]; then
ARCH_ARGS="-vm /awips2/java/jre/lib/amd64/server/libjvm.so"
fi
lookupINI "${USER_ARGS[@]}"
lookupINI "${USER_ARGS[@]}"
if [[ "${runMonitorThreads}" == "true" ]] ; then
# nohup to allow tar process to continue after user has logged out
nohup ${CAVE_INSTALL}/monitorThreads.sh $pid >> /dev/null 2>&1 &
fi
if [[ "${runMonitorThreads}" == "true" ]] ; then
# nohup to allow tar process to continue after user has logged out
nohup ${CAVE_INSTALL}/monitorThreads.sh $pid >> /dev/null 2>&1 &
fi
if [[ "${redirect}" == "true" ]] ; then
exec ${CAVE_INSTALL}/cave ${ARCH_ARGS} ${SWITCHES} "${CAVE_INI_ARG}" "${USER_ARGS[@]}" > ${LOGFILE} 2>&1
else
exec ${CAVE_INSTALL}/cave ${ARCH_ARGS} ${SWITCHES} "${CAVE_INI_ARG}" "${USER_ARGS[@]}" 2>&1 | tee ${LOGFILE}
fi
) &
pid=$!
LOGFILE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_console.log"
logExitStatus $pid $LOGFILE
if [[ "${redirect}" == "true" ]] ; then
exec ${CAVE_INSTALL}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} "${USER_ARGS[@]}" > ${LOGFILE} 2>&1
else
exec ${CAVE_INSTALL}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} "${USER_ARGS[@]}" 2>&1 | tee ${LOGFILE}
fi

View file

@ -25,6 +25,10 @@
# Dec 05, 2013 #2593 rjpeter Fix getPidsOfMyRunningCaves
# Dec 05, 2013 #2590 dgilling Modified extendLibraryPath() to export a
# var if it's already been run.
# Jan 24, 2014 #2739 bsteffen Add method to log exit status of process.
# Jan 30, 2014 #2593 bclement extracted generic part of getPidsOfMyRunningCaves into forEachRunningCave
# added methods for reading max memory from .ini files
# fixes for INI files with spaces
#
#
@ -39,6 +43,10 @@ fi
# This script will be sourced by cave.sh.
export CAVE_INI_ARG=
BYTES_IN_KB=1024
BYTES_IN_MB=1048576
BYTES_IN_GB=1073741824
function lookupINI()
{
# Arguments:
@ -55,7 +63,7 @@ function lookupINI()
position=$(( $position + 1 ))
nextArg=${!position}
retrieveAssociatedINI ${arg} ${nextArg}
retrieveAssociatedINI ${arg} "${nextArg}"
RC=$?
if [ ${RC} -eq 0 ]; then
export CAVE_INI_ARG="--launcher.ini /awips2/cave/${ASSOCIATED_INI}"
@ -116,8 +124,8 @@ function copyVizShutdownUtilIfNecessary()
chmod a+x ${HOME}/.kde/shutdown/${VIZ_UTILITY_SCRIPT}
}
# returns _numPids and array _pids containing the pids of the currently running cave sessions.
function getPidsOfMyRunningCaves()
# takes a function as an argument and calls the function passing in the ps string of the process
function forEachRunningCave()
{
local user=`whoami`
local caveProcs=`ps -ef | grep -E "(/awips2/cave|/usr/local/viz)/cave " | grep -v "grep" | grep $user`
@ -125,17 +133,89 @@ function getPidsOfMyRunningCaves()
# preserve IFS and set it to line feed only
local PREV_IFS=$IFS
IFS=$'\n'
_numPids=0
# grab the pids for future use
for caveProc in $caveProcs
do
_pids[$_numPids]=`echo $caveProc | awk '{print $2}'`
let "_numPids+=1"
"$@" $caveProc
done
IFS=$PREV_IFS
}
# takes in ps string of cave process, stores pid in _pids and increments _numPids
function processPidOfCave()
{
_pids[$_numPids]=`echo $1 | awk '{print $2}'`
let "_numPids+=1"
}
# returns _numPids and array _pids containing the pids of the currently running cave sessions.
function getPidsOfMyRunningCaves()
{
_numPids=0
forEachRunningCave processPidOfCave
}
# takes a name of an ini file as an argument, echos the memory (in bytes) from file (or default)
function readMemFromIni()
{
local inifile="$1"
local mem
local unit
local regex='^[^#]*-Xmx([0-9]+)([bBkKmMgG])?'
# read ini file line by line looking for Xmx arg
while read -r line
do
if [[ $line =~ $regex ]]
then
mem=${BASH_REMATCH[1]}
unit=${BASH_REMATCH[2]}
break
fi
done < "$inifile"
# convert to bytes
case "$unit" in
[kK])
mem=$(($mem * $BYTES_IN_KB))
;;
[mM])
mem=$(($mem * $BYTES_IN_MB))
;;
[gG])
mem=$(($mem * $BYTES_IN_GB))
;;
esac
regex='^[0-9]+$'
if [[ ! $mem =~ $regex ]]
then
# we couldn't find a valid Xmx value
# java default is usually 1G
mem=1073741824
fi
echo $mem
}
# takes in ps string of cave process, reads Xmx from ini and adds bytes to _totalRunninMem
function addMemOfCave()
{
local inifile
# get ini file from process string
local regex='--launcher.ini\s(.+\.ini)'
if [[ $1 =~ $regex ]]
then
inifile="${BASH_REMATCH[1]}"
else
inifile="/awips2/cave/cave.ini"
fi
let "_totalRunningMem+=$(readMemFromIni "$inifile")"
}
# finds total max memory of running caves in bytes and places it in _totalRunningMem
function getTotalMemOfRunningCaves()
{
_totalRunningMem=0
forEachRunningCave addMemOfCave
}
function deleteOldCaveDiskCaches()
{
local curDir=`pwd`
@ -193,3 +273,28 @@ function deleteOldCaveDiskCaches()
cd $curDir
}
# log the exit status and time to a log file, requires 2 args pid and log file
function logExitStatus()
{
pid=$1
logFile=$2
trap 'kill $pid' SIGHUP SIGINT SIGQUIT SIGTERM
wait $pid
exitCode=$?
curTime=`date --rfc-3339=seconds`
echo Exited at $curTime with an exit status of $exitCode >> $logFile
# If a core file was generated attempt to save it to a better place
coreFile=core.$pid
if [ -f "$coreFile" ]; then
basePath="/data/fxa/cave"
hostName=`hostname -s`
hostPath="$basePath/$hostName/"
mkdir -p $hostPath
if [ -d "$hostPath" ]; then
cp $coreFile $hostPath
fi
fi
}

View file

@ -19,6 +19,10 @@
package com.raytheon.uf.viz.application;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
@ -39,6 +43,7 @@ import com.raytheon.uf.viz.application.component.IStandaloneComponent;
* Apr 18, 2007 chammack Initial Creation.
* Dec 03, 2007 461 bphillip Added persistence of workstation time to localization
* Oct 07, 2008 1433 chammack Added alertviz startup
* Jan 23, 2014 njensen Added shutdown hook and printout
*
* </pre>
*
@ -54,6 +59,7 @@ public class VizApplication implements IApplication {
* @seeorg.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.
* IApplicationContext)
*/
@Override
public Object start(IApplicationContext context) throws Exception {
String appToRun = ProgramArguments.getInstance()
@ -78,6 +84,8 @@ public class VizApplication implements IApplication {
return IApplication.EXIT_OK;
}
addShutdownHook();
return component.startComponent(appToRun);
}
@ -86,6 +94,7 @@ public class VizApplication implements IApplication {
*
* @see org.eclipse.equinox.app.IApplication#stop()
*/
@Override
public void stop() {
}
@ -123,4 +132,29 @@ public class VizApplication implements IApplication {
return standalone;
}
protected void addShutdownHook() {
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
/*
* This may seem pointless but is actually quite helpful to
* confirm how the process exited. If the process is killed by a
* kill command on a terminal, the console output will have this
* message but not the normal safe shutdown output (see
* com.raytheon.uf.viz.core.Activator's stop() and
* VizWorkbenchAdvisor's preShutdown()). In contrast, a
* spontaneous death of the process or force kill will not have
* this printout.
*/
SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
System.out.println(sdf.format(new Date())
+ " VizApplication's runtime shutdown hook triggered");
}
}) {
});
}
}

View file

@ -81,6 +81,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* archive and category directory and
* implementation of compression.
* Oct 08, 2013 2442 rferrel Remove category directory.
* Feb 04, 2013 2270 rferrel Move HDF files to parent's directory.
*
* </pre>
*
@ -89,6 +90,10 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
*/
public class GenerateCaseDlg extends CaveSWTDialog {
/** Extension for HDF files. */
private static final String hdfExt = ".h5";
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(GenerateCaseDlg.class);
@ -539,6 +544,11 @@ public class GenerateCaseDlg extends CaveSWTDialog {
new File(destination, file));
}
} else {
// DR 2270 bump HDF files up a directory.
if (destination.getName().endsWith(hdfExt)) {
destination = new File(destination.getParentFile()
.getParentFile(), destination.getName());
}
FileUtil.copyFile(source, destination);
destination.setLastModified(source.lastModified());
}
@ -652,6 +662,13 @@ public class GenerateCaseDlg extends CaveSWTDialog {
addTarFiles(file.listFiles());
}
} else {
// DR 2270 bump HDF files up a directory.
if (name.endsWith(hdfExt)) {
File destination = new File(file.getParentFile()
.getParentFile(), file.getName());
name = destination.getAbsolutePath().substring(
startRelativePath);
}
TarArchiveEntry entry = new TarArchiveEntry(file, name);
entry.setSize(file.length());
FileInputStream fileStream = null;

View file

@ -106,5 +106,8 @@
<graphicsExtension
class="com.raytheon.uf.viz.core.drawables.ext.GeneralCanvasRenderingExtension">
</graphicsExtension>
<graphicsExtension
class="com.raytheon.uf.viz.core.drawables.ext.colormap.GeneralColormapShadedShapeExtension">
</graphicsExtension>
</extension>
</plugin>

View file

@ -21,10 +21,6 @@
package com.raytheon.uf.viz.core;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@ -52,6 +48,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
* Aug 27, 2013 2295 bkowal Removed the jms server property; added
* jms connection string
* Feb 17, 2014 2812 njensen getHostName() now uses getWsId()'s hostname
*
* </pre>
*
@ -255,45 +252,20 @@ public final class VizApp {
private static String host = null;
/**
* Gets the ip address of the host machine calling the function
* Gets the host name from the WsId of the host machine calling the function
*
* @return
*/
public static synchronized String getHostName() {
if (host == null) {
InetAddress addrToUse = null;
boolean found = false;
try {
Enumeration<NetworkInterface> nis = NetworkInterface
.getNetworkInterfaces();
while (nis.hasMoreElements() && !found) {
NetworkInterface ni = nis.nextElement();
ni.isVirtual();
ni.isUp();
Enumeration<InetAddress> addrs = ni.getInetAddresses();
while (addrs.hasMoreElements() && !found) {
InetAddress addr = addrs.nextElement();
if (addr.isLinkLocalAddress() == false
&& addr.isSiteLocalAddress() == false
&& addr.isLoopbackAddress() == false) {
addrToUse = addr;
found = true;
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
if (addrToUse == null) {
host = getWsId().getHostName();
if (host == null) {
String hostname = System.getenv("HOSTNAME");
if (hostname != null && hostname.trim().length() == 0) {
if (hostname != null && hostname.trim().length() > 0) {
host = hostname;
} else {
host = "localhost";
}
} else {
host = addrToUse.getHostName();
}
}
return host;

View file

@ -19,6 +19,10 @@
**/
package com.raytheon.uf.viz.core.comm;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.comm.IHttpsCredentialsHandler;
import com.raytheon.uf.viz.core.auth.UserController;
@ -34,6 +38,7 @@ import com.raytheon.uf.viz.core.auth.UserController;
* ------------ ---------- ----------- --------------------------
* Mar 04, 2013 1786 mpduff Initial creation.
* Jun 07, 2013 1981 mpduff Save user's username in UserController.
* Feb 10, 2014 2704 njensen Added credentialsFailed()
*
* </pre>
*
@ -59,4 +64,11 @@ public class CaveHttpsCredentialsHandler implements IHttpsCredentialsHandler {
UserController.updateUserData(credentials[0]);
return credentials;
}
@Override
public void credentialsFailed() {
MessageDialog.openError(new Shell(Display.getDefault()),
"Login failed",
"Invalid username and/or password. Please try again.");
}
}

View file

@ -53,6 +53,8 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* Mar 22, 2013 1786 mpduff Changed to use HttpClient for
* connectivity.
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Jan 15, 2014 njensen Added printConnectivityProblems()
* Feb 04, 2014 2704 njensen Check JMS capability, return exceptions with results
*
* </pre>
*
@ -74,9 +76,16 @@ public class ConnectivityManager {
public String server;
public Exception exception;
public ConnectivityResult(boolean hc, String server) {
this(hc, server, null);
}
public ConnectivityResult(boolean hc, String server, Exception e) {
this.hasConnectivity = hc;
this.server = server;
this.exception = e;
}
}
@ -88,8 +97,10 @@ public class ConnectivityManager {
* @return whether quit was selected. TODO: need to return two booleans, one
* for quit and one for connectivity
*/
public static void checkHttpServer(String server, IConnectivityCallback callback) {
public static void checkHttpServer(String server,
IConnectivityCallback callback) {
boolean good = false;
Exception exc = null;
try {
HttpClient client = HttpClient.getInstance();
HttpGet request = new HttpGet();
@ -97,9 +108,9 @@ public class ConnectivityManager {
client.executeRequest(request);
good = true;
} catch (Exception e) {
// ignore
exc = e;
}
callback.connectionChecked(new ConnectivityResult(good, server));
callback.connectionChecked(new ConnectivityResult(good, server, exc));
}
/**
@ -108,14 +119,16 @@ public class ConnectivityManager {
* @param server
* server to check
*/
public static void checkLocalizationServer(String server, IConnectivityCallback callback) {
public static void checkLocalizationServer(String server,
IConnectivityCallback callback) {
boolean good = false;
Exception exc = null;
try {
good = checkLocalizationServer(server, true) != null;
} catch (Exception e) {
// ignore
exc = e;
}
callback.connectionChecked(new ConnectivityResult(good, server));
callback.connectionChecked(new ConnectivityResult(good, server, exc));
}
/**
@ -124,8 +137,8 @@ public class ConnectivityManager {
* result is returned, otherwise the localization server is contacted to get
* the response.
*/
public static GetServersResponse checkLocalizationServer(String server, boolean force)
throws VizException {
public static GetServersResponse checkLocalizationServer(String server,
boolean force) throws VizException {
if (!force) {
GetServersResponse resp = getServersResponseCache.get(server);
if (resp != null) {
@ -133,29 +146,53 @@ public class ConnectivityManager {
}
}
GetServersRequest req = new GetServersRequest();
GetServersResponse resp = (GetServersResponse) ThriftClient.sendRequest(req, server);
GetServersResponse resp = (GetServersResponse) ThriftClient
.sendRequest(req, server);
getServersResponseCache.put(server, resp);
return resp;
}
/**
* Checks the connectivity of the given server
* Checks the connectivity of the given alert service
*
* @param server
* server to check
* @return whether quit was selected. TODO: need to return two booleans, one
* for quit and one for connectivity
*/
public static void checkJmsServer(String server,
public static void checkAlertService(String server,
IConnectivityCallback callback) {
boolean good = true;
Exception exc = null;
try {
ActiveMQConnectionFactory f = new ActiveMQConnectionFactory(server);
f.createConnection().close();
} catch (JMSException e) {
exc = e;
good = false;
}
callback.connectionChecked(new ConnectivityResult(good, server));
callback.connectionChecked(new ConnectivityResult(good, server, exc));
}
/**
* Checks the connectivity of the given JMS server
*
* @param connectionString
* @param callback
*/
public static void checkJmsServer(String connectionString,
IConnectivityCallback callback) {
boolean good = true;
Exception exc = null;
try {
JMSConnection jms = new JMSConnection(connectionString);
jms.getFactory().createConnection().close();
} catch (JMSException e) {
exc = e;
good = false;
}
callback.connectionChecked(new ConnectivityResult(good,
connectionString, exc));
}
}

View file

@ -42,7 +42,8 @@ import org.eclipse.ui.PlatformUI;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 6, 2013 1786 mpduff Initial creation
* Mar 06, 2013 1786 mpduff Initial creation
* Feb 10, 2014 2704 njensen Allow message to expand size of dialog
*
* </pre>
*
@ -50,6 +51,7 @@ import org.eclipse.ui.PlatformUI;
* @version 1.0
*/
public class HttpsLoginDlg extends Dialog {
private static final long serialVersionUID = 1L;
private Shell shell;
@ -76,7 +78,7 @@ public class HttpsLoginDlg extends Dialog {
*/
public HttpsLoginDlg(String message) {
super(new Shell(Display.getDefault(), SWT.TITLE));
this.message = message;
this.message = message.replace("\"", "");
}
/**
@ -112,7 +114,9 @@ public class HttpsLoginDlg extends Dialog {
comp.setLayout(new GridLayout(2, false));
GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 500;
if (message == null || message.length() < 50) {
gd.widthHint = 500;
}
gd.horizontalSpan = 2;
Label authMessage = new Label(comp, SWT.CENTER);

View file

@ -0,0 +1,267 @@
/**
* 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.core.drawables.ext.colormap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.swt.graphics.RGB;
import org.geotools.coverage.grid.GeneralGridGeometry;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IShadedShape;
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension;
import com.raytheon.uf.viz.core.exception.VizException;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryCollection;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.Polygon;
/**
* For targets which cannot optimize support of {@link IColormapShadedShape}
* this will provide an inefficient default that simply generates a shaded shape
* whenever draw is called with new colors.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Jan 23, 2014 2363 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public class GeneralColormapShadedShapeExtension extends
GraphicsExtension<IGraphicsTarget> implements
IColormapShadedShapeExtension {
@Override
public GeneralColormapShadedShape createColormapShadedShape(
GeneralGridGeometry targetGeometry, boolean tesselate) {
return new GeneralColormapShadedShape(targetGeometry, tesselate);
}
@Override
public IShadedShape createShadedShape(IColormapShadedShape baseShape,
Map<Object, RGB> colors) {
GeneralColormapShadedShape generalShape = (GeneralColormapShadedShape) baseShape;
return generalShape.generateShape(target, colors);
}
@Override
public void drawColormapShadedShape(IColormapShadedShape shape,
Map<Object, RGB> colors, float alpha, float brightness)
throws VizException {
if (shape.isDrawable()) {
GeneralColormapShadedShape generalShape = (GeneralColormapShadedShape) shape;
IShadedShape shadedShape = generalShape.getShape(target,
colors);
target.drawShadedShape(shadedShape, alpha, brightness);
}
}
@Override
public int getCompatibilityValue(IGraphicsTarget target) {
return Compatibilty.GENERIC;
}
/**
* Contains all the interesting logic for this extension. Basic
* functionality is to save off the LineStrings for each add operation so
* that a real {@link IShadedShape} can be generated when the colors are
* provided. Also keeps around a shape after rendering for potential reuse
* if the colors don't change.
*/
private static class GeneralColormapShadedShape implements
IColormapShadedShape {
private final GeneralGridGeometry targetGeometry;
private final boolean tesselate;
private List<AddPair> addPairs = new ArrayList<AddPair>();
private Map<Object, RGB> lastColors;
private IShadedShape lastShape;
private GeneralColormapShadedShape(GeneralGridGeometry targetGeometry,
boolean tesselate) {
this.targetGeometry = targetGeometry;
this.tesselate = tesselate;
}
/**
* Get a shaded shape that can be used to render this. This method also
* implements the caching if colors doesn't change.
*
* @param target
* the target be rendered onto.
* @param colors
* the colors to use for the shape
* @return the shape to render.
*/
public IShadedShape getShape(IGraphicsTarget target,
Map<Object, RGB> colors) {
if (!colors.equals(lastColors)) {
if (lastShape != null) {
lastShape.dispose();
}
lastShape = generateShape(target, colors);
lastColors = new HashMap<Object, RGB>(colors);
}
return lastShape;
}
/**
* Generate a new {@link IShadedShape} that renders identically to this.
*
* @param target
* the target be rendered onto.
* @param colors
* the colors to use for the shape
* @return a new shape that will render the same as this shape with
* colors applied.
*/
public IShadedShape generateShape(IGraphicsTarget target,
Map<Object, RGB> colors) {
IShadedShape shape = target.createShadedShape(true, targetGeometry,
tesselate);
for (AddPair pair : addPairs) {
if (pair.pixelSpace) {
shape.addPolygonPixelSpace(pair.lineString,
colors.get(pair.colorKey));
} else {
shape.addPolygon(pair.lineString, colors.get(pair.colorKey));
}
}
return shape;
}
@Override
public void compile() {
if (lastShape != null) {
lastShape.compile();
}
}
@Override
public boolean isMutable() {
if (lastShape != null) {
return lastShape.isMutable();
}
return true;
}
@Override
public boolean isDrawable() {
return !addPairs.isEmpty();
}
@Override
public void dispose() {
if (lastShape != null) {
lastShape.dispose();
lastShape = null;
}
addPairs = new ArrayList<AddPair>();
}
@Override
public void reset() {
lastShape.reset();
lastColors.clear();
addPairs = new ArrayList<AddPair>();
}
@Override
public Collection<Object> getColorKeys() {
Set<Object> keys = new HashSet<Object>(addPairs.size(), 1.0f);
return keys;
}
@Override
public void addPolygon(LineString[] lineString, Object colorKey) {
addPairs.add(new AddPair(lineString, colorKey, false));
if (lastShape != null && lastColors != null) {
lastShape.addPolygon(lineString, lastColors.get(colorKey));
}
}
@Override
public void addPolygonPixelSpace(LineString[] contours, Object colorKey) {
addPairs.add(new AddPair(contours, colorKey, true));
if (lastShape != null && lastColors != null) {
lastShape.addPolygonPixelSpace(contours,
lastColors.get(colorKey));
}
}
@Override
public void addGeometry(Geometry geometry, Object colorKey) {
if (geometry instanceof GeometryCollection) {
GeometryCollection geomCollection = (GeometryCollection) geometry;
for (int i = 0; i < geomCollection.getNumGeometries(); i++) {
addGeometry(geomCollection.getGeometryN(i), colorKey);
}
} else if (geometry instanceof LineString) {
LineString[] lineStrings = { (LineString) geometry };
addPolygon(lineStrings, colorKey);
} else if (geometry instanceof Polygon) {
LineString[] lineStrings = { ((Polygon) geometry)
.getExteriorRing() };
addPolygon(lineStrings, colorKey);
}
}
}
/**
* Simple Object for storing the parameters to any of the add methods on
* {@link IColormapShadedShape}.
*/
private static class AddPair {
public final LineString[] lineString;
public final Object colorKey;
public final boolean pixelSpace;
public AddPair(LineString[] lineString, Object colorKey,
boolean pixelSpace) {
this.lineString = lineString;
this.colorKey = colorKey;
this.pixelSpace = pixelSpace;
}
}
}

View file

@ -19,11 +19,17 @@
**/
package com.raytheon.uf.viz.core.localization;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.net.UnknownHostException;
import java.util.regex.Pattern;
import org.apache.http.conn.HttpHostConnectException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.VerifyEvent;
@ -41,6 +47,8 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.comm.HttpServerException;
import com.raytheon.uf.common.comm.InvalidURIException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -58,6 +66,9 @@ import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
* ------------ ---------- ----------- --------------------------
* Aug 05, 2009 mschenke Initial creation
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Feb 04, 2014 2704 njensen Shifted some private fields/methods to protected,
* Added status and details, better site validation
* Feb 17, 2014 2704 njensen Changed some alertviz fields to protected
*
* </pre>
*
@ -66,16 +77,23 @@ import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
*/
public class ConnectivityPreferenceDialog extends Dialog {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ConnectivityPreferenceDialog.class, "CAVE");
protected static final Pattern VALID_SITENAME = Pattern
.compile("^[A-Za-z0-9._-]+$");
private class LocalizationCallback implements IConnectivityCallback {
@Override
public void connectionChecked(ConnectivityResult results) {
localizationGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
private class AlertVizCallback implements IConnectivityCallback {
@ -83,31 +101,32 @@ public class ConnectivityPreferenceDialog extends Dialog {
@Override
public void connectionChecked(ConnectivityResult results) {
alertVizGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
/**
* Set time dialog shell
*/
private Shell shell;
/**
* Display component
*/
private Display display;
protected Display display;
private Label localizationLabel;
private Text localizationText;
protected Text localizationText;
private String localization = "";
private boolean localizationGood = false;
private Text alertVizText;
protected Text alertVizText;
private String alertVizServer = null;
protected String alertVizServer = null;
private boolean alertVizGood = true;
@ -115,10 +134,16 @@ public class ConnectivityPreferenceDialog extends Dialog {
private String site = "";
private Text siteText;
protected Text siteText;
private Label statusLabel;
private boolean canceled = false;
private Composite detailsComp;
private StyledText detailsText;
private IConnectivityCallback localizationCallback = new LocalizationCallback();
private IConnectivityCallback alertCallback = new AlertVizCallback();
@ -126,14 +151,20 @@ public class ConnectivityPreferenceDialog extends Dialog {
/**
* Title of the dialog.
*/
private static final String dialogTitle = "Connectivity Preferences";
private String title;
public ConnectivityPreferenceDialog(boolean checkAlertViz) {
this(new Shell(Display.getDefault()), checkAlertViz);
protected String status;
protected String details;
public ConnectivityPreferenceDialog(boolean checkAlertViz, String title) {
this(new Shell(Display.getDefault()), checkAlertViz, title);
}
public ConnectivityPreferenceDialog(Shell parentShell, boolean checkAlertViz) {
public ConnectivityPreferenceDialog(Shell parentShell,
boolean checkAlertViz, String title) {
super(parentShell);
this.title = title;
localization = LocalizationManager.getInstance()
.getLocalizationServer();
site = LocalizationManager.getInstance().getSite();
@ -155,8 +186,8 @@ public class ConnectivityPreferenceDialog extends Dialog {
if (!validate()) {
Shell parent = getParent();
display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM);
shell.setText(dialogTitle);
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
shell.setText(title);
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, true);
@ -165,6 +196,9 @@ public class ConnectivityPreferenceDialog extends Dialog {
initializeComponents();
shell.pack();
shell.setMinimumSize(shell.getBounds().width,
shell.getBounds().height);
updateStatus(false, status, details);
shell.open();
while (!shell.isDisposed()) {
@ -177,16 +211,69 @@ public class ConnectivityPreferenceDialog extends Dialog {
}
private void initializeComponents() {
createErrorText();
Composite textBoxComp = new Composite(shell, SWT.NONE);
textBoxComp.setLayout(new GridLayout(2, false));
createTextBoxes(textBoxComp);
createStatusText();
createBottomButtons();
}
private void createErrorText() {
Label label = new Label(shell, SWT.CENTER);
label.setText("Error: Unable to connect to localization server");
/**
* Creates the status label, text, and details button
*/
protected void createStatusText() {
Composite comp = new Composite(shell, SWT.NONE);
comp.setLayout(new GridLayout(3, false));
comp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
Label lbl = new Label(comp, SWT.NONE);
lbl.setText("Status:");
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
statusLabel = new Label(comp, SWT.BORDER);
statusLabel.setLayoutData(gd);
statusLabel.setText("");
final Button detailsButton = new Button(comp, SWT.TOGGLE);
detailsButton.setText("Details");
detailsButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (detailsComp.isVisible()) {
((GridData) detailsComp.getLayoutData()).exclude = true;
detailsComp.setVisible(false);
shell.pack();
} else {
((GridData) detailsComp.getLayoutData()).exclude = false;
((GridData) detailsComp.getLayoutData()).widthHint = detailsComp
.getBounds().width;
detailsComp.setVisible(true);
shell.pack();
}
}
});
createDetailsText();
}
/**
* Creates the expanding details text
*/
protected void createDetailsText() {
detailsComp = new Composite(shell, SWT.NONE);
detailsComp.setLayout(new GridLayout(1, false));
detailsComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = 150;
detailsText = new StyledText(detailsComp, SWT.BORDER | SWT.MULTI
| SWT.H_SCROLL | SWT.V_SCROLL);
detailsText.setText("");
detailsText.setLayoutData(gd);
/*
* Hide the composite
*/
((GridData) detailsComp.getLayoutData()).exclude = true;
detailsComp.setVisible(false);
}
protected void createTextBoxes(Composite textBoxComp) {
@ -194,12 +281,12 @@ public class ConnectivityPreferenceDialog extends Dialog {
localizationLabel = new Label(textBoxComp, SWT.RIGHT);
localizationLabel.setText("Localization Server:");
GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true);
GridData gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150;
localizationLabel.setLayoutData(gd);
localizationText = new Text(textBoxComp, SWT.NONE);
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
localizationText = new Text(textBoxComp, SWT.BORDER);
gd = new GridData(SWT.LEFT, SWT.None, true, true);
gd.widthHint = 300;
localizationText.setLayoutData(gd);
localizationText.setText(localization == null ? "" : localization);
@ -207,17 +294,18 @@ public class ConnectivityPreferenceDialog extends Dialog {
Label label = new Label(textBoxComp, SWT.RIGHT);
label.setText("Site:");
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150;
label.setLayoutData(gd);
siteText = new Text(textBoxComp, SWT.NONE);
siteText = new Text(textBoxComp, SWT.BORDER);
siteText.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
e.text = e.text.toUpperCase();
}
});
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd = new GridData(SWT.LEFT, SWT.None, true, true);
gd.widthHint = 300;
siteText.setLayoutData(gd);
siteText.setText(site == null ? "" : site);
@ -299,7 +387,7 @@ public class ConnectivityPreferenceDialog extends Dialog {
shell.setVisible(false);
MessageDialog
.openError(
null,
shell,
"Connectivity Error",
"Unable to validate localization preferences, please enter valid options or quit the application");
shell.setVisible(true);
@ -327,6 +415,8 @@ public class ConnectivityPreferenceDialog extends Dialog {
}
public boolean validate() {
status = null;
details = null;
if (localizationText != null && !localizationText.isDisposed()
&& localizationText.isEnabled()) {
String localization = localizationText.getText().trim();
@ -360,20 +450,28 @@ public class ConnectivityPreferenceDialog extends Dialog {
} else {
validateSite();
}
return siteGood && localizationGood && alertVizGood;
boolean everythingGood = siteGood && localizationGood && alertVizGood;
updateStatus(everythingGood, status, details);
return everythingGood;
}
private void validateLocalization() {
ConnectivityManager.checkLocalizationServer(localization, localizationCallback);
ConnectivityManager.checkLocalizationServer(localization,
localizationCallback);
}
private void validateAlertviz() {
ConnectivityManager.checkJmsServer(alertVizServer, alertCallback);
protected void validateAlertviz() {
ConnectivityManager.checkAlertService(alertVizServer, alertCallback);
}
private void validateSite() {
if (site == null || site.trim().equals("")) {
protected void validateSite() {
if (site == null || site.trim().length() == 0
|| !VALID_SITENAME.matcher(site).find()) {
siteGood = false;
if (status == null) {
status = "Invalid Site ID";
}
} else {
siteGood = true;
}
@ -387,6 +485,20 @@ public class ConnectivityPreferenceDialog extends Dialog {
}
}
/**
* Gets the color for the status label
*
* @param isGood
* @return
*/
protected Color getForegroundColor(boolean isGood) {
if (isGood) {
return display.getSystemColor(SWT.COLOR_DARK_GREEN);
} else {
return display.getSystemColor(SWT.COLOR_DARK_RED);
}
}
public String getLocalization() {
return localization;
}
@ -438,4 +550,118 @@ public class ConnectivityPreferenceDialog extends Dialog {
localizationText.setEnabled(enabled);
}
}
/**
* Builds a details string based on a stacktrace of connectivity results. If
* there is no exception with the results, this returns the empty string.
*
* @param results
* @return
*/
protected String buildDetails(ConnectivityResult results) {
StringBuilder sb = new StringBuilder();
if (results.exception != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
results.exception.printStackTrace(ps);
String stack = baos.toString();
ps.close();
sb.append(stack);
}
return sb.toString();
}
/**
* Adds new details to the details field without overwriting it
*
* @param newDetails
*/
protected void appendDetails(String newDetails) {
if (details == null) {
details = "";
}
if (details.length() > 0) {
details += "\n\n\n";
}
details += newDetails;
}
/**
* Creates an error message for the status label by attempting to find the
* most relevant error message from the exception's stacktrace.
*
* @param result
* @return
*/
protected String buildErrorMessage(ConnectivityResult result) {
StringBuilder sb = new StringBuilder();
Exception prettyErrExc = result.exception;
/*
* Loop through the Caused Bys and try to find one that is the most
* useful for the label. This is totally arbitrary and corresponds to
* what njensen predicted would be most useful.
*/
while (prettyErrExc != null) {
if (prettyErrExc instanceof HttpHostConnectException
|| prettyErrExc instanceof InvalidURIException) {
sb.append(prettyErrExc.getMessage());
break;
}
if (prettyErrExc instanceof UnknownHostException) {
sb.append("Unknown host: " + prettyErrExc.getMessage());
break;
} else if (prettyErrExc instanceof HttpServerException) {
sb.append("Server returned Error ");
String emsg = prettyErrExc.getMessage();
int titleIndex = emsg.indexOf("<title>");
if (titleIndex > -1) {
String httpMsg = emsg.substring(titleIndex + 7,
emsg.indexOf("</title>"));
sb.append(httpMsg);
} else {
int statusCode = ((HttpServerException) prettyErrExc)
.getStatusCode();
sb.append(statusCode);
break;
}
}
prettyErrExc = (Exception) prettyErrExc.getCause();
}
if (sb.length() == 0) {
if (result.exception != null
&& result.exception.getMessage() != null) {
sb.append(result.exception.getMessage());
} else {
sb.append("Connectivity Error");
}
}
return sb.toString();
}
/**
* Updates the status label and details of the connectivity dialog
*
* @param good
* @param status
* @param details
*/
protected void updateStatus(boolean good, String status, String details) {
if (statusLabel != null && !statusLabel.isDisposed()
&& detailsText != null && !detailsText.isDisposed()) {
statusLabel.setForeground(getForegroundColor(good));
detailsText.setText(details != null ? details : "");
if (good) {
statusLabel.setText("Successful connection");
} else {
if (status != null) {
statusLabel.setText(status);
} else {
// shoudln't be able to reach this but just in case
statusLabel.setText("Connection error");
}
}
}
}
}

View file

@ -52,6 +52,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Aug 27, 2013 2295 bkowal The entire jms connection string is now
* provided by EDEX.
* Feb 04, 2014 2704 njensen Pass connectivity dialog title
*
* </pre>
*
@ -108,7 +109,7 @@ public class LocalizationInitializer {
protected void setupServers() throws VizException {
if (promptUI) {
ConnectivityPreferenceDialog dlg = new ConnectivityPreferenceDialog(
checkAlertviz);
checkAlertviz, "Connectivity Preferences");
if (dlg.open() == true) {
System.exit(0);
}

View file

@ -95,6 +95,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Aug 27, 2013 2295 bkowal The entire jms connection string is now
* provided by EDEX.
* Feb 04, 2014 2704 njensen Allow setting server without saving
*
* </pre>
*
@ -210,19 +211,39 @@ public class LocalizationManager implements IPropertyChangeListener {
}
}
/**
* Sets the localization server and saves the setting
*
* @param currentServer
* the localization URI
*/
public void setCurrentServer(String currentServer) {
setCurrentServer(currentServer, true);
}
/**
* Sets the localization server
*
* @param currentServer
* the localization URI
* @param save
* whether or not to save the setting
*/
public void setCurrentServer(String currentServer, boolean save) {
if (!this.currentServer.equals(currentServer)) {
this.currentServer = currentServer;
if (!overrideServer) {
localizationStore.putValue(
LocalizationConstants.P_LOCALIZATION_HTTP_SERVER,
this.currentServer);
applyChanges();
if (save) {
applyChanges();
}
}
try {
GetServersResponse resp = ConnectivityManager.checkLocalizationServer(
currentServer, false);
GetServersResponse resp = ConnectivityManager
.checkLocalizationServer(currentServer, false);
VizApp.setHttpServer(resp.getHttpServer());
VizApp.setJmsConnectionString(resp.getJmsConnectionString());
VizApp.setPypiesServer(resp.getPypiesServer());

View file

@ -236,7 +236,7 @@ public class LocalizationPreferences extends FieldEditorPreferencePage
if (alertEditor != null) {
text = alertEditor.getTextControl(getFieldEditorParent());
ConnectivityManager.checkJmsServer(text.getText().trim(),
ConnectivityManager.checkAlertService(text.getText().trim(),
new IConnectivityCallback() {
@Override
public void connectionChecked(ConnectivityResult results) {
@ -260,6 +260,7 @@ public class LocalizationPreferences extends FieldEditorPreferencePage
* @see
* org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
@Override
public void init(IWorkbench workbench) {
}

View file

@ -86,7 +86,7 @@ public class LocalizationServerEditor extends StringFieldEditor implements
ConnectivityManager.checkHttpServer(this.getTextControl().getText(),
this);
} else {
ConnectivityManager.checkJmsServer(this.getTextControl().getText(),
ConnectivityManager.checkAlertService(this.getTextControl().getText(),
this);
}
if (!good) {

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.core.reflect;
import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@ -45,6 +46,7 @@ import org.reflections.util.ConfigurationBuilder;
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Oct 21, 2013 2491 bsteffen Initial creation
* Jan 22, 2014 2062 bsteffen Handle bundles with no wiring.
*
* </pre>
*
@ -54,19 +56,28 @@ import org.reflections.util.ConfigurationBuilder;
public class BundleReflections {
private Reflections reflections;
private final Reflections reflections;
public BundleReflections(Bundle bundle, Scanner scanner) throws IOException {
ConfigurationBuilder cb = new ConfigurationBuilder();
BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
cb.addClassLoader(bundleWiring.getClassLoader());
cb.addUrls(FileLocator.getBundleFile(bundle).toURI().toURL());
cb.setScanners(scanner);
reflections = cb.build();
if (bundleWiring != null) {
cb.addClassLoader(bundleWiring.getClassLoader());
cb.addUrls(FileLocator.getBundleFile(bundle).toURI().toURL());
cb.setScanners(scanner);
reflections = cb.build();
} else {
reflections = null;
}
}
public <T> Set<Class<? extends T>> getSubTypesOf(final Class<T> type) {
return reflections.getSubTypesOf(type);
if (reflections == null) {
return Collections.emptySet();
} else {
return reflections.getSubTypesOf(type);
}
}
public Set<Class<?>> getSubTypesOf(Class<?>... types) {

View file

@ -20,19 +20,18 @@
package com.raytheon.uf.viz.core.reflect;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.osgi.framework.namespace.BundleNamespace;
import org.osgi.framework.namespace.PackageNamespace;
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;
import org.reflections.scanners.SubTypesScanner;
@ -56,6 +55,7 @@ import com.raytheon.uf.viz.core.Activator;
* Oct 18, 2013 2491 bsteffen Initial creation
* Dec 10, 2013 2602 bsteffen Add null checks to detect unloaded
* bundles.
* Feb 03, 2013 2764 bsteffen Use OSGi API to get dependencies.
*
* </pre>
*
@ -68,15 +68,11 @@ public class SubClassLocator implements ISubClassLocator {
private static final String CACHE_FILENAME = "subclassCache.txt";
private static final Pattern COMMA_SPLIT = Pattern.compile("[,]");
private static final Pattern SEMICOLON_SPLIT = Pattern.compile("[;]");
private final Map<String, BundleReflections> reflectionLookup = new HashMap<String, BundleReflections>();
private final Map<String, Bundle> bundleLookup = new HashMap<String, Bundle>();
private final Map<String, List<Bundle>> requiredBundles = new HashMap<String, List<Bundle>>();
private final Map<String, Collection<Bundle>> requiredBundles = new HashMap<String, Collection<Bundle>>();
private final BundleClassCache cache;
@ -146,6 +142,14 @@ public class SubClassLocator implements ISubClassLocator {
return Collections.emptySet();
}
if (bundle.getState() == Bundle.UNINSTALLED) {
/*
* We won't be able to get a class loader for uninstalled bundles so
* don't process them.
*/
return Collections.emptySet();
}
if (includeRequiredSubclasses) {
/* Short circut if we already did this. */
Set<Class<?>> result = recursiveClasses.get(bundleName);
@ -159,7 +163,8 @@ public class SubClassLocator implements ISubClassLocator {
Set<Class<?>> dependencies = getRequiredSubclasses(base, bundle,
recursiveClasses);
/* Must pass dependencies in so type heirarchy is complete. */
Set<Class<?>> owned = loadSubClassesReflectively(bundle, dependencies);
Set<Class<?>> owned = loadSubClassesReflectively(bundle,
dependencies);
/* populate the cache */
ownedNames = new String[owned.size()];
int index = 0;
@ -180,8 +185,7 @@ public class SubClassLocator implements ISubClassLocator {
Arrays.asList(ownedNames));
if (includeRequiredSubclasses) {
Set<Class<?>> dependencies = getRequiredSubclasses(base,
bundle,
recursiveClasses);
bundle, recursiveClasses);
Set<Class<?>> all = new HashSet<Class<?>>(dependencies);
all.addAll(owned);
recursiveClasses.put(bundleName, all);
@ -279,31 +283,32 @@ public class SubClassLocator implements ISubClassLocator {
}
/**
* Parse bundle header to get all required bundles
* Get back all the bundles this bundle depends on.
*
* @param bundle
* the bundle
* @return bundles required by bundle.
*/
private List<Bundle> getRequiredBundles(Bundle bundle) {
private Collection<Bundle> getRequiredBundles(Bundle bundle) {
String bundleName = bundle.getSymbolicName();
List<Bundle> required = requiredBundles.get(bundle);
Collection<Bundle> required = requiredBundles.get(bundleName);
if (required == null) {
required = new ArrayList<Bundle>();
String requiredBundlesHeader = bundle.getHeaders().get(
Constants.REQUIRE_BUNDLE);
if (requiredBundlesHeader != null) {
String[] requiredBundles = COMMA_SPLIT
.split(requiredBundlesHeader);
for (String requiredBundleName : requiredBundles) {
String[] nameParts = SEMICOLON_SPLIT
.split(requiredBundleName);
Bundle reqBundle = bundleLookup.get(nameParts[0]);
if (reqBundle != null) {
required.add(reqBundle);
}
required = new HashSet<Bundle>();
BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
if (bundleWiring != null) {
/* Get Required bundles */
for (BundleWire bw : bundleWiring
.getRequiredWires(BundleNamespace.BUNDLE_NAMESPACE)) {
required.add(bw.getProviderWiring().getBundle());
}
/* Get Bundles through import package */
for (BundleWire bw : bundleWiring
.getRequiredWires(PackageNamespace.PACKAGE_NAMESPACE)) {
required.add(bw.getProviderWiring().getBundle());
}
}
/* Avoid recursion */
required.remove(bundle);
requiredBundles.put(bundleName, required);
}

View file

@ -36,6 +36,7 @@ import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.geospatial.CRSCache;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -63,14 +64,17 @@ import com.vividsolutions.jts.geom.Coordinate;
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 8, 2012 mschenke Initial creation
* May 28, 2013 2037 njensen Made imageMap concurrent to fix leak
* Jun 20, 2013 2122 mschenke Fixed null pointer in interrogate and made
* canceling jobs safer
* Oct 16, 2013 2333 mschenke Added auto NaN checking for interrogation
* Nov 14, 2013 2492 mschenke Added more interrogate methods that take units
* Date Ticket# Engineer Description
* ------------- -------- ----------- -----------------------------------------
* Aug 08, 2012 mschenke Initial creation
* May 28, 2013 2037 njensen Made imageMap concurrent to fix leak
* Jun 20, 2013 2122 mschenke Fixed null pointer in interrogate and
* made canceling jobs safer
* Oct 16, 2013 2333 mschenke Added auto NaN checking for interrogation
* Nov 14, 2013 2492 mschenke Added more interrogate methods that take
* units
* Feb 07, 2014 2211 bsteffen Fix sampling units when data mapping is
* enabled.
*
* </pre>
*
@ -539,55 +543,65 @@ public class TileSetRenderable implements IRenderable {
public double interrogate(Coordinate coordinate, Unit<?> resultUnit,
double nanValue) throws VizException {
double dataValue = Double.NaN;
TileLevel level = tileSet.getTileLevel(lastPaintedLevel);
double[] grid = null;
try {
double[] local = new double[2];
llToLocalProj
.transform(new double[] { coordinate.x, coordinate.y }, 0,
local, 0, 1);
double localX = local[0];
double localY = local[1];
TileLevel level = tileSet.getTileLevel(lastPaintedLevel);
double[] grid = level.crsToGrid(localX, localY);
Tile tile = level.getTile(grid[0], grid[1]);
if (tile != null) {
DrawableImage di = imageMap.get(tile);
if (di != null) {
IImage image = di.getImage();
if (image instanceof IColormappedImage) {
IColormappedImage cmapImage = (IColormappedImage) image;
dataValue = cmapImage.getValue(
(int) grid[0] % tileSize, (int) grid[1]
% tileSize);
if (dataValue == nanValue) {
dataValue = Double.NaN;
} else {
Unit<?> dataUnit = cmapImage.getDataUnit();
if (resultUnit != null && dataUnit != null
&& dataUnit.equals(resultUnit) == false) {
if (resultUnit.isCompatible(dataUnit)) {
dataValue = dataUnit.getConverterTo(
resultUnit).convert(dataValue);
} else {
throw new IllegalArgumentException(
"Unable to interrogate tile set. "
+ String.format(
"Desired unit (%s) is not compatible with data unit (%s).",
UnitFormat
.getUCUMInstance()
.format(resultUnit),
UnitFormat
.getUCUMInstance()
.format(dataUnit)));
}
}
}
}
}
}
grid = level.crsToGrid(local[0], local[1]);
} catch (TransformException e) {
throw new VizException("Error interrogating ", e);
}
IColormappedImage cmapImage = null;
Tile tile = level.getTile(grid[0], grid[1]);
if (tile != null) {
DrawableImage di = imageMap.get(tile);
if (di != null) {
IImage image = di.getImage();
if (image instanceof IColormappedImage) {
cmapImage = (IColormappedImage) image;
}
}
}
if (cmapImage != null) {
dataValue = cmapImage.getValue((int) grid[0] % tileSize,
(int) grid[1] % tileSize);
if (dataValue == nanValue) {
dataValue = Double.NaN;
} else {
ColorMapParameters parameters = cmapImage
.getColorMapParameters();
Unit<?> dataUnit = cmapImage.getDataUnit();
if (parameters.getDataMapping() != null) {
/*
* Ignore dataUnit, use colorMapUnit which is derived from
* the data mapping
*/
dataUnit = parameters.getColorMapUnit();
}
if (resultUnit != null && dataUnit != null
&& dataUnit.equals(resultUnit) == false) {
if (resultUnit.isCompatible(dataUnit)) {
dataValue = dataUnit.getConverterTo(resultUnit)
.convert(dataValue);
} else {
UnitFormat uf = UnitFormat.getUCUMInstance();
String message = String
.format("Unable to interrogate tile set. Desired unit (%s) is not compatible with data unit (%s).",
uf.format(resultUnit),
uf.format(dataUnit));
throw new IllegalArgumentException(message);
}
}
}
}
return dataValue;
}
}

View file

@ -10,7 +10,7 @@
</crossSectionAdapter>
<crossSectionAdapter
adapter="com.raytheon.uf.viz.d2d.xy.adapters.crosssection.PointCSAdapter"
class="com.raytheon.edex.plugin.modelsounding.common.SoundingSite"
class="com.raytheon.uf.common.dataplugin.modelsounding.SoundingSite"
name="Model Sounding Cross Section Adapter">
</crossSectionAdapter>
<crossSectionAdapter
@ -119,7 +119,7 @@
</timeSeriesAdapter>
<timeSeriesAdapter
adapter="com.raytheon.uf.viz.d2d.xy.adapters.timeseries.PointDataTimeSeriesAdapter"
class="com.raytheon.edex.plugin.modelsounding.common.SoundingSite"
class="com.raytheon.uf.common.dataplugin.modelsounding.SoundingSite"
name="Model Sounding Time Series Adapter">
</timeSeriesAdapter>
</extension>
@ -175,7 +175,7 @@
</varHeightAdapter>
<varHeightAdapter
adapter="com.raytheon.uf.viz.d2d.xy.adapters.varheight.PointDataVarHeightAdapter"
class="com.raytheon.edex.plugin.modelsounding.common.SoundingSite"
class="com.raytheon.uf.common.dataplugin.modelsounding.SoundingSite"
name="Model Sounding Var Height Adapter">
</varHeightAdapter>
</extension>

View file

@ -18,6 +18,12 @@
<property name="registryHandler" ref="registryHandler" />
</bean>
</constructor-arg>
<constructor-arg>
<bean
class="com.raytheon.uf.common.datadelivery.registry.handlers.AdhocSubscriptionHandler">
<property name="registryHandler" ref="registryHandler" />
</bean>
</constructor-arg>
</bean>
<bean name="PendingSubscriptionHandler"

View file

@ -33,7 +33,6 @@ import com.raytheon.uf.common.datadelivery.registry.Coverage;
import com.raytheon.uf.common.datadelivery.registry.DataType;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionType;
import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
import com.raytheon.uf.common.datadelivery.registry.handlers.IAdhocSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
@ -44,11 +43,11 @@ 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.BinOffset;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.uf.viz.productbrowser.AbstractRequestableProductBrowserDataDefinition;
import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel;
import com.raytheon.uf.viz.productbrowser.ProductBrowserPreference;
@ -74,6 +73,8 @@ import com.raytheon.viz.pointdata.util.PointDataInventory;
* Oct 13, 2013 2460 dhladky Added display of Adhoc subscriptions
* Nov 19, 2013 2458 mpduff Only pull subscriptions for the local site
* Nov 21, 2013 2554 dhladky Restored ADHOC's to working.
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
@ -403,7 +404,7 @@ public class DataDeliveryProductBrowserDataDefinition
List<Subscription> subList = getSubscriptions();
for (Subscription s : subList) {
if (SubscriptionStatus.ACTIVE.toString().equals(s.getStatus())
if (s.isActive()
|| s.getSubscriptionType().equals(SubscriptionType.QUERY)) {
if (s.getDataSetType() == dataType) {
activeSubList.add(s);
@ -439,8 +440,8 @@ public class DataDeliveryProductBrowserDataDefinition
final ISubscriptionHandler handler = RegistryObjectHandlers
.get(ISubscriptionHandler.class);
try {
subList = handler.getByFilters(null, LocalizationManager
.getInstance().getCurrentSite());
subList = handler.getByFilters(null,
DataDeliveryUtils.getDataDeliveryId());
} catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}

View file

@ -26,7 +26,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.datadelivery.bandwidth.ui.BandwidthUtilizationDlg;
import com.raytheon.uf.viz.datadelivery.bandwidth.ui.GraphDataUtil;
/**
* Action handler for the bandwidth scheduling graph.
@ -40,6 +39,7 @@ import com.raytheon.uf.viz.datadelivery.bandwidth.ui.GraphDataUtil;
* Nov 25, 2012 1269 mpduff Initial creation.
* Dec 13, 2012 1269 lvenable Updated to use a graph utility for the graph data.
* Oct 28, 2013 2430 mpduff Removed redraw if already open.
* Jan 29, 2014 2722 mpduff Don't get graph data up front.
*
* </pre>
*
@ -58,11 +58,9 @@ public class BandwidthScheduleGraphAction extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
if (dlg == null || dlg.isDisposed()) {
GraphDataUtil gdu = new GraphDataUtil(null);
gdu.retrieveData();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
dlg = new BandwidthUtilizationDlg(shell, gdu);
dlg = new BandwidthUtilizationDlg(shell);
dlg.open();
} else {
dlg.open();

View file

@ -31,11 +31,11 @@ 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.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionManagerFilter;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerDlg;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
/**
* Subscription Manager Dialog Action class.
@ -49,8 +49,9 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters;
* Jan 10, 2012 mpduff Initial creation
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}.
* May 28, 2013 1650 djohnson Allow using filters for the Subscription Manager Dialog.
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
* Sep 04, 2013 2330 bgonzale execute now filters subscriptions by current site id.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
*
* </pre>
@ -81,7 +82,7 @@ public class SubscriptionManagerAction extends AbstractHandler {
@Override
public Object execute(ExecutionEvent arg0) {
return loadSubscriptionManager(SubscriptionManagerFilters
.getBySiteId(LocalizationManager.getInstance().getCurrentSite()));
.getBySiteId(DataDeliveryUtils.getDataDeliveryId()));
}
/**

View file

@ -102,7 +102,9 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Oct 28, 2013 2430 mpduff Add % of bandwidth utilized graph.
* Nov 19, 2013 1531 mpduff Made graph resizable.
* Nov 25, 2013 2545 mpduff Default to Opsnet if Network not available yet.
* Dec 17, 2013 2633 mpduff Fix redraw problems.
* Dec 17, 2013 2633 mpduff Fix redraw problems..
* Jan 09, 2014 2633 mpduff On resize keep graph at bottom so data are always visible.
* Jan 29, 2014 2722 mpduff Changed how graph data are requested.
* </pre>
*
* @author lvenable
@ -249,13 +251,13 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
* @param graphDataUtil
* Bandwidth graph data object
*/
public BandwidthCanvasComp(Composite parentComp, GraphDataUtil graphDataUtil) {
public BandwidthCanvasComp(Composite parentComp) {
super(parentComp, SWT.BORDER);
this.parentComp = parentComp;
this.display = this.parentComp.getDisplay();
this.graphDataUtil = graphDataUtil;
this.bgd = this.graphDataUtil.getGraphData(false);
this.graphDataUtil = new GraphDataUtil(this);
this.bgd = this.graphDataUtil.getGraphData();
init();
}
@ -264,7 +266,6 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
* Initialize method.
*/
private void init() {
this.graphDataUtil.setDataUpdateCallback(this);
NotificationManagerJob.addObserver("notify.msg", this);
this.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
@ -1408,7 +1409,7 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
* @param graphData
* Bandwidth graph data.
*/
public void setGraphData(BandwidthGraphData graphData) {
private void setGraphData(BandwidthGraphData graphData) {
this.bgd = graphData;
generateCanvasSettings();
@ -1479,6 +1480,9 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
cornerPointOffset.y = 0;
}
cornerPointOffset.y = (graphCanvasSettings.getImageHeight() - graphCanvasSettings
.getCanvasHeight()) * -1;
verticalSlider.setSelection(cornerPointOffset.y * -1);
horizontalSlider.setSelection(cornerPointOffset.x * -1);
@ -1523,14 +1527,15 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
// Do a full update every 10 minutes
if (fullUpdateMinuteCount > 10) {
graphDataUtil.requestGraphDataUsingThread();
fullUpdateMinuteCount = 0;
}
}
}
}
/**
* This method will update the subscription table with any updates,
* deletions, or new subscriptions.
* This method will update the graph with any updates, deletions, or new
* subscriptions.
*/
@Override
public void notificationArrived(NotificationMessage[] messages) {
@ -1555,7 +1560,7 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
VizApp.runAsync(new Runnable() {
@Override
public void run() {
setGraphData(graphDataUtil.getGraphData(true));
setGraphData(graphDataUtil.getGraphData());
updateCanvasSettings();
updateCanvases();
layout();

View file

@ -53,6 +53,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Dec 13, 2012 1269 lvenable Fixes and updates.
* Oct 28, 2013 2430 mpduff Add % of bandwidth utilized graph.
* Nov 19, 2013 1531 mpduff Made resizable.
* Jan 29, 2014 2722 mpduff GraphDataUtil not in this class.
*
* </pre>
*
@ -77,9 +78,6 @@ public class BandwidthUtilizationDlg extends CaveSWTDialog {
/** Graph composite */
private BandwidthCanvasComp canvasComp;
/** Graph data utility class */
private final GraphDataUtil graphDataUtil;
private MenuItem displayOpsNetMI;
private MenuItem displaySbnMI;
@ -92,12 +90,10 @@ public class BandwidthUtilizationDlg extends CaveSWTDialog {
* @param graphDataUtil
* Graph data utility object
*/
public BandwidthUtilizationDlg(Shell parent, GraphDataUtil graphDataUtil) {
public BandwidthUtilizationDlg(Shell parent) {
super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE, CAVE.DO_NOT_BLOCK
| CAVE.INDEPENDENT_SHELL);
setText("Bandwidth Utilization");
this.graphDataUtil = graphDataUtil;
}
/**
@ -133,7 +129,7 @@ public class BandwidthUtilizationDlg extends CaveSWTDialog {
mainComp.setLayout(gl);
mainComp.setLayoutData(gd);
canvasComp = new BandwidthCanvasComp(mainComp, graphDataUtil);
canvasComp = new BandwidthCanvasComp(mainComp);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gl = new GridLayout(1, false);

View file

@ -46,6 +46,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Dec 12, 2012 1269 lvenable Initial creation
* Feb 14, 2013 1596 djohnson Remove sysouts, correct statusHandler class, handle null response.
* Mar 26, 2013 1827 djohnson Graph data should be requested from data delivery.
* Jan 29, 2014 2722 mpduff Callback is now passed in.
*
* </pre>
*
@ -67,7 +68,7 @@ public class GraphDataUtil implements Runnable {
private BandwidthGraphData graphData;
/** Callback called when the data has been updated */
private IDataUpdated dataUpdatedCB;
private final IDataUpdated dataUpdatedCB;
/** Executor service used for the threaded data retrieval */
private final ExecutorService service = Executors.newSingleThreadExecutor();
@ -83,21 +84,10 @@ public class GraphDataUtil implements Runnable {
this.dataUpdatedCB = dataUpdatedCB;
}
/**
* Set the updated data callback.
*
* @param dataUpdatedCB
* Call back called when the data has been updated via separate
* thread.
*/
public void setDataUpdateCallback(IDataUpdated dataUpdatedCB) {
this.dataUpdatedCB = dataUpdatedCB;
}
/**
* Perform a data retrieval on the UI thread.
*/
public void retrieveData() {
private void retrieveData() {
response = sendRequest(request);
if (response != null) {
@ -115,10 +105,11 @@ public class GraphDataUtil implements Runnable {
* returning the data.
* @return Bandwidth graph data.
*/
public BandwidthGraphData getGraphData(boolean newData) {
if (newData || graphData == null) {
public BandwidthGraphData getGraphData() {
if (graphData == null) {
retrieveData();
}
return graphData;
}

View file

@ -48,7 +48,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.datadelivery.common.ui.IDialogClosed;
import com.raytheon.uf.viz.datadelivery.common.ui.SortImages.SortDirection;
@ -57,6 +56,7 @@ import com.raytheon.uf.viz.datadelivery.common.ui.TableComp;
import com.raytheon.uf.viz.datadelivery.common.ui.TableCompConfig;
import com.raytheon.uf.viz.datadelivery.common.ui.TableDataManager;
import com.raytheon.uf.viz.datadelivery.common.ui.ViewDetailsDlg;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.BrowserColumnNames;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
@ -85,6 +85,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Feb 15, 2013 1638 mschenke Moved Util.EOL into FileUtil
* Apr 10, 2013 1891 djohnson Declare variable as List.
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
@ -627,7 +628,7 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
try {
datasetNames = DataDeliveryHandlers.getSubscriptionHandler()
.getSubscribedToDataSetNames(
LocalizationManager.getInstance().getCurrentSite());
DataDeliveryUtils.getDataDeliveryId());
} catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to retrieve subscription dataset names!", e);

View file

@ -93,6 +93,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jul 12, 2013 2141 mpduff Valid envelope test happens as needed instead of when changes are made.
* Oct 10, 2013 2104 mschenke Switched to use MapScalesManager
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Jan 10, 2014 2452 mpduff Add label stating all lat/lons will be converted to easting.
* Jan 25, 2014 2452 mpduff Changed label based on feedback.
*
* </pre>
*
@ -396,11 +398,17 @@ public class AreaComp extends Composite implements ISubset {
});
gd = new GridData();
gd.horizontalSpan = 3;
gd.horizontalSpan = 2;
manualLbl = new Label(regionComp, SWT.LEFT);
manualLbl.setText("Manual Lat/Lon Edit");
manualLbl.setLayoutData(gd);
gd = new GridData();
gd.horizontalSpan = 1;
Label l = new Label(regionComp, SWT.LEFT);
l.setText("Lat/Lon values will be in the format of the data set.");
l.setLayoutData(gd);
/*
* Predefined controls.
*/

View file

@ -19,6 +19,10 @@
**/
package com.raytheon.uf.viz.datadelivery.common.ui;
import java.util.List;
import com.raytheon.uf.viz.datadelivery.notification.NotificationRowData;
/**
* Table find interface.
*
@ -30,6 +34,7 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
* ------------ ---------- ----------- --------------------------
* May 7, 2012 jpiatt Initial creation.
* Sep 26, 2013 2417 mpduff Add clearSelection method.
* Feb 07, 2014 2453 mpduff Added getCurrentSelectionIndex method.
* </pre>
*
* @author jpiatt
@ -38,26 +43,34 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
public interface ITableFind {
/**
* handleFind call
* handle page selection
*/
void handlePageSelection();
/**
* handleFind call
* select a row
*
* @param index
*/
void selectIndex(int index);
void selectRow(NotificationRowData row);
/**
* handleFind call
* handle multiple rows
*
* @param indices
*/
void selectIndices(int[] indices);
void selectRows(List<NotificationRowData> rows);
/**
* Clear any table selections.
*/
void clearSelections();
/**
* Get the currently selected index within the data array, not the visible
* table.
*
* @return
*/
int getCurrentSelectionIndex();
}

View file

@ -29,7 +29,8 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 06, 2012 lvenable Initial creation
* Apr 10, 2013 1891 djohnson Declare variable as List.
* Apr 10, 2013 1891 djohnson Declare variable as List.
* Feb 07, 2014 2453 mpduff Added getSize().
*
* </pre>
*
@ -132,8 +133,7 @@ public class TableDataManager<T extends ITableData<T>> implements ISortTable {
public T getDataRow(int index) {
if (index >= 0 && index < tableData.size()) {
return tableData.get(index);
}
else {
} else {
return tableData.get(0);
}
}
@ -187,4 +187,13 @@ public class TableDataManager<T extends ITableData<T>> implements ISortTable {
public SortDirection getSortDirection() {
return currentSortDirection;
}
/**
* Get the size of the data array.
*
* @return The size
*/
public int getSize() {
return this.tableData.size();
}
}

View file

@ -97,6 +97,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
* May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
* Jun 13, 2013 2108 mpduff Refactored DataSizeUtils.
* Oct 28, 2013 2292 mpduff Change overlap services.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* </pre>
*
* @author jpiatt
@ -410,8 +411,7 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay,
subscription.setCoverage(cov);
}
subscription.addOfficeID(LocalizationManager.getInstance()
.getCurrentSite());
subscription.addOfficeID(DataDeliveryUtils.getDataDeliveryId());
if (sizeUtils != null) {
subscription.setDataSetSize(sizeUtils
.getDataSetSizeInKb(subscription));

View file

@ -21,7 +21,11 @@ package com.raytheon.uf.viz.datadelivery.handlers;
import java.util.List;
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionDeleteRequest;
import com.raytheon.uf.common.datadelivery.registry.handlers.IAdhocSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISharedSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISiteSubscriptionHandler;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
@ -46,6 +50,7 @@ import com.raytheon.uf.common.serialization.comm.RequestRouter;
* Mar 29, 2013 1841 djohnson Composes a userSubscriptionsHandler.
* Apr 05, 2013 1841 djohnson Add shared subscription support.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* Jan 20, 2014 2538 mpduff Added the doesNameExist method.
*
* </pre>
*
@ -62,8 +67,10 @@ public class VizSubscriptionHandler extends SubscriptionHandler {
*/
public VizSubscriptionHandler(
ISiteSubscriptionHandler siteSubscriptionHandler,
ISharedSubscriptionHandler sharedSubscriptionHandler) {
super(siteSubscriptionHandler, sharedSubscriptionHandler);
ISharedSubscriptionHandler sharedSubscriptionHandler,
IAdhocSubscriptionHandler adhocSubscriptionHandler) {
super(siteSubscriptionHandler, sharedSubscriptionHandler,
adhocSubscriptionHandler);
}
/**
@ -72,7 +79,7 @@ public class VizSubscriptionHandler extends SubscriptionHandler {
@Override
public void deleteByIds(String username, List<String> ids)
throws RegistryHandlerException {
SubscriptionDeleteRequest request = new SubscriptionDeleteRequest(ids,
ISubscriptionHandler.class, username);
@ -85,4 +92,40 @@ public class VizSubscriptionHandler extends SubscriptionHandler {
}
}
/**
* Does the name exist for the provided type of subscription?
*
* @param name
* The subscription name to check
* @param clazzes
* List of subscription types
* @return true if the name exists for any of the provided types
* @throws RegistryHandlerException
*/
public boolean doesNameExist(String name, Class... clazzes)
throws RegistryHandlerException {
boolean found = false;
for (Class<?> clazz : clazzes) {
if (found) {
return true;
}
if (clazz == SiteSubscription.class) {
found = getSiteSubscriptionHandler().getByName(name) != null;
continue;
}
if (!found && clazz == SharedSubscription.class) {
found = getSharedSubscriptionHandler().getByName(name) != null;
continue;
}
if (!found && clazz == AdhocSubscription.class) {
found = getAdhocSubscriptionHandler().getByName(name) != null;
continue;
}
}
return found;
}
}

View file

@ -20,21 +20,18 @@
package com.raytheon.uf.viz.datadelivery.notification;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
@ -59,6 +56,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Dec 12. 2012 1418 mpduff Change label.
* Aug 30, 2013 2314 mpduff Fixed find, filter, and various other bugs.
* Sep 26, 2013 2417 mpduff Reset the highlight all indices on close.
* Feb 07, 2014 2453 mpduff Refactored dialog.
*
* </pre>
*
@ -95,41 +93,20 @@ public class FindDlg extends CaveSWTDialog {
/** ITableFind callback */
private final ITableFind callback;
/** Table row Index */
int tableIndex = -1;
/** Table row start Index */
int startIndex = 0;
/** Table row end Index */
int endIndex = 0;
/** Table row selected Index */
int selectedIndex = 0;
private int selectedIndex = 0;
/** Message Checkbox flag */
boolean msgFlag = false;
private boolean msgFlag = false;
/** Category Checkbox flag */
boolean categoryFlag = false;
private boolean categoryFlag = false;
/** Case Sensitive flag */
boolean caseFlag = false;
/** Yes continue search flag */
boolean yesFlag = false;
/** Found Item flag */
boolean exists = false;
private boolean caseFlag = false;
/** Exclude search flag */
boolean excludeFlag = false;
/** Message string */
String msg = null;
/** Subscription string */
String sub = null;
private boolean excludeFlag = false;
/**
* Constructor.
@ -150,13 +127,11 @@ public class FindDlg extends CaveSWTDialog {
*/
public FindDlg(Shell parent,
TableDataManager<NotificationRowData> filteredTableList,
int sIndex, int eIndex, int selected, ITableFind callback) {
int selected, ITableFind callback) {
super(parent, SWT.DIALOG_TRIM, CAVE.NONE | CAVE.DO_NOT_BLOCK);
this.setText("Find");
this.filteredTableList = filteredTableList;
sIndex = startIndex;
eIndex = endIndex;
selectedIndex = selected;
this.callback = callback;
}
@ -185,12 +160,6 @@ public class FindDlg extends CaveSWTDialog {
*/
@Override
protected void initializeComponents(Shell shell) {
shell.addListener(SWT.Close, new Listener() {
@Override
public void handleEvent(Event event) {
callback.selectIndices(null);
}
});
createFindLayout();
createBottomButtons();
}
@ -219,12 +188,6 @@ public class FindDlg extends CaveSWTDialog {
findTxt.setLayoutData(gd);
findTxt.selectAll();
findTxt.setLayoutData(gd);
findTxt.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
findText();
}
});
gl = new GridLayout(2, false);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
@ -314,89 +277,16 @@ public class FindDlg extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
callback.selectIndices(null);
close();
}
});
}
/**
* Find text on key release. Check all pages of filtered list. Stop when
* match is found and don't move to the next.
*/
private void findText() {
// Text in the find text box
String text = findTxt.getText();
// Get button selections
msgFlag = msgBtn.getSelection();
categoryFlag = categoryBtn.getSelection();
caseFlag = caseBtn.getSelection();
excludeFlag = exclusionBtn.getSelection();
int itemCount = filteredTableList.getDataArray().size();
tableIndex = 0;
if (filteredTableList != null) {
// Check rows in the entire filtered list - all pages
for (NotificationRowData row : filteredTableList.getDataArray()) {
// Column data
msg = row.getMessage();
sub = row.getCategory();
if (tableIndex <= itemCount) {
tableIndex++;
if (caseFlag) {
if (excludeFlag) {
// Select index if does not match message or
// subscription
if ((!msg.contains(text) && msgFlag)
|| (!sub.contains(text) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
// Select index if matches message or subscription
} else if ((msg.contains(text) && msgFlag)
|| (sub.contains(text) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
} else {
if (excludeFlag) {
// Select index if matches non case sensitive
// message or subscription
if ((!msg.toUpperCase()
.contains(text.toUpperCase()) && msgFlag)
|| (!sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
} else if ((msg.toUpperCase().contains(
text.toUpperCase()) && msgFlag)
|| (sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
}
}
}
}
}
/**
* Find Button action handler. Find the next matching row upon button click.
*/
private void handleFindBtn() {
int prevSelectedIndex = selectedIndex;
// Text in the find text box
String text = findTxt.getText();
@ -420,56 +310,20 @@ public class FindDlg extends CaveSWTDialog {
boolean continueSearch = true;
boolean exists = false;
boolean hitEnd = false;
selectedIndex = selectedIndex + 1;
selectedIndex = callback.getCurrentSelectionIndex() + 1;
while (continueSearch) {
if (tableIndex < itemCount) {
// Get the row data starting at the currently highlighted row
if (selectedIndex < itemCount) {
NotificationRowData row = filteredTableList.getDataArray().get(
tableIndex);
selectedIndex);
// Column data
msg = row.getMessage();
sub = row.getCategory();
tableIndex++;
if (caseFlag) {
if (excludeFlag) {
// Select index if does not match message or
// subscription
if ((!msg.contains(text) && msgFlag)
|| (!sub.contains(text) && categoryFlag)) {
continueSearch = false;
callback.selectIndex(tableIndex);
}
} else if ((msg.contains(text) && msgFlag)
|| (sub.contains(text) && categoryFlag)) {
// Select index if matches message or subscription
continueSearch = false;
callback.selectIndex(tableIndex);
}
} else {
if (excludeFlag) {
// Select index if matches non case sensitive message or
// subscription
if ((!msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (!sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
continueSearch = false;
callback.selectIndex(tableIndex);
}
} else if ((msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (sub.toLowerCase().contains(text.toLowerCase()) && categoryFlag)) {
continueSearch = false;
callback.selectIndex(tableIndex);
}
}
// If the item was found set exists to true
if (!continueSearch) {
boolean matchFound = checkForMatch(text, row);
if (matchFound) {
continueSearch = false;
exists = true;
callback.selectRow(row);
}
selectedIndex++;
} else {
if (!hitEnd) {
int answer = DataDeliveryUtils
@ -480,10 +334,11 @@ public class FindDlg extends CaveSWTDialog {
"The end of the table has been reached. Would you like to search from the beginning of the table?");
if (answer == SWT.NO) {
exists = true;
selectedIndex = prevSelectedIndex;
break;
// Start search over at beginning of table
} else if (answer == SWT.YES) {
tableIndex = 0;
// Start search over at beginning of table
selectedIndex = 0;
continueSearch = true;
}
hitEnd = true;
@ -499,7 +354,7 @@ public class FindDlg extends CaveSWTDialog {
mb.setText("Find Warning");
mb.setMessage("No item matching your search was found.");
mb.open();
tableIndex = 0;
selectedIndex = prevSelectedIndex;
callback.clearSelections();
}
}
@ -509,7 +364,6 @@ public class FindDlg extends CaveSWTDialog {
* text.
*/
private void handleHighlightBtn() {
// Text in the find text box
String text = findTxt.getText();
@ -519,61 +373,54 @@ public class FindDlg extends CaveSWTDialog {
caseFlag = caseBtn.getSelection();
excludeFlag = exclusionBtn.getSelection();
ArrayList<Integer> items = new ArrayList<Integer>();
int[] indices = new int[0];
// Start search at beginning of table
tableIndex = 0;
List<NotificationRowData> items = new ArrayList<NotificationRowData>();
if (filteredTableList != null) {
for (int i = 0; i < filteredTableList.getDataArray().size(); i++) {
for (int i = 0; i < filteredTableList.getSize(); i++) {
NotificationRowData row = filteredTableList.getDataArray().get(
i);
// Message Column
msg = row.getMessage();
// Subscription Name column
sub = row.getCategory();
if (caseFlag) {
if (excludeFlag) {
// Select index if does not match message or
// subscription
if ((!msg.contains(text) && msgFlag)
|| (!sub.contains(text) && categoryFlag)) {
items.add(i);
}
} else if ((msg.contains(text) && msgFlag)
|| (sub.contains(text) && categoryFlag)) {
// Select index if matches message or subscription
items.add(i);
}
} else {
if (excludeFlag) {
// Select index if matches non case sensitive message or
// subscription
if ((!msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (!sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
items.add(i);
}
} else if ((msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (sub.toLowerCase().contains(text.toLowerCase()) && categoryFlag)) {
items.add(i);
}
boolean matchFound = checkForMatch(text, row);
if (matchFound) {
items.add(row);
}
tableIndex++;
}
indices = new int[items.size()];
// Create an int array of the rows to highlight
for (int i = 0; i < items.size(); i++) {
indices[i] = items.get(i);
}
callback.selectIndices(indices);
callback.selectRows(items);
}
}
}
/**
* Check if the matchText matches the row.
*
* @param matchText
* The text to match
* @param row
* The row to check
* @return true if matches
*/
private boolean checkForMatch(String matchText, NotificationRowData row) {
boolean matchFound = false;
String msg = row.getMessage();
String sub = row.getCategory();
if (!caseFlag) {
msg = msg.toUpperCase();
sub = sub.toUpperCase();
matchText = matchText.toUpperCase();
}
if (excludeFlag) {
if ((!msg.contains(matchText) && msgFlag)
|| (!sub.contains(matchText) && categoryFlag)) {
matchFound = true;
}
} else {
if ((msg.contains(matchText) && msgFlag)
|| (sub.contains(matchText) && categoryFlag)) {
matchFound = true;
}
}
return matchFound;
}
}

View file

@ -104,6 +104,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Aug 30, 2013 2314 mpduff Change the reading of the xml. Make load config dlg non-blocking.
* Sep 25, 2013 2408 mpduff Added a restore hidden notifications menu.
* Sep 25, 2013 2410 mpduff Check type of localization file.
* Feb 07, 2013 2453 mpduff Support find dialog refactor..
*
* </pre>
*
@ -394,7 +395,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
hideOlderMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
tableComp.handleDeleteOlderThan();
tableComp.handleHideOlderThan();
}
});
@ -405,7 +406,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
hideMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
tableComp.handleDeleteNotification();
tableComp.handleHideNotification();
}
});
@ -493,7 +494,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
mi.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
tableComp.handleDeleteByPriority((Integer) ((MenuItem) e
tableComp.handleHideByPriority((Integer) ((MenuItem) e
.getSource()).getData());
}
});
@ -572,8 +573,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
private void handleFind() {
if (fnd == null || fnd.isDisposed()) {
fnd = new FindDlg(shell, tableComp.getFilteredTableList(),
tableComp.getStartIndex(), tableComp.getEndIndex(),
tableComp.getSelectedIndex(), tableComp);
tableComp.getTable().getSelectionIndex(), tableComp);
fnd.open();
} else {
fnd.bringToTop();
@ -839,7 +839,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
if (isDisposed() == false && tableComp.passesFilter(records)) {
tableComp.populateTableDataRows(records);
tableComp.populateTable();
tableComp.handlePageSelection();
// update title display......
if (tableComp.isLocked()) {
setText(TITLE_TEXT + tableComp.getPauseCountLabel());

View file

@ -40,6 +40,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Jun 07, 2012 687 lvenable Table data refactor.
* Aug 30, 2013 2314 mpduff Fix formatting.
* Sep 16, 2013 2375 mpduff Change date sort order.
* Feb 07, 2014 2453 mpduff Added toString()
*
* </pre>
*
@ -299,4 +300,8 @@ public class NotificationRowData implements ITableData<NotificationRowData> {
}
}
@Override
public String toString() {
return this.date.toString() + " - " + this.message;
}
}

View file

@ -23,7 +23,6 @@ import java.util.ArrayList;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.Region;
import org.eclipse.swt.widgets.Shell;
@ -58,6 +57,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Oct 10, 2013 2428 skorolev Fixed memory leak for Regions
* Oct 24, 2013 2486 skorolev Fixed an error of editing subset box.
* Nov 06, 2013 2486 skorolev Corrected the regions and zoom handling defects.
* Jan 08, 2014 2643 mpduff Changed the way mouse interactions are handled.
*
* </pre>
*
@ -124,9 +124,6 @@ public class DrawBoxResource extends
/** The x value of the 360 degree longitude line */
private double x360;
/** Map pixel rectangle */
private Rectangle mapRctgl;
/**
* @param resourceData
* @param loadProperties
@ -165,7 +162,7 @@ public class DrawBoxResource extends
double[] lr = descriptor.worldToPixel(new double[] { c2.x, c2.y });
PixelExtent pe = new PixelExtent(ul[0], lr[0], ul[1], lr[1]);
target.drawRect(pe, boxColor, 3, 1);
getMapRectangle();
setCorners();
}
}
@ -190,8 +187,7 @@ public class DrawBoxResource extends
double[] point360 = getResourceContainer().translateInverseClick(c);
this.x360 = Math.round(point360[0]);
getMapRectangle();
setCorners();
}
/*
@ -225,18 +221,17 @@ public class DrawBoxResource extends
@Override
public boolean handleMouseDown(int x, int y, int mouseButton) {
if (mouseButton == 1) {
// handle mouse only in the map space
if (mapRctgl.contains(x, y)) {
// translateClick returns null if point is not in the map space
Coordinate coord = getResourceContainer().translateClick(x, y);
if (coord != null) {
if (!resizingBox) {
x1 = x;
y1 = y;
c1 = getResourceContainer().translateClick(x, y);
if (c1 != null) {
c1.x = spatialUtils.convertToEasting(c1.x);
if (spatialUtils.getLongitudinalShift() > 0
&& x >= x360) {
c1.x += 360;
}
c1 = (Coordinate) coord.clone();
c1.x = spatialUtils.convertToEasting(c1.x);
if (spatialUtils.getLongitudinalShift() > 0
&& x >= x360) {
c1.x += 360;
}
}
}
@ -256,34 +251,31 @@ public class DrawBoxResource extends
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
if (mouseButton == 1) {
drawingBox = true;
// handle mouse only in the map space
if (mapRctgl.contains(x, y)) {
// translateClick returns null if point is not in the map space
Coordinate c = getResourceContainer().translateClick(x, y);
if (c != null) {
if (resizingBox) {
Coordinate c = getResourceContainer().translateClick(x,
y);
if (c != null) {
if (boxSide == 0) {
c1.y = c.y;
y1 = y;
} else if (boxSide == 1) {
c1.x = c.x;
x1 = x;
c1.x = spatialUtils.convertToEasting(c1.x);
if (spatialUtils.getLongitudinalShift() > 0
&& x >= x360) {
c1.x += 360;
}
} else if (boxSide == 2) {
c2.y = c.y;
y2 = y;
} else if (boxSide == 3) {
c2.x = c.x;
x2 = x;
c2.x = spatialUtils.convertToEasting(c2.x);
if (spatialUtils.getLongitudinalShift() > 0
&& x >= x360) {
c2.x += 360;
}
if (boxSide == 0) {
c1.y = c.y;
y1 = y;
} else if (boxSide == 1) {
c1.x = c.x;
x1 = x;
c1.x = spatialUtils.convertToEasting(c1.x);
if (spatialUtils.getLongitudinalShift() > 0
&& x >= x360) {
c1.x += 360;
}
} else if (boxSide == 2) {
c2.y = c.y;
y2 = y;
} else if (boxSide == 3) {
c2.x = c.x;
x2 = x;
c2.x = spatialUtils.convertToEasting(c2.x);
if (spatialUtils.getLongitudinalShift() > 0
&& x >= x360) {
c2.x += 360;
}
}
} else {
@ -298,7 +290,6 @@ public class DrawBoxResource extends
x2 = x;
y2 = y;
}
fireBoxChangedEvent();
target.setNeedsRefresh(true);
}
@ -347,37 +338,34 @@ public class DrawBoxResource extends
@Override
public boolean handleMouseUp(int x, int y, int mouseButton) {
if (mouseButton == 1) {
// handle mouse only in the map space
if (mapRctgl.contains(x, y)) {
// translateClick returns null if point is not in the map space
Coordinate c = getResourceContainer().translateClick(x, y);
if (c != null) {
if (resizingBox) {
Coordinate c = getResourceContainer().translateClick(x,
y);
if (c != null) {
c.x = spatialUtils.convertToEasting(c.x);
if (spatialUtils.getLongitudinalShift() > 0
&& x >= x360) {
c.x += 360;
}
if (boxSide == 0) {
c1.y = c.y;
y1 = y;
} else if (boxSide == 1) {
c1.x = c.x;
x1 = x;
} else if (boxSide == 2) {
c2.y = c.y;
y2 = y;
} else if (boxSide == 3) {
c2.x = c.x;
x2 = x;
}
c.x = spatialUtils.convertToEasting(c.x);
if (spatialUtils.getLongitudinalShift() > 0
&& x >= x360) {
c.x += 360;
}
if (boxSide == 0) {
c1.y = c.y;
y1 = y;
} else if (boxSide == 1) {
c1.x = c.x;
x1 = x;
} else if (boxSide == 2) {
c2.y = c.y;
y2 = y;
} else if (boxSide == 3) {
c2.x = c.x;
x2 = x;
}
} else {
if (drawingBox) {
x2 = x;
y2 = y;
c2 = getResourceContainer().translateClick(x, y);
if (c2 != null) {
c2 = getResourceContainer().translateClick(x, y);
if (c2 != null) {
if (drawingBox) {
x2 = x;
y2 = y;
c2.x = spatialUtils.convertToEasting(c2.x);
if (spatialUtils.getLongitudinalShift() > 0
&& x >= x360) {
@ -388,14 +376,14 @@ public class DrawBoxResource extends
c1 = getResourceContainer().translateClick(x, y);
}
}
createRegions();
target.setNeedsRefresh(true);
fireBoxChangedEvent();
}
createRegions();
target.setNeedsRefresh(true);
fireBoxChangedEvent();
drawingBox = false;
} else if (mouseButton == 2) {
super.handleMouseUp(x, y, 1);
getMapRectangle();
setCorners();
}
return true;
}
@ -554,23 +542,7 @@ public class DrawBoxResource extends
/**
* Get map's rectangle in pixels after changing.
*/
private void getMapRectangle() {
Coordinate top = new Coordinate();
top.x = spatialUtils.getUpperLeft().x;
top.y = spatialUtils.getUpperLeft().y;
double[] pointTop = getResourceContainer().translateInverseClick(top);
int xTop = (int) Math.round(pointTop[0]);
int yTop = (int) Math.round(pointTop[1]);
Coordinate bot = new Coordinate();
bot.x = spatialUtils.getLowerRight().x;
bot.y = spatialUtils.getLowerRight().y;
double[] pointBot = getResourceContainer().translateInverseClick(bot);
int xBottom = (int) Math.round(pointBot[0]);
int yBottom = (int) Math.round(pointBot[1]);
mapRctgl = new Rectangle(xTop, yTop, (xBottom - xTop), (yBottom - yTop));
private void setCorners() {
// Re-calculate regions
if ((c1 != null) && (c2 != null)) {
double[] luBox = getResourceContainer().translateInverseClick(c1);

View file

@ -39,6 +39,8 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceA
* ------------ ---------- ----------- --------------------------
* Dec 4, 2012 1286 djohnson Initial creation
* May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
* Jan 17, 2014 2459 mpduff Change gui usage of unscheduled to deactivated.
* Jan 26, 2014 2459 mpduff Change unscheduled label to deactivated.
*
* </pre>
*
@ -88,10 +90,10 @@ public class CancelForceApplyAndIncreaseLatencyDisplayText implements
if (singleSubscription
&& wouldBeUnscheduledSubscriptions.contains(name)) {
return titleCaseActionText + " " + name
+ " and leave in an unscheduled status";
+ " and leave in a Deactivated status";
}
return titleCaseActionText + " " + name
+ " and unschedule the others";
+ " and deactivate the others";
case EDIT_SUBSCRIPTIONS:
return "Edit the "
+ ((singleSubscription) ? "subscription" : "subscriptions");

View file

@ -72,7 +72,6 @@ import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetQuery;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
@ -144,6 +143,8 @@ import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
* Oct 21, 2013 2292 mpduff Close dialog on OK.
* Nov 07, 2013 2291 skorolev Used showText() method for "Unable to Create Subscription" message.
* Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is updated and created.
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
@ -471,8 +472,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
btn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String currentSite = LocalizationManager.getInstance()
.getCurrentSite();
String currentSite = DataDeliveryUtils.getDataDeliveryId();
SiteSelectionDlg dlg = new SiteSelectionDlg(shell, currentSite,
sharedSites);
dlg.setCloseCallback(new ICloseCallback() {
@ -1030,7 +1030,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
subscription = sharedSub;
} else {
Set<String> officeList = Sets.newHashSet();
officeList.add(LocalizationManager.getInstance().getCurrentSite());
officeList.add(DataDeliveryUtils.getDataDeliveryId());
subscription.setOfficeIDs(officeList);
}
@ -1088,14 +1088,11 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
.parse(endText);
subscription.setActivePeriodEnd(endPeriodDate);
}
subscription.setActive(true);
} catch (ParseException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
} else {
subscription.setActive(true);
subscription.setActivePeriodStart(null);
subscription.setActivePeriodEnd(null);
}
@ -1543,8 +1540,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
*/
private void setSubscriptionId(Subscription sub) {
if (sub.getOriginatingSite() == null) {
LocalizationManager lm = LocalizationManager.getInstance();
sub.setOriginatingSite(lm.getCurrentSite());
sub.setOriginatingSite(DataDeliveryUtils.getDataDeliveryId());
}
String id = RegistryUtil.getRegistryObjectKey(sub);
sub.setId(id);
@ -1635,8 +1631,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
// If currently in the window, assume starting from last year for
// the start date
if (subscription.getStatus().equals(
SubscriptionStatus.ACTIVE.toString())) {
if (subscription.isActive()) {
calendarYearToUse--;
}

View file

@ -41,10 +41,10 @@ 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.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.common.ui.GroupSelectComp;
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
import com.raytheon.viz.ui.presenter.components.WidgetConf;
@ -67,7 +67,8 @@ import com.raytheon.viz.ui.presenter.components.WidgetConf;
* Apr 08, 2013 1826 djohnson Remove delivery options.
* May 14, 2013 1040 mpduff Changed to add office Id rather than setting it.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is created.
* Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is created.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
@ -263,8 +264,7 @@ public class GroupAddDlg extends CaveSWTDialog {
System.out.println("Fix Me: Need to calculate data set size");
subscription.setDataSetSize(999);
subscription.addOfficeID(LocalizationManager.getInstance()
.getCurrentSite());
subscription.addOfficeID(DataDeliveryUtils.getDataDeliveryId());
// TODO: How to do this better? Will shared subscriptions participate in
// groups?

View file

@ -52,6 +52,7 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 29, 2013 1040 mpduff Initial creation
* Feb 11, 2014 2771 bgonzale Show all SiteDataTypes in site list.
*
* </pre>
*
@ -153,9 +154,7 @@ public class SiteSelectionDlg extends CaveSWTDialog {
for (Entry<String, SiteData> entry : siteDataMap.entrySet()) {
SiteDataType type = entry.getValue().getType();
if (type == SiteDataType.WFO || type == SiteDataType.RFC) {
siteList.add(entry.getKey());
}
siteList.add(entry.getKey());
}
// Remove the current site

View file

@ -26,6 +26,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.xml.bind.JAXBException;
@ -54,6 +57,7 @@ import org.eclipse.swt.widgets.TableColumn;
import com.raytheon.uf.common.auth.AuthException;
import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
@ -71,6 +75,8 @@ import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.actions.DataBrowserAction;
@ -144,6 +150,12 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Nov 06, 2013 2358 mpduff Resurrected file management code.
* Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is deleted.
* Dec 05, 2013 2570 skorolev Show All subscriptions.
* Jan 08, 2014 2642 mpduff Update dialog for permissions, adding site to shared
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Feb 04, 2014 2722 mpduff Add auto-refresh task.
* Feb 14, 2014 2806 mpduff Disable activate/deactivate buttons when viewing other site's subscriptions
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
* @author mpduff
@ -180,8 +192,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
}
/** Current site */
private final String CURRENT_SITE = LocalizationManager.getInstance()
.getCurrentSite();
private final String CURRENT_SITE = DataDeliveryUtils.getDataDeliveryId();
/** The activate button */
private Button activateBtn;
@ -253,6 +264,29 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
/** Option to select all groups of subscriptions */
private final String ALL_SUBSCRIPTIONS = "All Subscriptions";
/** Edit menu */
private MenuItem editMI;
/** Copy menu */
private MenuItem copyMI;
/** Delete menu */
private MenuItem deleteMI;
/** Edit group menu */
private MenuItem editGroupMI;
/** Delete group menu */
private MenuItem deleteGroupMI;
/** Group menu */
private MenuItem groupMI;
/** New menu */
private MenuItem newMI;
private final ScheduledExecutorService scheduler;
/**
* Constructor
*
@ -263,9 +297,13 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
public SubscriptionManagerDlg(Shell parent,
ISubscriptionManagerFilter filter) {
super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE,
CAVE.INDEPENDENT_SHELL | CAVE.PERSPECTIVE_INDEPENDENT);
CAVE.INDEPENDENT_SHELL | CAVE.PERSPECTIVE_INDEPENDENT
| CAVE.DO_NOT_BLOCK);
this.filter = filter;
scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(new RefreshTask(), 15, 15,
TimeUnit.MINUTES);
setText("Data Delivery Subscription Manager");
}
@ -320,6 +358,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
createBottomButtons();
enableControls(true);
}
/*
@ -337,6 +376,17 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
return mainLayout;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
super.disposed();
scheduler.shutdownNow();
}
/**
* Create subscription menu.
*/
@ -351,7 +401,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
Menu fileMenu = new Menu(menuBar);
fileMenuItem.setMenu(fileMenu);
MenuItem newMI = new MenuItem(fileMenu, SWT.NONE);
newMI = new MenuItem(fileMenu, SWT.NONE);
newMI.setText("New Subscription...");
newMI.addSelectionListener(new SelectionAdapter() {
@Override
@ -360,7 +410,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
}
});
MenuItem groupMI = new MenuItem(fileMenu, SWT.NONE);
groupMI = new MenuItem(fileMenu, SWT.NONE);
groupMI.setText("New Group...");
groupMI.addSelectionListener(new SelectionAdapter() {
@Override
@ -510,7 +560,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
Menu editMenu = new Menu(menuBar);
editMenuItem.setMenu(editMenu);
MenuItem editMI = new MenuItem(editMenu, SWT.NONE);
editMI = new MenuItem(editMenu, SWT.NONE);
editMI.setText("Edit Subscription...");
editMI.addSelectionListener(new SelectionAdapter() {
@Override
@ -519,7 +569,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
}
});
MenuItem copyMI = new MenuItem(editMenu, SWT.NONE);
copyMI = new MenuItem(editMenu, SWT.NONE);
copyMI.setText("Copy Subscription...");
copyMI.addSelectionListener(new SelectionAdapter() {
@Override
@ -528,8 +578,8 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
}
});
MenuItem deleteMI = new MenuItem(editMenu, SWT.NONE);
deleteMI.setText("Delete Subscription");
deleteMI = new MenuItem(editMenu, SWT.NONE);
deleteMI.setText("Delete/Remove from Subscription");
deleteMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
@ -537,7 +587,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
}
});
MenuItem editGroupMI = new MenuItem(editMenu, SWT.NONE);
editGroupMI = new MenuItem(editMenu, SWT.NONE);
editGroupMI.setText("Edit Group...");
editGroupMI.addSelectionListener(new SelectionAdapter() {
@Override
@ -546,7 +596,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
}
});
MenuItem deleteGroupMI = new MenuItem(editMenu, SWT.NONE);
deleteGroupMI = new MenuItem(editMenu, SWT.NONE);
deleteGroupMI.setText("Delete Group...");
deleteGroupMI.addSelectionListener(new SelectionAdapter() {
@Override
@ -607,6 +657,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
@Override
public void widgetSelected(SelectionEvent event) {
handleFilterSelection();
enableControls(officeCbo.getText().equals(CURRENT_SITE));
}
});
@ -631,8 +682,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
*/
@Override
public void handleRefresh() {
tableComp.populateData();
tableComp.populateTable();
tableComp.handleRefresh();
}
private void createBottomButtons() {
@ -702,7 +752,6 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
* true for create dialog and false for edit
*/
private void handleGroupCreate(boolean create) {
final String permission = DataDeliveryPermission.SUBSCRIPTION_CREATE
.toString();
IUser user = UserController.getUserObject();
@ -940,52 +989,78 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
try {
if (DataDeliveryServices.getPermissionsService()
.checkPermission(user, msg, permission).isAuthorized()) {
String message = null;
ArrayList<SubscriptionManagerRowData> deleteList = new ArrayList<SubscriptionManagerRowData>();
final List<Subscription> subsToDelete = new ArrayList<Subscription>();
final List<Subscription> subsToUpdate = new ArrayList<Subscription>();
if (selectionCount > 1) {
message = "Are you sure you want to delete these subscriptions?";
} else {
message = "Are you sure you want to delete this subscription?";
for (int idx : tableComp.getTable().getSelectionIndices()) {
SubscriptionManagerRowData removedItem = tableComp
.getSubscriptionData().getDataRow(idx);
Subscription sub = removedItem.getSubscription();
if (sub instanceof SharedSubscription) {
sub.getOfficeIDs().remove(CURRENT_SITE);
if (sub.getOfficeIDs().size() > 0) {
subsToUpdate.add(sub);
} else {
subsToDelete.add(sub);
}
} else {
subsToDelete.add(removedItem.getSubscription());
}
deleteList.add(removedItem);
}
String message = getMessage(subsToDelete, subsToUpdate);
int choice = DataDeliveryUtils.showMessage(shell, SWT.YES
| SWT.NO, "Delete Confirmation", message);
if (choice == SWT.YES) {
ArrayList<SubscriptionManagerRowData> deleteList = new ArrayList<SubscriptionManagerRowData>();
final List<Subscription> subsToDelete = new ArrayList<Subscription>();
for (int idx : tableComp.getTable().getSelectionIndices()) {
SubscriptionManagerRowData removedItem = tableComp
.getSubscriptionData().getDataRow(idx);
subsToDelete.add(removedItem.getSubscription());
deleteList.add(removedItem);
}
// remove the rows from the table
tableComp.getSubscriptionData().removeAll(deleteList);
// Should we be using this or the LocalizationManager, or
// UserController.getUserObject().getUniqueID()
final String username = System.getenv().get("LOGNAME");
final String username = LocalizationManager.getInstance()
.getCurrentUser();
Job job = new Job("Deleting Subscriptions...") {
@Override
protected IStatus run(IProgressMonitor monitor) {
DataDeliveryGUIUtils.markBusyInUIThread(shell);
List<RegistryHandlerException> exceptions = deleteSubscriptions(
username, subsToDelete);
List<RegistryHandlerException> exceptions = new ArrayList<RegistryHandlerException>(
0);
if (!subsToDelete.isEmpty()) {
exceptions = deleteSubscriptions(username,
subsToDelete);
}
if (!subsToUpdate.isEmpty()) {
exceptions.addAll(updateSubscriptions(username,
subsToUpdate));
}
for (RegistryHandlerException t : exceptions) {
statusHandler.handle(Priority.ERROR,
"Failed to delete some subscriptions: "
+ t.getLocalizedMessage(), t);
}
return Status.OK_STATUS;
}
};
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
handleRefresh();
}
});
DataDeliveryGUIUtils.markNotBusyInUIThread(shell);
}
});
job.schedule();
} else {
// Refresh the table to reset any objects edited
handleRefresh();
}
}
} catch (AuthException e) {
@ -993,6 +1068,35 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
}
}
/**
* Get the delete confirmation message.
*
* @param subsToDelete
* subscription list to delete
* @param subsToUpdate
* subscription list to update
* @return The confirmation message
*/
private String getMessage(List<Subscription> subsToDelete,
List<Subscription> subsToUpdate) {
StringBuilder sb = new StringBuilder();
if (!subsToDelete.isEmpty()) {
sb.append("The following subscriptions will be deleted:\n");
for (Subscription sub : subsToDelete) {
sb.append(sub.getName()).append("\n");
}
}
if (!subsToUpdate.isEmpty()) {
sb.append("\nThe following subscriptions will be removed:\n");
for (Subscription sub : subsToUpdate) {
sb.append(sub.getName()).append("\n");
}
}
return sb.toString();
}
/**
* Handle filtering the subscription table using combo box selections.
*/
@ -1080,7 +1184,11 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
.getSubscriptionData().getDataRow(idx);
Subscription sub = rowData.getSubscription();
sub.setActive(activate);
if (activate) {
sub.activate();
} else {
sub.deactivate();
}
try {
SubscriptionServiceResult response = subscriptionService
@ -1199,16 +1307,12 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
Set<String> sites = siteData.keySet();
officeNames = sites.toArray(new String[sites.size()]);
String[] officeAll = new String[officeNames.length + 1];
officeAll[0] = ALL;
System.arraycopy(officeNames, 0, officeAll, 1, officeNames.length);
officeCbo.setItems(officeAll);
officeCbo.setItems(officeNames);
String site = CURRENT_SITE;
if (this.selectedOffice != null) {
for (String item : officeAll) {
for (String item : officeNames) {
if (item.equals(selectedOffice)) {
site = item;
break;
@ -1319,7 +1423,6 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
*/
private List<RegistryHandlerException> deleteSubscriptions(String username,
List<Subscription> subscriptions) {
List<RegistryHandlerException> exceptions = new ArrayList<RegistryHandlerException>();
ISubscriptionHandler handler = RegistryObjectHandlers
@ -1333,6 +1436,32 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
return exceptions;
}
/**
* Update subscriptions.
*
* @param username
* User updating the subscriptions
* @param subscriptions
* Subscriptions to update
* @return List of errors that occurred
*/
private List<RegistryHandlerException> updateSubscriptions(String username,
List<Subscription> subscriptions) {
List<RegistryHandlerException> exceptions = new ArrayList<RegistryHandlerException>();
ISubscriptionHandler handler = RegistryObjectHandlers
.get(ISubscriptionHandler.class);
for (Subscription sub : subscriptions) {
try {
handler.update(sub);
} catch (RegistryHandlerException e) {
exceptions.add(e);
}
}
return exceptions;
}
/**
* {@inheritDoc}
*/
@ -1389,4 +1518,41 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
loadGroupNames();
loadOfficeNames();
}
/**
* Enable/Disable controls.
*
* @param enable
* true to enable, false to disable
*/
private void enableControls(boolean enable) {
copyMI.setEnabled(enable);
deleteGroupMI.setEnabled(enable);
editMI.setEnabled(enable);
copyMI.setEnabled(enable);
deleteMI.setEnabled(enable);
editGroupMI.setEnabled(enable);
groupMI.setEnabled(enable);
newMI.setEnabled(enable);
tableComp.enableMenus(enable);
activateBtn.setEnabled(enable);
deactivateBtn.setEnabled(enable);
}
/**
* Private inner work thread used to auto refresh dialog.
*/
private class RefreshTask implements Runnable {
@Override
public void run() {
if (TimeUtil.currentTimeMillis() - tableComp.getLastUpdateTime() >= TimeUtil.MILLIS_PER_MINUTE * 5) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
handleRefresh();
}
});
}
}
}
}

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Jan 25, 2012 1528 djohnson Priorities no longer need incrementing for display.
* Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Change Office IDs to set.
* Jan 14, 2014 2459 mpduff Change Subscription status code
* </pre>
*
* @author mpduff
@ -472,8 +473,7 @@ public class SubscriptionManagerRowData implements
this.setPriority(subscription.getPriority().getPriorityValue());
this.setSubscriptionStart(subscription.getSubscriptionStart());
this.setSubscriptionEnd(subscription.getSubscriptionEnd());
this.setActive(subscription.isActive());
this.setStatus(subscription.getStatus());
this.setStatus(subscription.getStatus().toString());
}
/**

View file

@ -45,7 +45,9 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedTime;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.PointTime;
import com.raytheon.uf.common.datadelivery.registry.RecurringSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionState;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
@ -94,6 +96,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Oct 12, 2013 2460 dhladky restored adhoc subscriptions to registry storage.
* Oct 22, 2013 2292 mpduff Removed subscriptionOverlapService.
* Nov 07, 2013 2291 skorolev Used showText() method for "Shared Subscription" message.
* Jan 26, 2014 2259 mpduff Turn off subs to be deactivated.
* Feb 04, 2014 2677 mpduff Don't do overlap checks when deactivating subs.
*
* </pre>
*
@ -539,28 +543,42 @@ public class SubscriptionService implements ISubscriptionService {
final IForceApplyPromptDisplayText displayTextStrategy)
throws RegistryHandlerException {
SubscriptionOverlapRequest request = new SubscriptionOverlapRequest(
subscriptions);
if (subscriptions == null || subscriptions.isEmpty()) {
return new SubscriptionServiceResult(false,
"No subscriptions submitted.");
}
SubscriptionOverlapResponse response = null;
try {
response = (SubscriptionOverlapResponse) RequestRouter.route(
request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
if (response.isDuplicate()) {
return new SubscriptionServiceResult(true,
StringUtil.createMessage(DUPLICATE_SUBSCRIPTIONS,
response.getSubscriptionNameList()));
}
/*
* If activating the subscriptions check for overlaps.
*
* Only need to check one because all are being updated the same way.
*/
if (subscriptions.get(0).getSubscriptionState() == SubscriptionState.ON) {
SubscriptionOverlapRequest request = new SubscriptionOverlapRequest(
subscriptions);
if (response.isOverlap()) {
List<String> subNames = response.getSubscriptionNameList();
Collections.sort(subNames);
forceApplyPrompt.displayMessage(displayTextStrategy, StringUtil
.createMessage(OVERLAPPING_SUBSCRIPTIONS, subNames));
SubscriptionOverlapResponse response = null;
try {
response = (SubscriptionOverlapResponse) RequestRouter.route(
request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
if (response.isDuplicate()) {
return new SubscriptionServiceResult(true,
StringUtil.createMessage(DUPLICATE_SUBSCRIPTIONS,
response.getSubscriptionNameList()));
}
if (response.isOverlap()) {
List<String> subNames = response.getSubscriptionNameList();
Collections.sort(subNames);
forceApplyPrompt.displayMessage(displayTextStrategy,
StringUtil.createMessage(OVERLAPPING_SUBSCRIPTIONS,
subNames));
}
} catch (Exception e) {
statusHandler.error("Error checking subscription overlapping",
e);
return new SubscriptionServiceResult(false);
}
} catch (Exception e) {
statusHandler.error("Error checking subscription overlapping", e);
return new SubscriptionServiceResult(false);
}
try {
@ -768,6 +786,10 @@ public class SubscriptionService implements ISubscriptionService {
continue;
}
unscheduledSub.setUnscheduled(true);
if (unscheduledSub instanceof RecurringSubscription) {
((RecurringSubscription) unscheduledSub)
.setSubscriptionState(SubscriptionState.OFF);
}
subscriptionHandler.update(unscheduledSub);
}
}

View file

@ -46,7 +46,9 @@ import org.eclipse.swt.widgets.TableItem;
import com.raytheon.uf.common.auth.AuthException;
import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.datadelivery.service.BaseSubscriptionNotificationResponse;
@ -55,6 +57,7 @@ import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
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.core.auth.UserController;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
@ -106,6 +109,9 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Jul 29, 2013 2232 mpduff IndexOutOfBoundsException check.
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Jan 08, 2014 2642 mpduff Enable/disable menus based on site, allow user to add their site to a shared sub.
* Feb 04, 2014 2722 mpduff Add last update time.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* @version 1.0
*/
@ -115,6 +121,9 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(SubscriptionTableComp.class);
/** Current site constant */
private final String CURRENT_SITE = DataDeliveryUtils.getDataDeliveryId();
/** Pop up menu object. */
private Menu popupMenu;
@ -152,6 +161,12 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
/** The subscription type. */
private SubscriptionType subType = SubscriptionType.VIEWER;
/** Currently selected site */
private boolean currentSiteSelected;
/** Last table update time */
protected long lastUpdateTime = TimeUtil.currentTimeMillis();
/**
* Constructor.
*
@ -668,7 +683,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
if (subType == SubscriptionType.MANAGER) {
MenuItem editItem = new MenuItem(popupMenu, SWT.PUSH);
editItem.setText("Edit...");
editItem.setEnabled(menuItemsEnabled);
editItem.setEnabled(menuItemsEnabled && this.currentSiteSelected);
editItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@ -679,13 +694,32 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
// Add the selected row to a subscription group
MenuItem groupItem = new MenuItem(popupMenu, SWT.PUSH);
groupItem.setText("Add to Group...");
groupItem.setEnabled(menuItemsEnabled);
groupItem.setEnabled(menuItemsEnabled && this.currentSiteSelected);
groupItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleGroupAdd();
}
});
/*
* If a single shared sub is selected and another site's subs are
* loaded then allow the user to add their site to the shared sub.
*/
if (table.getSelectionCount() == 1) {
final Subscription sub = getSelectedSubscription();
if (sub instanceof SharedSubscription) {
MenuItem addToShared = new MenuItem(popupMenu, SWT.PUSH);
addToShared.setText("Add site to shared");// subscription");
addToShared.setEnabled(true);
addToShared.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleAddSiteToShared(sub);
}
});
}
}
}
table.setMenu(popupMenu);
@ -730,6 +764,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
lastUpdateTime = TimeUtil.currentTimeMillis();
if (!isDisposed()) {
handleRefresh();
}
@ -753,9 +788,11 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
*/
@Override
public void handleRefresh() {
populateData();
populateTable();
if (!isDisposed()) {
populateData();
populateTable();
this.lastUpdateTime = TimeUtil.currentTimeMillis();
}
}
@Override
@ -786,4 +823,83 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
ISubscriptionManagerFilter subscriptionFilter) {
this.subscriptionFilter = subscriptionFilter;
}
}
/**
* Enable based on the current site selected in the SubscriptionManagerDlg.
*
* @param enable
* true to enable the menu
*/
protected void enableMenus(boolean enable) {
this.currentSiteSelected = enable;
}
/**
* Add the current site ID to the shared subscription.
*
* @param sub
* The subscription to add the current site
*/
private void handleAddSiteToShared(final Subscription sub) {
final Shell shell = table.getShell();
Job job = new Job("Updating Subscription...") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
DataDeliveryGUIUtils.markBusyInUIThread(shell);
final String permission = DataDeliveryPermission.SUBSCRIPTION_EDIT
.toString();
IUser user = UserController.getUserObject();
String msg = user.uniqueId()
+ " is not authorized to add site to existing shared subscriptions.\nPermission: "
+ permission;
try {
if (DataDeliveryServices.getPermissionsService()
.checkPermissions(user, msg, permission)
.isAuthorized()) {
sub.getOfficeIDs().add(CURRENT_SITE);
DataDeliveryHandlers.getSubscriptionHandler()
.update(sub);
}
} catch (AuthException e) {
statusHandler.handle(Priority.PROBLEM,
"Error occurred in authorization request", e);
} catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
return Status.OK_STATUS;
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Unexpected Exception", e);
return Status.CANCEL_STATUS;
}
}
};
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
try {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
populateTable();
}
});
} finally {
DataDeliveryGUIUtils.markNotBusyInUIThread(shell);
}
}
});
job.schedule();
}
/**
* @return the lastUpdateTime
*/
public long getLastUpdateTime() {
return lastUpdateTime;
}
}

View file

@ -51,6 +51,7 @@ import com.raytheon.uf.common.datadelivery.registry.DataType;
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.PointDataSet;
import com.raytheon.uf.common.datadelivery.registry.SharedSubscription;
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionType;
@ -68,6 +69,7 @@ import com.raytheon.uf.viz.core.VizAppTaskExecutor;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.common.xml.AreaXML;
import com.raytheon.uf.viz.datadelivery.filter.MetaDataManager;
import com.raytheon.uf.viz.datadelivery.handlers.VizSubscriptionHandler;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.subscription.CreateSubscriptionDlg;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
@ -138,6 +140,9 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Oct 25, 2013 2292 mpduff Move overlap processing to edex.
* Nov 14, 2013 2538 mpduff Added check for duplicate subscription.
* Nov 14, 2013 2548 mpduff Set the subscription type (QUERY OR RECURRING)
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Jan 20, 2014 2538 mpduff Call doesNameExist method to check for dupes
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* </pre>
*
* @author mpduff
@ -504,10 +509,13 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
if (valid) {
// Check for existing subscription
ISubscriptionHandler handler = RegistryObjectHandlers
VizSubscriptionHandler handler = (VizSubscriptionHandler) RegistryObjectHandlers
.get(ISubscriptionHandler.class);
String name = nameText.getText();
try {
if (handler.getByName(nameText.getText()) != null) {
if (handler.doesNameExist(name, SiteSubscription.class,
SharedSubscription.class, AdhocSubscription.class)) {
String message = "A query with this name already exists.\n\nPlease enter a different query name.";
DataDeliveryUtils.showMessage(getShell(), SWT.ERROR,
"Duplicate Query Name", message);
@ -563,8 +571,7 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
sub.setOwner((create) ? LocalizationManager.getInstance()
.getCurrentUser() : this.subscription.getOwner());
sub.setOriginatingSite(LocalizationManager.getInstance()
.getCurrentSite());
sub.setOriginatingSite(DataDeliveryUtils.getDataDeliveryId());
sub.setSubscriptionType(SubscriptionType.RECURRING);
return setupCommonSubscriptionAttributes(sub, defaultRoute);
@ -592,7 +599,7 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
sub.setRoute(defaultRoute);
sub.setName(nameText.getText());
if (subscription == null || subscription.getOfficeIDs() == null) {
sub.addOfficeID(LocalizationManager.getInstance().getCurrentSite());
sub.addOfficeID(DataDeliveryUtils.getDataDeliveryId());
} else {
sub.setOfficeIDs(subscription.getOfficeIDs());
}
@ -603,7 +610,6 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
sub.setSubscriptionStart(this.subscription.getSubscriptionStart());
sub.setActivePeriodEnd(this.subscription.getActivePeriodEnd());
sub.setActivePeriodStart(this.subscription.getActivePeriodStart());
sub.setActive(this.subscription.isActive());
sub.setPriority(this.subscription.getPriority());
}

View file

@ -34,6 +34,9 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.auth.resp.SuccessfulExecution;
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest;
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest.RequestType;
import com.raytheon.uf.common.datadelivery.registry.Coverage;
import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
import com.raytheon.uf.common.datadelivery.registry.DataType;
@ -43,6 +46,8 @@ import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.PointTime;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.common.util.SizeUtil;
@ -82,8 +87,9 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jul 26, 2031 2232 mpduff Removed sendAuthorizationRequest method.
* Aug 30, 2013 2288 bgonzale Added latency to details display.
* Sep 30, 2013 1797 dhladky Time GriddedTime separation
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Nov 07, 2013 2291 skorolev Added showText() method for messages with many lines.
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Nov 07, 2013 2291 skorolev Added showText() method for messages with many lines.
* Feb 11, 2014 2771 bgonzale Added Data Delivery ID, getter, and retrieval method.
* </pre>
*
* @author mpduff
@ -121,6 +127,8 @@ public class DataDeliveryUtils {
public static final String UNABLE_TO_RETRIEVE_PENDING_SUBSCRIPTIONS = "Unable to retrieve pending subscriptions!";
private static final String dataDeliveryId = retrieveDataDeliveryId();
/**
* TABLE_TYPE enumeration.
*/
@ -832,4 +840,21 @@ public class DataDeliveryUtils {
public static int getMaxLatency(GriddedDataSet dataSet) {
return getMaxLatency(new ArrayList<Integer>(dataSet.getCycles()));
}
public static String getDataDeliveryId() {
return dataDeliveryId;
}
private static String retrieveDataDeliveryId() {
IBandwidthRequest request = new IBandwidthRequest();
request.setRequestType(RequestType.GET_DATADELIVERY_ID);
try {
SuccessfulExecution response = (SuccessfulExecution) RequestRouter
.route(request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
return (String) response.getResponse();
} catch (Exception e) {
throw new RuntimeException(
"Unable to retrieve Data Delivery ID from EDEX.", e);
}
}
}

View file

@ -31,6 +31,7 @@ import com.raytheon.uf.viz.datadelivery.notification.xml.MessageLoadXML;
* Mar 12, 2012 jsanchez Initial creation
* Jan 22, 2013 1501 djohnson Route requests to datadelivery.
* Sep 05, 2013 2314 mpduff support the load all messages option.
* Feb 07, 2014 2453 mpduff Remove username query param.
*
* </pre>
*
@ -84,10 +85,9 @@ public class NotificationHandler implements INotificationObserver {
public List<NotificationRecord> intialLoad(MessageLoadXML messageLoad,
ArrayList<String> users) {
int loadAmount;
String username = null;
Integer hours = null;
Integer maxResults = null;
Boolean loadAll = false;
boolean loadAll = false;
// Retrieve the message load configuration
if (messageLoad != null) {
loadAll = messageLoad.isLoadAllMessages();
@ -100,22 +100,11 @@ public class NotificationHandler implements INotificationObserver {
}
}
// Set usernames from filter
if (users != null && users.isEmpty() == false) {
StringBuffer sb = new StringBuffer();
for (String user : users) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append(user);
}
username = sb.toString();
}
// Request data from the notification table.
// Note: Removing username query parameter for front end label
// consistency
try {
GetNotificationRequest request = new GetNotificationRequest();
request.setUsername(username);
request.setHours(hours);
request.setMaxResults(maxResults);
request.setLoadAll(loadAll);

View file

@ -21,7 +21,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 7, 2013 skorolev Initial creation
* Nov 7, 2013 skorolev Initial creation
* Jan 20, 2013 #2291 lvenable Fixed resizing of components.
*
* </pre>
*
@ -41,23 +42,26 @@ public class TextMessageDlg extends CaveSWTDialog {
@Override
protected void initializeComponents(Shell shell) {
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, false, false);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
GridLayout gl = new GridLayout(1, false);
Composite mainComp = new Composite(shell, SWT.NONE);
mainComp.setLayout(gl);
mainComp.setLayoutData(gd);
gd = new GridData();
gd.widthHint = 350;
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.widthHint = 400;
gd.heightHint = 350;
StyledText text = new StyledText(mainComp, SWT.MULTI | SWT.WRAP
| SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
text.setLayoutData(gd);
text.setText(messageText);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = 60;
Button okBtn = new Button(mainComp, SWT.PUSH);
okBtn.setText("OK");
okBtn.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, true));
okBtn.setLayoutData(gd);
okBtn.setLayoutData(gd);
okBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@ -65,5 +69,4 @@ public class TextMessageDlg extends CaveSWTDialog {
}
});
}
}

View file

@ -57,6 +57,7 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
* Jul 16, 2013 2158 bsteffen Allow VizGlobalsManager to work without
* accessing UI thread.
* Oct 15, 2013 2361 njensen Added startupTimer
* Jan 27, 2014 2744 njensen Add Local History pref back in
*
* </pre>
*
@ -192,8 +193,17 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor {
for (IPreferenceNode root : topNodes) {
String rootId = root.getId();
if (rootId.equals("org.eclipse.ui.preferencePages.Workbench")) {
IPreferenceNode node = root
.findSubNode("org.eclipse.ui.preferencePages.Workspace");
if (node != null) {
node.remove("org.eclipse.ui.preferencePages.LinkedResources");
node.remove("org.eclipse.ui.preferencePages.BuildOrder");
IPreferenceNode localHistoryNode = node
.findSubNode("org.eclipse.ui.preferencePages.FileStates");
root.add(localHistoryNode);
root.remove("org.eclipse.ui.preferencePages.Workspace");
}
root.remove("org.eclipse.search.preferences.SearchPreferencePage");
root.remove("org.eclipse.ui.preferencePages.Workspace");
} else if (rootId.equals("org.python.pydev.prefs")) {
root.remove("org.python.pydev.ui.pythonpathconf.interpreterPreferencesPageJython");
root.remove("org.python.pydev.ui.pythonpathconf.interpreterPreferencesPageIronpython");
@ -325,7 +335,7 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor {
startupTimer.stop();
System.out.println("Workbench startup time: "
+ startupTimer.getElapsedTime() + " ms");
}
}
}

View file

@ -123,8 +123,10 @@ public class AlertVizApplication implements IStandaloneComponent {
AlertvizJob as = new AlertvizJob(port);
if (as.isAlreadyStarted()) {
Container.logInternal(Priority.ERROR,
"Alertviz already started on port: " + port + ", exiting");
String exitMsg = "Alertviz already started on port: " + port
+ ", exiting";
System.out.println(exitMsg);
Container.logInternal(Priority.ERROR, exitMsg);
return IApplication.EXIT_OK;
}

View file

@ -23,11 +23,11 @@
</requires>
<plugin
id="com.raytheon.edex.plugin.modelsounding"
id="com.raytheon.uf.common.dataplugin.modelsounding"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
unpack="true"/>
<plugin
id="com.raytheon.uf.common.sounding"

View file

@ -36,6 +36,7 @@ import com.raytheon.uf.viz.core.comm.ConnectivityManager;
import com.raytheon.uf.viz.core.comm.ConnectivityManager.ConnectivityResult;
import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
import com.raytheon.uf.viz.thinclient.Activator;
import com.raytheon.uf.viz.thinclient.ThinClientUriUtil;
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
/**
@ -51,6 +52,7 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
* Jan 14, 2013 1469 bkowal The hdf5 data directory is no longer a
* preference.
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Feb 04, 2014 2704 njensen Only one field for proxy server
*
* </pre>
*
@ -61,9 +63,7 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
private BooleanFieldEditor useProxies;
private StringFieldEditor pypiesServer;
private StringFieldEditor servicesServer;
private StringFieldEditor proxyServer;
private Button connectivityButton;
@ -92,18 +92,11 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
"&Use Proxy Servers", getFieldEditorParent());
addField(useProxies);
servicesServer = new StringFieldEditor(
ThinClientPreferenceConstants.P_SERVICES_PROXY,
"&Services Address: ", getFieldEditorParent());
servicesServer.setErrorMessage("Cannot connect to Services server");
addField(servicesServer);
pypiesServer = new StringFieldEditor(
ThinClientPreferenceConstants.P_PYPIES_PROXY,
"&Pypies Address: ", getFieldEditorParent());
pypiesServer.setErrorMessage("Cannot connect to Pypies server");
addField(pypiesServer);
proxyServer = new StringFieldEditor(
ThinClientPreferenceConstants.P_PROXY_ADDRESS,
"&Proxy Address: ", getFieldEditorParent());
proxyServer.setErrorMessage("Cannot connect to Proxy server");
addField(proxyServer);
addConnectivityButton();
}
@ -131,43 +124,40 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
* Check the connectivity of the server field editors
*/
private void checkConnectivity() {
final ConnectivityResult result = new ConnectivityResult(false, "");
final ConnectivityResult servicesResult = new ConnectivityResult(false,
"");
final ConnectivityResult pypiesResult = new ConnectivityResult(false,
"");
String errorMessage = "Cannot connect to proxy server: ";
boolean serverError = false;
// check HTTP Server
Text text = servicesServer.getTextControl(getFieldEditorParent());
ConnectivityManager.checkLocalizationServer(text.getText().trim(),
Text text = proxyServer.getTextControl(getFieldEditorParent());
String proxyAddr = text.getText().trim();
ConnectivityManager.checkLocalizationServer(
ThinClientUriUtil.getServicesAddress(proxyAddr),
new IConnectivityCallback() {
@Override
public void connectionChecked(ConnectivityResult results) {
result.hasConnectivity = results.hasConnectivity;
servicesResult.hasConnectivity = results.hasConnectivity;
}
});
if (result.hasConnectivity) {
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_WHITE));
} else {
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_RED));
serverError = true;
}
// check Pypies Server
Text textPypies = pypiesServer.getTextControl(getFieldEditorParent());
ConnectivityManager.checkHttpServer(textPypies.getText().trim(),
ConnectivityManager.checkHttpServer(
ThinClientUriUtil.getPypiesAddress(proxyAddr),
new IConnectivityCallback() {
@Override
public void connectionChecked(ConnectivityResult results) {
result.hasConnectivity = results.hasConnectivity;
pypiesResult.hasConnectivity = results.hasConnectivity;
}
});
if (result.hasConnectivity) {
textPypies.setBackground(Display.getDefault().getSystemColor(
if (servicesResult.hasConnectivity && pypiesResult.hasConnectivity) {
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_WHITE));
} else {
textPypies.setBackground(Display.getDefault().getSystemColor(
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_RED));
serverError = true;
}
@ -191,8 +181,7 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
private void updateEnabledFields() {
boolean useProxies = this.useProxies.getBooleanValue();
servicesServer.setEnabled(useProxies, connectivityButton.getParent());
pypiesServer.setEnabled(useProxies, connectivityButton.getParent());
proxyServer.setEnabled(useProxies, connectivityButton.getParent());
connectivityButton.setEnabled(useProxies);
}

View file

@ -0,0 +1,91 @@
/**
* 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.thinclient;
/**
* Utilities for manipulating thin client URIs
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 3, 2014 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class ThinClientUriUtil {
private static String services = "services";
private static String pypies = "pypies";
static {
services = System.getProperty("thinclient.proxy.services", services);
pypies = System.getProperty("thinclient.proxy.pypies", pypies);
}
private ThinClientUriUtil() {
}
/**
* Returns the address to connect to EDEX services when going through the
* thin client proxy
*
* @param proxyAddress
* the address of the proxy server
* @return
*/
public static String getServicesAddress(String proxyAddress) {
return appendTrailingSlash(proxyAddress) + services;
}
/**
* Returns the address to connect to PyPIES when going through the thin
* client proxy
*
* @param proxyAddress
* the address of the proxy server
* @return
*/
public static String getPypiesAddress(String proxyAddress) {
return appendTrailingSlash(proxyAddress) + pypies;
}
/**
* Appends a trailing slash to an address if the address does not have one
*
* @param proxyAddress
* @return
*/
private static String appendTrailingSlash(String proxyAddress) {
if (!proxyAddress.endsWith("/")) {
proxyAddress += "/";
}
return proxyAddress;
}
}

View file

@ -25,15 +25,15 @@ import org.apache.commons.collections.map.DefaultedMap;
import org.eclipse.jface.preference.IPreferenceStore;
import com.raytheon.uf.common.comm.HttpClient;
import com.raytheon.uf.common.localization.msgs.GetServersRequest;
import com.raytheon.uf.common.localization.msgs.GetServersResponse;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.VizServers;
import com.raytheon.uf.viz.core.comm.ConnectivityManager;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationInitializer;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.thinclient.Activator;
import com.raytheon.uf.viz.thinclient.ThinClientUriUtil;
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
import com.raytheon.uf.viz.thinclient.ui.ThinClientConnectivityDialog;
@ -51,8 +51,9 @@ import com.raytheon.uf.viz.thinclient.ui.ThinClientConnectivityDialog;
* Dec 06, 2012 1396 njensen Added setting VizServers
* Jan 14, 2013 1469 bkowal Removed setting the hdf5 data directory
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Aug 27, 2013 2295 bkowal The entire jms connection string is
* Aug 27, 2013 2295 bkowal The entire jms connection string is
* now provided by EDEX.
* Feb 04, 2014 2704 njensen Single proxy address/preference
*
* </pre>
*
@ -87,20 +88,25 @@ public class ThinClientLocalizationInitializer extends LocalizationInitializer {
.getBoolean(ThinClientPreferenceConstants.P_DISABLE_JMS);
if (store.getBoolean(ThinClientPreferenceConstants.P_USE_PROXIES)) {
String servicesProxy = store
.getString(ThinClientPreferenceConstants.P_SERVICES_PROXY);
LocalizationManager.getInstance().setCurrentServer(servicesProxy);
String proxyAddr = store
.getString(ThinClientPreferenceConstants.P_PROXY_ADDRESS);
String servicesProxy = ThinClientUriUtil
.getServicesAddress(proxyAddr);
LocalizationManager.getInstance().setCurrentServer(servicesProxy,
false);
VizApp.setHttpServer(servicesProxy);
if (!disableJMS) {
GetServersRequest req = new GetServersRequest();
GetServersResponse resp = (GetServersResponse) ThriftClient
.sendLocalizationRequest(req);
GetServersResponse resp = ConnectivityManager
.checkLocalizationServer(servicesProxy, false);
if (!disableJMS) {
VizApp.setJmsConnectionString(resp.getJmsConnectionString());
}
}
VizApp.setHttpServer(servicesProxy);
VizApp.setPypiesServer(store
.getString(ThinClientPreferenceConstants.P_PYPIES_PROXY));
String pypiesProxy = ThinClientUriUtil
.getPypiesAddress(proxyAddr);
VizApp.setPypiesServer(pypiesProxy);
boolean compressRequests = store
.getBoolean(ThinClientPreferenceConstants.P_ENABLE_REQUEST_COMPRESSION);
HttpClient.getInstance().setCompressRequests(compressRequests);

View file

@ -30,6 +30,7 @@ package com.raytheon.uf.viz.thinclient.preferences;
* ------------ ---------- ----------- --------------------------
* Oct 20, 2011 mschenke Initial creation
* Jan 14, 2013 1469 bkowal The hdf5 data directory is no longer a preference constant.
* Feb 04, 2014 2704 njensen Single proxy preference constant
*
* </pre>
*
@ -47,10 +48,6 @@ public class ThinClientPreferenceConstants {
public static String P_USE_PROXIES = "useHttpProxy";
public static String P_SERVICES_PROXY = "servicesProxyAddress";
public static String P_PYPIES_PROXY = "pypiesProxyAddress";
public static String P_MENU_TIME_UPDATE_INTERVALS = "menuTimeUpdateInterval";
public static String P_DATA_UPDATE_INTERVALS = "dataUpdateInterval";
@ -70,4 +67,6 @@ public class ThinClientPreferenceConstants {
public static String P_ENABLE_REQUEST_COMPRESSION = "enableRequestCompression";
public static String P_PREFERENCE_PLACEHOLDER = "placeholderPreference";
public static String P_PROXY_ADDRESS = "proxyAddress";
}

View file

@ -27,25 +27,30 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.localization.msgs.GetServersResponse;
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.viz.core.comm.ConnectivityManager;
import com.raytheon.uf.viz.core.comm.ConnectivityManager.ConnectivityResult;
import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.ConnectivityPreferenceDialog;
import com.raytheon.uf.viz.core.localization.LocalizationConstants;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.thinclient.Activator;
import com.raytheon.uf.viz.thinclient.ThinClientUriUtil;
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
/**
* TODO Add Description
* Connectivity dialog for launching thinclient or thinalertviz. Contains extra
* options not available when connecting with a normal CAVE.
*
* <pre>
*
@ -55,6 +60,8 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
* ------------ ---------- ----------- --------------------------
* Nov 23, 2011 bsteffen Initial creation
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Feb 04, 2014 2704 njensen Refactored
* Feb 17, 2014 2704 njensen Added checks for alertviz connectivity
*
* </pre>
*
@ -71,8 +78,11 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
@Override
public void connectionChecked(ConnectivityResult results) {
servicesGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
private class PypiesCallback implements IConnectivityCallback {
@ -80,26 +90,30 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
@Override
public void connectionChecked(ConnectivityResult results) {
pypiesGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
private class JmsCallback implements IConnectivityCallback {
@Override
public void connectionChecked(ConnectivityResult results) {
jmsGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
private Label servicesLabel;
private Text servicesText;
private String services = "";
private boolean servicesGood = false;
private IConnectivityCallback servicesCallback = new ServicesCallback();
private Label pypiesLabel;
private Text pypiesText;
private String pypies = "";
private boolean pypiesGood = false;
private IConnectivityCallback pypiesCallback = new PypiesCallback();
@ -108,15 +122,29 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
private boolean useProxy = false;
private Button disableJmsCheck;
private boolean disableJms = false;
private boolean jmsGood = false;
private Label jmsErrorLabel;
private IConnectivityCallback jmsCallback = new JmsCallback();
private Text proxyText;
private String proxyAddress;
public ThinClientConnectivityDialog(boolean checkAlertViz) {
super(checkAlertViz);
super(checkAlertViz, "Thin Client Connectivity Preferences");
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
useProxy = store
.getBoolean(ThinClientPreferenceConstants.P_USE_PROXIES);
services = store
.getString(ThinClientPreferenceConstants.P_SERVICES_PROXY);
pypies = store.getString(ThinClientPreferenceConstants.P_PYPIES_PROXY);
disableJms = store
.getBoolean(ThinClientPreferenceConstants.P_DISABLE_JMS);
proxyAddress = store
.getString(ThinClientPreferenceConstants.P_PROXY_ADDRESS);
}
@Override
@ -124,66 +152,75 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
super.createTextBoxes(textBoxComp);
Label label = new Label(textBoxComp, SWT.RIGHT);
label.setText("Use Proxy Servers:");
GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true);
label.setText("Disable JMS:");
GridData gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150;
label.setLayoutData(gd);
useProxyCheck = new Button(textBoxComp, SWT.CHECK | SWT.LEFT);
Composite jmsComp = new Composite(textBoxComp, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
jmsComp.setLayout(gl);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
jmsComp.setLayoutData(gd);
disableJmsCheck = new Button(jmsComp, SWT.CHECK | SWT.LEFT);
disableJmsCheck.setSelection(disableJms);
disableJmsCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
disableJms = disableJmsCheck.getSelection();
validate();
}
});
jmsErrorLabel = new Label(jmsComp, SWT.LEFT);
jmsErrorLabel.setText("Error connecting to JMS");
jmsErrorLabel.setForeground(display.getSystemColor(SWT.COLOR_RED));
jmsErrorLabel.setVisible(false);
label = new Label(textBoxComp, SWT.RIGHT);
label.setText("Use Proxy Server:");
gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150;
label.setLayoutData(gd);
Composite proxyComp = new Composite(textBoxComp, SWT.NONE);
gl = new GridLayout(2, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
proxyComp.setLayout(gl);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
proxyComp.setLayoutData(gd);
useProxyCheck = new Button(proxyComp, SWT.CHECK | SWT.LEFT);
useProxyCheck.setSelection(useProxy);
useProxyCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateProxyEnabled();
}
});
servicesLabel = new Label(textBoxComp, SWT.RIGHT);
servicesLabel.setText("Services Proxy Address:");
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 150;
servicesLabel.setLayoutData(gd);
proxyText = new Text(proxyComp, SWT.NONE | SWT.BORDER);
gd = new GridData(SWT.FILL, SWT.None, true, true);
proxyText.setLayoutData(gd);
proxyText.setText(proxyAddress == null ? "" : proxyAddress);
proxyText.setBackground(getTextColor(servicesGood && pypiesGood));
servicesText = new Text(textBoxComp, SWT.NONE);
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 300;
servicesText.setLayoutData(gd);
servicesText.setText(services);
if (!servicesGood) {
servicesText.setBackground(textBoxComp.getDisplay().getSystemColor(
SWT.COLOR_RED));
}
pypiesLabel = new Label(textBoxComp, SWT.RIGHT);
pypiesLabel.setText("Pypies Proxy Address:");
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 150;
pypiesLabel.setLayoutData(gd);
pypiesText = new Text(textBoxComp, SWT.NONE);
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 300;
pypiesText.setLayoutData(gd);
pypiesText.setText(pypies);
if (!pypiesGood) {
pypiesText.setBackground(textBoxComp.getDisplay().getSystemColor(
SWT.COLOR_RED));
}
updateProxyEnabled();
}
@Override
protected void applySettings() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
store.setValue(ThinClientPreferenceConstants.P_USE_PROXIES, useProxy);
store.setValue(ThinClientPreferenceConstants.P_DISABLE_JMS, disableJms);
if (useProxy) {
store.setValue(ThinClientPreferenceConstants.P_SERVICES_PROXY,
services);
store.setValue(ThinClientPreferenceConstants.P_PYPIES_PROXY, pypies);
// Set the site and alertViz server for super.
LocalizationManager.getInstance().setCurrentSite(getSite());
store.setValue(ThinClientPreferenceConstants.P_USE_PROXIES,
useProxy);
store.setValue(ThinClientPreferenceConstants.P_PROXY_ADDRESS,
proxyAddress);
if (getAlertVizServer() != null) {
LocalizationManager
.getInstance()
@ -191,11 +228,11 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
.setValue(LocalizationConstants.P_ALERT_SERVER,
getAlertVizServer());
}
// setting the site will save the preference store
LocalizationManager.getInstance().setCurrentSite(getSite());
try {
((IPersistentPreferenceStore) store).save();
((IPersistentPreferenceStore) LocalizationManager.getInstance()
.getLocalizationStore()).save();
} catch (IOException e) {
statusHandler.handle(Priority.SIGNIFICANT,
"Unable to persist localization preference store", e);
@ -208,50 +245,103 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
@Override
public boolean validate() {
boolean superValid = super.validate();
if (!useProxy) {
return superValid;
return super.validate();
}
if (servicesText != null && !servicesText.isDisposed()
&& servicesText.isEnabled()) {
String services = servicesText.getText().trim();
if (!servicesGood || !this.services.equals(services)) {
this.services = services;
validateServices();
servicesText.setBackground(getTextColor(servicesGood));
}
} else {
status = null;
details = null;
// validate proxy
if (proxyText != null && !proxyText.isDisposed()
&& proxyText.isEnabled()) {
proxyAddress = proxyText.getText();
}
if (proxyAddress != null && proxyAddress.length() > 0) {
validateServices();
}
if (pypiesText != null && !pypiesText.isDisposed()
&& pypiesText.isEnabled()) {
String pypies = pypiesText.getText().trim();
if (!pypiesGood || !this.pypies.equals(pypies)) {
this.pypies = pypies;
validatePypies();
pypiesText.setBackground(getTextColor(pypiesGood));
}
} else {
validatePypies();
} else {
status = "Please enter a thin client proxy server address";
}
return servicesGood && pypiesGood && isSiteGood() && isAlertVizGood();
if (proxyText != null && !proxyText.isDisposed()) {
proxyText.setBackground(getTextColor(servicesGood && pypiesGood));
}
// only check Jms if it's enabled and we can connect to the services
if (!disableJms) {
if (servicesGood) {
try {
GetServersResponse response = ConnectivityManager
.checkLocalizationServer(ThinClientUriUtil
.getServicesAddress(proxyAddress), false);
ConnectivityManager.checkJmsServer(
response.getJmsConnectionString(), jmsCallback);
} catch (VizException e) {
if (status == null) {
status = "Error connecting to JMS";
}
appendDetails(buildDetails(new ConnectivityResult(false,
null, e)));
jmsGood = false;
}
} else {
// JMS can't be good if services fail cause then we don't
// even know where to connect JMS to
jmsGood = false;
}
}
jmsGood = (jmsGood || disableJms);
if (jmsErrorLabel != null && !jmsErrorLabel.isDisposed()) {
jmsErrorLabel.setVisible(!jmsGood);
}
// validate site
if (siteText != null && !siteText.isDisposed()) {
super.setSite(siteText.getText());
}
super.validateSite();
if (siteText != null && !siteText.isDisposed()) {
siteText.setBackground(getTextColor(isSiteGood()));
}
// validate alertviz
// apparently alertvizserver == null means it's alertviz itself
if (alertVizServer != null) {
if (alertVizText != null && !alertVizText.isDisposed()) {
setAlertVizServer(alertVizText.getText());
super.validateAlertviz();
alertVizText.setBackground(getTextColor(isAlertVizGood()));
}
}
boolean everythingGood = servicesGood && pypiesGood && isSiteGood()
&& isAlertVizGood() && jmsGood;
updateStatus(everythingGood, status, details);
return everythingGood;
}
private void validateServices() {
ConnectivityManager.checkLocalizationServer(services, servicesCallback);
ConnectivityManager.checkLocalizationServer(
ThinClientUriUtil.getServicesAddress(proxyAddress),
servicesCallback);
}
private void validatePypies() {
ConnectivityManager.checkHttpServer(pypies, pypiesCallback);
ConnectivityManager.checkHttpServer(
ThinClientUriUtil.getPypiesAddress(proxyAddress),
pypiesCallback);
}
private void updateProxyEnabled() {
useProxy = useProxyCheck.getSelection();
servicesLabel.setEnabled(useProxy);
servicesText.setEnabled(useProxy);
pypiesLabel.setEnabled(useProxy);
pypiesText.setEnabled(useProxy);
setLocalizationEnabled(!useProxy);
proxyText.setEnabled(useProxy);
super.setLocalizationEnabled(!useProxy);
if (useProxy) {
if (localizationText != null && !localizationText.isDisposed()) {
localizationText.setBackground(getTextColor(true));
}
}
validate();
}

View file

@ -6,8 +6,13 @@ const int RED_BAND = 0;
const int GREEN_BAND = 1;
const int BLUE_BAND = 2;
uniform DataTexture rawData;
uniform DataMapping dataMapping;
uniform sampler2D rawDataTex;
uniform DataTextureInfo rawData;
uniform sampler1D dataMappingDataValues;
uniform sampler1D dataMappingColorValues;
uniform int dataMappingValues;
uniform ColorMapping colorMapping;
uniform sampler2D trueColorTexture;
@ -49,7 +54,7 @@ vec4 applyColorBand(int colorband) {
vec2((xy.x / width), (xy.y / height)));
// Lookup raw data value
float dataValue = textureToDataValue(rawData, gl_TexCoord[0].st);
float dataValue = textureToDataValue(rawDataTex, rawData, gl_TexCoord[0].st);
float r = curVal.r;
float g = curVal.g;
@ -58,7 +63,7 @@ vec4 applyColorBand(int colorband) {
if (dataValue != rawData.noDataValue && dataValue == dataValue) {
// Convert dataValue to cmapValue
float cmapValue = dataToColorMapValue(dataValue, dataMapping);
float cmapValue = dataToColorMapValue(dataValue, dataMappingDataValues, dataMappingColorValues, dataMappingValues);
float index = getColorMappingIndex(cmapValue, colorMapping);
int currentMask = toBitMask(a);
@ -86,4 +91,4 @@ void main(void) {
} else {
gl_FragColor = applyColorBand(band);
}
}
}

View file

@ -278,7 +278,7 @@ public class VectorGraphicsRenderable {
lineShape.addLineSegment(new double[][] { { ix2, jy2 },
{ ix3, jy3 } });
if (config.isBarbFillFiftyTriangle()) {
double[] triangleRaw = { ix1, jy1, ix2, jy2, ix3, jy3 };
double[] triangleRaw = { ix1, jy1, ix2, jy2, ix3, jy3, ix1, jy1 };
CoordinateSequence triangleSeq = new PackedCoordinateSequence.Double(
triangleRaw, 2);
LineString triangleLS = new GeometryFactory()

View file

@ -3,7 +3,10 @@
#include <mapping>
#include <coloring>
uniform sampler1D colorMappingColorMap;
uniform sampler1D colorMappingAlphaMask;
uniform ColorMapping colorMapping;
uniform ColorModifiers modifiers;
uniform float bkgrndRed;
@ -11,22 +14,20 @@ uniform float bkgrndGreen;
uniform float bkgrndBlue;
void main(void){
sampler1D colorMap = colorMapping.colorMap;
float logFactor = colorMapping.logFactor;
int applyMask = colorMapping.applyMask;
sampler1D alphaMask = colorMapping.alphaMask;
// Lookup color in colorMap for index
float index = gl_TexCoord[0].s;
if ( logFactor > 0.0 ) {
index = getLogFactorIndex(index, logFactor);
}
vec4 color = texture1D(colorMap, index).rgba;
vec4 color = texture1D(colorMappingColorMap, index).rgba;
// Apply alpha mask if set
float alpha = color.a;
if ( applyMask == 1 ) {
if ( texture1D(alphaMask , index ).r != 0.0 ) {
if ( texture1D(colorMappingAlphaMask , index ).r != 0.0 ) {
color = vec4(bkgrndRed, bkgrndGreen, bkgrndBlue, alpha);
}
}

View file

@ -1,13 +1,21 @@
#include <mapping>
#include <coloring>
uniform DataTexture rawData;
uniform DataMapping dataMapping;
uniform sampler2D rawDataTex;
uniform DataTextureInfo rawData;
uniform sampler1D dataMappingDataValues;
uniform sampler1D dataMappingColorValues;
uniform int dataMappingValues;
uniform sampler1D colorMappingColorMap;
uniform sampler1D colorMappingAlphaMask;
uniform ColorMapping colorMapping;
uniform ColorModifiers modifiers;
void main(void) {
float dataValue = textureToDataValue(rawData, gl_TexCoord[0].st);
float dataValue = textureToDataValue(rawDataTex, rawData, gl_TexCoord[0].st);
// No data check/special NaN check
if (dataValue == rawData.noDataValue || dataValue != dataValue) {
@ -16,9 +24,9 @@ void main(void) {
}
// Convert dataValue to cmapValue
float cmapValue = dataToColorMapValue(dataValue, dataMapping);
float cmapValue = dataToColorMapValue(dataValue, dataMappingDataValues, dataMappingColorValues, dataMappingValues);
// Get color for colormapping, given value
vec4 textureColor = getColorByValue(cmapValue, colorMapping);
vec4 textureColor = getColorByValue(cmapValue, colorMapping, colorMappingColorMap, colorMappingAlphaMask);
// Apply the color modifiers into gl_FragColor
gl_FragColor = applyColorModifiers(textureColor, modifiers);
}

View file

@ -8,8 +8,7 @@
* implied data will range 0-1 and need scaling to get raw value
* where scaleMin maps to 0 and scaleMax maps to 1.
*/
struct DataTexture {
sampler2D rawTex;
struct DataTextureInfo {
float noDataValue;
int isScaled;
float scaleMin;
@ -18,23 +17,9 @@ struct DataTexture {
float height;
};
/**
* Fields used for converting from image data values to
* colormapping data values. Done to avoid conversions in
* application code. dmv[i] -> cmv[i]. Linear interpolation
* is done where non-exact matches are found. Mappings should
* be uploaded as floats so no scaling is needed
*/
struct DataMapping {
sampler1D dataMappingValues;
sampler1D colorMappingValues;
int numMappingValues;
};
struct ColorMapping {
/** Fields for color map and size. colorMap contains colors to
* use for mapping. cmapMin/Max is range colormap is applied over */
sampler1D colorMap;
float cmapMin;
float cmapMax;
@ -42,7 +27,6 @@ struct ColorMapping {
* same size as colorMap and contains 0s and 1s, 1 indicating alpha
* should be set to completely transparent */
int applyMask;
sampler1D alphaMask;
/** Fields for logarithmic and mirrored indexing into the colorMap */
int isMirrored;
@ -51,28 +35,28 @@ struct ColorMapping {
};
/**
* Returns the data value for the DataTexture at location.
* Returns the data value for the DataTextureInfo at location.
*/
float textureToDataValue(DataTexture texture, vec2 location) {
vec4 textureValue = texture2D(texture.rawTex, location);
float textureToDataValue(sampler2D texture, DataTextureInfo info, vec2 location) {
vec4 textureValue = texture2D(texture, location);
float dataValue = textureValue.r;
if (texture.isScaled == 1) {
if (info.isScaled == 1) {
// Convert to non-scaled value
dataValue = ((dataValue * (texture.scaleMax - texture.scaleMin))
+ texture.scaleMin);
dataValue = ((dataValue * (info.scaleMax - info.scaleMin))
+ info.scaleMin);
}
return dataValue;
}
/**
* Returns the data value for the DataTexture at location.
* Returns the data value for the DataTextureInfo at location.
*/
float dataToTextureValue(DataTexture texture, float dataValue) {
float dataToTextureValue(DataTextureInfo info, float dataValue) {
float textureValue = dataValue;
if (texture.isScaled == 1) {
textureValue = (dataValue - texture.scaleMin)
/ (texture.scaleMax - texture.scaleMin);
if (info.isScaled == 1) {
textureValue = (dataValue - info.scaleMin)
/ (info.scaleMax - info.scaleMin);
}
return textureValue;
}
@ -86,10 +70,9 @@ float lookupMappingValue(sampler1D mappingTex, int index,
}
/**
* Converts a data value into a colorMap value given the DataMapping
* Converts a data value into a colorMap value given the data mapping info
*/
float dataToColorMapValue(float dataValue, DataMapping mapping) {
int numMappingValues = mapping.numMappingValues;
float dataToColorMapValue(float dataValue, sampler1D dataMappingDataValues, sampler1D dataMappingColorValues, int numMappingValues) {
if (numMappingValues == 0) {
// Short circuit if no mapping is needed
return dataValue;
@ -99,9 +82,9 @@ float dataToColorMapValue(float dataValue, DataMapping mapping) {
int lowIndex = 0;
int highIndex = numMappingValues - 1;
float lowValue = lookupMappingValue(mapping.dataMappingValues, lowIndex,
float lowValue = lookupMappingValue(dataMappingDataValues, lowIndex,
numMappingValues);
float highValue = lookupMappingValue(mapping.dataMappingValues, highIndex,
float highValue = lookupMappingValue(dataMappingDataValues, highIndex,
numMappingValues);
int reversed = 0;
if (lowValue > highValue) {
@ -117,7 +100,7 @@ float dataToColorMapValue(float dataValue, DataMapping mapping) {
int nextIndex = lowIndex + ((highIndex - lowIndex) / 2);
if (nextIndex > lowIndex && nextIndex < highIndex) {
// Look up next value and determine if it is a high or low
float nextValue = lookupMappingValue(mapping.dataMappingValues,
float nextValue = lookupMappingValue(dataMappingDataValues,
nextIndex, numMappingValues);
if (nextValue < dataValue) {
if (reversed == 0) {
@ -146,9 +129,9 @@ float dataToColorMapValue(float dataValue, DataMapping mapping) {
factor = 1.0 - factor;
}
float lowCmapValue = lookupMappingValue(mapping.colorMappingValues,
float lowCmapValue = lookupMappingValue(dataMappingColorValues,
lowIndex, numMappingValues);
float highCmapValue = lookupMappingValue(mapping.colorMappingValues,
float highCmapValue = lookupMappingValue(dataMappingColorValues,
highIndex, numMappingValues);
return lowCmapValue + (highCmapValue - lowCmapValue) * factor;
@ -180,16 +163,16 @@ float getLinearIndex(float cmapValue, float cmapMin, float cmapMax) {
*/
float valueToLogIndex(float value, float rangeMin, float rangeMax) {
// Account for 0 min index
if (rangeMin == 0) {
if (rangeMin == 0.0) {
rangeMin = 0.0000001;
if (rangeMax < 0) {
if (rangeMax < 0.0) {
rangeMin = -rangeMin;
}
}
int reverse = 0;
if ((value < rangeMin && rangeMin > 0)
|| (value > rangeMin && rangeMin < 0)) {
if ((value < rangeMin && rangeMin > 0.0)
|| (value > rangeMin && rangeMin < 0.0)) {
reverse = 1;
}
@ -200,10 +183,10 @@ float valueToLogIndex(float value, float rangeMin, float rangeMax) {
// Check uncomputable index value, everything between this range is 0,
// rangeMin->rangeMax 0 -> 1, -rangeMin->-rangeMax 0 -> -1
if (value <= rangeMin && value >= -rangeMin) {
return 0;
return 0.0;
}
double index = (log(value) - log(rangeMin))
float index = (log(value) - log(rangeMin))
/ (log(rangeMax) - log(rangeMin));
if (reverse != 0) {
index = -index;
@ -232,12 +215,12 @@ float getLogIndex(float cmapValue, float cmapMin, float cmapMax, int mirror) {
float index = 0.0;
// Flag if min/max values are on opposite sides of zero
int minMaxOpposite = 0;
if ((cmapMin < 0 && cmapMax > 0) || (cmapMin > 0 && cmapMax < 0)) {
if ((cmapMin < 0.0 && cmapMax > 0.0) || (cmapMin > 0.0 && cmapMax < 0.0)) {
minMaxOpposite = 1;
}
if (mirror != 0 || minMaxOpposite != 0) {
if (cmapMax < 0) {
if (cmapMax < 0.0) {
// Invert colormapping if negative range was given
cmapValue = -cmapValue;
}
@ -261,9 +244,9 @@ float getLogIndex(float cmapValue, float cmapMin, float cmapMax, int mirror) {
float logPosCmapMax = absLogZeroVal + log(posCmapMax);
// Calculate index which zeroVal is at based on neg max and pos max
float zeroValIndex = logNegCmapMax / (logNegCmapMax + logPosCmapMax);
if (cmapValue > 0) {
if (cmapValue > 0.0) {
index = valueToLogIndex(rangeValue, zeroVal, posCmapMax);
index = zeroValIndex + (1 - zeroValIndex) * index;
index = zeroValIndex + (1.0 - zeroValIndex) * index;
} else {
index = valueToLogIndex(rangeValue, zeroVal, negCmapMax);
index = zeroValIndex - zeroValIndex * index;
@ -277,8 +260,8 @@ float getLogIndex(float cmapValue, float cmapMin, float cmapMax, int mirror) {
if (inverted == 1) {
index = 1.0 - index;
}
if (cmapMin > 0 && cmapValue < rangeMin
|| (cmapMin < 0 && cmapValue > -rangeMin)) {
if (cmapMin > 0.0 && cmapValue < rangeMin
|| (cmapMin < 0.0 && cmapValue > -rangeMin)) {
index = -index;
}
}
@ -333,13 +316,13 @@ float getColorMappingIndex(float cmapValue, ColorMapping colorMapping) {
/**
* Returns a color for the index based on the ColorMapping
*/
vec4 getColorByIndex(float index, ColorMapping colorMapping) {
vec4 getColorByIndex(float index, sampler1D colorMap, sampler1D alphaMask, int applyMask) {
// Lookup color in colorMap for index
vec4 textureColor = texture1D(colorMapping.colorMap, index).rgba;
vec4 textureColor = texture1D(colorMap, index).rgba;
// Apply alpha mask
if (colorMapping.applyMask == 1) {
if (texture1D(colorMapping.alphaMask, index).r != 0.0) {
if (applyMask == 1) {
if (texture1D(alphaMask, index).r != 0.0) {
textureColor = vec4(textureColor.rgb, 0.0);
}
}
@ -349,7 +332,7 @@ vec4 getColorByIndex(float index, ColorMapping colorMapping) {
/**
* Returns a color for the cmapValue based on the ColorMapping
*/
vec4 getColorByValue(float cmapValue, ColorMapping colorMapping) {
return getColorByIndex(getColorMappingIndex(cmapValue, colorMapping),
colorMapping);
vec4 getColorByValue(float cmapValue, ColorMapping colorMapping, sampler1D colorMap, sampler1D alphaMask) {
float index = getColorMappingIndex(cmapValue, colorMapping);
return getColorByIndex(index, colorMap, alphaMask, colorMapping.applyMask);
}

View file

@ -3,21 +3,27 @@
#include <mapping>
uniform DataTexture imageData;
uniform DataMapping imageToMosaic;
uniform DataTexture mosaicData;
uniform sampler2D imageDataTex;
uniform DataTextureInfo imageData;
uniform sampler1D imageToMosaicDataValues;
uniform sampler1D imageToMosaicColorValues;
uniform int imageToMosaicValues;
uniform sampler2D mosaicDataTex;
uniform DataTextureInfo mosaicData;
void main(void) {
float imageValue = textureToDataValue(imageData, gl_TexCoord[0].st);
float imageValue = textureToDataValue(imageDataTex, imageData, gl_TexCoord[0].st);
vec2 frag_xy = gl_FragCoord.xy;
float mosaicValue = textureToDataValue(mosaicData,
float mosaicValue = textureToDataValue(mosaicDataTex, mosaicData,
vec2(frag_xy.x / mosaicData.width, frag_xy.y / mosaicData.height));
float newValue = mosaicValue;
// No data check/special NaN check
if (imageValue != imageData.noDataValue && imageValue == imageValue) {
// Convert image value to mosaic value
imageValue = dataToColorMapValue(imageValue, imageToMosaic);
imageValue = dataToColorMapValue(imageValue, imageToMosaicDataValues, imageToMosaicColorValues, imageToMosaicValues);
if (imageValue > mosaicValue) {
newValue = imageValue;
}

View file

@ -3,14 +3,20 @@
#include <mapping>
uniform DataTexture imageData;
uniform DataMapping imageToMosaic;
uniform DataTexture mosaicData;
uniform sampler2D imageDataTex;
uniform DataTextureInfo imageData;
uniform sampler1D imageToMosaicDataValues;
uniform sampler1D imageToMosaicColorValues;
uniform int imageToMosaicValues;
uniform sampler2D mosaicDataTex;
uniform DataTextureInfo mosaicData;
void main(void) {
float imageValue = textureToDataValue(imageData, gl_TexCoord[0].st);
float imageValue = textureToDataValue(imageDataTex, imageData, gl_TexCoord[0].st);
vec2 frag_xy = gl_FragCoord.xy;
float mosaicValue = textureToDataValue(mosaicData,
float mosaicValue = textureToDataValue(mosaicDataTex, mosaicData,
vec2(frag_xy.x / mosaicData.width, frag_xy.y / mosaicData.height));
float newValue;
@ -19,7 +25,7 @@ void main(void) {
// Use existing value
newValue = mosaicValue;
} else {
newValue = dataToColorMapValue(imageValue, imageToMosaic);
newValue = dataToColorMapValue(imageValue, imageToMosaicDataValues, imageToMosaicColorValues, imageToMosaicValues);
}
gl_FragColor = vec4(dataToTextureValue(mosaicData, newValue), 0.0, 0.0,
1.0);

View file

@ -110,8 +110,7 @@ public class GLStats {
lowMem |= getSystemStats(output);
lowMem |= getImageCacheStats(output);
lowMem |= getNvidiaStats(gl, output);
// The ATI version is untested, only enable if it has been tested.
// lowMem |= getAtiStats(gl, output);
lowMem |= getAtiStats(gl, output);
if (lowMem) {
lastPrintTime = curTime;

View file

@ -19,9 +19,6 @@
**/
package com.raytheon.viz.core.gl.ext.imaging;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.util.HashSet;
import java.util.Set;
@ -41,6 +38,9 @@ import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.core.gl.AbstractGLMesh;
import com.raytheon.viz.core.gl.GLCapabilities;
import com.raytheon.viz.core.gl.GLGeometryObject2D;
import com.raytheon.viz.core.gl.GLGeometryObject2D.GLGeometryObjectData;
import com.raytheon.viz.core.gl.GLGeometryPainter;
import com.raytheon.viz.core.gl.IGLTarget;
import com.raytheon.viz.core.gl.glsl.GLSLFactory;
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
@ -57,7 +57,10 @@ import com.vividsolutions.jts.geom.Coordinate;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 15, 2011 mschenke Initial creation
* Dec 15, 2011 mschenke Initial creation
* Jan 9, 2014 2680 mschenke Switched simple PixelCoverage mesh
* rendering to use VBOs instead of
* deprecated immediate mode rendering
*
* </pre>
*
@ -206,6 +209,11 @@ public abstract class AbstractGLImagingExtension extends
continue;
}
}
// Needed to fix ATI driver bug, after each image render, flush the
// GL pipeline to avoid random images being drawn improperly. May be
// fixed with driver update or cleaning up how image coverages are
// rendered (getting rid of glEnableClientState as it is deprecated)
gl.glFlush();
}
if (lastTextureType != -1) {
@ -258,46 +266,36 @@ public abstract class AbstractGLImagingExtension extends
return ((AbstractGLMesh) mesh).paint(target, paintProps);
}
} else if (coords != null) {
FloatBuffer fb = ByteBuffer.allocateDirect(4 * 5 * 4)
.order(ByteOrder.nativeOrder()).asFloatBuffer();
Coordinate ul = pc.getUl();
Coordinate ur = pc.getUr();
Coordinate lr = pc.getLr();
Coordinate ll = pc.getLl();
fb.put(new float[] { coords.left() + corrFactor,
coords.bottom() + corrFactor });
fb.put(new float[] { (float) ll.x, (float) ll.y, (float) ll.z });
int geometryType = GL.GL_TRIANGLE_STRIP;
GLGeometryObject2D vertexData = new GLGeometryObject2D(
new GLGeometryObjectData(geometryType, GL.GL_VERTEX_ARRAY));
vertexData.allocate(4);
vertexData.addSegment(new double[][] { { ll.x, ll.y },
{ lr.x, lr.y }, { ul.x, ul.y }, { ur.x, ur.y } });
vertexData.compile(gl);
fb.put(new float[] { coords.right() - corrFactor,
coords.bottom() + corrFactor });
fb.put(new float[] { (float) lr.x, (float) lr.y, (float) lr.z });
GLGeometryObject2D textureData = new GLGeometryObject2D(
new GLGeometryObjectData(geometryType,
GL.GL_TEXTURE_COORD_ARRAY));
textureData.allocate(4);
textureData.addSegment(new double[][] {
{ coords.left(), coords.bottom() },
{ coords.right(), coords.bottom() },
{ coords.left(), coords.top() },
{ coords.right(), coords.top() } });
textureData.compile(gl);
fb.put(new float[] { coords.left() + corrFactor,
coords.top() - corrFactor });
fb.put(new float[] { (float) ul.x, (float) ul.y, (float) ul.z });
GLGeometryPainter.paintGeometries(gl, vertexData, textureData);
fb.put(new float[] { coords.right() - corrFactor,
coords.top() - corrFactor });
fb.put(new float[] { (float) ur.x, (float) ur.y, (float) ur.z });
vertexData.dispose();
textureData.dispose();
// Clear error bit
gl.glGetError();
gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
gl.glInterleavedArrays(GL.GL_T2F_V3F, 0, fb.rewind());
int error = gl.glGetError();
if (error == GL.GL_NO_ERROR) {
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
} else {
target.handleError(error);
}
gl.glDisableClientState(GL.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY);
return PaintStatus.PAINTED;
}
return PaintStatus.ERROR;

View file

@ -56,7 +56,9 @@ public class GLSLStructFactory {
int texBinding, AbstractGLColormappedImage image) {
ColorMapParameters parameters = image.getColorMapParameters();
AbstractGLColorMapDataFormat dataFormat = image.getDataFormat();
setFieldUniform(program, name, "rawTex", texBinding);
// Set the texture outside the struct
setFieldUniform(program, name + "Tex", texBinding);
// Set struct fields
setFieldUniform(program, name, "noDataValue",
parameters.getNoDataValue());
setFieldUniform(program, name, "isScaled", dataFormat.isScaled());
@ -82,11 +84,9 @@ public class GLSLStructFactory {
public static void createDataMapping(GLShaderProgram program, String name,
int dataMappingTexBinding, int colorMappingTexBinding,
int numMappingValues) {
setFieldUniform(program, name, "dataMappingValues",
dataMappingTexBinding);
setFieldUniform(program, name, "colorMappingValues",
colorMappingTexBinding);
setFieldUniform(program, name, "numMappingValues", numMappingValues);
setFieldUniform(program, name + "DataValues", dataMappingTexBinding);
setFieldUniform(program, name + "ColorValues", colorMappingTexBinding);
setFieldUniform(program, name + "Values", numMappingValues);
}
/**
@ -101,12 +101,12 @@ public class GLSLStructFactory {
public static void createColorMapping(GLShaderProgram program, String name,
int colorMapTexBinding, int alphaMaskTexBinding,
ColorMapParameters parameters) {
setFieldUniform(program, name, "colorMap", colorMapTexBinding);
setFieldUniform(program, name + "ColorMap", colorMapTexBinding);
setFieldUniform(program, name, "cmapMin", parameters.getColorMapMin());
setFieldUniform(program, name, "cmapMax", parameters.getColorMapMax());
setFieldUniform(program, name, "applyMask", parameters.isUseMask());
setFieldUniform(program, name, "alphaMask", alphaMaskTexBinding);
setFieldUniform(program, name + "AlphaMask", alphaMaskTexBinding);
setFieldUniform(program, name, "isMirrored", parameters.isMirror());
setFieldUniform(program, name, "isLogarithmic",
@ -132,6 +132,13 @@ public class GLSLStructFactory {
private static void setFieldUniform(GLShaderProgram program,
String structName, String fieldName, Object fieldValue) {
program.setUniform(structName + FIELD_SEPERATOR + fieldName, fieldValue);
setFieldUniform(program, structName + FIELD_SEPERATOR + fieldName,
fieldValue);
}
private static void setFieldUniform(GLShaderProgram program,
String fieldName, Object fieldValue) {
program.setUniform(fieldName, fieldValue);
}
}

View file

@ -280,7 +280,7 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
gl = GLU.getCurrentGL();
theWidth = width;
theHeight = width;
theHeight = height;
float magnificationVal = Activator.getDefault().getPreferenceStore()
.getFloat(PreferenceConstants.P_FONT_MAGNIFICATION);
@ -324,7 +324,7 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
gl = GLU.getCurrentGL();
theWidth = width;
theHeight = width;
theHeight = height;
float magnificationVal = Activator.getDefault().getPreferenceStore()
.getFloat(PreferenceConstants.P_FONT_MAGNIFICATION);
@ -1706,8 +1706,9 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
endAzm += 360.0;
}
double totalAzimuth = (endAzm - startAzm);
boolean includeSides = circle.includeSides && !fill
&& ((endAzm - startAzm) < 360.0);
&& (totalAzimuth < 360.0);
if (fill) {
gl.glBegin(GL.GL_TRIANGLE_FAN);
@ -1720,8 +1721,16 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
}
}
double step = (endAzm - startAzm) / (circle.numberOfPoints);
for (double azm = startAzm; azm <= endAzm; azm += step) {
// Get the number of unique points in the circle
int points = circle.numberOfPoints;
if (totalAzimuth >= 360) {
// If angle is meant to be complete circle, add extra point
// to ensure circle is touching
points += 1;
}
double step = totalAzimuth / (points - 1);
for (int i = 0; i < points; ++i) {
double azm = startAzm + (i * step);
double[] pointOnCircle = getPointOnCircle(x, y, z, radius,
azm);
gl.glVertex3d(pointOnCircle[0], pointOnCircle[1],
@ -1784,8 +1793,12 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
message = "GL table too large?";
break;
}
case GL.GL_INVALID_FRAMEBUFFER_OPERATION_EXT: {
message = "Invalid FrameBuffer operation";
break;
}
default: {
message = "GL Error" + errorid;
message = "GL Error: " + errorid;
}
}

View file

@ -35,6 +35,9 @@ import com.raytheon.viz.core.gl.GLDisposalManager.GLDisposer;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 13, 2007 chammack Initial Creation.
* Jan 9, 2013 2680 mschenke Changed size calculation to longs to
* avoid int overflow when using cache
* size > 1GB
*
* </pre>
*
@ -90,14 +93,15 @@ public class ImageCache extends LRUCache<Object, IImageCacheable> implements
public static ImageCache getInstance(CacheType type) {
if (type == CacheType.MEMORY) {
if (memoryCache == null) {
memoryCache = new ImageCache(1024 * 1024 * MEMORY_CACHE_SIZE);
memoryCache = new ImageCache(1024L * 1024L * MEMORY_CACHE_SIZE);
}
return memoryCache;
}
if (type == CacheType.TEXTURE) {
if (textureCache == null) {
textureCache = new ImageCache(1024 * 1024 * TEXTURE_CACHE_SIZE);
textureCache = new ImageCache(
1024L * 1024L * TEXTURE_CACHE_SIZE);
}
return textureCache;
}

View file

@ -32,7 +32,8 @@ import javax.media.opengl.GL;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 17, 2012 bsteffen Initial creation
* Feb 17, 2012 bsteffen Initial creation
* Jan 9, 2014 2680 mschenke Added default error message handling
*
* </pre>
*
@ -113,8 +114,11 @@ public class GLFrameBufferObject extends GLIdWrapper {
errorMessage = "Error: Framebuffer not supported by hardware/drivers";
break;
}
default: {
errorMessage = "Framebuffer is not complete, unknown reason";
break;
}
}
return errorMessage;
}
}

View file

@ -36,6 +36,8 @@ import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters.PersistedParameters;
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.IDataRecord;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.style.LabelingPreferences;
import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
@ -91,6 +93,8 @@ public class TopoResource extends
protected TileSetRenderable topoTileSet;
private double noDataValue;
protected TopoResource(TopoResourceData topoData,
LoadProperties loadProperties, File dataFile) throws VizException {
super(topoData, loadProperties);
@ -189,12 +193,13 @@ public class TopoResource extends
}
SamplePreferences samplePrefs = prefs.getSamplePrefs();
if (samplePrefs != null && samplePrefs.getFormatString() != null) {
if ((samplePrefs != null)
&& (samplePrefs.getFormatString() != null)) {
params.setFormatString(samplePrefs.getFormatString());
}
LabelingPreferences labelPrefs = prefs.getColorbarLabeling();
if (labelPrefs != null && labelPrefs.getValues() != null) {
if ((labelPrefs != null) && (labelPrefs.getValues() != null)) {
params.setColorBarIntervals(labelPrefs.getValues());
}
}
@ -213,6 +218,16 @@ public class TopoResource extends
getCapability(ColorMapCapability.class).setColorMapParameters(params);
IDataStore dataStore = DataStoreFactory.getDataStore(this.dataFile);
try {
IDataRecord rec = dataStore.retrieve("/", "full",
Request.buildPointRequest(new java.awt.Point(0, 0)));
noDataValue = rec.getFillValue().doubleValue();
} catch (Exception e) {
statusHandler.error(e.getLocalizedMessage(), e);
noDataValue = Double.NaN;
}
topoTileSet = new TileSetRenderable(
getCapability(ImagingCapability.class), getTopoGeometry(),
getTopoTileImageCreator(), getNumberOfTopoLevels(), 512);
@ -284,7 +299,7 @@ public class TopoResource extends
double height;
try {
// height = TopoQuery.getInstance().getHeight(coord.asLatLon());
height = topoTileSet.interrogate(coord.asLatLon());
height = topoTileSet.interrogate(coord.asLatLon(), noDataValue);
} catch (Exception e) {
throw new VizException("Error transforming", e);
}

View file

@ -1,5 +1,4 @@
#!/bin/bash
# CAVE startup script
# Note: CAVE will not run as 'root'
@ -25,8 +24,6 @@
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Dec 04, 2013 #2589 dgilling Create command-line arg that controls
# xvfb initialization.
# Dec 05, 2013 #2593 rjpeter set IGNORE_NUM_CAVES
# Dec 05, 2013 #2590 dgilling Remove duplicated code and call to
# cave.sh.
@ -50,28 +47,12 @@ fi
PROGRAM_NAME="gfeclient"
# remove "-enablegl" flag from command-line if set so it doesn't confuse any
# commands we call later.
USER_ARGS=()
while [[ $1 ]]
do
if [ "$1" == "-enablegl" ]
then
ENABLEGL="true"
else
USER_ARGS+=("$1")
fi
shift
done
if [ -n "$ENABLEGL" ]
# if display not set
if [ -n "$DISPLAY" ]
then
# if display not set
if [ -n "$DISPLAY" ]
then
echo "Using Display set to $DISPLAY"
extendLibraryPath
else
else
echo "Display not set, creating offscreen x on port $$"
extendLibraryPath "-noX"
Xvfb :$$ -screen 0 1280x1024x24 &
@ -79,13 +60,12 @@ then
export DISPLAY="localhost:$$.0"
#don't use shader when no display set
SWITCHES="${SWITCHES} -no_shader"
fi
fi
export IGNORE_NUM_CAVES=1
source /awips2/cave/cave.sh -nosplash -noredirect -component gfeclient "${USER_ARGS[@]}" &
wait
source /awips2/cave/cave.sh -nosplash -noredirect -component gfeclient "$@" &
wait $!
if [ -n "$xvfb" ]
then

View file

@ -24,6 +24,7 @@
# ------------ ---------- ----------- --------------------------
# Dec 04, 2013 #2589 dgilling Create command-line arg that controls
# xvfb initialization.
# Feb 07, 2014 #2509 dgilling Fix baseline merge issue.
#
#
@ -37,8 +38,7 @@ CAVE_DIR=/awips2/cave
# execute the runProcedure module
_GFECLI="${RUN_FROM_DIR}/gfeclient.sh"
_GFECLI_ARGS="-enablegl"
_MODULE="${CAVE_DIR}/etc/gfe/utility/PngWriter.py"
_MODULE="${RUN_FROM_DIR}/src/ifpimage/PngWriter.py"
# quoting of '$@' is used to prevent command line interpretation
if [ ! -f $_GFECLI ] || [ ! -d $CAVE_DIR ]
@ -46,6 +46,6 @@ then
echo "CAVE and/or gfeclient not installed on this workstation ..exiting"
exit 1
else
$_GFECLI $_GFECLI_ARGS $_MODULE "$@"
$_GFECLI $_MODULE "$@"
fi

View file

@ -505,16 +505,16 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
def windSpdProb_thresholds(self, tree, node):
return [
((50.0, 80.0), (40.0, 60.0)), # Per 1
(45.0, 32.5), # Per 2
(40.0, 25.0), # Per 3
(35.0, 20.0), # Per 4
(30.0, 15.0), # Per 5
(25.0, 12.5), # Per 6
(22.5, 10.0), # Per 7
(20.0, 8.0), # Per 8
(17.5, 6.0), # Per 9
(15.0, 5.0), # Per 10
((45.0, 80.0), (25.0, 60.0)), # Per 1
(35.0, 20.0), # Per 2
(30.0, 15.0), # Per 3
(25.0, 12.5), # Per 4
(22.5, 10.0), # Per 5
(20.0, 8.0), # Per 6
(17.5, 7.0), # Per 7
(15.0, 6.0), # Per 8
(12.5, 5.0), # Per 9
(10.0, 4.0), # Per 10
]
def firstComponentPeriod(self, tree, node):
@ -1130,7 +1130,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
desc = "posHR"
elif maxMag >= 34.0:
desc = "posTS"
elif pws64 >= thresh64low or pws64 +2.0 >= thresh64low:
elif pws64 >= thresh64low or pws64 +5.0 >= thresh64low:
desc = "posHR"
elif pws34 >= thresh34low or pws34+10.0 >= thresh34low:
desc = "posTS"
@ -1203,7 +1203,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
desc = "posHR"
elif maxMag >= 34.0:
desc = "posTS"
elif pws64 >= thresh64 or pws64 +2.0 >= thresh64:
elif pws64 >= thresh64 or pws64 +5.0 >= thresh64:
desc = "posHR"
elif pws34 >= thresh34 or pws34+10.0 >= thresh34:
desc = "posTS"
@ -1299,7 +1299,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
else:
self.debug_print("HERE I AM")
if pws64 >= thresh64 or pws64+1.0 >= thresh64:
if pws64 >= thresh64 or pws64+2.5 >= thresh64:
desc = "posHR"
elif maxMag >= 64.0:
desc = "posHR"
@ -1399,7 +1399,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
else:
self.debug_print("HERE I AM")
if pws64 >= thresh64 or pws64+1 >= thresh64:
if pws64 >= thresh64 or pws64+2.5 >= thresh64:
desc = "posHR"
elif maxMag >= 64.0:
desc = "posHR"
@ -1435,14 +1435,18 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
self.debug_print("(34 kt threshold, 64 kt threshold) = (%.2f, %.2f)" %
(thresh34, thresh64), 1)
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64) and maxMag >= 20.0:
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64):
desc = "posHR"
elif maxMag >= 64.0:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34) and maxMag >= 20.0:
elif (self._Hurricane_A or self._Hurricane_W) and maxMag >= 50:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34):
desc = "posTS"
elif maxMag >= 34.0:
desc = "posTS"
elif (self._Hurricane_A or self._Hurricane_W or self._TropStorm_A or self._TropStorm_W) and maxMag >= 25:
desc = "posTS"
else:
desc = ""
@ -1470,14 +1474,18 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
self.debug_print("(34 kt threshold, 64 kt threshold) = (%.2f, %.2f)" %
(thresh34, thresh64), 1)
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64) and maxMag >= 20.0:
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64):
desc = "posHR"
elif maxMag >= 64.0:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34) and maxMag >= 20.0:
elif (self._Hurricane_A or self._Hurricane_W) and maxMag >= 50:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34):
desc = "posTS"
elif maxMag >= 34.0:
desc = "posTS"
elif (self._Hurricane_A or self._Hurricane_W or self._TropStorm_A or self._TropStorm_W) and maxMag >= 25:
desc = "posTS"
else:
desc = ""

View file

@ -29,7 +29,7 @@
# ------------ ---------- ----------- --------------------------
# 07/25/08 njensen Initial Creation.
# 09/05/13 #2329 randerso Added error handling
#
# 02/06/2014 #2591 randerso Changed log level to debug
#
import sys, traceback, os, time, LogStream
@ -55,7 +55,7 @@ def getCombinations(comboName):
with open(filename,'r') as fd:
filecontents = fd.read()
LogStream.logProblem("\nERROR loading combinations file: "+ comboName +
LogStream.logDebug("ERROR loading combinations file: "+ comboName +
"\nmd.__file__: " + md.__file__ +
"\ndir(md): " + str(dir(md)) +
"\n" + md.__file__ + " last modified: " + time.strftime("%Y-%m-%d %H:%M:%S",time.gmtime(os.path.getmtime(md.__file__))) +

View file

@ -63,6 +63,7 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager;
* DataManager instance.
* 05 SEP 2013 2329 randerso Added call to ZoneCombinerComp.applyZoneCombo when
* when run formatter button is clicked.
* 05 FEB 2014 2591 randerso Added dataManager to ZoneCombinerComp constructor
*
* </pre>
*
@ -592,7 +593,7 @@ public class ProductAreaComp extends Composite implements
*/
private void createZoneCombinerComp() {
zoneCombiner = new ZoneCombinerComp(stackGridComp, productTabCB,
productName, getTextProductManager());
productName, getTextProductManager(), this.dataMgr);
}
/**

View file

@ -152,6 +152,10 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 05/08/2013 #1842 dgilling Add alternate setProductText(), fix
* warnings.
* 09/03/2013 16534 ryu Refactor; sneak in a change for Ron (RM #1597).
* 01/06/2014 2649 dgilling Pass flag to StoreTransmitDlg to only
* update VTEC lines on products that
* aren't being corrected.
* 02/05/2014 17022 ryu Modified loadDraft() to fix merging of WMO heading and AWIPS ID.
*
* </pre>
*
@ -1139,7 +1143,7 @@ public class ProductEditorComp extends Composite implements
// prevent the launching of another dialog until the modal dialog is
// closed.
StoreTransmitDlg storeDlg = new StoreTransmitDlg(parent.getShell(),
showStore, this, transmissionCB, pid);
showStore, this, transmissionCB, pid, !textComp.isCorMode());
storeDlg.open();
}
}
@ -2386,10 +2390,13 @@ public class ProductEditorComp extends Composite implements
}
DraftProduct draft = DraftProduct.load(lf);
setTabColorFunc(productStateEnum.Finished);
productDefinition = draft.getProductDefinition();
clearProductText();
setProductText(draft.getProductText());
setTabColorFunc(productStateEnum.Finished);
setStatusText('R', productId + " draft loaded.");
if (productDefinition.get("brain") != null) {
brain();
String msg = "Your saved draft was loaded, but the draft is invalid "
@ -2877,7 +2884,7 @@ public class ProductEditorComp extends Composite implements
mb2.open();
return;
}
// Word-wrap the whole selection.
int curLine = styledText.getLineAtOffset(selectionRange.x);
int lastSelIdx = selectionRange.x + selectionRange.y - 1;

View file

@ -21,8 +21,8 @@ package com.raytheon.viz.gfe.dialogs.formatterlauncher;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@ -67,18 +67,24 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 21 APR 2008 ### lvenable Initial creation
* 19 FEB 2010 4132 ryu Product correction.
* 28May2010 2187 cjeanbap Added StdTextProductFactory
* functionality.
* 09 NOV 2012 1298 rferrel Changes for non-blocking dialog.
* 02apr2013 15564 mgamazaychikov Ensured awipsWanPil to be 10 characters space-padded long
* 08 MAY 2013 1842 dgilling Use VtecUtil to set product ETNs, fix
* Apr 21, 2008 ### lvenable Initial creation
* Feb 19, 2010 4132 ryu Product correction.
* May 28, 2010 2187 cjeanbap Added StdTextProductFactory
* functionality.
* Nov 09, 2012 1298 rferrel Changes for non-blocking dialog.
* Apr 02, 2013 15564 mgamazaychikov Ensured awipsWanPil to be 10 characters
* space-padded long
* May 08, 2013 1842 dgilling Use VtecUtil to set product ETNs, fix
* warnings.
* 07 Jun 2013 1981 mpduff Set user's id in OUPRequest as it is now a protected operation.
* 23 Oct 2013 1843 dgilling Ensure that dialog is always closed,
* Jun 07, 2013 1981 mduff Set user's id in OUPRequest as it is
* now a protected operation.
* Oct 23, 2013 1843 dgilling Ensure that dialog is always closed,
* even on failure, changes for error handling
* of intersite ETN assignment.
* Dec 18, 2013 2641 dgilling Support changes to GFEVtecUtil.getVtecLinesThatNeedEtn().
* Jan 06, 2014 2649 dgilling Make ETN assignment process optional.
* Feb 17, 2014 2774 dgilling Merge changes from 14.1 baseline to 14.2.
*
* </pre>
*
* @author lvenable
@ -141,17 +147,26 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
private final String pid;
private final boolean updateVtec;
/**
* Constructor.
*
* @param parent
* Parent shell.
* @param storeDialog
* Store flag. True is store, false is transmit.
* @param editor
* Parent editor. Product will be updated in this editor after
* transmission.
* @param transmissionCB
* @param pid
* @param updateVtec
* Whether or not to update the ETNs of any VTEC lines in the
* product to be transmitted. Recommend setting this to false
* when correcting a previously transmitted product.
*/
public StoreTransmitDlg(Shell parent, boolean storeDialog,
ProductEditorComp editor, ITransmissionState transmissionCB,
String pid) {
String pid, boolean updateVtec) {
super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
CAVE.DO_NOT_BLOCK);
@ -160,6 +175,7 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
parentEditor = editor;
this.productText = editor.getProductText();
this.pid = pid;
this.updateVtec = updateVtec;
}
@Override
@ -343,114 +359,78 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
// Store/Transmit the product...
if (!countdownThread.threadCancelled()) {
boolean retrieveEtnFailed = false;
try {
if (updateVtec) {
// With GFE VTEC products, it's possible to have multiple
// segments with NEW vtec action codes and the same phensig.
// For
// this reason, HazardsTable.py implemented a "cache" that
// would
// ensure all NEWs for the same phensig would be assigned
// the
// same ETN. This Map replicates that legacy behavior.
//
// This "cache" has two levels:
// 1. The first level is keyed by the hazard's phensig.
// 2. The second level is keyed by the valid period of the
// hazard.
// Effectively, making this a Map<Phensig, Map<ValidPeriod,
// ETN>>.
Map<String, List<VtecObject>> vtecsToAssignEtn = GFEVtecUtil
.initETNCache(productText);
Map<String, Map<TimeRange, Integer>> etnCache = new HashMap<String, Map<TimeRange, Integer>>();
Set<VtecObject> vtecsToAssignEtn = GFEVtecUtil
.getVtecLinesThatNeedEtn(productText);
// With GFE VTEC products, it's possible to have multiple segments
// with
// NEW vtec action codes and the same phensig. For this reason,
// HazardsTable.py implemented a "cache" that would ensure all NEWs
// for
// the same phensig would be assigned the same ETN. This Map
// replicates
// that legacy behavior.
//
// This "cache" has two levels:
// 1. The first level is keyed by the hazard's phensig.
// 2. The second level is keyed by the valid period of the hazard.
// Effectively, making this a Map<Phensig, Map<ValidPeriod, ETN>>.
Map<String, Map<TimeRange, Integer>> etnCache = new HashMap<String, Map<TimeRange, Integer>>();
for (String phensig : vtecsToAssignEtn.keySet()) {
Map<TimeRange, Integer> l2EtnCache = new HashMap<TimeRange, Integer>();
List<VtecObject> vtecs = vtecsToAssignEtn.get(phensig);
for (VtecObject vtec : vtecsToAssignEtn) {
try {
GetNextEtnResponse serverResponse = GFEVtecUtil.getNextEtn(
vtec.getOffice(), vtec.getPhensig(), true, true);
if (!serverResponse.isOkay()) {
final VtecObject vtecToFix = vtec;
final boolean[] exitLoopContainer = { false };
final Exception[] exceptionContainer = { null };
final GetNextEtnResponse[] responseContainer = { serverResponse };
for (int i = 0; i < vtecs.size(); i++) {
VtecObject vtec = vtecs.get(i);
TimeRange validPeriod = new TimeRange(
vtec.getStartTime(), vtec.getEndTime());
Integer currentEtn = vtec.getSequence();
do {
getDisplay().syncExec(new Runnable() {
@Override
public void run() {
GetNextEtnResponse serverResponse = responseContainer[0];
ETNConfirmationDialog dlg = new ETNConfirmationDialog(
getShell(), serverResponse);
if (dlg.open() == ETNConfirmationDialog.OK) {
int etn = dlg.getProposedEtn();
statusHandler.info(String
.format("User confirmed ETN for %s: %04d",
serverResponse
.getPhensig(),
etn));
try {
GetNextEtnResponse followupResp = GFEVtecUtil.getNextEtn(
vtecToFix.getOffice(),
vtecToFix.getPhensig(),
true, true, true, etn);
responseContainer[0] = followupResp;
} catch (VizException e) {
exceptionContainer[0] = e;
exitLoopContainer[0] = true;
}
} else {
statusHandler
.info("User declined to fix ETN for %s",
serverResponse
.getPhensig());
exitLoopContainer[0] = true;
}
}
});
} while (!responseContainer[0].isOkay()
&& !exitLoopContainer[0]);
if (!responseContainer[0].isOkay()) {
String msg = "Unable to set ETN for phensig "
+ responseContainer[0].getPhensig()
+ "\nStatus: "
+ responseContainer[0].toString();
Exception e = exceptionContainer[0];
if (e == null) {
throw new VizException(msg);
// the first time we select a new, unique ETN, any
// other
// VTEC lines in the product that have the same
// phensig
// and an adjacent TimeRange can also re-use this
// ETN
if (currentEtn == 0) {
currentEtn = getNextEtn(vtec);
l2EtnCache.put(validPeriod, currentEtn);
} else {
throw new VizException(msg, e);
// BUT...once we've made our one pass through
// the
// product and re-used the ETN where
// appropriate, we
// should not check again
continue;
}
for (int j = i + 1; j < vtecs.size(); j++) {
VtecObject vtec2 = vtecs.get(j);
TimeRange validPeriod2 = new TimeRange(
vtec2.getStartTime(),
vtec2.getEndTime());
Integer currentEtn2 = vtec2.getSequence();
if ((currentEtn2 == 0)
&& (validPeriod2
.isAdjacentTo(validPeriod) || validPeriod2
.overlaps(validPeriod))) {
l2EtnCache.put(validPeriod2, currentEtn);
vtec2.setSequence(currentEtn);
}
}
} else {
serverResponse = responseContainer[0];
}
etnCache.put(phensig, l2EtnCache);
}
TimeRange validPeriod = new TimeRange(vtec.getStartTime()
.getTime(), vtec.getEndTime().getTime());
String phensig = vtec.getPhensig();
Map<TimeRange, Integer> etnsByTR = etnCache.get(phensig);
if (etnsByTR == null) {
etnsByTR = new HashMap<TimeRange, Integer>();
etnCache.put(phensig, etnsByTR);
}
etnsByTR.put(validPeriod, serverResponse.getNextEtn());
} catch (VizException e) {
statusHandler.handle(Priority.CRITICAL,
"Error setting ETNs for product", e);
retrieveEtnFailed = true;
VizApp.runAsync(new Runnable() {
@Override
public void run() {
sendTransmissionStatus(ConfigData.productStateEnum.Failed);
StoreTransmitDlg.this.parentEditor.revive();
}
});
break;
productText = GFEVtecUtil.finalizeETNs(productText,
etnCache);
}
}
if (!retrieveEtnFailed) {
productText = GFEVtecUtil.finalizeETNs(productText, etnCache);
VizApp.runSync(new Runnable() {
@ -475,6 +455,17 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
}
});
} catch (VizException e) {
statusHandler.handle(Priority.CRITICAL,
"Error preparing product for transmission.", e);
VizApp.runAsync(new Runnable() {
@Override
public void run() {
sendTransmissionStatus(ConfigData.productStateEnum.Failed);
StoreTransmitDlg.this.parentEditor.revive();
}
});
}
}
@ -489,6 +480,65 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
});
}
private Integer getNextEtn(VtecObject vtec) throws VizException {
GetNextEtnResponse serverResponse = GFEVtecUtil.getNextEtn(
vtec.getOffice(), vtec.getPhensig(), true, true);
if (!serverResponse.isOkay()) {
final VtecObject vtecToFix = vtec;
final boolean[] exitLoopContainer = { false };
final Exception[] exceptionContainer = { null };
final GetNextEtnResponse[] responseContainer = { serverResponse };
do {
getDisplay().syncExec(new Runnable() {
@Override
public void run() {
GetNextEtnResponse serverResponse = responseContainer[0];
ETNConfirmationDialog dlg = new ETNConfirmationDialog(
getShell(), serverResponse);
if (dlg.open() == ETNConfirmationDialog.OK) {
int etn = dlg.getProposedEtn();
statusHandler.info(String.format(
"User confirmed ETN for %s: %04d",
serverResponse.getPhensig(), etn));
try {
GetNextEtnResponse followupResp = GFEVtecUtil
.getNextEtn(vtecToFix.getOffice(),
vtecToFix.getPhensig(), true,
true, true, etn);
responseContainer[0] = followupResp;
} catch (VizException e) {
exceptionContainer[0] = e;
exitLoopContainer[0] = true;
}
} else {
statusHandler.info(
"User declined to fix ETN for %s",
serverResponse.getPhensig());
exitLoopContainer[0] = true;
}
}
});
} while (!responseContainer[0].isOkay() && !exitLoopContainer[0]);
if (!responseContainer[0].isOkay()) {
String msg = "Unable to set ETN for phensig "
+ responseContainer[0].getPhensig() + "\nStatus: "
+ responseContainer[0].toString();
Exception e = exceptionContainer[0];
if (e == null) {
throw new VizException(msg);
} else {
throw new VizException(msg, e);
}
} else {
serverResponse = responseContainer[0];
}
}
return serverResponse.getNextEtn();
}
/**
* Method to transmit the product.
*/
@ -596,4 +646,4 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
transmissionCB.setTransmissionState(status);
}
}
}
}

View file

@ -58,8 +58,7 @@ import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.CombinationsFileChangedNotification;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
@ -74,7 +73,9 @@ import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.core.internal.NotificationRouter.AbstractGFENotificationObserver;
import com.raytheon.viz.gfe.textformatter.CombinationsFileUtil;
import com.raytheon.viz.gfe.textformatter.TextProductManager;
import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector;
@ -99,6 +100,12 @@ import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector;
* not found to match A1.
* Dec 03, 2013 #2591 dgilling Ensure all change states to the combo
* file are handled.
* Jan 07, 2014 #2662 randerso Disabled zone combiner if no maps are selected
* Feb 04, 2014 #2591 randerso Forced reload of combinations file after save to ensure
* file is updated prior to running formatter
* Changed to use CombinationsFileChangedNotification instead of
* FileUpdatedMessage so we can ignore our own changes
* Moved retrieval of combinations file to CombinationsFileUtil.init
*
* </pre>
*
@ -106,8 +113,7 @@ import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector;
* @version 1.0
*
*/
public class ZoneCombinerComp extends Composite implements
ILocalizationFileObserver, IZoneCombiner {
public class ZoneCombinerComp extends Composite implements IZoneCombiner {
private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ZoneCombinerComp.class);
@ -190,6 +196,8 @@ public class ZoneCombinerComp extends Composite implements
protected TextProductManager textProductMgr;
protected DataManager dataManager;
protected String product;
protected boolean mapRequired;
@ -223,6 +231,8 @@ public class ZoneCombinerComp extends Composite implements
private List<String> mapNames;
private AbstractGFENotificationObserver<CombinationsFileChangedNotification> comboChangeListener;
private void initPreferences() {
IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
@ -246,7 +256,8 @@ public class ZoneCombinerComp extends Composite implements
* Product name.
*/
public ZoneCombinerComp(Composite parent, IProductTab callBack,
String productName, TextProductManager textProductMgr) {
String productName, TextProductManager textProductMgr,
DataManager dataManager) {
super(parent, SWT.NONE);
this.parent = parent;
@ -257,7 +268,13 @@ public class ZoneCombinerComp extends Composite implements
this.textProductMgr = textProductMgr;
mapRequired = textProductMgr.mapRequired(productName);
this.dataManager = dataManager;
mapRequired = this.textProductMgr.mapRequired(productName);
this.mapNames = getMapNames(productName);
if (mapNames.isEmpty()) {
mapRequired = false;
}
initPreferences();
init();
@ -267,15 +284,47 @@ public class ZoneCombinerComp extends Composite implements
LocalizationType.CAVE_STATIC, LocalizationLevel.BASE);
comboDir = pathMgr.getLocalizationFile(baseCtx,
CombinationsFileUtil.COMBO_DIR_PATH);
comboDir.addFileUpdatedObserver(this);
this.comboChangeListener = new AbstractGFENotificationObserver<CombinationsFileChangedNotification>(
CombinationsFileChangedNotification.class) {
@Override
public void notify(
CombinationsFileChangedNotification notificationMessage) {
comboFileChanged(notificationMessage);
}
};
this.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
comboDir.removeFileUpdatedObserver(ZoneCombinerComp.this);
ZoneCombinerComp.this.dataManager.getNotificationRouter()
.removeObserver(
ZoneCombinerComp.this.comboChangeListener);
}
});
dataManager.getNotificationRouter().addObserver(
this.comboChangeListener);
}
private List<String> getMapNames(String productName) {
Object obj = this.textProductMgr.getMapNameForCombinations(productName);
List<String> mapNames = new ArrayList<String>();
if (obj instanceof String) {
String s = (String) obj;
if (!s.isEmpty()) {
mapNames.add(s);
}
} else if (obj instanceof List<?>) {
@SuppressWarnings("unchecked")
List<String> list = (List<String>) obj;
mapNames.addAll(list);
}
return mapNames;
}
/**
@ -757,9 +806,14 @@ public class ZoneCombinerComp extends Composite implements
}
try {
String comboName = getCombinationsFileName();
CombinationsFileUtil.generateAutoCombinationsFile(
zoneSelector.getZoneGroupings(), getCombinationsFileName()
+ ".py");
zoneSelector.getZoneGroupings(), comboName);
// reload here forces file to be retrieved from server before
// allowing formatter to run
loadCombinationsFile(comboName);
applyButtonState(false);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, "Unable to save "
@ -790,21 +844,9 @@ public class ZoneCombinerComp extends Composite implements
}
Map<String, Integer> comboDict = loadCombinationsFile(comboName);
Object obj = textProductMgr.getMapNameForCombinations(productName);
mapNames = new ArrayList<String>();
if (obj instanceof String) {
String s = (String) obj;
if (!s.isEmpty()) {
mapNames.add(s);
}
} else if (obj instanceof List<?>) {
@SuppressWarnings("unchecked")
List<String> list = (List<String>) obj;
mapNames.addAll(list);
}
boolean singleComboOnly = false;
obj = textProductMgr.getDefinitionValue(productName, "singleComboOnly");
Object obj = textProductMgr.getDefinitionValue(productName,
"singleComboOnly");
if (obj != null) {
if (obj instanceof Integer) {
singleComboOnly = ((Integer) obj) != 0;
@ -915,17 +957,7 @@ public class ZoneCombinerComp extends Composite implements
public Map<String, Integer> loadCombinationsFile(String comboName) {
Map<String, Integer> dict = new HashMap<String, Integer>();
try {
File localFile = PathManagerFactory.getPathManager().getStaticFile(
FileUtil.join(CombinationsFileUtil.COMBO_DIR_PATH,
comboName + ".py"));
List<List<String>> combolist = new ArrayList<List<String>>();
if ((localFile != null) && localFile.exists()) {
combolist = CombinationsFileUtil.init(comboName);
} else {
// statusHandler
// .error("Combinations file not found: " + comboName);
}
List<List<String>> combolist = CombinationsFileUtil.init(comboName);
// reformat combinations into combo dictionary
int group = 1;
@ -941,8 +973,7 @@ public class ZoneCombinerComp extends Composite implements
return new HashMap<String, Integer>();
}
currentComboFile = FileUtil.join(CombinationsFileUtil.COMBO_DIR_PATH,
comboName + ".py");
currentComboFile = comboName;
return dict;
}
@ -977,20 +1008,14 @@ public class ZoneCombinerComp extends Composite implements
return colors;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.localization.ILocalizationFileObserver#fileUpdated
* (com.raytheon.uf.common.localization.FileUpdatedMessage)
*/
@Override
public void fileUpdated(FileUpdatedMessage message) {
if (message.getFileName().equalsIgnoreCase(currentComboFile)) {
File file = new File(message.getFileName());
String comboName = file.getName().replace(".py", "");
private void comboFileChanged(CombinationsFileChangedNotification notif) {
String comboName = notif.getCombinationsFileName();
// if it's the same file and not changed by me update the combos
if (comboName.equalsIgnoreCase(currentComboFile)
&& !VizApp.getWsId().equals(notif.getWhoChanged())) {
statusHandler
.info("Received FileUpdatedMessage for combinations file: "
.info("Received CombinationsFileChangedNotification for combinations file: "
+ comboName);
Map<String, Integer> comboDict = loadCombinationsFile(comboName);
this.zoneSelector.updateCombos(comboDict);

View file

@ -59,6 +59,8 @@ import com.raytheon.viz.gfe.rsc.GFEResource;
* Feb 14, 2013 1616 bsteffen Add option for interpolation of colormap
* parameters, disable colormap interpolation
* by default.
* 02/11/2014 #2788 randerso Fixed infinite loop in computeIntervalAndPrecision
* when pmax < pmin
*
* </pre>
*
@ -186,10 +188,10 @@ public class ContinuousColorbar implements IColorBarDisplay {
dstring.font = colorbarResource.getColorbarScaleFont();
dstring.textStyle = TextStyle.NORMAL;
for (int i = 0; (minParm + i * interval) <= maxParm; i++) {
for (int i = 0; (minParm + (i * interval)) <= maxParm; i++) {
// check to see whether this colorTable item needs to be
// rendered
float labelValue = minParm + i * interval;
float labelValue = minParm + (i * interval);
// Check to see if value is same as previous unless float....
if ((tmpValue != (int) labelValue) || (precision > 0)) {
@ -197,7 +199,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
labelValue, precision);
labelLoc = llx
+ ((labelValue - minParm) / (maxParm - minParm) * xExtent);
+ (((labelValue - minParm) / (maxParm - minParm)) * xExtent);
if (GFEColorbarResource.isLabelWithin(pe.getMinX(),
pe.getMaxX(), labelLoc, 0)) {
@ -219,10 +221,10 @@ public class ContinuousColorbar implements IColorBarDisplay {
labelValue = labelValueObj.floatValue();
if (precision == 0) {
labelLoc = llx
+ ((labelValue - minParm) / (maxParm - minParm) * xExtent);
+ (((labelValue - minParm) / (maxParm - minParm)) * xExtent);
} else {
labelLoc = llx
+ ((labelValue - minParm) / (maxParm - minParm) * xExtent);
+ (((labelValue - minParm) / (maxParm - minParm)) * xExtent);
}
if (GFEColorbarResource.isLabelWithin(pe.getMinX(),
pe.getMaxX(), labelLoc, 0)) {
@ -246,7 +248,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
float floatValue = ((ScalarWxValue) wxv).getValue();
if ((floatValue >= minParm) && (floatValue <= maxParm)) {
labelLoc = llx
+ ((floatValue - minParm) / (maxParm - minParm) * xExtent);
+ (((floatValue - minParm) / (maxParm - minParm)) * xExtent);
String s = wxv.toString();
dstring.font = colorbarResource.getPickupValueFont();
@ -261,12 +263,11 @@ public class ContinuousColorbar implements IColorBarDisplay {
dstring.shadowColor = new RGB(0, 0, 0);
}
double halfWidth = target.getStringsBounds(dstring).getWidth()
* ratio / 2;
double halfWidth = (target.getStringsBounds(dstring).getWidth() * ratio) / 2;
if (labelLoc - halfWidth < pe.getMinX()) {
if ((labelLoc - halfWidth) < pe.getMinX()) {
labelLoc = pe.getMinX() + halfWidth;
} else if (labelLoc + halfWidth > pe.getMaxX()) {
} else if ((labelLoc + halfWidth) > pe.getMaxX()) {
labelLoc = pe.getMaxX() - halfWidth;
}
dstring.setCoordinates(labelLoc,
@ -298,7 +299,8 @@ public class ContinuousColorbar implements IColorBarDisplay {
// initial values are good if decade < parmExtent
// loop is infinite if parmExtent is NaN or 0, so avoid it
if (decade < parmExtent || Float.isNaN(parmExtent) || parmExtent == 0.0) {
if (Float.isNaN(parmExtent) || (parmExtent <= 0.0)
|| (decade < parmExtent)) {
return new float[] { finterval, precision, labelLength };
}
@ -438,7 +440,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
switch (parm.getGridInfo().getGridType()) {
case SCALAR:
return new ScalarWxValue(min + (max - min) * fractionX, parm);
return new ScalarWxValue(min + ((max - min) * fractionX), parm);
case VECTOR:
WxValue previous = parm.getParmState().getPickUpValue();
float mag = 0.0f;
@ -448,7 +450,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
dir = ((VectorWxValue) previous).getDir();
}
if (mouseButton == 1) {
mag = min + (max - min) * fractionX;
mag = min + ((max - min) * fractionX);
} else if (mouseButton == 2) {
dir = 360 * fractionX;
}

View file

@ -51,6 +51,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.core.internal.IFPClient;
@ -68,6 +69,8 @@ import com.raytheon.viz.gfe.textformatter.CombinationsFileUtil.ComboData.Entry;
* Sep 05, 2013 #2329 randerso Moved genereateAutoCombinationsFile here
* Cleaned up error handling
* Sep 30, 2013 2361 njensen Use JAXBManager for XML
* Feb 05, 2014 #2591 randerso Forced retrieval of combinations file
* Implemented retry on error
*
* </pre>
*
@ -79,6 +82,8 @@ public class CombinationsFileUtil {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CombinationsFileUtil.class);
private static final int MAX_TRIES = 2;
public static String COMBO_DIR_PATH = FileUtil.join("gfe", "combinations");
public static String SAVED_COMBO_DIR = FileUtil.join("gfe", "comboData");
@ -215,13 +220,20 @@ public class CombinationsFileUtil {
IPathManager pm = PathManagerFactory.getPathManager();
// retrieve combinations file if it's changed
LocalizationFile lf = pm.getStaticLocalizationFile(FileUtil.join(
COMBO_DIR_PATH, comboName + ".py"));
File pyFile;
try {
pyFile = lf.getFile(true);
} catch (LocalizationException e) {
throw new GfeException("Error retrieving combinations file: "
+ comboName, e);
}
LocalizationContext baseContext = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.BASE);
// Strip any path components from comboName
File comboFile = new File(comboName);
comboName = comboFile.getName();
String scriptPath = FileUtil.join(
GfePyIncludeUtil.getUtilitiesLF(baseContext).getFile()
.getPath(), "CombinationsInterface.py");
@ -230,21 +242,41 @@ public class CombinationsFileUtil {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("comboName", comboName);
PythonScript python = null;
for (int retryCount = 0; retryCount < MAX_TRIES; retryCount++) {
try {
python = new PythonScript(scriptPath, PyUtil.buildJepIncludePath(
python = new PythonScript(scriptPath,
PyUtil.buildJepIncludePath(
GfePyIncludeUtil.getCombinationsIncludePath(),
GfePyIncludeUtil.getCommonPythonIncludePath()),
CombinationsFileUtil.class.getClassLoader());
Object com = python.execute("getCombinations", map);
combos = (List<List<String>>) com;
// if successfully retrieved break out of the loop
break;
} catch (JepException e) {
// remove the .pyo file
new File(pyFile.getAbsolutePath() + "o").delete();
// if not last try, log and try again
if (retryCount < MAX_TRIES - 1) {
// log but don't pop up
statusHandler.handle(Priority.EVENTB,
"Error loading combinations file: " + comboName
+ ", retrying ", e);
}
// else throw exception
else {
throw new GfeException("Error loading combinations file: "
+ comboName, e);
}
} finally {
if (python != null) {
python.dispose();
}
}
}
return combos;
}

View file

@ -74,6 +74,7 @@ import com.vividsolutions.jts.geom.Envelope;
* ------------ ---------- ----------- --------------------------
* Aug 23, 2011 randerso Initial creation
* May 30, 2013 #2028 randerso Fixed date line issue with map display
* Jan 07, 2014 #2662 randerso Fixed limitZones (subDomainUGCs) support
*
* </pre>
*
@ -158,7 +159,6 @@ public abstract class AbstractZoneSelector extends PaneManager {
return this.zoomLevel;
}
// command to label the zones, calls setMap() to update the display
public void setLabelZones(boolean labelZones) {
if (labelZones == this.labelZones) {
return;
@ -182,7 +182,9 @@ public abstract class AbstractZoneSelector extends PaneManager {
return;
}
this.limitZoneNames = limitZones;
setMapInternal(this.mapRscList);
for (ZoneSelectorResource mapRsc : this.mapRscList) {
mapRsc.setLimitZones(limitZones);
}
}
/*
@ -287,7 +289,7 @@ public abstract class AbstractZoneSelector extends PaneManager {
.retrieveMap(bundlePath).getResourceData();
ZoneSelectorResource rsc = new ZoneSelectorResource(rscData,
new LoadProperties(), gloc);
new LoadProperties(), gloc, this.limitZoneNames);
mapRscList.add(rsc);
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, "Error loading map: "

View file

@ -102,6 +102,7 @@ import com.vividsolutions.jts.io.WKBReader;
* Apr 10, 2013 #1854 randerso Fix for compatibility with PostGIS 2.0
* May 30, 2013 #2028 randerso Fixed date line issue with map display
* Jul 31, 2013 #2239 randerso Fixed scaling of maps that cross the date line
* Jan 07, 2014 #2662 randerso Fixed limitZones (subDomainUGCs) support
*
* </pre>
*
@ -230,6 +231,7 @@ public class ZoneSelectorResource extends DbMapResource {
int numPoints = 0;
int wfoPoints = 0;
List<String> limitZones = req.rsc.getLimitZones();
WKBReader wkbReader = new WKBReader();
for (int i = 0; i < mappedResult.getResultCount(); i++) {
if (canceled) {
@ -259,6 +261,12 @@ public class ZoneSelectorResource extends DbMapResource {
// TODO: what do we do with this?
// zoneName = "";
}
if (limitZones != null
&& !limitZones.contains(zoneName)) {
continue;
}
String wfo = (String) mappedResult
.getRowColumnValue(i, "wfo");
@ -532,6 +540,8 @@ public class ZoneSelectorResource extends DbMapResource {
private Map<String, ZoneInfo> zoneData;
private List<String> limitZones;
private RGB defaultFillColor;
private RGB outlineColor;
@ -559,9 +569,12 @@ public class ZoneSelectorResource extends DbMapResource {
/**
* @param data
* @param loadProperties
* @param gloc
* @param limitZones
*/
public ZoneSelectorResource(DbMapResourceData data,
LoadProperties loadProperties, GridLocation gloc) {
LoadProperties loadProperties, GridLocation gloc,
List<String> limitZones) {
super(data, loadProperties);
this.zoneData = new HashMap<String, ZoneInfo>();
this.geomFactory = new GeometryFactory();
@ -570,6 +583,7 @@ public class ZoneSelectorResource extends DbMapResource {
this.outlineColor = RGBColors.getRGBColor("white");
this.wfoOutlineColor = RGBColors.getRGBColor("yellow");
this.gloc = gloc;
this.limitZones = limitZones;
GeneralEnvelope env = new GeneralEnvelope(MapUtil.LATLON_PROJECTION);
env.setEnvelope(-180.0, -90.0, 180.0, 90.0);
@ -848,13 +862,10 @@ public class ZoneSelectorResource extends DbMapResource {
query.append(geometryField);
// add any additional columns
List<String> additionalColumns = new ArrayList<String>();
if (resourceData.getColumns() != null) {
for (ColumnDefinition column : resourceData.getColumns()) {
query.append(", ");
query.append(column);
additionalColumns.add(column.getName());
}
}
@ -915,6 +926,22 @@ public class ZoneSelectorResource extends DbMapResource {
return newShadedShape;
}
/**
* @return the limitZones
*/
public List<String> getLimitZones() {
return limitZones;
}
/**
* @param limitZones
* the limitZones to set
*/
public void setLimitZones(List<String> limitZones) {
this.limitZones = limitZones;
issueRefresh();
}
/**
* @param labelZones
*/
@ -1023,6 +1050,16 @@ public class ZoneSelectorResource extends DbMapResource {
query.append(resourceData.getGeomField());
query.append(")) as extent");
// add editarea column
if (resourceData.getColumns() != null) {
for (ColumnDefinition column : resourceData.getColumns()) {
if (column.getName().equalsIgnoreCase("editarea")) {
query.append(", ");
query.append(column);
}
}
}
// add the geometry table
query.append(" FROM ");
query.append(resourceData.getTable());
@ -1047,6 +1084,14 @@ public class ZoneSelectorResource extends DbMapResource {
WKBReader wkbReader = new WKBReader();
for (int i = 0; i < mappedResult.getResultCount(); i++) {
String zoneName = (String) mappedResult.getRowColumnValue(
i, "editarea");
if (this.limitZones != null
&& !this.limitZones.contains(zoneName)) {
continue;
}
byte[] b = (byte[]) mappedResult.getRowColumnValue(i,
"extent");
if (b != null) {

View file

@ -19,11 +19,13 @@
**/
package com.raytheon.viz.gfe.vtec;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import com.google.common.collect.ImmutableSet;
@ -58,6 +60,9 @@ import com.raytheon.viz.texteditor.util.VtecUtil;
* Nov 22, 2013 #2578 dgilling Fix ETN assignment for products with
* multiple NEW VTEC lines for the same
* phensig but disjoint TimeRanges.
* Dec 18, 2013 #2641 dgilling Force ordering of items returned by
* getVtecLinesThatNeedEtn().
* Feb 05, 2014 #2774 dgilling Additional correction to previous fix.
*
* </pre>
*
@ -76,6 +81,24 @@ public class GFEVtecUtil {
public static final Collection<String> IGNORE_NATIONAL_ETN = ImmutableSet
.copyOf(GFEVtecConfig.getInstance().getSitesIgnoreNationalEtn());
private static final Comparator<VtecObject> VTEC_COMPARATOR = new Comparator<VtecObject>() {
@Override
public int compare(VtecObject vtec1, VtecObject vtec2) {
TimeRange tr1 = new TimeRange(vtec1.getStartTime(),
vtec1.getEndTime());
TimeRange tr2 = new TimeRange(vtec2.getStartTime(),
vtec2.getEndTime());
int retVal = tr1.getStart().compareTo(tr2.getStart());
if (retVal == 0) {
retVal = tr1.getEnd().compareTo(tr2.getEnd());
}
return retVal;
}
};
/**
* A private constructor so that Java does not attempt to create one for us.
* As this class should not be instantiated, do not attempt to ever call
@ -192,12 +215,12 @@ public class GFEVtecUtil {
* @return A <code>Set</code> of <code>VtecObject</code>s that need to have
* a new ETN assigned to them.
*/
public static Set<VtecObject> getVtecLinesThatNeedEtn(String product) {
public static Map<String, List<VtecObject>> initETNCache(String product) {
if (StringUtil.isEmptyString(product)) {
return Collections.emptySet();
return Collections.emptyMap();
}
Set<VtecObject> phensigs = new HashSet<VtecObject>();
Map<String, List<VtecObject>> cache = new HashMap<String, List<VtecObject>>();
Matcher vtecMatcher = VtecUtil.VTEC_REGEX.matcher(product);
while (vtecMatcher.find()) {
@ -206,11 +229,24 @@ public class GFEVtecUtil {
&& ((!NATIONAL_PHENSIGS.contains(vtec.getPhensig())) || (IGNORE_NATIONAL_ETN
.contains(vtec.getOffice()) && TROPICAL_PHENSIGS
.contains(vtec.getPhensig())))) {
phensigs.add(vtec);
List<VtecObject> vtecsForPhensig = cache.get(vtec.getPhensig());
if (vtecsForPhensig == null) {
vtecsForPhensig = new ArrayList<VtecObject>();
}
vtec.setSequence(0);
vtecsForPhensig.add(vtec);
cache.put(vtec.getPhensig(), vtecsForPhensig);
}
}
return phensigs;
for (String phensig : cache.keySet()) {
List<VtecObject> vtecsByTimeOrder = new ArrayList<VtecObject>(
cache.get(phensig));
Collections.sort(vtecsByTimeOrder, VTEC_COMPARATOR);
cache.put(phensig, vtecsByTimeOrder);
}
return cache;
}
/**
@ -242,46 +278,12 @@ public class GFEVtecUtil {
&& ((!NATIONAL_PHENSIGS.contains(vtec.getPhensig())) || (IGNORE_NATIONAL_ETN
.contains(vtec.getOffice()) && TROPICAL_PHENSIGS
.contains(vtec.getPhensig())))) {
// With GFE VTEC products, it's possible to have multiple
// segments with
// NEW vtec action codes and the same phensig. For this reason,
// HazardsTable.py implemented a "cache" that would ensure all
// NEWs for
// the same phensig would be assigned the same ETN. This Map
// replicates
// that legacy behavior.
//
// This "cache" has two levels:
// 1. The first level is keyed by the hazard's phensig.
// 2. The second level is keyed by the valid period of the
// hazard.
// Effectively, making this a Map<Phensig, Map<ValidPeriod,
// ETN>>.
// Some more clarification on the ETN assignment behavior: all
// NEW VTEC lines with the same phensig should be assigned the
// same ETN if the hazards' valid periods are adjacent or
// overlapping.
// If there's a discontinuity in TimeRanges we increment to the
// next ETN.
Integer newEtn = null;
String cacheKey = vtec.getPhensig();
String phensig = vtec.getPhensig();
TimeRange validPeriod = new TimeRange(vtec.getStartTime()
.getTime(), vtec.getEndTime().getTime());
Map<TimeRange, Integer> etnsByTR = etnCache.get(cacheKey);
if (etnsByTR != null) {
newEtn = etnsByTR.get(validPeriod);
for (TimeRange tr : etnsByTR.keySet()) {
if ((validPeriod.isAdjacentTo(tr))
|| (validPeriod.overlaps(tr))) {
vtec.setSequence(newEtn);
break;
}
}
}
Integer newEtn = etnCache.get(phensig).get(validPeriod);
vtec.setSequence(newEtn);
}
vtecMatcher
.appendReplacement(
finalOutput,
@ -291,4 +293,4 @@ public class GFEVtecUtil {
vtecMatcher.appendTail(finalOutput);
return finalOutput.toString();
}
}
}

View file

@ -21,7 +21,10 @@ package com.raytheon.viz.grid.rsc;
import java.util.Map;
import javax.measure.converter.UnitConverter;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.viz.core.exception.VizException;
@ -39,9 +42,11 @@ import com.raytheon.viz.grid.rsc.general.GeneralGridData;
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 13, 2010 bsteffen Initial creation
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Oct 13, 2010 bsteffen Initial creation
* Feb 07, 2014 2211 bsteffen Fix sampling
*
*
* </pre>
*
@ -71,29 +76,36 @@ public class DataMappedGridResource extends D2DGridResource {
if (map == null) {
return "NO DATA";
}
Double val = ((Float) map.get(INTERROGATE_VALUE)).doubleValue();
Double val = ((Number) map.get(INTERROGATE_VALUE)).doubleValue();
if (val.isNaN() || val <= -9999) {
return "No Data";
}
ColorMapParameters params = getCapability(ColorMapCapability.class)
.getColorMapParameters();
if (params != null) {
UnitConverter d2cm = params.getDisplayToColorMapConverter();
if (d2cm != null) {
val = d2cm.convert(val);
}
val = params.getDisplayToImageConverter().convert(val);
DataMappingPreferences dataMapping = params.getDataMapping();
if (dataMapping != null) {
for (DataMappingEntry entry : dataMapping.getEntries()) {
double pixelValue = entry.getPixelValue();
double relError = Math.abs((pixelValue - val) / val);
String text = entry.getLabel();
if (relError < 0.00001 && text != null) {
return text;
}
}
}
for (DataMappingEntry entry : params.getDataMapping().getEntries()) {
double pixelValue = entry.getPixelValue();
double relError = Math.abs((pixelValue - val) / val);
String text = entry.getLabel();
if (relError < 0.00001 && text != null) {
return text;
UnitConverter cm2d = params.getColorMapToDisplayConverter();
if (cm2d != null) {
val = cm2d.convert(val);
}
}
if (params != null && params.getImageToDisplayConverter() != null) {
val = params.getImageToDisplayConverter().convert(val);
}
return ((DataMappedGridResourceData) this.getResourceData())
.getSampleFormat().format(val) + map.get(INTERROGATE_UNIT);
}

View file

@ -39,9 +39,10 @@ import com.raytheon.viz.grid.rsc.general.GeneralGridData;
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 16, 2009 mnash Initial creation
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Dec 16, 2009 mnash Initial creation
* Feb 07, 2014 2211 bsteffen Fix sampling
*
* </pre>
*
@ -71,7 +72,7 @@ public class RcmResource extends D2DGridResource {
if (map == null) {
return "NO DATA";
}
float val = (Float) map.get(INTERROGATE_VALUE);
float val = ((Number) map.get(INTERROGATE_VALUE)).floatValue();
String sampleVal = "";
if (val < 1f) {
sampleVal = "No Data";

View file

@ -56,7 +56,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* ------------- -------- ----------- -----------------------------------------
* Mar 09, 2011 bsteffen Initial creation
* Jul 17, 2013 2185 bsteffen Cache computed grid reprojections.
* Aug 27, 2013 2287 randerso Removed 180 degree adjustment required by error
@ -64,6 +64,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Dec 09, 2013 2617 bsteffen Added 180 degree rotation into reproject
* so wind direction is calculated as
* direction wind is coming from.
* Feb 03, 2013 2764 bsteffen Ensure that internal buffers are array
* backed heap buffers.
*
* </pre>
*
@ -152,15 +154,23 @@ public class GeneralGridData {
private GeneralGridData(GeneralGridGeometry gridGeometry,
FloatBuffer scalarData, Unit<?> dataUnit) {
this.gridGeometry = GridGeometry2D.wrap(gridGeometry);
this.scalarData = scalarData;
this.dataUnit = dataUnit;
this(gridGeometry, scalarData, null, null, null, dataUnit);
}
private GeneralGridData(GeneralGridGeometry gridGeometry,
FloatBuffer magnitude, FloatBuffer direction,
FloatBuffer uComponent, FloatBuffer vComponent, Unit<?> dataUnit) {
this.gridGeometry = GridGeometry2D.wrap(gridGeometry);
if (magnitude != null && !magnitude.hasArray()) {
/*
* TODO refactor dispaly code so it doesn't need array instead of
* copying data.
*/
FloatBuffer copy = FloatBuffer.allocate(magnitude.capacity());
magnitude.rewind();
copy.put(magnitude);
magnitude = copy;
}
this.scalarData = magnitude;
this.direction = direction;
this.uComponent = uComponent;

View file

@ -34,6 +34,7 @@ import com.raytheon.viz.hydrocommon.data.GageData.ThreatIndex;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 21, 2008 mpduff Initial creation
* Feb 03, 2014 16843 lbousaidi add a check for index OutOfBoundsException
*
* </pre>
*
@ -101,8 +102,9 @@ public class PDCFindBasis {
} else {
currentLid = fcstReportList.get(fcstIndex).getLid();
}
} else if (obsReportList.get(obsIndex) != null) {
currentLid = obsReportList.get(obsIndex).getLid();
} else if ((obsIndex< obsReportList.size()) && (obsReportList
.get(obsIndex) != null)) {
currentLid = obsReportList.get(obsIndex).getLid();
} else {
currentLid = fcstReportList.get(fcstIndex).getLid();
}

View file

@ -138,8 +138,9 @@ import com.raytheon.viz.hydrocommon.util.DbUtils;
* 16 Jan 2013 15695 wkwock Fix popup menu
* 24 Apr 2013 1921 mpduff Fix zoom reset to only reset the "active" graph
* 06 May 2013 1976 mpduff Refactored Hydro time series data access.
* 29 May 2013 2016 mpduff Fix TS Toggle Traces.
* 29 May 2013 2016 mpduff Fix TS Toggle Traces.
* 05 Sep 2013 #2332 lvenable Fixed memory leaks.
* 24 Jan 2013 15959 lbousaidi Swap the corner points of the bounding box when zooming.
* @author lvenable
* @version 1.0
*
@ -1241,7 +1242,13 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
}
Date xMin = pixel2x(gd, rubberBandX1 - GRAPHBORDER_LEFT);
Date xMax = pixel2x(gd, rubberBandX2 - GRAPHBORDER_LEFT);
//Swap the corner points of the bounding box when zooming
if (xMin.after(xMax)) {
Date xtmp;
xtmp= xMin;
xMin=xMax;
xMax=xtmp;
}
gd.setXMin(xMin);
gd.setXMax(xMax);
gd.setX(gd.getXMax().getTime() - gd.getXMin().getTime());
@ -1256,7 +1263,13 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
if (ymin < gd.getYmin()) {
ymin = gd.getYmin();
}
//Swap the corner points of the bounding box when zooming
if (ymin > ymax) {
double ytmp;
ytmp= ymin;
ymin=ymax;
ymax=ytmp;
}
gd.setYmin(ymin);
gd.setYmax(ymax);
gd.setY2(gd.getYmax2() - gd.getYmin2());

View file

@ -0,0 +1,46 @@
<?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.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem" file="bundles/LightningPlot60Min.xml"
menuText="1hr CG stroke plot" id="1HrLightningStrokePlot"
productInterval="3600">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot15Min.xml"
menuText="15min CG stroke plot" id="15MinLightningStrokePlot"
productInterval="900">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot15MinPN.xml"
menuText="15min Pos/Neg CG stroke plot" id="15MinPNLightningStrokePlot"
productInterval="900">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot5Min.xml"
menuText="5min CG stroke plot" id="5MinLightningStrokePlot"
productInterval="300">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningSeq.xml"
menuText="1min Lgtng Seq CG stroke" id="1MinLightningStrokeSeq">
<dataURI>/binlightning/%</dataURI>
</contribute>
</menuTemplate>

View file

@ -20,6 +20,6 @@
-->
<menuContributionFile>
<include installTo="menu:obs?after=LIGHTNINGPLACEHOLDER"
fileName="menus/lightning/baseLightning.xml"
fileName="menus/lightning/lightningMenuItems.xml"
subMenu="Lightning"/>
</menuContributionFile>

View file

@ -0,0 +1,32 @@
<?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.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="subMenu" menuText="NLDN" id="NLDNSubMenu">
<contribute xsi:type="subinclude" fileName="menus/lightning/nldnLightningBundleItems.xml">
<substitute key="lightSource" value="NLDN"/>
</contribute>
</contribute>
<contribute xsi:type="subMenu" menuText="GLD" id="GLDSubMenu">
<contribute xsi:type="subinclude" fileName="menus/lightning/gldLightningBundleItems.xml">
<substitute key="lightSource" value="GLD"/>
</contribute>
</contribute>
</menuTemplate>

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