diff --git a/cave/build/p2-build.xml b/cave/build/p2-build.xml index cb9aaa38b0..f33b5d2b33 100644 --- a/cave/build/p2-build.xml +++ b/cave/build/p2-build.xml @@ -264,6 +264,10 @@ + + + diff --git a/cave/com.raytheon.uf.viz.archive.feature/feature.xml b/cave/com.raytheon.uf.viz.archive.feature/feature.xml index 5196e8495f..17e8e6923a 100644 --- a/cave/com.raytheon.uf.viz.archive.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.archive.feature/feature.xml @@ -18,15 +18,8 @@ - - - - - - - - - + + + + + + + + diff --git a/cave/com.raytheon.uf.viz.archive/build.properties b/cave/com.raytheon.uf.viz.archive/build.properties index 34d2e4d2da..e9863e281e 100644 --- a/cave/com.raytheon.uf.viz.archive/build.properties +++ b/cave/com.raytheon.uf.viz.archive/build.properties @@ -1,4 +1,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ - . + .,\ + plugin.xml diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/AbstractArchiveDlg.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/AbstractArchiveDlg.java index c9784a1dd8..1d3f0df3ef 100644 --- a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/AbstractArchiveDlg.java +++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/AbstractArchiveDlg.java @@ -24,6 +24,7 @@ import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -32,7 +33,6 @@ import org.eclipse.core.runtime.jobs.Job; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Combo; @@ -96,10 +96,19 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements */ protected boolean setSelect = false; + /** + * Must be set by sub-class prior to creating table. + */ protected TableType tableType; + /** + * Job that computes sizes of table row entries off the UI thread. + */ protected final SizeJob sizeJob = new SizeJob(); + /** Keeps track of when it is safe to clear the busy cursor. */ + protected final AtomicInteger busyCnt = new AtomicInteger(0); + /** * @param parentShell */ @@ -270,15 +279,27 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements Job job = new Job("setup") { @Override protected IStatus run(IProgressMonitor monitor) { - initInfo(); - VizApp.runAsync(new Runnable() { + ArchiveConfigManager.getInstance().reset(); + if (!shell.isDisposed()) { + VizApp.runAsync(new Runnable() { - @Override - public void run() { - populateComboBoxes(); - updateTableComp(); - } - }); + @Override + public void run() { + populateComboBoxes(); + setCursorBusy(false); + } + }); + } + initDisplayData(); + if (!shell.isDisposed()) { + VizApp.runAsync(new Runnable() { + + @Override + public void run() { + updateTableComp(); + } + }); + } return Status.OK_STATUS; } }; @@ -360,12 +381,11 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements } /** - * Get information from manager for populating combo boxes and set up to get - * selected entries sizes. Intended for use on a non-UI thread. + * Set up all display data and queue getting sizes for any that are + * selected. */ - private void initInfo() { + private void initDisplayData() { ArchiveConfigManager manager = ArchiveConfigManager.getInstance(); - manager.reset(); Calendar startCal = getStart(); Calendar endCal = getEnd(); String[] archiveNames = manager.getArchiveDataNamesList(); @@ -401,18 +421,32 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements Calendar endCal = getEnd(); setCursorBusy(true); - sizeJob.clearQueue(); - ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName); - CategoryInfo categoryInfo = archiveInfo.get(categoryName); + try { + sizeJob.clearQueue(); - for (DisplayData displayData : categoryInfo.getDisplayDataList()) { - sizeJob.queue(new SizeJobRequest(displayData, startCal, endCal)); + ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName); + + // Not yet populated by background job. + if (archiveInfo == null) { + return; + } + + // Not yet populated by background job. + CategoryInfo categoryInfo = archiveInfo.get(categoryName); + if (categoryInfo == null) { + return; + } + + for (DisplayData displayData : categoryInfo.getDisplayDataList()) { + sizeJob.queue(new SizeJobRequest(displayData, startCal, endCal)); + } + sizeJob.requeueSelected(startCal, endCal); + + tableComp.populateTable(categoryInfo.getDisplayDataList()); + } finally { + setCursorBusy(false); } - sizeJob.requeueSelected(startCal, endCal); - - tableComp.populateTable(categoryInfo.getDisplayDataList()); - setCursorBusy(false); } /** @@ -421,11 +455,12 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements * @param state */ protected void setCursorBusy(boolean state) { - Cursor cursor = null; if (state) { - cursor = shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT); + busyCnt.addAndGet(1); + shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); + } else if (busyCnt.addAndGet(-1) == 0) { + shell.setCursor(null); } - shell.setCursor(cursor); } /* diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveTableComp.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveTableComp.java index 8923e72b3f..740642beae 100644 --- a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveTableComp.java +++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveTableComp.java @@ -380,6 +380,7 @@ public class ArchiveTableComp extends Composite { } updateSelectionLabels(); + setModified(); } /** diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/CaseCreationDlg.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/CaseCreationDlg.java index eb39bdc72c..4bcc137089 100644 --- a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/CaseCreationDlg.java +++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/CaseCreationDlg.java @@ -418,7 +418,7 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements browseBtn.setToolTipText("Select directory to place case."); Label stateLbl = new Label(fileBrowserComp, SWT.NONE); - stateLbl.setText("Full - Avaliable:"); + stateLbl.setText("Full - Available:"); locationStateLbl = new Label(fileBrowserComp, SWT.BORDER); gd = new GridData(200, SWT.DEFAULT); @@ -612,6 +612,7 @@ public class CaseCreationDlg extends AbstractArchiveDlg implements */ private void handleBrowserSelection() { DirectoryDialog dlg = new DirectoryDialog(shell, SWT.OPEN); + dlg.setText("Case Location"); String dirName = dlg.open(); if (dirName != null) { locationLbl.setText(trimDirectoryName(dirName)); diff --git a/cave/com.raytheon.viz.grid/localization/styleRules/gridImageryStyleRules.xml b/cave/com.raytheon.viz.grid/localization/styleRules/gridImageryStyleRules.xml index ff063d9038..441bc15cc6 100644 --- a/cave/com.raytheon.viz.grid/localization/styleRules/gridImageryStyleRules.xml +++ b/cave/com.raytheon.viz.grid/localization/styleRules/gridImageryStyleRules.xml @@ -4169,6 +4169,14 @@ TPCSG + TPCSG-20 + TPCSG-30 + TPCSG-40 + TPCSG-50 + TPCSG-60 + TPCSG-70 + TPCSG-80 + TPCSG-90 ft @@ -4188,15 +4196,30 @@ --> - TPCSG_61E2 - TPCSG_305E2 - TPCSG_274E2 - TPCSG_244E2 - TPCSG_213E2 - TPCSG_183E2 - TPCSG_152E2 - TPCSG_122E2 - TPCSG_91E2 + TPCSG-61E2 + TPCSG-91E2 + TPCSG-122E2 + TPCSG-152E2 + TPCSG-183E2 + TPCSG-213E2 + TPCSG-244E2 + TPCSG-274E2 + TPCSG-305E2 + TPCSG-335E2 + TPCSG-366E2 + TPCSG-396E2 + TPCSG-457E2 + TPCSG-427E2 + TPCSG-488E2 + TPCSG-518E2 + TPCSG-549E2 + TPCSG-579E2 + TPCSG-610E2 + TPCSG-640E2 + TPCSG-671E2 + TPCSG-701E2 + TPCSG-732E2 + TPCSG-762E2 % @@ -4842,4 +4865,4 @@ - \ No newline at end of file + diff --git a/cave/com.raytheon.viz.grid/localization/volumebrowser/FieldDisplayTypes.xml b/cave/com.raytheon.viz.grid/localization/volumebrowser/FieldDisplayTypes.xml index ff71abbd4f..997811c16d 100644 --- a/cave/com.raytheon.viz.grid/localization/volumebrowser/FieldDisplayTypes.xml +++ b/cave/com.raytheon.viz.grid/localization/volumebrowser/FieldDisplayTypes.xml @@ -47,15 +47,38 @@ - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesAction.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesAction.java index 53ac5a315f..b88a81f16a 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesAction.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesAction.java @@ -38,6 +38,7 @@ import org.eclipse.core.commands.ExecutionException; * ------------ ---------- ----------- -------------------------- * 6/27/06 lvenable Initial Creation. * 02/05/2013 1578 rferrel Changes for non-blocking singleton TimeSeriesDlg. + * 6/8/2013 15980 wkwock Fix selected station not update * * * @@ -48,8 +49,10 @@ public class TimeSeriesAction extends AbstractHandler { @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - TimeSeriesDlg.getInstance().open(); + TimeSeriesDlg tsd = TimeSeriesDlg.getInstance(); + tsd.open(); + tsd.updateFromDisplayManager(); - return null; + return null; } } diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDlg.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDlg.java index 70017bfcb3..9d4024bf4f 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDlg.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDlg.java @@ -122,6 +122,7 @@ import com.raytheon.viz.hydrocommon.util.StnClassSyncUtil; * 05 Feb 2013 1578 rferrel Dialog made non-blocking and a singleton. * 06 May 2013 1976 mpduff Code cleanup. * 06 Jun 2013 2076 mpduff Fix station list selection and graph button enabling. + * 0 Jun 2013 15980 wkwock Fix selected station not update * * * @author lvenable @@ -2612,4 +2613,18 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog { protected void preOpened() { super.preOpened(); } + + /** + * In case user selected a different station in the Hydro perspective, + * update currentLid, etc + */ + public void updateFromDisplayManager() { + HydroDisplayManager hdm = HydroDisplayManager.getInstance(); + String newLid=hdm.getCurrentLid(); + if (newLid!=null && !newLid.equalsIgnoreCase(currentLid)) { + updateAndOpen(newLid, this.displayGraph); + openGraph(); + } + } + } diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/IPlotModelGeneratorCaller.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/IPlotModelGeneratorCaller.java index db1ebce4d0..9357496134 100644 --- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/IPlotModelGeneratorCaller.java +++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/IPlotModelGeneratorCaller.java @@ -29,7 +29,8 @@ import com.raytheon.uf.viz.core.drawables.IImage; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Sep 16, 2009 mschenke Initial creation + * Sep 16, 2009 mschenke Initial creation + * Jun 25, 2013 1869 bsteffen Fix plot sampling. * * * @@ -42,5 +43,5 @@ public interface IPlotModelGeneratorCaller { public void clearImages(); - public void messageGenerated(String dataURI, String message); + public void messageGenerated(PlotInfo[] key, String message); } diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResource2.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResource2.java index a585fe1687..ddb376e3a2 100644 --- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResource2.java +++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResource2.java @@ -28,7 +28,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.TreeMap; import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang.Validate; @@ -96,6 +95,8 @@ import com.vividsolutions.jts.geom.Coordinate; * stations updates properly * Jun 06, 2013 2072 bsteffen Fix concurrency problems when init is * called before time matching is done. + * Jun 25, 2013 1869 bsteffen Fix plot sampling. + * * * * @author brockwoo @@ -126,8 +127,6 @@ public class PlotResource2 extends private JobPool frameRetrievalPool = new JobPool("Retrieving plot frame", 8, true); - private TreeMap rawMessageMap = new TreeMap(); - private class FrameRetriever implements Runnable { private DataTime dataTime; @@ -145,13 +144,36 @@ public class PlotResource2 extends } + /** + * A station represents all the data for a single location(station) for a + * single frame + * + */ public static class Station { + /* + * Contains all PlotInfo objects for the same stationId with the same + * normalized time(real time will be different) + */ public PlotInfo[] info; + /* + * The image to display for this plot + */ public PointImage plotImage; + /* + * Sampling text for this plot + */ + public String rawMessage; + + /* + * Information used be the progressive disclosure algorithm + */ public Object progDiscInfo; + /* + * Location of the plot in descriptor grid space. + */ public Coordinate pixelLocation; } @@ -385,7 +407,7 @@ public class PlotResource2 extends existingStation.plotImage.getImage().dispose(); existingStation.plotImage = null; // DR14966 - rawMessageMap.remove(existingStation.info[0].dataURI); + existingStation.rawMessage = null; PlotInfo[] samplePlot = new PlotInfo[1]; samplePlot[0] = new PlotInfo(); samplePlot[0] = plot; @@ -406,8 +428,8 @@ public class PlotResource2 extends } } if (!dup) { - // Added for DR14996 - existingStation.info = Arrays.copyOf(existingStation.info,1); + // Added for DR14996 + existingStation.info = Arrays.copyOf(existingStation.info, 1); existingStation.info[0] = plot; Arrays.sort(existingStation.info, new Comparator() { @Override @@ -516,32 +538,25 @@ public class PlotResource2 extends } } - PlotInfo[] inspectPlot = null; + Station inspectPlot = null; if (availableStations.size() == 1) { - inspectPlot = availableStations.get(0).info; + inspectPlot = availableStations.get(0); } else if (availableStations.size() > 1) { int index = findClosestPlot(latlon, availableStations); if (index != -1) { - inspectPlot = availableStations.get(index).info; + inspectPlot = availableStations.get(index); } } if (inspectPlot != null) { - String dataURI = inspectPlot[0].dataURI; - if (rawMessageMap.containsKey(dataURI)) { - if (rawMessageMap.get(dataURI) != null) { - message = rawMessageMap.get(dataURI); - } - } else { + message = inspectPlot.rawMessage; + if (message == null) { message = "Generating..."; - synchronized (rawMessageMap) { - rawMessageMap.put(dataURI, message); - } - List list = new ArrayList(); - list.add(inspectPlot); + List list = new ArrayList(1); + list.add(inspectPlot.info); Params params = Params.PLOT_AND_SAMPLE; - if (inspectPlot[0].pdv != null) { + if (inspectPlot.info[0].pdv != null) { params = Params.SAMPLE_ONLY; } GetDataTask task = new GetDataTask(list, params); @@ -737,11 +752,20 @@ public class PlotResource2 extends } @Override - public void messageGenerated(String dataURI, String message) { - synchronized (rawMessageMap) { - rawMessageMap.put(dataURI, message); + public void messageGenerated(PlotInfo[] key, String message) { + // Key will be the same PlotInfo[] provided to the generator(which will + // be all the PlotInfo[] from a single station) and message will be the + // sample text. + DataTime normTime = getNormalizedTime(key[0].dataTime); + FrameInformation frameInfo = this.frameMap.get(normTime); + if (frameInfo != null) { + Station s = frameInfo.stationMap.get(key[0].stationId); + if (s != null) { + s.rawMessage = message; + issueRefresh(); + } } - issueRefresh(); } + } diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/thread/PlotSampleGeneratorJob.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/thread/PlotSampleGeneratorJob.java index a1b8a02a1c..957a71314d 100644 --- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/thread/PlotSampleGeneratorJob.java +++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/thread/PlotSampleGeneratorJob.java @@ -43,6 +43,7 @@ import com.raytheon.viz.pointdata.PlotModelFactory2; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jul 13, 2011 njensen Initial creation + * Jun 25, 2013 1869 bsteffen Fix plot sampling. * * * @@ -82,7 +83,7 @@ public class PlotSampleGeneratorJob extends Job { String message = plotFactory.getStationMessage(infos[0].pdv, infos[0].dataURI); - caller.messageGenerated(infos[0].dataURI, message); + caller.messageGenerated(infos, message); } catch (Exception e) { statusHandler.error("Error creating plot", e); } diff --git a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatResource.java b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatResource.java index beee2420f1..67dbd6040f 100644 --- a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatResource.java +++ b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatResource.java @@ -38,8 +38,6 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.datum.PixelInCell; import com.raytheon.uf.common.colormap.IColorMap; -import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; -import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord; import com.raytheon.uf.common.dataplugin.satellite.units.SatelliteUnits; @@ -59,6 +57,7 @@ import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.DrawableImage; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IMeshCallback; +import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.map.MapDescriptor; @@ -67,6 +66,7 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; import com.raytheon.uf.viz.core.rsc.hdf5.ImageTile; +import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences; import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; import com.raytheon.uf.viz.core.style.StyleManager; import com.raytheon.uf.viz.core.style.StyleRule; @@ -98,6 +98,7 @@ import com.raytheon.viz.satellite.SatelliteConstants; * - AWIPS2 Baseline Repository -------- * 07/17/2012 798 jkorman Use decimationLevels from SatelliteRecord. Removed hard-coded * data set names. + * 06/14/2013 DR 16070 jgerth Support for sampling from data mapping * * * @author chammack @@ -244,6 +245,7 @@ public class SatResource extends colorMapParameters.setColorMapMin(0.0f); colorMapParameters.setColorMapMax(255.0f); } + if (unit instanceof GenericPixel) { // Derived parameter data will be signed colorMapParameters.setDataMin(-128.0f); @@ -255,8 +257,8 @@ public class SatResource extends colorMapParameters.setColorMapMin(0.0f); colorMapParameters.setColorMapMax(252.0f); } else { - colorMapParameters.setDataMin(0.0f); - colorMapParameters.setDataMax(255.0f); + colorMapParameters.setDataMin(0.0f); + colorMapParameters.setDataMax(255.0f); } if (colorMap != null) { @@ -404,11 +406,24 @@ public class SatResource extends DataMappingPreferences dataMapping = cmp.getDataMapping(); if (dataMapping != null) { // convert to pixel value for checking labels - double pixelValue = cmp.getDisplayToDataConverter().convert( - value.doubleValue()); - // if the pixel value matches the data mapping entry use that - // label instead - String label = dataMapping.getLabelValueForDataValue(pixelValue); + // START DR 16070 fix 1 + double pixelValue = value.doubleValue(); + if (cmp.getDisplayToDataConverter() != null) + pixelValue = cmp.getDisplayToDataConverter().convert( + value.doubleValue()); + // if the pixel value matches the data mapping entry use that + // label instead + String label = null; + String gfs = null; + if (sampleRange != null) { + gfs = sampleRange.getFormatString(); + } + if (gfs != null && gfs.length() < 3) { + label = dataMapping.getLabelValueForDataValue(pixelValue, gfs); + } else { + label = dataMapping.getLabelValueForDataValue(pixelValue); + } + // END fix 1 if (label != null) { return label; } @@ -419,6 +434,16 @@ public class SatResource extends // counts was not an acceptable unit. String unitString = unit == null ? "" : unit.toString().equals("bit") ? "counts" : unit.toString(); + // START DR 16070 fix 2 + if (dataMapping != null) + if (dataMapping.getEntries() != null) + if (dataMapping.getEntries().get(0) != null) + if (dataMapping.getEntries().get(0).getOperator() != null) + if (unitString.equals("") + && dataMapping.getEntries().get(0).getOperator().equals("i") + && dataMapping.getEntries().get(0).getLabel() != null) + unitString = dataMapping.getEntries().get(0).getLabel(); + // END fix 2 double f1 = Double.NEGATIVE_INFINITY; double f2 = Double.POSITIVE_INFINITY; if (sampleRange != null) { diff --git a/cave/com.raytheon.viz.ui.personalities.awips/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.ui.personalities.awips/META-INF/MANIFEST.MF index b607cb7aa4..0cf745162c 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.ui.personalities.awips/META-INF/MANIFEST.MF @@ -27,4 +27,5 @@ Bundle-ActivationPolicy: lazy Bundle-ClassPath: . Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: com.raytheon.viz.ui.personalities.awips -Import-Package: com.raytheon.uf.common.pypies +Import-Package: com.raytheon.uf.common.pypies, + com.raytheon.uf.viz.core.maps diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/CAVE.java b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/CAVE.java index 165a53b133..d745adf9f6 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/CAVE.java +++ b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/CAVE.java @@ -19,8 +19,11 @@ **/ package com.raytheon.viz.ui.personalities.awips; +import com.raytheon.uf.viz.core.maps.MapStore; + /** - * TODO Add Description + * This is the default component for CAVE that is the standard workbench with + * all the perspectives. * *
  * 
@@ -28,6 +31,7 @@ package com.raytheon.viz.ui.personalities.awips;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Aug 9, 2010            mschenke     Initial creation
+ * Jul 1, 2013  2139      jsanchez     Loaded map tree at cave start up.
  * 
  * 
* @@ -50,7 +54,11 @@ public class CAVE extends AbstractCAVEComponent { */ @Override protected void startInternal(String componentName) throws Exception { - + // Loading Map Tree + long t = System.currentTimeMillis(); + MapStore.getMapTree(); + System.out.println("Loading Map Tree: " + + (System.currentTimeMillis() - t)); } } diff --git a/edexOsgi/build.edex/build.xml b/edexOsgi/build.edex/build.xml index e5c6a8871a..10cf4d77d2 100644 --- a/edexOsgi/build.edex/build.xml +++ b/edexOsgi/build.edex/build.xml @@ -102,6 +102,10 @@
+ + + diff --git a/edexOsgi/build.edex/esb/conf/spring/cron.properties b/edexOsgi/build.edex/esb/conf/spring/cron.properties index 3cc6b840d8..a865af4eff 100644 --- a/edexOsgi/build.edex/esb/conf/spring/cron.properties +++ b/edexOsgi/build.edex/esb/conf/spring/cron.properties @@ -14,6 +14,8 @@ gfe.cron=0+15+*+*+*+? repack.cron=0+20+*+*+*+? # runs database and hdf5 archive for archive server to pull data from archive.cron=0+40+*+*+*+? +# purge archives +archive.purge.cron=0+0+*+*+*+? ###purge configuration # Interval at which the purge job kicks off diff --git a/edexOsgi/com.raytheon.edex.feature.uframe/feature.xml b/edexOsgi/com.raytheon.edex.feature.uframe/feature.xml index 069eb250f0..22c3c97dc2 100644 --- a/edexOsgi/com.raytheon.edex.feature.uframe/feature.xml +++ b/edexOsgi/com.raytheon.edex.feature.uframe/feature.xml @@ -107,7 +107,7 @@ - + @@ -124,4 +124,8 @@ id="com.raytheon.uf.edex.registry.feature" version="0.0.0"/> + + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/tables/7/14/4.2.10.3.table b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/tables/7/14/4.2.10.3.table index 225bcf3a14..34dc83c0b9 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/tables/7/14/4.2.10.3.table +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/tables/7/14/4.2.10.3.table @@ -1,6 +1,6 @@ # Product Discipline 10: Oceanographic products, Parameter Category 3: Surface Properties #192-254 Reserved for local use -192:192:Probabilistic Storm Surge height w/10% chance of being exceeded:%:TPCSG +192:192:Probabilistic Storm Surge height w/10% chance of being exceeded:m:TPCSG 193:193:Extra Tropical Storm Surge:m:ETSRG 194:194:Ocean Surface Elevation Relative to Geoid:m:ELEV 195:195:Sea Surface Height Relative to Geoid:m:SSHG @@ -11,13 +11,13 @@ 200:200:Surface Salinity Trend:psu per day:SSST 201:201:Kinetic Energy:J/kg:KENG 202:202:Salt Flux:mm*s:SLTFL -242:242:Probabilistic Storm Surge height w/20% chance of being exceeded:%:TPCSG_20 -243:243:Probabilistic Storm Surge height w/30% chance of being exceeded:%:TPCSG_30 -244:244:Probabilistic Storm Surge height w/40% chance of being exceeded:%:TPCSG_40 -245:245:Probabilistic Storm Surge height w/50% chance of being exceeded:%:TPCSG_50 -246:246:Probabilistic Storm Surge height w/60% chance of being exceeded:%:TPCSG_60 -247:247:Probabilistic Storm Surge height w/70% chance of being exceeded:%:TPCSG_70 -248:248:Probabilistic Storm Surge height w/80% chance of being exceeded:%:TPCSG_80 -249:249:Probabilistic Storm Surge height w/90% chance of being exceeded:%:TPCSG_90 +242:242:Probabilistic Storm Surge height w/20% chance of being exceeded:m:TPCSG_20 +243:243:Probabilistic Storm Surge height w/30% chance of being exceeded:m:TPCSG_30 +244:244:Probabilistic Storm Surge height w/40% chance of being exceeded:m:TPCSG_40 +245:245:Probabilistic Storm Surge height w/50% chance of being exceeded:m:TPCSG_50 +246:246:Probabilistic Storm Surge height w/60% chance of being exceeded:m:TPCSG_60 +247:247:Probabilistic Storm Surge height w/70% chance of being exceeded:m:TPCSG_70 +248:248:Probabilistic Storm Surge height w/80% chance of being exceeded:m:TPCSG_80 +249:249:Probabilistic Storm Surge height w/90% chance of being exceeded:m:TPCSG_90 250:250:Extra Tropical Storm Surge Combined Surge and Tide:m:ETCWL 255:255:Missing diff --git a/edexOsgi/com.raytheon.uf.common.archive/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.archive/META-INF/MANIFEST.MF index c3617550f9..7fa1445e69 100644 --- a/edexOsgi/com.raytheon.uf.common.archive/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.archive/META-INF/MANIFEST.MF @@ -7,8 +7,8 @@ Bundle-Vendor: RAYTHEON Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: com.raytheon.uf.common.archive.config, com.raytheon.uf.common.archive.exception -Require-Bundle: com.raytheon.uf.common.util;bundle-version="1.12.1174", - com.raytheon.uf.common.localization;bundle-version="1.12.1174", - com.raytheon.uf.common.status;bundle-version="1.12.1174", - org.apache.commons.io;bundle-version="2.4.0", - com.raytheon.uf.common.time;bundle-version="1.12.1174" +Require-Bundle: com.raytheon.uf.common.util, + com.raytheon.uf.common.localization, + com.raytheon.uf.common.status, + org.apache.commons.io, + com.raytheon.uf.common.time diff --git a/edexOsgi/com.raytheon.uf.common.archive/build.properties b/edexOsgi/com.raytheon.uf.common.archive/build.properties index 131d4d53ca..2e47d39a18 100644 --- a/edexOsgi/com.raytheon.uf.common.archive/build.properties +++ b/edexOsgi/com.raytheon.uf.common.archive/build.properties @@ -2,3 +2,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ + / + diff --git a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/ArchiveConfigManager.java b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/ArchiveConfigManager.java index 835cd59897..db9e504589 100644 --- a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/ArchiveConfigManager.java +++ b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/ArchiveConfigManager.java @@ -29,6 +29,7 @@ import java.util.Arrays; import java.util.Calendar; import java.util.Collection; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TimeZone; @@ -71,6 +72,9 @@ import com.raytheon.uf.common.util.FileUtil; * ------------ ---------- ----------- -------------------------- * May 1, 2013 1966 rferrel Initial creation * May 29, 2013 1965 bgonzale Added archive creation, purge, and save methods. + * Updated purgeExpiredFromArchive to check time of files in + * directory before purging them. + * Added null check for topLevelDirs in purgeExpiredFromArchive. * * * @@ -203,23 +207,18 @@ public class ArchiveConfigManager { public Collection createArchive(File archiveDir, Collection displaysSelectedForArchive, Calendar start, Calendar end) throws IOException, ArchiveException { - Collection archivedFiles = null; + Collection archivedFiles = new ArrayList(); FileUtils.forceMkdir(archiveDir); if (archiveDir.exists()) { - Collection filesToArchive = new ArrayList(); - for (DisplayData display : displaysSelectedForArchive) { - List files = getDisplayFiles(display, start, end); - filesToArchive.addAll(files); - String rootDirString = display.archiveConfig.getRootDir(); String archiveDirString = archiveDir.getAbsolutePath(); + String rootDirString = display.archiveConfig.getRootDir(); - archivedFiles = new ArrayList(filesToArchive.size()); rootDirString = (rootDirString.endsWith(File.separator) ? rootDirString .substring(0, rootDirString.lastIndexOf(File.separatorChar)) : rootDirString); - for (File srcFile : filesToArchive) { + for (File srcFile : getDisplayFiles(display, start, end)) { String fileAbsPath = srcFile.getAbsolutePath(); File newArchiveDir = getDirRelativeToArchiveDirFromRoot( srcFile.isDirectory(), fileAbsPath, rootDirString, @@ -269,33 +268,87 @@ public class ArchiveConfigManager { */ public Collection purgeExpiredFromArchive(ArchiveConfig archive) { Collection filesPurged = new ArrayList(); + String archiveRootDirPath = archive.getRootDir(); + File archiveRootDir = new File(archiveRootDirPath); + String[] topLevelDirs = archiveRootDir.list(); + List topLevelDirsNotPurged = new ArrayList(); + if (topLevelDirs != null) { + topLevelDirsNotPurged.addAll(Arrays.asList(topLevelDirs)); + } for (CategoryConfig category : archive.getCategoryList()) { Calendar purgeTime = calculateExpiration(archive, category); + CategoryFileDateHelper helper = new CategoryFileDateHelper( + category, archive.getRootDir()); + IOFileFilter fileDateFilter = FileFilterUtils.and( + FileFilterUtils.fileFileFilter(), + new FileDateFilter(null, purgeTime, helper)); + // Remove the directory associated with this category from the not + // purged list since it is being purged. + for (Iterator iter = topLevelDirsNotPurged.iterator(); iter + .hasNext();) { + String dirName = iter.next(); + if (helper.isCategoryDirectory(dirName)) { + iter.remove(); + break; + } + } for (DisplayData display : getDisplayData(archive.getName(), category.getName(), true)) { List displayFiles = getDisplayFiles(display, null, purgeTime); for (File file : displayFiles) { - if (file.isFile()) { - filesPurged.add(file); - } else if (file.isDirectory()) { - filesPurged.addAll(FileUtils.listFiles(file, - FileFilterUtils.fileFileFilter(), - FileFilterUtils.trueFileFilter())); - } - FileUtils.deleteQuietly(file); + filesPurged.addAll(purgeFile(file, fileDateFilter, + archiveRootDirPath)); } } } + + // check for other expired in top level directories not covered + // by the categories in the archives + Calendar defaultPurgeTime = calculateExpiration(archive, null); + for (String topDirName : topLevelDirsNotPurged) { + IOFileFilter fileDateFilter = FileFilterUtils.and(FileFilterUtils + .fileFileFilter(), new FileDateFilter(null, + defaultPurgeTime)); + File topLevelDir = new File(archiveRootDir, topDirName); + + filesPurged.addAll(purgeFile(topLevelDir, fileDateFilter, + archiveRootDirPath)); + } + return filesPurged; + } + + private Collection purgeFile(File fileToPurge, + IOFileFilter filter, final String archiveRootDir) { + Collection filesPurged = new ArrayList(); + + if (fileToPurge.isFile() && filter.accept(fileToPurge)) { + filesPurged.add(fileToPurge); + FileUtils.deleteQuietly(fileToPurge); + } else if (fileToPurge.isDirectory()) { + Collection expiredFilesInDir = FileUtils.listFiles( + fileToPurge, filter, FileFilterUtils.trueFileFilter()); + + for (File dirFile : expiredFilesInDir) { + filesPurged.addAll(purgeFile(dirFile, filter, archiveRootDir)); + } + + // if the directory is empty and not the archive root dir, then + // delete it + if (fileToPurge.list().length == 0 + && !fileToPurge.getAbsolutePath().equals(archiveRootDir)) { + FileUtils.deleteQuietly(fileToPurge); + } + } return filesPurged; } private Calendar calculateExpiration(ArchiveConfig archive, CategoryConfig category) { Calendar newCal = TimeUtil.newGmtCalendar(); - int retHours = category.getRetentionHours() == 0 ? archive + int retHours = category == null || category.getRetentionHours() == 0 ? archive .getRetentionHours() : category.getRetentionHours(); if (retHours != 0) { newCal.add(Calendar.HOUR, (-1) * retHours); @@ -462,40 +515,11 @@ public class ArchiveConfigManager { List fileList = new ArrayList(); if (dirOnly) { - Pattern pattern = Pattern.compile(categoryConfig.getDirPattern()); + for (String dirPattern : categoryConfig.getDirPatternList()) { + Pattern pattern = Pattern.compile(dirPattern); - for (File dir : dirs) { - String path = dir.getAbsolutePath().substring(beginIndex); - Matcher matcher = pattern.matcher(path); - if (matcher.matches()) { - int year = Integer.parseInt(matcher.group(yearIndex)); - // Adjust month value to Calendar's 0 - 11 - int month = Integer.parseInt(matcher.group(monthIndex)) - 1; - int day = Integer.parseInt(matcher.group(dayIndex)); - int hour = Integer.parseInt(matcher.group(hourIndex)); - fileCal.set(year, month, day, hour, 0, 0); - long fileTime = fileCal.getTimeInMillis(); - if ((startTime <= fileTime) && (fileTime < endTime)) { - fileList.add(dir); - } - } - } - } else { - Pattern pattern = Pattern.compile(categoryConfig.getDirPattern() - + File.separator + categoryConfig.getFilePattern()); - final Pattern filePattern = Pattern.compile("^" + filePatternStr - + "$"); - for (File dir : dirs) { - List fList = FileUtil.listDirFiles(dir, new FileFilter() { - - @Override - public boolean accept(File pathname) { - return filePattern.matcher(pathname.getName()) - .matches(); - } - }, false); - for (File file : fList) { - String path = file.getAbsolutePath().substring(beginIndex); + for (File dir : dirs) { + String path = dir.getAbsolutePath().substring(beginIndex); Matcher matcher = pattern.matcher(path); if (matcher.matches()) { int year = Integer.parseInt(matcher.group(yearIndex)); @@ -506,7 +530,45 @@ public class ArchiveConfigManager { fileCal.set(year, month, day, hour, 0, 0); long fileTime = fileCal.getTimeInMillis(); if ((startTime <= fileTime) && (fileTime < endTime)) { - fileList.add(file); + fileList.add(dir); + } + } + } + } + } else { + for (String dirPattern : categoryConfig.getDirPatternList()) { + Pattern pattern = Pattern.compile(dirPattern + File.separator + + categoryConfig.getFilePattern()); + final Pattern filePattern = Pattern.compile("^" + + filePatternStr + "$"); + for (File dir : dirs) { + List fList = FileUtil.listDirFiles(dir, + new FileFilter() { + + @Override + public boolean accept(File pathname) { + return filePattern.matcher( + pathname.getName()).matches(); + } + }, false); + for (File file : fList) { + String path = file.getAbsolutePath().substring( + beginIndex); + Matcher matcher = pattern.matcher(path); + if (matcher.matches()) { + int year = Integer.parseInt(matcher + .group(yearIndex)); + // Adjust month value to Calendar's 0 - 11 + int month = Integer.parseInt(matcher + .group(monthIndex)) - 1; + int day = Integer.parseInt(matcher.group(dayIndex)); + int hour = Integer.parseInt(matcher + .group(hourIndex)); + fileCal.set(year, month, day, hour, 0, 0); + long fileTime = fileCal.getTimeInMillis(); + if ((startTime <= fileTime) && (fileTime < endTime)) { + fileList.add(file); + } } } } @@ -517,7 +579,7 @@ public class ArchiveConfigManager { } /** - * Get a list of directories matching the categories directory pattern that + * Get a list of directories matching the categories directory patterns that * are sub-directories of the archive's root directory. * * @param archiveConfig @@ -526,35 +588,39 @@ public class ArchiveConfigManager { */ private List getDirs(ArchiveConfig archiveConfig, CategoryConfig categoryConfig) { - String dirPattern = categoryConfig.getDirPattern(); - + List resultDirs = new ArrayList(); File rootFile = new File(archiveConfig.getRootDir()); - - String[] subExpr = dirPattern.split(File.separator); List dirs = new ArrayList(); - dirs.add(rootFile); List tmpDirs = new ArrayList(); List swpDirs = null; - for (String regex : subExpr) { - Pattern subPattern = Pattern.compile("^" + regex + "$"); - IOFileFilter filter = FileFilterUtils - .makeDirectoryOnly(new RegexFileFilter(subPattern)); - - for (File dir : dirs) { - File[] list = dir.listFiles(); - if (list != null) { - List dirList = Arrays.asList(list); - tmpDirs.addAll(Arrays.asList(FileFilterUtils.filter(filter, - dirList))); - } - } - swpDirs = dirs; - dirs = tmpDirs; - tmpDirs = swpDirs; + for (String dirPattern : categoryConfig.getDirPatternList()) { + String[] subExpr = dirPattern.split(File.separator); + dirs.clear(); + dirs.add(rootFile); tmpDirs.clear(); + + for (String regex : subExpr) { + Pattern subPattern = Pattern.compile("^" + regex + "$"); + IOFileFilter filter = FileFilterUtils + .makeDirectoryOnly(new RegexFileFilter(subPattern)); + + for (File dir : dirs) { + File[] list = dir.listFiles(); + if (list != null) { + List dirList = Arrays.asList(list); + tmpDirs.addAll(Arrays.asList(FileFilterUtils.filter( + filter, dirList))); + } + } + swpDirs = dirs; + dirs = tmpDirs; + tmpDirs = swpDirs; + tmpDirs.clear(); + } + resultDirs.addAll(dirs); } - return dirs; + return resultDirs; } /** @@ -571,6 +637,18 @@ public class ArchiveConfigManager { return getDisplayData(archiveName, categoryName, false); } + /** + * Get the Display labels matching the pattern for the archive data's + * category. Assumes the archive data's root directory is the mount point to + * start the search. + * + * @param archiveName + * @param categoryName + * @param setSelect + * - when true set the displayData selection base on category's + * selection list + * @return displayDataList + */ public List getDisplayData(String archiveName, String categoryName, boolean setSelect) { Map> displayMap = new HashMap>(); @@ -578,14 +656,20 @@ public class ArchiveConfigManager { ArchiveConfig archiveConfig = archiveMap.get(archiveName); CategoryConfig categoryConfig = findCategory(archiveConfig, categoryName); - String dirPattern = categoryConfig.getDirPattern(); + List dirPatternList = categoryConfig.getDirPatternList(); // index for making directory paths' relative to the root path. List dirs = getDirs(archiveConfig, categoryConfig); File rootFile = new File(archiveMap.get(archiveName).getRootDir()); int beginIndex = rootFile.getAbsolutePath().length() + 1; - Pattern pattern = Pattern.compile("^" + dirPattern + "$"); + List patterns = new ArrayList(dirPatternList.size()); + + for (String dirPattern : dirPatternList) { + Pattern pattern = Pattern.compile("^" + dirPattern + "$"); + patterns.add(pattern); + } + TreeSet displays = new TreeSet( String.CASE_INSENSITIVE_ORDER); @@ -595,26 +679,31 @@ public class ArchiveConfigManager { for (File dir : dirs) { String path = dir.getAbsolutePath().substring(beginIndex); - Matcher matcher = pattern.matcher(path); - if (matcher.matches()) { - sb.setLength(0); - String[] args = new String[matcher.groupCount() + 1]; - args[0] = matcher.group(); - for (int i = 1; i < args.length; ++i) { - args[i] = matcher.group(i); + for (Pattern pattern : patterns) { + Matcher matcher = pattern.matcher(path); + if (matcher.matches()) { + sb.setLength(0); + String[] args = new String[matcher.groupCount() + 1]; + args[0] = matcher.group(); + for (int i = 1; i < args.length; ++i) { + args[i] = matcher.group(i); + } + String displayLabel = msgfmt.format(args, sb, pos0) + .toString(); + List displayDirs = displayMap.get(displayLabel); + if (displayDirs == null) { + displayDirs = new ArrayList(); + displayMap.put(displayLabel, displayDirs); + } + displayDirs.add(dir); + displays.add(displayLabel); + break; } - String displayLabel = msgfmt.format(args, sb, pos0).toString(); - List displayDirs = displayMap.get(displayLabel); - if (displayDirs == null) { - displayDirs = new ArrayList(); - displayMap.put(displayLabel, displayDirs); - } - displayDirs.add(dir); - displays.add(displayLabel); } } - List displayInfoList = new ArrayList(); + List displayDataList = new ArrayList( + displays.size()); for (String displayLabel : displays) { DisplayData displayData = new DisplayData(archiveConfig, @@ -623,10 +712,10 @@ public class ArchiveConfigManager { displayData.setSelected(categoryConfig .getSelectedDisplayNames().contains(displayLabel)); } - displayInfoList.add(displayData); + displayDataList.add(displayData); } - return displayInfoList; + return displayDataList; } /** diff --git a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/CategoryConfig.java b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/CategoryConfig.java index 66f4d7b5a1..a97dcf22d3 100644 --- a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/CategoryConfig.java +++ b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/CategoryConfig.java @@ -19,7 +19,9 @@ **/ package com.raytheon.uf.common.archive.config; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.TreeSet; import javax.xml.bind.annotation.XmlAccessType; @@ -96,7 +98,7 @@ public class CategoryConfig implements Comparable { * */ @XmlElement(name = "dirPattern") - private String dirPattern; + private List dirPatternList; /** * Use to display the information found by the dirPattern. Any groups in the @@ -187,21 +189,21 @@ public class CategoryConfig implements Comparable { } /** - * Obtain the directory pattern. + * Obtain the list of directory patterns. * - * @return dirPattern + * @return dirPatternList */ - public String getDirPattern() { - return dirPattern; + public List getDirPatternList() { + return new ArrayList(dirPatternList); } /** - * Set the directory pattern; must not be null. + * Set the directory pattern list; must not be null. * - * @param dirPattern + * @param dirPatternList */ - public void setDirPattern(String dirPattern) { - this.dirPattern = dirPattern; + public void setDirPatternList(List dirPatternList) { + this.dirPatternList = dirPatternList; } /** @@ -285,7 +287,7 @@ public class CategoryConfig implements Comparable { public int compareTo(CategoryConfig o) { return getDisplay().compareToIgnoreCase(o.getDisplay()); } - + /* * (non-Javadoc) * @@ -296,8 +298,11 @@ public class CategoryConfig implements Comparable { StringBuilder sb = new StringBuilder(); sb.append("Category [ name: ").append(getName()); sb.append(", retentionHours: ").append(getRetentionHours()); - sb.append(", dirPattern: ").append(getDirPattern()); - sb.append(", filePattern: ").append(getFilePattern()); + sb.append(", dirPatternList[ "); + for (String dirPattern : getDirPatternList()) { + sb.append(" \"").append(dirPattern).append("\","); + } + sb.append("], filePattern: ").append(getFilePattern()); sb.append(", displayLabel: ").append(getDisplay()); sb.append(", dateGroupIndices: ").append(getDateGroupIndices()); sb.append(", selectedDisplayNames: "); diff --git a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/CategoryFileDateHelper.java b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/CategoryFileDateHelper.java new file mode 100644 index 0000000000..4534160878 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/CategoryFileDateHelper.java @@ -0,0 +1,196 @@ +/** + * 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.archive.config; + +import java.io.File; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.commons.io.FilenameUtils; + +import com.raytheon.uf.common.time.util.TimeUtil; + +/** + * File date helper for CategoryConfig objects. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 21, 2013 1965       bgonzale    Initial creation
+ * 
+ * 
+ * + * @author bgonzale + * @version 1.0 + */ + +public class CategoryFileDateHelper implements IFileDateHelper { + /** + * Date information derived from each of a Category's dirPatterns. + */ + private static class CategoryDateInfo { + private final Pattern datePattern; + + private final Pattern categoryTopLevelDirPattern; + + private final int yearIndex; + + private final int monthIndex; + + private final int dayIndex; + + private final int hourIndex; + + /** + * Initialization constructor. + * + * @param datePattern + * @param categoryTopLevelDirPattern + * @param yearIndex + * @param monthIndex + * @param dayIndex + * @param hourIndex + */ + public CategoryDateInfo(Pattern datePattern, + Pattern categoryTopLevelDirPattern, + int yearIndex, int monthIndex, int dayIndex, int hourIndex) { + this.datePattern = datePattern; + this.categoryTopLevelDirPattern = categoryTopLevelDirPattern; + this.yearIndex = yearIndex; + this.monthIndex = monthIndex; + this.dayIndex = dayIndex; + this.hourIndex = hourIndex; + } + + } + + private final List dateInfoList; + + private final String rootDir; + + private final boolean isDirOnly; + + /** + * Initialization constructor. + * + * @param config + * @param rootDirPattern + * categoryTopLevelDirPattern + */ + public CategoryFileDateHelper(CategoryConfig config, String rootDir) { + List categoryDirPatternList = config.getDirPatternList(); + this.dateInfoList = new ArrayList( + categoryDirPatternList.size()); + + String filePatternStr = config.getFilePattern(); + this.rootDir = rootDir; + this.isDirOnly = (filePatternStr == null) + || ".*".equals(filePatternStr); + + for (String patternString : categoryDirPatternList) { + Pattern datePattern = null; + if (isDirOnly) { + datePattern = Pattern.compile(patternString); + } else { + datePattern = Pattern.compile(patternString + File.separator + + config.getFilePattern()); + } + int dirSeparatorIndex = patternString.indexOf(File.separatorChar); + patternString = dirSeparatorIndex > patternString.length() + || dirSeparatorIndex < 0 ? patternString : patternString + .substring(0, dirSeparatorIndex); + Pattern categoryTopLevelDirPattern = Pattern.compile(patternString); + String[] indexValues = config.getDateGroupIndices().split( + "\\s*,\\s*"); + int yearIndex = Integer.parseInt(indexValues[0]); + int monthIndex = Integer.parseInt(indexValues[1]); + int dayIndex = Integer.parseInt(indexValues[2]); + int hourIndex = Integer.parseInt(indexValues[3]); + + dateInfoList.add(new CategoryDateInfo(datePattern, + categoryTopLevelDirPattern, yearIndex, monthIndex, + dayIndex, hourIndex)); + } + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.common.archive.config.IFileDateHelper#getFileDate(java + * .lang.String) + */ + @Override + public Calendar getFileDate(String filenamePath) { + String pathForPatternCheck = filenamePath.substring(rootDir.length()); + pathForPatternCheck = isDirOnly ? FilenameUtils + .getFullPathNoEndSeparator(pathForPatternCheck) + : pathForPatternCheck; + Calendar result = null; + + for (CategoryDateInfo dateInfo : dateInfoList) { + Matcher matcher = dateInfo.datePattern.matcher(pathForPatternCheck); + + if (matcher.matches()) { + int year = Integer.parseInt(matcher.group(dateInfo.yearIndex)); + // Adjust month value to Calendar's 0 - 11 + int month = Integer + .parseInt(matcher.group(dateInfo.monthIndex)) - 1; + int day = Integer.parseInt(matcher.group(dateInfo.dayIndex)); + int hour = Integer.parseInt(matcher.group(dateInfo.hourIndex)); + + result = TimeUtil.newGmtCalendar(); + result.set(year, month, day, hour, 0, 0); + break; + } + } + if (result == null) { + // no matching pattern, use file last modified date + File file = new File(filenamePath); + long lastModifiedMillis = file.lastModified(); + + result = TimeUtil.newGmtCalendar(); + result.setTimeInMillis(lastModifiedMillis); + } + return result; + } + + /** + * Check if this directory is a category directory. i.e. if the category is + * satellite, is the directory satellite. + * + * @param dirName + * @return true if category directory; false otherwise. + */ + public boolean isCategoryDirectory(String dirName) { + for (CategoryDateInfo dateInfo : dateInfoList) { + if (dateInfo.categoryTopLevelDirPattern.matcher(dirName).matches()) { + return true; + } + } + return false; + } +} diff --git a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/FileDateFilter.java b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/FileDateFilter.java new file mode 100644 index 0000000000..16dc9fd732 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/FileDateFilter.java @@ -0,0 +1,125 @@ +/** + * 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.archive.config; + +import java.io.File; +import java.util.Calendar; + +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.filefilter.IOFileFilter; + +import com.raytheon.uf.common.time.util.TimeUtil; + +/** + * Filter files based on a file date parsed using the given file date helper. + * Accept returns true for files that fall between the Start and End times. If + * start is null, then all after start checks will return true. If end is null, + * then all before end checks will return true. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 18, 2013 1965       bgonzale    Initial creation
+ * 
+ * 
+ * + * @author bgonzale + * @version 1.0 + */ + +public class FileDateFilter implements IOFileFilter { + + private IFileDateHelper helper; + + private final Calendar start; + + private final Calendar end; + + /** + * Initialization constructor. This filter uses file last modified time as + * the filter time. + * + * @param startDate + * @param endDate + */ + public FileDateFilter(Calendar start, Calendar end) { + this(start, end, DEFAULT_FILE_DATE_HELPER); + } + + /** + * Initialization constructor. + * + * @param startDate + * @param endDate + * @param helper + */ + public FileDateFilter(Calendar start, Calendar end, IFileDateHelper helper) { + this.helper = helper == null ? DEFAULT_FILE_DATE_HELPER : helper; + this.start = start; + this.end = end; + } + + /* (non-Javadoc) + * @see org.apache.commons.io.filefilter.IOFileFilter#accept(java.io.File) + */ + @Override + public boolean accept(File file) { + String filePath = file.getAbsolutePath(); + String dirName = FilenameUtils.getFullPath(filePath); + String fileName = FilenameUtils.getName(filePath); + return accept(new File(dirName), fileName); + } + + /* (non-Javadoc) + * @see org.apache.commons.io.filefilter.IOFileFilter#accept(java.io.File, java.lang.String) + */ + @Override + public boolean accept(File dir, String name) { + String dirPath = dir.getAbsolutePath(); + boolean endsWithSeparator = dirPath.endsWith(File.separator); + dirPath = endsWithSeparator ? dirPath : dirPath + File.separator; + String fileFullPath = dirPath + name; + Calendar fileDate = helper.getFileDate(fileFullPath); + boolean isAfterEqualsStart = start == null || fileDate.after(start) + || fileDate.equals(start); + boolean isBeforeEqualsEnd = end == null || fileDate.before(end) + || fileDate.equals(end); + return isAfterEqualsStart && isBeforeEqualsEnd; + } + + /** + * This File Date helper returns a file's last modified time. + */ + private static final IFileDateHelper DEFAULT_FILE_DATE_HELPER = new IFileDateHelper() { + @Override + public Calendar getFileDate(String filenamePath) { + // use file last modified date + File file = new File(filenamePath); + long lastModifiedMillis = file.lastModified(); + Calendar result = TimeUtil.newGmtCalendar(); + result.setTimeInMillis(lastModifiedMillis); + return result; + } + }; + +} diff --git a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/IFileDateHelper.java b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/IFileDateHelper.java new file mode 100644 index 0000000000..16a4f24d0c --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/config/IFileDateHelper.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.archive.config; + +import java.util.Calendar; + +/** + * Helper to get a file last modification date. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 21, 2013            bgonzale     Initial creation
+ * 
+ * 
+ * + * @author bgonzale + * @version 1.0 + */ + +public interface IFileDateHelper { + + public Calendar getFileDate(String filenamePath); + +} diff --git a/edexOsgi/com.raytheon.uf.common.colormap/src/com/raytheon/uf/common/colormap/prefs/ColorMapParameters.java b/edexOsgi/com.raytheon.uf.common.colormap/src/com/raytheon/uf/common/colormap/prefs/ColorMapParameters.java index 1f7ef46ae1..3889f5e143 100644 --- a/edexOsgi/com.raytheon.uf.common.colormap/src/com/raytheon/uf/common/colormap/prefs/ColorMapParameters.java +++ b/edexOsgi/com.raytheon.uf.common.colormap/src/com/raytheon/uf/common/colormap/prefs/ColorMapParameters.java @@ -35,6 +35,7 @@ import javax.xml.bind.annotation.XmlElement; import com.raytheon.uf.common.colormap.AbstractColorMap; import com.raytheon.uf.common.colormap.Color; import com.raytheon.uf.common.colormap.IColorMap; +import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences; import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry; import com.raytheon.uf.common.serialization.ISerializableObject; @@ -53,6 +54,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject; * Feb 14, 2013 1616 bsteffen Add option for interpolation of * colormap parameters, disable colormap * interpolation by default. + * Jun 14, 2013 DR 16070 jgerth Utilize data mapping * * * @@ -908,7 +910,18 @@ public class ColorMapParameters implements Cloneable, ISerializableObject { if (colorMapRange != 0.0) { double pixelValue; - if (displayToImage != null) { + // START DR 16070 fix + if (this.dataMapping != null) + if (this.dataMapping.getEntries() != null) + if (this.dataMapping.getEntries().get(0) != null) + if (this.dataMapping.getEntries().get(0).getOperator() != null) + if (this.dataMapping.getEntries().get(0).getOperator().equals("i")) { + Double dValue = this.dataMapping.getDataValueforNumericValue(dispValue); + if (dValue != null) + return (dValue.floatValue() - colorMapMin) / colorMapRange; + } + // END fix + if (displayToImage != null) { pixelValue = displayToImage.convert(dispValue); } else { pixelValue = dispValue; diff --git a/edexOsgi/com.raytheon.uf.common.colormap/src/com/raytheon/uf/common/colormap/prefs/DataMappingPreferences.java b/edexOsgi/com.raytheon.uf.common.colormap/src/com/raytheon/uf/common/colormap/prefs/DataMappingPreferences.java index 7b0c86c1fb..da3a217e7c 100644 --- a/edexOsgi/com.raytheon.uf.common.colormap/src/com/raytheon/uf/common/colormap/prefs/DataMappingPreferences.java +++ b/edexOsgi/com.raytheon.uf.common.colormap/src/com/raytheon/uf/common/colormap/prefs/DataMappingPreferences.java @@ -37,7 +37,7 @@ import com.raytheon.uf.common.units.PiecewisePixel; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * + * 6/2013 DR 16070 jgerth Interpolation capability * * * @@ -47,6 +47,8 @@ import com.raytheon.uf.common.units.PiecewisePixel; @XmlAccessorType(XmlAccessType.NONE) public class DataMappingPreferences { + private String formatString; + @XmlAccessorType(XmlAccessType.NONE) public static class DataMappingEntry implements Comparable { @@ -177,6 +179,7 @@ public class DataMappingPreferences { private final ArrayList greaterThanEntries = new ArrayList(); private final ArrayList lessThanEntries = new ArrayList(); private final ArrayList equalsEntries = new ArrayList(); + private final ArrayList interpEntries = new ArrayList(); private Unit imageUnit; @SuppressWarnings({ "unchecked", "rawtypes" }) @@ -248,10 +251,28 @@ public class DataMappingPreferences { } else if ("<".equals(operator)) { lessThanEntries.add(entry); Collections.sort(lessThanEntries); + } else if ("i".equals(operator)) { + interpEntries.add(entry); } } } + /** + * Matches a number against the pixelValue and displays value to the + * number of decimal places set in formatString + * + * DR 16070 + * + * @param dataValue + * @param formatString + * @return + */ + public String getLabelValueForDataValue(double dataValue, + String formatString) { + this.setFormatString(formatString); + return this.getLabelValueForDataValue(dataValue); + } + /** * Matches a number against the pixelValue in each entry based on the * operator until the first match is found. @@ -281,7 +302,96 @@ public class DataMappingPreferences { return entry.getLabel(); } } + // START DR 16070 fix + Double interpValue = this.getNumericValueforDataValue(dataValue); + int ies = interpEntries.size(); + for (int i = 1; i < ies; i++) { + Double pixelValue1 = interpEntries.get(i - 1).getPixelValue(); + Double pixelValue2 = interpEntries.get(i).getPixelValue(); + if ((dataValue >= pixelValue1) && (dataValue <= pixelValue2)) { + if (this.getFormatString() != null) + return String.format("%." + this.getFormatString() + "f%s", + interpValue, interpEntries.get(i).getLabel()); + else + return String.format("%.1f%s", interpValue, interpEntries + .get(i).getLabel()); + } + } + // END fix return null; } + /** + * Get numeric value for data value + * + * DR 16070 + */ + public Double getNumericValueforDataValue(double dataValue) { + Double interpValue; + int ies = interpEntries.size(); + for (int i = 1; i < ies; i++) { + Double pixelValue1 = interpEntries.get(i - 1).getPixelValue(); + Double pixelValue2 = interpEntries.get(i).getPixelValue(); + Double displValue1 = interpEntries.get(i - 1).getDisplayValue(); + Double displValue2 = interpEntries.get(i).getDisplayValue(); + if ((dataValue >= pixelValue1) && (dataValue <= pixelValue2)) { + interpValue = displValue1 + (dataValue - pixelValue1) + / (pixelValue2 - pixelValue1) + * (displValue2 - displValue1); + return interpValue; + } + } + return null; + } + + /** + * Get data value for numeric value + * + * DR 16070 + */ + public Double getDataValueforNumericValue(double numericValue) { + Double interpValue; + int ies = interpEntries.size(); + for (int i = 1; i < ies; i++) { + Double pixelValue1 = interpEntries.get(i - 1).getPixelValue(); + Double pixelValue2 = interpEntries.get(i).getPixelValue(); + Double displValue1 = interpEntries.get(i - 1).getDisplayValue(); + Double displValue2 = interpEntries.get(i).getDisplayValue(); + if (displValue1 > displValue2) { + if ((numericValue <= displValue1) && (numericValue >= displValue2)) { + interpValue = pixelValue1 + (numericValue - displValue1) + / (displValue2 - displValue1) + * (pixelValue2 - pixelValue1); + return interpValue; + } + } else { + if ((numericValue >= displValue1) && (numericValue <= displValue2)) { + interpValue = pixelValue1 + (numericValue - displValue1) + / (displValue2 - displValue1) + * (pixelValue2 - pixelValue1); + return interpValue; + } + } + } + return null; + } + + /** + * Set formatString + * + * DR 16070 + */ + public void setFormatString(String formatString) { + this.formatString = formatString; + } + + /** + * Get formatString + * + * DR 16070 + */ + public String getFormatString() { + return formatString; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.archive/res/spring/archivepurger-spring.xml b/edexOsgi/com.raytheon.uf.edex.archive/res/spring/archivepurger-spring.xml index 2a44f644d6..8dd6192d7d 100644 --- a/edexOsgi/com.raytheon.uf.edex.archive/res/spring/archivepurger-spring.xml +++ b/edexOsgi/com.raytheon.uf.edex.archive/res/spring/archivepurger-spring.xml @@ -9,7 +9,7 @@ xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler"> + uri="clusteredquartz://archive/archivePurgeScheduled/?cron=${archive.purge.cron}" /> diff --git a/edexOsgi/com.raytheon.uf.edex.archive/resources/archivePurger.properties b/edexOsgi/com.raytheon.uf.edex.archive/resources/archivePurger.properties deleted file mode 100644 index 78ade270dd..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.archive/resources/archivePurger.properties +++ /dev/null @@ -1,2 +0,0 @@ -# purge every half hour -archivePurge.cron=0+0/30,*,*,*,*,*+*+*+*+? diff --git a/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archive/PROCESSED_DATA.xml b/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archive/PROCESSED_DATA.xml index b719f63b81..7ec34bdc8a 100644 --- a/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archive/PROCESSED_DATA.xml +++ b/edexOsgi/com.raytheon.uf.edex.archive/utility/common_static/base/archive/PROCESSED_DATA.xml @@ -18,6 +18,16 @@ See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for further_licensing_information. --> + +