diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/monitor/CcfpData.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/monitor/CcfpData.java index dde08a3c0d..e9efef2cfd 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/monitor/CcfpData.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/monitor/CcfpData.java @@ -49,6 +49,7 @@ import com.vividsolutions.jts.geom.GeometryFactory; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Sep 15, 2009 njensen Initial creation + * Jun 3, 2014 16289 zhao Use "end time" instead of "start time" for CCFP report * * * @@ -119,7 +120,7 @@ public class CcfpData { CcfpRecord area = findMostRelevantArea(c, list); List reports = siteReportMap.get(site); if (area != null) { - String report = mkCCFPReport(site, dt, area); + String report = mkCCFPReport(site, area.getDataTime().getValidPeriod().getEnd(), area); reports.add(report); } siteReportMap.put(site, reports); diff --git a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ToolsDataManager.java b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ToolsDataManager.java index 8c8d7f234a..709ce60ee7 100644 --- a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ToolsDataManager.java +++ b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ToolsDataManager.java @@ -27,7 +27,6 @@ import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; -import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; @@ -35,14 +34,14 @@ import java.util.Map; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; +import javax.xml.bind.JAXB; + import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.ListenerList; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.preference.IPersistentPreferenceStore; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; import com.raytheon.uf.common.localization.FileUpdatedMessage; import com.raytheon.uf.common.localization.ILocalizationFileObserver; @@ -51,6 +50,8 @@ import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationFile; +import com.raytheon.uf.common.localization.LocalizationFileInputStream; +import com.raytheon.uf.common.localization.LocalizationFileOutputStream; import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.exception.LocalizationException; import com.raytheon.uf.common.status.IUFStatusHandler; @@ -60,7 +61,6 @@ import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage; import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore; import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.points.PointsDataManager; import com.raytheon.viz.awipstools.common.RangeRing; @@ -86,14 +86,14 @@ import com.vividsolutions.jts.geom.LineString; * 07-11-12 #875 rferrel Move points to PointsDataManager. * 01-29-14 DR 16351 D. Friedman Fix updates to storm track from preferences. * 04-02-14 DR 16351 D. Friedman Fix updates to storm track from preferences. (backport from 14.2.2) + * 06-03-24 3191 njensen Improved saving/loading storm track data * * * * @author bsteffen * @version 1.0 */ -public class ToolsDataManager implements ILocalizationFileObserver, - IPropertyChangeListener { +public class ToolsDataManager implements ILocalizationFileObserver { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(ToolsDataManager.class); @@ -103,13 +103,9 @@ public class ToolsDataManager implements ILocalizationFileObserver, private static final String P_RANGERING_LOCATIONS = "rangeRingLocations"; - private static final String P_STORMTRACK_SPEED = "stormSpeed"; + private static final String TOOLS_DIR = "awipsTools"; - private static final String P_STORMTRACK_ANGLE = "stormAngle"; - - private static final String P_STORMTRACK_POINTS = "stormCoordinates"; - - private static final String P_STORMTRACK_DATE = "stormDate"; + private static final String STORM_TRACK_FILE = "stormTrackData.xml"; private static final int[] DEFAULT_LINE_RADIUS = { 120, 120, 120, 120, 240, 240, 216, 216, 360, 360 }; @@ -140,8 +136,6 @@ public class ToolsDataManager implements ILocalizationFileObserver, private boolean stormTrackDirty = false; - private String site; - private LocalizationFile userToolsDir; private IPathManager pathMgr; @@ -156,19 +150,19 @@ public class ToolsDataManager implements ILocalizationFileObserver, } private ToolsDataManager() { - site = LocalizationManager.getInstance().getCurrentSite(); - pathMgr = PathManagerFactory.getPathManager(); pointsManager = PointsDataManager.getInstance(); LocalizationContext userCtx = pathMgr.getContext( LocalizationType.CAVE_STATIC, LocalizationLevel.USER); - - userToolsDir = pathMgr.getLocalizationFile(userCtx, "awipsTools" - + File.separator + site); + /* + * TODO: Since it's already under the user localization, why does it + * then want to have the site underneath that? If anyone knows, please + * document it and remove this TODO. PointsManager does a similar thing. + */ + userToolsDir = pathMgr.getLocalizationFile(userCtx, TOOLS_DIR + + IPathManager.SEPARATOR + + LocalizationManager.getInstance().getCurrentSite()); userToolsDir.addFileUpdatedObserver(this); - - CorePlugin.getDefault().getPreferenceStore() - .addPropertyChangeListener(this); } public Collection getBaselineNames() { @@ -253,67 +247,73 @@ public class ToolsDataManager implements ILocalizationFileObserver, } private void loadStormData() { - stormData = new StormTrackData(); - HierarchicalPreferenceStore store = (HierarchicalPreferenceStore) CorePlugin - .getDefault().getPreferenceStore(); - store.setDefault(P_STORMTRACK_SPEED, 35.0); - double speed = store.getDouble(P_STORMTRACK_SPEED); - stormData.setMotionSpeed(speed); - - store.setDefault(P_STORMTRACK_ANGLE, 60.0); - double angle = store.getDouble(P_STORMTRACK_ANGLE); - stormData.setMotionDirection(angle); - - long date = store.getLong(P_STORMTRACK_DATE); - if (date > 0) { - stormData.setDate(new Date(date)); - } - String[] points = store.getStringArray(P_STORMTRACK_POINTS); - if (points != null) { - setCoordinates(stormData, points); + IPathManager pathMgr = PathManagerFactory.getPathManager(); + LocalizationFile f = pathMgr.getLocalizationFile( + userToolsDir.getContext(), userToolsDir.getName() + + IPathManager.SEPARATOR + STORM_TRACK_FILE); + if (f.exists()) { + LocalizationFileInputStream is = null; + try { + is = f.openInputStream(); + stormData = JAXB.unmarshal(is, StormTrackData.class); + } catch (Exception e) { + statusHandler.error("Error loading storm track data", e); + stormData = defaultStormTrackData(); + } finally { + if (is != null) { + try { + is.close(); + } catch (IOException e) { + statusHandler.handle(Priority.DEBUG, + "Error closing storm track data input stream", + e); + } + } + } + } else { + stormData = defaultStormTrackData(); } + stormTrackDirty = false; } - private void setCoordinates(StormTrackData data, String[] points) { - Coordinate[] coords = new Coordinate[points.length]; - for (int i = 0; i < points.length; ++i) { - String[] latLon = points[i].split("[ ]"); - try { - coords[i] = new Coordinate(Double.parseDouble(latLon[0]), - Double.parseDouble(latLon[1])); - } catch (NumberFormatException e) { - statusHandler.handle(Priority.PROBLEM, - "Error reading storm track coordinates", e); - coords = new Coordinate[0]; - break; - } - } - data.setCoordinates(coords); + /** + * Creates and returns a default storm track data + * + * @return + */ + private static StormTrackData defaultStormTrackData() { + StormTrackData data = new StormTrackData(); + data.setMotionSpeed(35.0); + data.setMotionDirection(60.0); + data.setDate(SimulatedTime.getSystemTime().getTime()); + return data; } private void storeStormData() { synchronized (stormLock) { // Update the store time stormData.setDate(SimulatedTime.getSystemTime().getTime()); - HierarchicalPreferenceStore store = (HierarchicalPreferenceStore) CorePlugin - .getDefault().getPreferenceStore(); - store.setValue(P_STORMTRACK_SPEED, stormData.getMotionSpeed()); - store.setValue(P_STORMTRACK_ANGLE, stormData.getMotionDirection()); - Coordinate[] coordinates = stormData.getCoordinates(); - if (coordinates != null) { - String[] coords = new String[coordinates.length]; - for (int i = 0; i < coordinates.length; ++i) { - coords[i] = coordinates[i].x + " " + coordinates[i].y; - } - store.setValue(P_STORMTRACK_POINTS, coords); - } - store.setValue(P_STORMTRACK_DATE, stormData.getDate().getTime()); + IPathManager pathMgr = PathManagerFactory.getPathManager(); + LocalizationFile f = pathMgr.getLocalizationFile( + userToolsDir.getContext(), userToolsDir.getName() + + IPathManager.SEPARATOR + STORM_TRACK_FILE); + LocalizationFileOutputStream os = null; try { - store.save(); - } catch (IOException e) { + os = f.openOutputStream(); + JAXB.marshal(stormData, os); + os.closeAndSave(); + } catch (Exception e) { statusHandler.handle(Priority.PROBLEM, "Error saving storm track data", e); + try { + if (os != null) { + os.close(); + } + } catch (IOException e1) { + statusHandler.handle(Priority.DEBUG, + "Error closing storm track data output stream", e1); + } } } } @@ -594,11 +594,18 @@ public class ToolsDataManager implements ILocalizationFileObserver, */ @Override public void fileUpdated(FileUpdatedMessage message) { + /* + * This will receive messages about points updates too, but since the + * PointsManager is listening for those we don't care. + */ String fileName = new File(message.getFileName()).getName(); if (fileName.startsWith(BASELINE_PREFIX)) { baselineFileUpdated(fileName); - } else { - pointsManager.fileUpdated(message); + } else if (fileName.equals(STORM_TRACK_FILE)) { + stormTrackDirty = true; + for (Object listener : stormListeners.getListeners()) { + ((IToolChangedListener) listener).toolChanged(); + } } } @@ -643,44 +650,4 @@ public class ToolsDataManager implements ILocalizationFileObserver, stormListeners.remove(listener); } - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse - * .jface.util.PropertyChangeEvent) - */ - @Override - public void propertyChange(PropertyChangeEvent event) { - String key = event.getProperty(); - if ((P_STORMTRACK_ANGLE.equals(key) || P_STORMTRACK_DATE.equals(key) - || P_STORMTRACK_POINTS.equals(key) || P_STORMTRACK_SPEED - .equals(key)) && stormData != null) { - synchronized (stormLock) { - Object value = event.getNewValue(); - if (P_STORMTRACK_ANGLE.equals(key) && value instanceof Double) { - stormData.setMotionDirection((Double) value); - } else if (P_STORMTRACK_DATE.equals(key) - && value instanceof Long) { - stormData.setDate(new Date((Long) value)); - } else if (P_STORMTRACK_POINTS.equals(key) - && value instanceof String[]) { - setCoordinates(stormData, (String[]) value); - } else if (P_STORMTRACK_SPEED.equals(key) - && value instanceof Double) { - stormData.setMotionSpeed((Double) value); - } else { - /* Incompatible value indicates update from preference - * store. We will want to reload. - */ - stormTrackDirty = true; - } - } - - // fire listeners - for (Object listener : stormListeners.getListeners()) { - ((IToolChangedListener) listener).toolChanged(); - } - } - } } diff --git a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/StormTrackData.java b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/StormTrackData.java index b8787bf970..bab4bbad71 100644 --- a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/StormTrackData.java +++ b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/StormTrackData.java @@ -21,10 +21,18 @@ package com.raytheon.viz.awipstools.common; import java.util.Date; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +import com.raytheon.uf.common.serialization.adapters.CoordAdapter; import com.vividsolutions.jts.geom.Coordinate; /** - * TODO Add Description + * Data representing a storm track that can be saved to XML * *
  * 
@@ -32,20 +40,29 @@ import com.vividsolutions.jts.geom.Coordinate;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Aug 12, 2009            bwoodle     Initial creation
+ * Jun 03, 2014 3191       njensen      Added xml annotations
  * 
  * 
* * @author bwoodle * @version 1.0 */ +@XmlAccessorType(XmlAccessType.NONE) +@XmlRootElement public class StormTrackData { + @XmlJavaTypeAdapter(DateAdapter.class) + @XmlElement(name = "stormDate") private Date date; + @XmlElement(name = "stormAngle") private double motionDirection; + @XmlElement(name = "stormSpeed") private double motionSpeed; + @XmlJavaTypeAdapter(CoordAdapter.class) + @XmlElement(name = "stormCoordinates") private Coordinate[] coordinates; public StormTrackData() { @@ -123,4 +140,19 @@ public class StormTrackData { return date != null && !Double.isNaN(motionDirection) && !Double.isNaN(motionSpeed); } + + private static class DateAdapter extends XmlAdapter { + + @Override + public Date unmarshal(Long v) throws Exception { + return new Date(v); + } + + @Override + public Long marshal(Date v) throws Exception { + return v.getTime(); + } + + } + } diff --git a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/stormtrack/StormTrackDisplay.java b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/stormtrack/StormTrackDisplay.java index 56ff25cd9c..e967fcc336 100644 --- a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/stormtrack/StormTrackDisplay.java +++ b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/stormtrack/StormTrackDisplay.java @@ -103,6 +103,9 @@ import com.vividsolutions.jts.geom.LineString; * 04-07-2014 DR 17232 D. Friedman Make sure pivot indexes are valid. * 04-24-2014 DR 16356 Qinglu Lin Updated generateTrackInfo(), generateNewTrackInfo(), * and createTrack(). + * 06-03-14 3191 njensen Fix postData to not retrieve + * 06-17-2014 DR17409 mgamazaychikov Fix futurePoints calculation in generateNewTrackInfo() + * and generateExistingTrackInfo() * * * @@ -938,7 +941,7 @@ public class StormTrackDisplay implements IRenderable { // time, the arrow of the pathcast is drawn behind the last frame if (state.duration >= 0) { for (int i = 1; i < futurePoints.length - (remainder == 0 ? 0 : 1); ++i) { - timeInMillis += minIntervalInSeconds * 1000; + timeInMillis += interval * 60 * 1000; DataTime time = new DataTime(new Date(timeInMillis)); double distance = speed @@ -1095,7 +1098,7 @@ public class StormTrackDisplay implements IRenderable { // time, the arrow of the pathcast is drawn behind the last frame if (state.duration >= 0) { for (int i = 1; i < futurePoints.length - (remainder == 0 ? 0 : 1); ++i) { - timeInMillis += minIntervalInSeconds * 1000; + timeInMillis += interval * 60 * 1000; DataTime time = new DataTime(new Date(timeInMillis)); double distance = speed @@ -1437,7 +1440,7 @@ public class StormTrackDisplay implements IRenderable { } private void postData(StormTrackState state) { - StormTrackData data = dataManager.getStormTrackData(); + StormTrackData data = new StormTrackData(); Coordinate[] coords = new Coordinate[state.timePoints.length]; for (int i = 0; i < coords.length; ++i) { coords[i] = new Coordinate(state.timePoints[i].coord); diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ServiceBackupComponent.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ServiceBackupComponent.java index efa8e7f9bf..edf5378bd8 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ServiceBackupComponent.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ServiceBackupComponent.java @@ -35,6 +35,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; * Oct 26, 2012 1287 rferrel Change to force blocking of ServiceBackupDlg. * Mar 21, 2013 1447 dgilling Fix dialog construction so this dialog * is created as a top-level shell. + * Jun 11, 2014 DR-17401 lshi * * * @@ -54,8 +55,11 @@ public class ServiceBackupComponent extends AbstractCAVEComponent { @Override protected void startInternal(String componentName) throws Exception { ServiceBackupDlg svcBuDlg = new ServiceBackupDlg(null); - svcBuDlg.setBlockOnOpen(true); - svcBuDlg.open(); + if (!svcBuDlg.isTerminated()) + { + svcBuDlg.setBlockOnOpen(true); + svcBuDlg.open(); + } } /* diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/CheckPermissions.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/CheckPermissions.java index 22a5f99a0a..686866b51c 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/CheckPermissions.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/CheckPermissions.java @@ -19,9 +19,12 @@ **/ package com.raytheon.viz.gfe.dialogs.sbu; +import java.util.Set; + import com.raytheon.uf.common.auth.user.IUser; import com.raytheon.uf.common.dataplugin.gfe.request.CheckPermissionsRequest; import com.raytheon.uf.common.dataplugin.gfe.request.CheckServiceBackupPrimarySiteRequest; +import com.raytheon.uf.common.dataplugin.gfe.request.GetServiceBackupPrimarySiteRequest; import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; @@ -46,7 +49,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient; * Jul 22, 2013 #1762 dgilling Ensure all fields of * CheckServiceBackupPrimarySiteRequest are * filled. - * + * Jun 10, 2013 DR-17401 lshi Added getPrimarySites() * * * @author bphillip @@ -104,4 +107,21 @@ public class CheckPermissions { } return false; } + + public static Set getPrimarySites() { + Set primary = null; + + GetServiceBackupPrimarySiteRequest request = new GetServiceBackupPrimarySiteRequest(); + try { + @SuppressWarnings("unchecked") + ServerResponse> sr = (ServerResponse>) ThriftClient + .sendRequest(request); + primary = sr.getPayload(); + return primary; + } catch (VizException e) { + statusHandler + .error("Error getting primary site(s)!", e); + } + return primary; + } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/ServiceBackupDlg.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/ServiceBackupDlg.java index a417cb2c2a..65d506094b 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/ServiceBackupDlg.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/ServiceBackupDlg.java @@ -99,6 +99,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; * May 01, 2013 1762 dgilling Remove national center check. * Jul 22, 2013 1762 dgilling Fix running as primary check. * Apr 14, 2014 2984 njensen Moved help files to viz.gfe plugin + * Jun 10,2014 DR-17401 lshi * * * @@ -166,8 +167,15 @@ public class ServiceBackupDlg extends CaveJFACEDialog { private boolean authorized; private SVCBU_OP currentOperation = SVCBU_OP.no_backup; + + private boolean isTerminated = false; + - /** + public boolean isTerminated() { + return isTerminated; + } + + /** * @param parentShell */ public ServiceBackupDlg(Shell parentShell) { @@ -175,6 +183,13 @@ public class ServiceBackupDlg extends CaveJFACEDialog { authorized = CheckPermissions.getAuthorization(); this.site = LocalizationManager.getInstance().getCurrentSite(); this.runningAsPrimary = CheckPermissions.runningAsPrimary(this.site); + + if (!CheckPermissions.getPrimarySites().contains(this.site)) { + displayMessage("You cannot run Service Backup as " + this.site + " - EXITING!!!"); + isTerminated = true; + return; + } + if (!ServiceBackupJobManager.getInstance().isRunning()) { ServiceBackupJobManager.getInstance().start(); } @@ -182,7 +197,6 @@ public class ServiceBackupDlg extends CaveJFACEDialog { progress = new ProgressDlg(getShell()); progress.setBlockOnOpen(false); updateJob = new Job("SvcbuUpdateJob") { - @Override protected IStatus run(IProgressMonitor monitor) { VizApp.runAsync(new Runnable() { @@ -230,7 +244,7 @@ public class ServiceBackupDlg extends CaveJFACEDialog { @Override public boolean close() { updateJob.cancel(); - return super.close(); + return super.close(); } /* @@ -481,7 +495,7 @@ public class ServiceBackupDlg extends CaveJFACEDialog { } private void doImportConfig() { - + switch (currentOperation) { case svcbuMode: displayMessage("" + this.failedSite.toUpperCase() @@ -537,7 +551,7 @@ public class ServiceBackupDlg extends CaveJFACEDialog { if (startGFE) { jobManager.addJob(new SvcbuStartGfeJob(failedSite, this.site)); - } + } } } } @@ -765,7 +779,7 @@ public class ServiceBackupDlg extends CaveJFACEDialog { jobManager.addJob(new SvcbuExitJob(this, this.site)); } } - + } private void doClean(boolean showMessage) { diff --git a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java index bd7324433e..09a6dd8303 100644 --- a/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java +++ b/cave/com.raytheon.viz.lightning/src/com/raytheon/viz/lightning/LightningResource.java @@ -100,6 +100,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; * Feb 27, 2013 DCS 152 jgerth/elau Support for WWLLN and multiple sources * Jan 21, 2014 2667 bclement renamed record's lightSource field to source * Jun 05, 2014 3226 bclement reference datarecords by LightningConstants + * Jun 06, 2014 DR 17367 D. Friedman Fix cache object usage. * Jun 19, 2014 3214 bclement added pulse and could flash support * * @@ -548,6 +549,24 @@ public class LightningResource extends */ @Override public void remove(DataTime dataTime) { + /* + * Workaround for time matching which does not know about records at the + * end of a time period that may contain data for the next period. If we + * are asked to remove the latest data time and there is only one record + * we know about, return without removing the time. + */ + if (dataTimes.indexOf(dataTime) == dataTimes.size() - 1) { + CacheObject co = cacheObjectMap.get(dataTime); + if (co != null) { + LightningFrameMetadata metadata = co.getMetadata(); + synchronized (metadata) { + if (metadata.newRecords.size() + metadata.processed.size() < 2) { + return; + } + } + } + } + dataTimes.remove(dataTime); cacheObjectMap.remove(dataTime); } @@ -591,20 +610,20 @@ public class LightningResource extends List records = entry.getValue(); - CacheObject co = cacheObjectMap - .get(dt); LightningFrameMetadata frame; - if (co == null) { - // New frame - frame = new LightningFrameMetadata(dt, - resourceData.getBinOffset(), this.lightSource); - co = CacheObject.newCacheObject(frame, resourceBuilder); - cacheObjectMap.put(dt, co); - dataTimes.add(dt); - } else { - // Frame exists - frame = co.getMetadata(); + CacheObject co; + synchronized (cacheObjectMap) { + co = cacheObjectMap.get(dt); + if (co == null) { + // New frame + LightningFrameMetadata key = new LightningFrameMetadata(dt, + resourceData.getBinOffset(), this.lightSource); + co = CacheObject.newCacheObject(key, resourceBuilder); + cacheObjectMap.put(dt, co); + dataTimes.add(dt); + } } + frame = co.getMetadata(); synchronized (frame) { // Add as new records diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java index 1f6eb6fb14..99948d854f 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java @@ -117,6 +117,7 @@ import com.vividsolutions.jts.geom.Point; * Jun 25, 2013 16224 Qinglu Lin Resolved the issue with "Date start" for pathcast in CON. * Dec 4, 2013 2604 jsanchez Refactored GisUtil. * Apr 29, 2014 3033 jsanchez Updated method to retrieve files in localization. + * Jun 17, 2014 DR 17390 Qinglu Lin Updated getClosestPoints(). * * * @author chammack @@ -768,7 +769,7 @@ public class Wx { cp.partOfArea = GisUtil.asStringList(GisUtil .calculateLocationPortion( cp.prepGeom.getGeometry(), reference, - false)); + false, true)); distance = 0; } } diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-request.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-request.xml index f9c13fb12c..dd70b126be 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-request.xml +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-request.xml @@ -280,6 +280,13 @@ + + + + + + + diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-spring.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-spring.xml index 93c3e69bac..548d6fa091 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-spring.xml +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-spring.xml @@ -24,9 +24,9 @@ - - - + + + diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/svcbu/GetServiceBackupPrimarySiteHandler.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/svcbu/GetServiceBackupPrimarySiteHandler.java new file mode 100644 index 0000000000..19f1de93d0 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/handler/svcbu/GetServiceBackupPrimarySiteHandler.java @@ -0,0 +1,68 @@ +/** + * 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.edex.plugin.gfe.server.handler.svcbu; + +import java.util.Set; + +import com.raytheon.edex.plugin.gfe.svcbackup.SvcBackupUtil; +import com.raytheon.uf.common.dataplugin.gfe.request.GetServiceBackupPrimarySiteRequest; +import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; +import com.raytheon.uf.common.serialization.comm.IRequestHandler; + +/** + * Handler for CheckServiceBackupPrimarySiteRequest. Determines + * whether the specified site id has been configured as one of service backup's + * primary sites. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date           Ticket#    Engineer    Description
+ * ------------   ---------- ----------- --------------------------
+ * Jun 10, 2014   DR-17401     lshi        Initial creation
+ * 
+ * 
+ * + * @author lshi + * @version 1.0 + */ + +public class GetServiceBackupPrimarySiteHandler implements + IRequestHandler { + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest + * (com.raytheon.uf.common.serialization.comm.IServerRequest) + */ + @Override + public ServerResponse> handleRequest( + GetServiceBackupPrimarySiteRequest request) throws Exception { + ServerResponse> sr = new ServerResponse>(); + Set primarySites = SvcBackupUtil.getPrimarySites(); + sr.setPayload(primarySites); + + return sr; + } +} + diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/AbstractWatchNotifierSrv.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/AbstractWatchNotifierSrv.java index dabbfbaf89..f33648f3cf 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/AbstractWatchNotifierSrv.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/AbstractWatchNotifierSrv.java @@ -47,6 +47,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * May 12, 2014 #3157 dgilling Initial creation + * Jun 10, 2014 #3268 dgilling Initial creation * * * diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/SPCWatchSrv.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/SPCWatchSrv.java index a12625a3a0..18893de27d 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/SPCWatchSrv.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/SPCWatchSrv.java @@ -40,6 +40,7 @@ import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord; * Oct 03, 2008 njensen Initial creation * Jul 10, 2009 #2590 njensen Added multiple site support * May 12, 2014 #3157 dgilling Re-factor based on AbstractWatchNotifierSrv. + * Jun 10, 2014 #3268 dgilling Re-factor based on AbstractWatchNotifierSrv. * * * @author njensen diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/TPCWatchSrv.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/TPCWatchSrv.java index f674ada433..1817aac5dc 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/TPCWatchSrv.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/TPCWatchSrv.java @@ -42,6 +42,7 @@ import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord; * Oct 03, 2008 njensen Initial creation * Jul 10, 2009 #2590 njensen Added multiple site support * May 12, 2014 #3157 dgilling Re-factor based on AbstractWatchNotifierSrv. + * Jun 10, 2014 #3268 dgilling Re-factor based on AbstractWatchNotifierSrv. * * * @author njensen diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/WCLWatchSrv.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/WCLWatchSrv.java index a00529d96a..e342a0c817 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/WCLWatchSrv.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/WCLWatchSrv.java @@ -22,15 +22,12 @@ */ package com.raytheon.edex.plugin.gfe.watch; -import java.io.BufferedWriter; import java.io.File; -import java.io.FileWriter; import java.io.IOException; -import java.io.Writer; +import java.io.PrintStream; import java.util.ArrayList; import java.util.Calendar; import java.util.Collection; -import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Set; @@ -44,14 +41,12 @@ import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification; import com.raytheon.uf.common.dataplugin.gfe.server.notify.UserMessageNotification; import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.LocalizationContext; -import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.SimulatedTime; -import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.common.util.FileUtil; import com.raytheon.uf.edex.core.EdexException; @@ -67,15 +62,15 @@ import com.raytheon.uf.edex.core.EdexException; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * ??? ??, 20?? wldougher Initial creation - * May 14, 2014 #3157 dgilling Ensure code works in multi-domain scenarios, - * code cleanup. + * Jun 09, 2014 #3268 dgilling Ensure code works in multi-domain scenarios. + * Jun 13, 2014 #3278 dgilling Ensure temporary files get deleted. * * * * @author wldougher * @version 1.0 */ -public final class WCLWatchSrv { +public class WCLWatchSrv { private static final String ALERT_FORM = "Alert: " + "%1$s has arrived. " + "Please select ViewWCL and use %1$s. (Hazards menu)"; @@ -118,22 +113,16 @@ public final class WCLWatchSrv { */ public void handleWclWatch(WclInfo wclInfo) throws EdexException { statusHandler.debug("handleWclWatch started"); - List notifications = Collections.emptyList(); - String completeProductPil = wclInfo.getCompleteProductPil(); - Collection wfos = WatchProductUtil.findAttnWFOs(wclInfo - .getLines()); + Collection sitesToNotify = WatchProductUtil + .findAttnWFOs(wclInfo.getLines()); Set siteIDs = getSiteIDs(); - wfos.retainAll(siteIDs); // Keep shared IDs - if (!wfos.isEmpty()) { - notifications = new ArrayList(wfos.size()); - String msg = String.format(ALERT_FORM, completeProductPil); + boolean doNotify = true; - for (String siteID : wfos) { - GfeNotification notice = new UserMessageNotification(msg, - Priority.CRITICAL, "GFE", siteID); - notifications.add(notice); - } + sitesToNotify.retainAll(siteIDs); // Keep shared IDs + if (sitesToNotify.isEmpty()) { + statusHandler.debug("WCL notification: sites not in ATTN list"); + doNotify = false; } // Process the WCL regardless of whether we are sending a notice @@ -150,71 +139,111 @@ public final class WCLWatchSrv { // Get the watch type String watchType = getWatchType(wclInfo); + // Get the WCL 'letter' + String completeProductPil = wclInfo.getCompleteProductPil(); + // Create a dummy Procedure for export String wclStr = makeWclStr(finalUGCList, expireTime, issueTime, watchType); - statusHandler.debug("WCLData: " + wclStr); + statusHandler.info("WCLData: " + wclStr); - // write the WCL file to / - makePermanent(wclStr, completeProductPil); + // Write dummy procedure to temp file + File tmpFile = createTempWclFile(wclStr); - if ((wclInfo.getNotify()) - && (!CollectionUtil.isNullOrEmpty(notifications))) { - SendNotifications.send(notifications); + // Move the file to the wcl folder + // Rename it to / + statusHandler.info("Placing WCL Procedure Utility in ifpServer "); + try { + makePermanent(tmpFile, completeProductPil, siteIDs); + } finally { + if (tmpFile != null) { + tmpFile.delete(); + } + } + + if (doNotify && wclInfo.getNotify()) { + for (String siteID : sitesToNotify) { + String msg = String.format(ALERT_FORM, completeProductPil); + GfeNotification notify = new UserMessageNotification(msg, + Priority.CRITICAL, "GFE", siteID); + SendNotifications.send(notify); + } } else { statusHandler.info("Notification of WCL skipped"); } statusHandler.debug("handleWclWatch() ending"); - return; } /** - * Convert a temporary parsed WCL file to a permanent one by moving it to - * the WCL directory. This is done through File.renameTo(). Unfortunately, - * that method returns a boolean success flag rather than throwing an error, - * so all we can do is tell the user that the rename failed, not why. + * Convert a temporary parsed WCL file to a permanent one by copying its + * contents to the localization path cave_static.SITE/gfe/wcl/ for each of + * the specified sites. * - * @param wclData - * WCL data to write to file. + * @param tmpFile + * The temporary file (may be {@code null}) * @param completeProductPil - * The simple name of the file. - * - * @throws EdexException - * if WCL file cannot be opened, written, or closed. + * The base name of the files to write. + * @param siteIDs + * The set of siteIDs to write out the WCL data for. */ - protected void makePermanent(String wclData, String completeProductPil) - throws EdexException { - statusHandler.debug("makePermanent for [" + completeProductPil - + "] started"); - - File wclDir = getWclDir(); - File dest = new File(wclDir, completeProductPil); - - Writer output = null; - try { - output = new BufferedWriter(new FileWriter(dest)); - output.write(wclData); - output.write("\n"); - - // If we got to here, claim success! - statusHandler.info("Wrote new WCL to " + dest.getAbsolutePath()); - } catch (IOException e) { - throw new EdexException("Could not write new WCL file " - + dest.getAbsolutePath(), e); - } finally { - if (output != null) { + protected void makePermanent(File tmpFile, String completeProductPil, + Collection siteIDs) { + statusHandler.debug("makePermanent(" + tmpFile + "," + + completeProductPil + ") started"); + if (tmpFile != null) { + for (String siteID : siteIDs) { try { - output.close(); + File wclDir = getWclDir(siteID); + if (wclDir != null) { + File dest = new File(wclDir, completeProductPil); + FileUtil.copyFile(tmpFile, dest); + statusHandler.info("Wrote WCL " + + tmpFile.getAbsolutePath() + " to " + + dest.getAbsolutePath()); + } else { + statusHandler + .error("Could not determine WCL directory for site " + + siteID); + } } catch (IOException e) { - throw new EdexException("Could not close new WCL file " - + dest.getAbsolutePath(), e); + statusHandler.error("Could not copy temporary WCL file " + + tmpFile.getAbsolutePath() + + " to site directory for " + siteID, e); } } - } - statusHandler.debug("makePermanent for [" + completeProductPil - + "] ending"); + + statusHandler.debug("makePermanent(" + tmpFile + "," + + completeProductPil + ") ending"); + } + + /** + * Create a temporary file with the prefix "wcl" and the default suffix in + * the default temporary file directory. Write all of wclStr into it. + * + * @param wclStr + * the String containing the contents to write to the file + * @return the File created. + * @throws EdexException + * if the file cannot be written + */ + protected File createTempWclFile(String wclStr) throws EdexException { + File tmpFile = null; + PrintStream wclOut = null; + try { + tmpFile = File.createTempFile("wcl", null); + wclOut = new PrintStream(tmpFile); + wclOut.println(wclStr); + } catch (IOException e) { + throw new EdexException("Error writing parsed WCL to file \"" + + tmpFile.getAbsolutePath() + "\"", e); + } finally { + if (wclOut != null) { + wclOut.close(); + } + } + return tmpFile; } /** @@ -308,7 +337,7 @@ public final class WCLWatchSrv { cal.set(Calendar.MINUTE, minute); cal.set(Calendar.MILLISECOND, 0); // Guess whether end time crossed a month boundary. - if (day < dom - 7) { + if (day < (dom - 7)) { cal.add(Calendar.MONTH, 1); } expireTime = cal.getTime(); @@ -382,12 +411,15 @@ public final class WCLWatchSrv { * getSiteIDs(), this is in a method rather than inline so that test code * can override it in subclasses. * + * @param siteID + * The siteID to write the WCL file for. + * * @return the directory, as a File. */ - protected File getWclDir() { + protected File getWclDir(String siteID) { IPathManager pathManager = PathManagerFactory.getPathManager(); - LocalizationContext ctx = pathManager.getContext( - LocalizationType.CAVE_STATIC, LocalizationLevel.SITE); + LocalizationContext ctx = pathManager.getContextForSite( + LocalizationType.CAVE_STATIC, siteID); String wclName = FileUtil.join("gfe", "wcl"); File wclDir = pathManager.getFile(ctx, wclName); if (wclDir == null) { diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/parameter/alias/gfeParamName.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/parameter/alias/gfeParamName.xml index 2590ff8d24..04fc251b9b 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/parameter/alias/gfeParamName.xml +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/parameter/alias/gfeParamName.xml @@ -30,6 +30,7 @@ geh gh gvv + hailprob heli hidx htsgw @@ -48,14 +49,20 @@ pot p pr + prsvr + prsigsv pvv pw rh scp shf sh + sighailprob + sigtrndprob + sigwindprob sli snd + srcono svv swdir swell @@ -81,6 +88,7 @@ weasd wgh wgs + windprob ws wvdir wvhgt diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py index 22bfe1f668..82b086f6f8 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py @@ -43,6 +43,7 @@ # 05/09/2014 3148 randerso Add tpHPCndfd to D2DAccumulativeElements for HPCERP # 06/20/2014 #3230 rferrel Added URMA25. # +# 05/29/2014 3224 randerso Added "SPC":8 to D2DDBVERSIONS ######################################################################## #---------------------------------------------------------------------------- @@ -1035,6 +1036,7 @@ D2DDBVERSIONS = { "TPCStormSurge": 1, "CRMTopo": 1, "NED": 1, + "SPC": 8, } #--------------------------------------------------------------------------- diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/IrtAccess.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/IrtAccess.py index 89fc8f5e28..31f6af9c6b 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/IrtAccess.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/IrtAccess.py @@ -491,7 +491,7 @@ class IrtAccess(): self.logEvent("Transmit: ", cmd) import siteConfig from subprocess import Popen,PIPE - output,err = Popen(cmd.split(" "), stdout=PIPE,stderr=PIPE).communicate() + output,err = Popen(cmd, shell=True, stdout=PIPE,stderr=PIPE).communicate() if output.find(siteConfig.GFESUITE_MHSID+"-") == -1: alertMsg = "ISC Send failed transmission to : "+",".join(addresses)+" --> "+output+" "+err self.logProblem(alertMsg) diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/spcGuideNDFD.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/spcGuideNDFD.xml index d15c9fed34..e177287f0f 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/spcGuideNDFD.xml +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/spcGuideNDFD.xml @@ -209,4 +209,19 @@ SFC + + srcono + Convective Outlook + 1 + category + srcono + 0.0 + 100.0 + -99999.0 + 0 + SFC + + SFC + + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/postProcessModels/postProcessedModels.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/postProcessModels/postProcessedModels.xml index b0fbb6c269..b4acb946e0 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/postProcessModels/postProcessedModels.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/postProcessModels/postProcessedModels.xml @@ -112,11 +112,5 @@ RUC130GribPostProcessor - - - TPCSurgeProb - TPCSurgeProbPostProcessor - - diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/res/spring/shef-ingest.xml b/edexOsgi/com.raytheon.edex.plugin.shef/res/spring/shef-ingest.xml index 27af321ca0..e52bd48561 100644 --- a/edexOsgi/com.raytheon.edex.plugin.shef/res/spring/shef-ingest.xml +++ b/edexOsgi/com.raytheon.edex.plugin.shef/res/spring/shef-ingest.xml @@ -151,7 +151,7 @@ - + java.lang.Throwable diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/database/PostShef.java b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/database/PostShef.java index 67cf7b587a..dcdaf7d57b 100644 --- a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/database/PostShef.java +++ b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/plugin/shef/database/PostShef.java @@ -85,6 +85,7 @@ import com.raytheon.uf.common.ohd.AppsDefaults; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.database.dao.CoreDao; import com.raytheon.uf.edex.database.dao.DaoConfig; import com.raytheon.uf.edex.decodertools.time.TimeTools; @@ -122,6 +123,8 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * 04/29/2014 3088 mpduff Change logging class, clean up/optimization. * Updated with more performance fixes. * May 14, 2014 2536 bclement removed TimeTools usage + * 05/28/2014 3222 mpduff Fix posting time to be processed time so db doesn't show all post times the same + * 06/02/2014 mpduff Fix for caching of range checks. * * * @author mduff @@ -294,6 +297,39 @@ public class PostShef { /** Forecast query results */ private Object[] queryForecastResults; + /** Location range data found flag */ + private boolean locRangeFound = false; + + /** Default range data found flag */ + private boolean defRangeFound = false; + + /** Valid date range flag */ + private boolean validDateRange = false; + + /** Gross range minimum value */ + private double grossRangeMin = ShefConstants.SHEF_MISSING_INT; + + /** Gross range maximum value */ + private double grossRangeMax = ShefConstants.SHEF_MISSING_INT; + + /** Reasonable range minimum value */ + private double reasonRangeMin = ShefConstants.SHEF_MISSING_INT; + + /** Reasonable range maximum value */ + private double reasonRangeMax = ShefConstants.SHEF_MISSING_INT; + + /** Alert upper limit value */ + private double alertUpperLimit = ShefConstants.SHEF_MISSING_INT; + + /** Alarm upper limit value */ + private double alarmUpperLimit = ShefConstants.SHEF_MISSING_INT; + + /** Alert lower limit value */ + private double alertLowerLimit = ShefConstants.SHEF_MISSING_INT; + + /** Alarm lower limit value */ + private double alarmLowerLimit = ShefConstants.SHEF_MISSING_INT; + /** * * @param date @@ -461,6 +497,8 @@ public class PostShef { return; } + postDate.setTime(getToNearestSecond(TimeUtil + .currentTimeMillis())); boolean same_lid_product = false; String dataValue = data.getStringValue(); @@ -479,6 +517,7 @@ public class PostShef { data.setCreationDate("1970-01-01 00:00:00"); } + locId = data.getLocationId(); String key = locId + prodId + data.getObservationTime(); if (idLocations.containsKey(key)) { postLocData = idLocations.get(key); @@ -732,7 +771,7 @@ public class PostShef { * shefrec structure */ if (!dataValue.equals(ShefConstants.SHEF_MISSING)) { - adjustRawValue(locId, data); + adjustRawValue(locId, data); } dataValue = data.getStringValue(); @@ -1075,6 +1114,18 @@ public class PostShef { useTs = null; basisTimeValues = null; previousQueryForecast = null; + locRangeFound = false; + defRangeFound = false; + validDateRange = false; + grossRangeMin = ShefConstants.SHEF_MISSING_INT; + grossRangeMax = ShefConstants.SHEF_MISSING_INT; + reasonRangeMin = ShefConstants.SHEF_MISSING_INT; + reasonRangeMax = ShefConstants.SHEF_MISSING_INT; + alertUpperLimit = ShefConstants.SHEF_MISSING_INT; + alarmUpperLimit = ShefConstants.SHEF_MISSING_INT; + alertLowerLimit = ShefConstants.SHEF_MISSING_INT; + alarmLowerLimit = ShefConstants.SHEF_MISSING_INT; + } /** @@ -2103,9 +2154,9 @@ public class PostShef { String telem = null; String sql = null; Object[] oa = null; - + String key = locId + data.getPeTsE(); try { - if (!ingestSwitchMap.containsKey(locId)) { + if (!ingestSwitchMap.containsKey(key)) { errorMsg.append("Error getting connection to IHFS Database"); sql = "select lid, pe, dur, ts, extremum, ts_rank, ingest, ofs_input, stg2_input from IngestFilter where lid = '" + locId + "'"; @@ -2142,11 +2193,11 @@ public class PostShef { } } - ingestSwitchMap.put(locId, ingestSwitch); + ingestSwitchMap.put(key, ingestSwitch); } - matchFound = ingestSwitchMap.containsKey(locId); - ingestSwitch = ingestSwitchMap.get(locId); + matchFound = ingestSwitchMap.containsKey(key); + ingestSwitch = ingestSwitchMap.get(key); /* * if there is no ingest record for this entry, then check if the @@ -2540,6 +2591,8 @@ public class PostShef { */ private void postProductLink(String locId, String productId, Date obsTime) { PersistableDataObject link = null; + + postDate.setTime(getToNearestSecond(TimeUtil.currentTimeMillis())); try { /* Get a Data Access Object */ link = new Productlink(new ProductlinkId(locId, productId, obsTime, @@ -2577,14 +2630,6 @@ public class PostShef { long qualityCode = ShefConstants.DEFAULT_QC_VALUE; String monthdaystart = null; String monthdayend = null; - double grossRangeMin = missing; - double grossRangeMax = missing; - double reasonRangeMin = missing; - double reasonRangeMax = missing; - double alertUpperLimit = missing; - double alarmUpperLimit = missing; - double alertLowerLimit = missing; - double alarmLowerLimit = missing; alertAlarm = ShefConstants.NO_ALERTALARM; @@ -2603,10 +2648,6 @@ public class PostShef { return ShefConstants.QC_MANUAL_FAILED; } - boolean locRangeFound = false; - boolean defRangeFound = false; - boolean validDateRange = false; - boolean executeQuery = true; if (!qualityCheckFlag) { // If qualityCheckFlag is false the the query has already been @@ -2918,6 +2959,7 @@ public class PostShef { ShefData data, String locId, String tableName, String dataValue, String qualifier, long qualityCode) { PersistableDataObject dataObj = null; + postDate.setTime(getToNearestSecond(TimeUtil.currentTimeMillis())); if (ShefConstants.COMMENT_VALUE.equalsIgnoreCase(tableName)) { Commentvalue comment = new Commentvalue(new CommentvalueId()); @@ -3166,6 +3208,19 @@ public class PostShef { return dataObj; } + /** + * Convert the provided millisecond value to the nearest second. + * + * @param time + * time in milliseconds + * + * @return milliseconds rounded to the nearest second. + */ + private long getToNearestSecond(long time) { + // Force time to nearest second. + return time - (time % 1000); + } + public void close() { postTables.close(); } diff --git a/edexOsgi/com.raytheon.edex.plugin.warning/WarningDecoder.py b/edexOsgi/com.raytheon.edex.plugin.warning/WarningDecoder.py index 0e30f99592..abefbfe7b1 100644 --- a/edexOsgi/com.raytheon.edex.plugin.warning/WarningDecoder.py +++ b/edexOsgi/com.raytheon.edex.plugin.warning/WarningDecoder.py @@ -43,6 +43,7 @@ # Oct 03, 2013 2402 bsteffen Make PythonDecoder more extendable. # May 15, 2014 2536 bclement moved WMO time parsing to WMOTimeParser # May 15, 2014 3157 dgilling Update location of WclInfo class. +# Jun 10, 2014 3268 dgilling Update location of WclInfo class. # # diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/request/GetServiceBackupPrimarySiteRequest.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/request/GetServiceBackupPrimarySiteRequest.java new file mode 100644 index 0000000000..c797bca4aa --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/request/GetServiceBackupPrimarySiteRequest.java @@ -0,0 +1,45 @@ +/** + * 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.common.dataplugin.gfe.request; + +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; + +/** + * Request to determine whether specified site id is one of the server's + * configured primary sites for service backup. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#    Engineer    Description
+ * ------------  ---------- ----------- --------------------------
+ * Jun 10, 2014  DR-17401     lshi      Initial creation
+ * 
+ * 
+ * + * @author lshi + * @version 1.0 + */ + +@DynamicSerialize +public class GetServiceBackupPrimarySiteRequest extends AbstractGfeRequest { + +} diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/gis/GeospatialFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/gis/GeospatialFactory.java index b1cd80e182..b7359ec1cd 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/gis/GeospatialFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/gis/GeospatialFactory.java @@ -63,6 +63,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; * to areaFields. * Jan 9, 2013 15600 Qinglu Lin Execute "timezones = myTimeZones;" even if timezones != null. * Oct 22, 2013 2361 njensen Use JAXBManager for XML + * Jun 17, 2014 DR 17390 Qinglu Lin Updated getMetaDataMap() for lonField and latField. * * * @@ -216,6 +217,9 @@ public class GeospatialFactory { areaFields.add(feAreaField); } + areaFields.add("LON"); + areaFields.add("LAT"); + if (timeZoneField != null) { areaFields.add(timeZoneField); } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/portions/GisUtil.java b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/portions/GisUtil.java index 1bba3944ab..63d1d3f9ed 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/portions/GisUtil.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/portions/GisUtil.java @@ -21,6 +21,7 @@ package com.raytheon.uf.common.dataplugin.warning.portions; import java.awt.geom.Point2D; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.EnumSet; @@ -29,6 +30,7 @@ import java.util.List; import org.geotools.referencing.GeodeticCalculator; +import com.raytheon.uf.common.dataplugin.warning.util.CountyUserData; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.GeometryFactory; @@ -54,6 +56,8 @@ import com.vividsolutions.jts.geom.GeometryFactory; * May 1, 2013 1963 jsanchez Refactored calculatePortion to match A1. Do not allow 'Central' to be included if East and West is included. * Jun 3, 2013 2029 jsanchez Updated A1 special case for calculating a central portion. Allowed East Central and West Central. * Dec 4, 2013 2604 jsanchez Moved out of viz.warngen. + * Jun 17, 2014 DR 17390 Qinglu Lin Update calculateLocationPortion(). Use centroid in maps county table for geomCentroid + * for county based products. * * * @author chammack @@ -345,13 +349,22 @@ public class GisUtil { * @return */ public static EnumSet calculateLocationPortion( - Geometry locationGeom, Geometry reference, boolean useExtreme) { + Geometry locationGeom, Geometry reference, boolean useExtreme, boolean notUseShapefileCentroid) { for (int i = 0; i < locationGeom.getNumGeometries(); i++) { Geometry geom = locationGeom.getGeometryN(i); if (geom.intersects(reference)) { - Coordinate geomCentroid = geom.getEnvelope().getCentroid() - .getCoordinate(); + Coordinate geomCentroid = null; + if (notUseShapefileCentroid) { + geomCentroid = geom.getEnvelope().getCentroid() + .getCoordinate(); + } else { + geomCentroid = new Coordinate(); + geomCentroid.x = ((BigDecimal)((CountyUserData)geom.getUserData()). + entry.attributes.get("LON")).doubleValue(); + geomCentroid.y = ((BigDecimal)((CountyUserData)geom.getUserData()). + entry.attributes.get("LAT")).doubleValue(); + } Coordinate refCentroid = reference.getCentroid() .getCoordinate(); diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/portions/PortionsUtil.java b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/portions/PortionsUtil.java index 2f97f7c354..934ce3c0de 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/portions/PortionsUtil.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/portions/PortionsUtil.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import org.geotools.coverage.grid.GeneralGridGeometry; +import com.raytheon.uf.common.dataplugin.warning.util.CountyUserData; import org.opengis.referencing.operation.MathTransform; import com.raytheon.uf.common.dataplugin.warning.portions.GisUtil.Direction; @@ -42,6 +43,7 @@ import com.vividsolutions.jts.geom.Geometry; * Aug 5, 2013 2177 jsanchez Initial creation * Sep 22, 2013 2177 jsanchez Updated logic. Used GisUtil for very small portions. * Dec 4, 2013 2604 jsanchez Moved out of viz.warngen. + * Jun 17, 2014 DR 17390 Qinglu Lin Update getPortions(). * * * @author jsanchez @@ -84,8 +86,15 @@ public class PortionsUtil { // This takes into account the warned areas that are very small // the convex hull of the warned area is used for case the // warnedArea is a geometry collection. - portions = GisUtil.calculateLocationPortion(countyOrZone, - warnedArea.convexHull(), useExtreme); + CountyUserData cud = (CountyUserData) countyOrZone.getUserData(); + String countyName = (String) cud.entry.attributes.get("COUNTYNAME"); + if (countyName == null) { + portions = GisUtil.calculateLocationPortion(countyOrZone, + warnedArea.convexHull(), useExtreme, true); + } else { + portions = GisUtil.calculateLocationPortion(countyOrZone, + warnedArea.convexHull(), useExtreme, false); + } } else { portions = getAreaDesc(entityData.getMeanMask(), entityData.getCoverageMask(), entityData.getOctants(), diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/VM_global_library.vm b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/VM_global_library.vm index 2976204612..c9d739e623 100755 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/VM_global_library.vm +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/VM_global_library.vm @@ -11,6 +11,7 @@ ##### Evan Bookbinder 05-05-2013 handleClosesPoints and 3rd bullet changes (OVER & now) ##### Evan Bookbinder 09-20-2013 Fixed rural area otherPoints in pathcast section, added rural phrase ##### Qinglu Lin 03-17-2014 DR 16309. Updated inserttorwatches and insertsvrwatches. +##### Qinglu Lin 05-21-2014 DR 16309. Updated inserttorwatches and insertsvrwatches by changing 'FOR##' to 'FOR ##'. #################################################################################################### #* Mile Marker Test Code diff --git a/edexOsgi/com.raytheon.uf.tools.gfesuite.servicebackup/svcBackup/ServiceBackup/scripts/cleanup_svcbk b/edexOsgi/com.raytheon.uf.tools.gfesuite.servicebackup/svcBackup/ServiceBackup/scripts/cleanup_svcbk index bbd6744cae..f52f3b09d8 100644 --- a/edexOsgi/com.raytheon.uf.tools.gfesuite.servicebackup/svcBackup/ServiceBackup/scripts/cleanup_svcbk +++ b/edexOsgi/com.raytheon.uf.tools.gfesuite.servicebackup/svcBackup/ServiceBackup/scripts/cleanup_svcbk @@ -49,7 +49,7 @@ fi if [ -d ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/gfe ]; then log_msg "Removing cave site configuration for site ${CAPS_FAILED_SITE}" - rm -fr ${LOCALIZATION_PATH}/cave_static/site/${SITE}/gfe + rm -fr ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/gfe fi if [ -d ${LOCALIZATION_PATH}/cave_static/site/${CAPS_FAILED_SITE}/bundles/maps ]; then diff --git a/edexOsgi/com.raytheon.uf.tools.gfesuite.servicebackup/svcBackup/ServiceBackup/scripts/proc_receive_grids b/edexOsgi/com.raytheon.uf.tools.gfesuite.servicebackup/svcBackup/ServiceBackup/scripts/proc_receive_grids index 88eab0511d..f90e00ca69 100644 --- a/edexOsgi/com.raytheon.uf.tools.gfesuite.servicebackup/svcBackup/ServiceBackup/scripts/proc_receive_grids +++ b/edexOsgi/com.raytheon.uf.tools.gfesuite.servicebackup/svcBackup/ServiceBackup/scripts/proc_receive_grids @@ -1,4 +1,34 @@ #!/bin/bash +## +# 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. +## +############################################################################## +# Process Received Digital Grids +# This is run at the backup site to merge the failed site's grids into the +# Fcst database. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/16/15 3276 randerso Added -T to iscMosaic call +############################################################################## import_file=${1} log_msg Processing file: $import_file @@ -98,7 +128,7 @@ log_msg "CDSPORT is $CDSPORT" log_msg Beginning iscMosaic log_msg 75 -${GFESUITE_BIN}/iscMosaic -h $SVCBU_HOST -r $CDSPORT -d ${SITE}_GRID__Fcst_00000000_0000 -f ${SVCBU_HOME}/${failed_site}Grd.netcdf.gz -n +${GFESUITE_BIN}/iscMosaic -h $SVCBU_HOST -r $CDSPORT -d ${SITE}_GRID__Fcst_00000000_0000 -f ${SVCBU_HOME}/${failed_site}Grd.netcdf.gz -n -T if [ $? -ne 0 ] then log_msg "ERROR: iscMosaic failed to import grids from ${SITE}_GRID__Fcst_00000000_0000" diff --git a/edexOsgi/com.raytheon.uf.tools.gfesuite.servicebackup/svcBackup/ServiceBackup/scripts/receive_grids_from_backup_site b/edexOsgi/com.raytheon.uf.tools.gfesuite.servicebackup/svcBackup/ServiceBackup/scripts/receive_grids_from_backup_site index c1a933df26..a528118a9d 100644 --- a/edexOsgi/com.raytheon.uf.tools.gfesuite.servicebackup/svcBackup/ServiceBackup/scripts/receive_grids_from_backup_site +++ b/edexOsgi/com.raytheon.uf.tools.gfesuite.servicebackup/svcBackup/ServiceBackup/scripts/receive_grids_from_backup_site @@ -1,4 +1,35 @@ #!/bin/bash +## +# 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. +## +############################################################################## +# Receive grids from backup site +# This script is run when importing your digital data back from the backup site. +# The grids are placed in the Restore database. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/16/15 3276 randerso Added -T to iscMosaic call +############################################################################## + if [ ${#AWIPS_HOME} = 0 ] then path_to_script=`readlink -f $0` @@ -94,7 +125,7 @@ if [ -a ${import_file} ] then #use iscMosaic to load grids into databases log_msg "Running iscMosaic to unpack griddded data..." - ${GFESUITE_BIN}/iscMosaic -h $SVCBU_HOST -r $CDSPORT -d ${SITE}_GRID__Restore_00000000_0000 -f ${import_file} -n -x + ${GFESUITE_BIN}/iscMosaic -h $SVCBU_HOST -r $CDSPORT -d ${SITE}_GRID__Restore_00000000_0000 -f ${import_file} -n -T -x if [ $? -ne 0 ]; then log_msg "ERROR: iscMosaic failed to run correctly. Please re-run iscMosaic manually." diff --git a/tests/unit/com/raytheon/edex/plugin/gfe/wcl/TestWCLWatchSrv.java b/tests/unit/com/raytheon/edex/plugin/gfe/wcl/TestWCLWatchSrv.java index a837637e79..d8980e8020 100644 --- a/tests/unit/com/raytheon/edex/plugin/gfe/wcl/TestWCLWatchSrv.java +++ b/tests/unit/com/raytheon/edex/plugin/gfe/wcl/TestWCLWatchSrv.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.edex.plugin.gfe.wcl; +package com.raytheon.edex.plugin.gfe.watch; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -29,6 +29,8 @@ import java.io.File; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Calendar; +import java.util.Collection; +import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.List; @@ -37,11 +39,12 @@ import java.util.TimeZone; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; -// TODO fix? -@Ignore +import com.raytheon.edex.plugin.gfe.watch.WCLWatchSrv; +import com.raytheon.edex.plugin.gfe.watch.WatchProductUtil; +import com.raytheon.edex.plugin.gfe.watch.WclInfo; + public class TestWCLWatchSrv { private WclInfo wclInfoA; @@ -78,11 +81,11 @@ public class TestWCLWatchSrv { wfosExpected.add("OAX"); wfosExpected.add("MFL"); wfosExpected.add("ICT"); - Set wfos = wclWatchSrv.attnWFOs(linesA); + Collection wfos = WatchProductUtil.findAttnWFOs(linesA); assertEquals("LinesA", wfosExpected, wfos); wfosExpected.clear(); - wfos = wclWatchSrv.attnWFOs(linesB); + wfos = WatchProductUtil.findAttnWFOs(linesB); assertEquals("LinesB", wfosExpected, wfos); } @@ -98,7 +101,7 @@ public class TestWCLWatchSrv { } @Override - protected File getWclDir() { + protected File getWclDir(String siteID) { String home = System.getenv("HOME"); File fakeDir = new File(home); return fakeDir; @@ -128,7 +131,7 @@ public class TestWCLWatchSrv { // localization. wclWatchSrv = new WCLWatchSrv() { @Override - protected File getWclDir() { + protected File getWclDir(String siteID) { String home = System.getenv("HOME"); return new File(home); } @@ -138,7 +141,8 @@ public class TestWCLWatchSrv { PrintWriter pw = new PrintWriter(temp); pw.println("Testing"); pw.close(); - wclWatchSrv.makePermanent(temp, completePIL); + Collection dummy = Collections.emptySet(); + wclWatchSrv.makePermanent(temp, completePIL, dummy); assertTrue("expetedFile exists", expectedFile.exists()); assertTrue("expectedFile isFile", expectedFile.isFile()); assertFalse("temp exists", temp.exists());