diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingEvent.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingEvent.java index 0c138412c9..ec07161cbd 100644 --- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingEvent.java +++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingEvent.java @@ -37,6 +37,7 @@ import com.vividsolutions.jts.geom.Coordinate; * ------------ ---------- ----------- -------------------------- * Apr 3, 2012 mnash Initial creation * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant + * May 05, 2014 3076 bclement added DISPOSE_ALL * * * @@ -48,7 +49,7 @@ import com.vividsolutions.jts.geom.Coordinate; public class CollaborationDrawingEvent { public static enum CollaborationEventType { - DRAW, ERASE, REDO, UNDO, CLEAR, LOCK_USERS, UNLOCK_USERS, CLEAR_ALL, NEW_USER_ARRIVED; + DRAW, ERASE, REDO, UNDO, CLEAR, CLEAR_ALL, LOCK_USERS, UNLOCK_USERS, DISPOSE_ALL, NEW_USER_ARRIVED; } @DynamicSerializeElement diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java index 48dd9259fe..e9cd38f8b7 100644 --- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java +++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java @@ -19,6 +19,9 @@ **/ package com.raytheon.uf.viz.collaboration.display.rsc.telestrator; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -64,6 +67,8 @@ import com.vividsolutions.jts.geom.Coordinate; * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant * Feb 13, 2014 2751 bclement VenueParticipant refactor * Mar 18, 2014 2895 njensen Fix concurrent mod exception on dispose + * May 05, 2014 3076 bclement old CLEAR_ALL is now DISPOSE_ALL, + * added clearLayers() and getAllDrawingLayers() * * * @@ -129,7 +134,7 @@ public class CollaborationDrawingResource extends CollaborationDrawingEvent event = new CollaborationDrawingEvent( resourceData.getDisplayId()); event.setUserName(myUser); - event.setType(CollaborationEventType.CLEAR_ALL); + event.setType(CollaborationEventType.DISPOSE_ALL); sendEvent(event); } @@ -205,6 +210,18 @@ public class CollaborationDrawingResource extends } } + /** + * Clear all drawing layers. Does not generate any collaboration events. + * This is not "undoable". + */ + private void clearLayers() { + synchronized (layerMap) { + for (DrawingToolLayer layer : layerMap.values()) { + layer.clearAllDrawingData(); + } + } + } + /** * @return the myUser */ @@ -249,6 +266,23 @@ public class CollaborationDrawingResource extends return null; } + /** + * A collection of drawing layers for resource + * + * @return empty collection if there are no layers + */ + public Collection getAllDrawingLayers() { + Collection rval; + if (layerMap != null) { + synchronized (layerMap) { + rval = new ArrayList(layerMap.values()); + } + } else { + rval = Collections.emptyList(); + } + return rval; + } + /* * (non-Javadoc) * @@ -377,9 +411,12 @@ public class CollaborationDrawingResource extends case UNDO: layer.undo(); break; - case CLEAR_ALL: + case DISPOSE_ALL: disposeLayers(); break; + case CLEAR_ALL: + clearLayers(); + break; case NEW_USER_ARRIVED: CollaborationDrawingToolLayer myLayer = (CollaborationDrawingToolLayer) getDrawingLayerFor(getMyUser()); InitialCollaborationData dataBundle = new InitialCollaborationData( diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/icons/clear_all.gif b/cave/com.raytheon.uf.viz.collaboration.ui/icons/clear_all.gif new file mode 100644 index 0000000000..3baa1c7a85 Binary files /dev/null and b/cave/com.raytheon.uf.viz.collaboration.ui/icons/clear_all.gif differ diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java index a27ce5e13c..a1b08ae7e0 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java @@ -21,6 +21,7 @@ package com.raytheon.uf.viz.collaboration.ui.session; **/ import java.util.Collection; +import java.util.Collections; import java.util.IdentityHashMap; import java.util.Map; @@ -101,6 +102,7 @@ import com.raytheon.viz.ui.input.EditableManager; * Mar 11, 2014 2865 lvenable Added null checks in threads * Mar 18, 2014 2895 njensen Fix lockAction enable/disable logic * Apr 15, 2014 2822 bclement only allow transfer leader if participant is using shared display + * May 05, 2014 3076 bclement added clear all action * * * @@ -140,6 +142,8 @@ public class CollaborationSessionView extends SessionView implements private ActionContributionItem lockAction; + private ActionContributionItem clearAllAction; + private ControlContribution noEditorAction; private ISharedDisplaySession session; @@ -181,6 +185,21 @@ public class CollaborationSessionView extends SessionView implements return null; } + /** + * @see CollaborationDrawingResource#getAllDrawingLayers() + * @return empty collection if no layers are found + */ + private Collection getAllLayers() { + Collection rval; + CollaborationDrawingResource resource = getCurrentDrawingResource(); + if (resource != null) { + rval = resource.getAllDrawingLayers(); + } else { + rval = Collections.emptyList(); + } + return rval; + } + /* * (non-Javadoc) * @@ -354,7 +373,15 @@ public class CollaborationSessionView extends SessionView implements lockAction.getAction().setImageDescriptor( IconUtil.getImageDescriptor(Activator.getDefault().getBundle(), "lock.gif")); - + clearAllAction = new ActionContributionItem(new Action("Clear All") { + @Override + public void run() { + clearAllDrawingLayers(); + } + }); + clearAllAction.getAction().setImageDescriptor( + IconUtil.getImageDescriptor(Activator.getDefault().getBundle(), + "clear_all.gif")); noEditorAction = new ControlContribution("noEditorAction") { @Override @@ -383,12 +410,30 @@ public class CollaborationSessionView extends SessionView implements mgr.insert(mgr.getSize() - 1, redoAction); mgr.insert(mgr.getSize() - 1, clearAction); mgr.insert(mgr.getSize() - 1, eraseAction); + mgr.insert(mgr.getSize() - 1, new Separator()); mgr.insert(mgr.getSize() - 1, lockAction); + mgr.insert(mgr.getSize() - 1, clearAllAction); mgr.insert(mgr.getSize() - 1, new Separator()); updateToolItems(); } + /** + * Clear all drawing layers and send clear all event + */ + private void clearAllDrawingLayers() { + for (DrawingToolLayer layer : getAllLayers()) { + layer.clearAllDrawingData(); + } + CollaborationDrawingResource resource = getCurrentDrawingResource(); + CollaborationDrawingEvent event = new CollaborationDrawingEvent( + resource.getResourceData().getDisplayId()); + event.setType(CollaborationEventType.CLEAR_ALL); + event.setUserName(resource.getMyUser()); + resource.sendEvent(event); + updateToolItems(); + } + private void toggleDrawMode(DrawMode mode) { if (mode != DrawMode.NONE) { CollaborationDrawingResource resource = getCurrentDrawingResource(); @@ -411,6 +456,20 @@ public class CollaborationSessionView extends SessionView implements } } + /** + * @return true if any drawing layer has been drawn on + */ + private boolean anyLayerHasDrawing() { + boolean anyCanClear = false; + for (DrawingToolLayer dtl : getAllLayers()) { + if (dtl.hasDrawing()) { + anyCanClear = true; + break; + } + } + return anyCanClear; + } + public void updateToolItems() { ToolBarManager mgr = (ToolBarManager) getViewSite().getActionBars() .getToolBarManager(); @@ -419,24 +478,21 @@ public class CollaborationSessionView extends SessionView implements mgr.insert(0, noEditorAction); } CollaborationDrawingResource currentResource = getCurrentDrawingResource(); - DrawingToolLayer layer = null; - if (currentResource != null) { - layer = currentResource.getDrawingLayerFor(currentResource - .getMyUser()); - } + DrawingToolLayer layer = getCurrentLayer(); if (layer != null && currentResource.isSessionLeader()) { lockAction.getAction().setEnabled(true); + clearAllAction.getAction().setEnabled(anyLayerHasDrawing()); } else { lockAction.getAction().setEnabled(false); + clearAllAction.getAction().setEnabled(false); } - // enable/disable toolbar buttons based on locked if (layer != null && (locked == false || currentResource.isSessionLeader())) { drawAction.getAction().setEnabled(true); undoAction.getAction().setEnabled(layer.canUndo()); redoAction.getAction().setEnabled(layer.canRedo()); - clearAction.getAction().setEnabled(layer.canClear()); + clearAction.getAction().setEnabled(layer.hasDrawing()); eraseAction.getAction().setEnabled(true); switch (layer.getDrawMode()) { case DRAW: diff --git a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/DrawingToolLayer.java b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/DrawingToolLayer.java index bd549a3665..8112d33860 100644 --- a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/DrawingToolLayer.java +++ b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/DrawingToolLayer.java @@ -65,6 +65,8 @@ import com.vividsolutions.jts.geom.TopologyException; * May 23, 2012 mschenke Initial creation * May 23, 2012 2646 bsteffen Fix NPE in project. * Apr 03, 2014 2967 njensen Fix error when erasing the last part of a line + * May 05, 2014 3076 bclement added clearAllDrawingData() and disposeWireframeShape() + * renamed canClear() to hasDrawing() * * * @@ -331,15 +333,7 @@ public class DrawingToolLayer implements IRenderable { * Disposes the data in the layer */ public void dispose() { - synchronized (currentData) { - if (wireframeShape != null) { - wireframeShape.dispose(); - } - currentData.geometries.clear(); - currentDrawingLine = null; - undoStack.clear(); - redoStack.clear(); - } + clearAllDrawingData(); } /** @@ -503,7 +497,7 @@ public class DrawingToolLayer implements IRenderable { * * @return */ - public boolean canClear() { + public boolean hasDrawing() { return currentData.geometries.size() > 0 || redoStack.size() > 0; } @@ -535,6 +529,20 @@ public class DrawingToolLayer implements IRenderable { } } + /** + * Clears the current display and the undo and redo stacks. This operation + * is not "undoable" + */ + public void clearAllDrawingData() { + synchronized (currentData) { + disposeWireframeShape(); + currentData.geometries.clear(); + currentDrawingLine = null; + undoStack.clear(); + redoStack.clear(); + } + } + /** * Pushes currentData on pushStack and pops next frame from popStack and * puts in currentData @@ -568,6 +576,13 @@ public class DrawingToolLayer implements IRenderable { StackFrame oldData = new StackFrame(new ArrayList( currentData.geometries)); stack.push(oldData); + disposeWireframeShape(); + } + + /** + * disposes and sets wireframeShape to null if not already null + */ + private void disposeWireframeShape() { if (wireframeShape != null) { wireframeShape.dispose(); wireframeShape = null; diff --git a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/fffg/FFFGDlg.java b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/fffg/FFFGDlg.java index 3eb5d8d52f..32de4c553f 100644 --- a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/fffg/FFFGDlg.java +++ b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/fffg/FFFGDlg.java @@ -91,6 +91,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * Changes for non-blocking LoadSaveDeleteSelectDlg. * Mar 28, 2013 #1790 rferrel Bug fix for non-blocking dialogs. * Apr, 15, 2013 #1911 dhladky dialog wouldn't open every time to retrieve file. + * May 05, 2014 #3109 lvenable Removed code that sets the cursor on Cave because it doesn't need + * to be set. * * * @@ -310,8 +312,7 @@ public class FFFGDlg extends CaveSWTDialog implements ISourceCompAction, public FFFGDlg(Shell parentShell) { super(parentShell, SWT.DIALOG_TRIM, CAVE.INDEPENDENT_SHELL | CAVE.DO_NOT_BLOCK); - this.getParent().setCursor( - this.getParent().getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); + setText("Forced Flash Flood Guidance"); sourceCompArray = new ArrayList(); @@ -808,15 +809,9 @@ public class FFFGDlg extends CaveSWTDialog implements ISourceCompAction, applyBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - getParent().setCursor( - getParent().getDisplay().getSystemCursor( - SWT.CURSOR_WAIT)); shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); applyDataAction(); updateFileStatusLabel(false); - getParent().setCursor( - getParent().getDisplay().getSystemCursor( - SWT.CURSOR_ARROW)); shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_ARROW)); saveFileAs(); @@ -886,6 +881,7 @@ public class FFFGDlg extends CaveSWTDialog implements ISourceCompAction, * -1 = error, 0 = information message * @param message */ + @Override public void setStatusMsg(int status, String message) { if (message == null) { statusLbl.setText(""); @@ -1609,8 +1605,8 @@ public class FFFGDlg extends CaveSWTDialog implements ISourceCompAction, } if (isDialogClear() && (fileNameLbl.getText().trim().length() == 0)) { - getRetrieveFilename(RetrieveMergeAction.RETRIEVE); - } else { + getRetrieveFilename(RetrieveMergeAction.RETRIEVE); + } else { if (retMergeDlg == null) { retMergeDlg = new RetrieveMergeDlg(shell); retMergeDlg.setCloseCallback(new ICloseCallback() { @@ -2223,10 +2219,6 @@ public class FFFGDlg extends CaveSWTDialog implements ISourceCompAction, sc.populateSourceComp(); statusLbl.setText(""); - this.getParent() - .setCursor( - this.getParent().getDisplay() - .getSystemCursor(SWT.CURSOR_ARROW)); } /* diff --git a/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF index 3186ca34c3..7b2a3d75be 100644 --- a/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF @@ -28,7 +28,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.viz.datacube;bundle-version="1.14.0", com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.comm, - com.raytheon.uf.common.numeric + com.raytheon.uf.common.numeric, + com.raytheon.viz.alerts Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.satellite, com.raytheon.viz.satellite.rsc diff --git a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/inventory/SatelliteInventory.java b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/inventory/SatelliteInventory.java index 6bfda8f9f8..3f94381331 100644 --- a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/inventory/SatelliteInventory.java +++ b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/inventory/SatelliteInventory.java @@ -53,6 +53,9 @@ 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.DataTime; +import com.raytheon.uf.viz.core.alerts.AlertMessage; +import com.raytheon.viz.alerts.IAlertObserver; +import com.raytheon.viz.alerts.observers.ProductAlertObserver; /** * Inventory of available satellite data. sectorID is used for source and @@ -65,13 +68,15 @@ import com.raytheon.uf.common.time.DataTime; * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- * Apr 09, 2014 2947 bsteffen Initial creation + * May 06, 2014 3117 bsteffen Update for new data. * * * * @author bsteffen * @version 1.0 */ -public class SatelliteInventory extends AbstractInventory { +public class SatelliteInventory extends AbstractInventory implements + IAlertObserver { private static final IUFStatusHandler statusHandler = UFStatus .getHandler(SatelliteInventory.class); @@ -88,6 +93,10 @@ public class SatelliteInventory extends AbstractInventory { private Level level; + public SatelliteInventory() { + ProductAlertObserver.addObserver(SATELLITE, this); + } + @Override public List timeAgnosticQuery(Map query) { /* Returning null means no data will be time agnostic. */ @@ -226,4 +235,26 @@ public class SatelliteInventory extends AbstractInventory { } } + @Override + public void alertArrived(Collection alertMessages) { + if (dataTree == null) { + return; + } + for (AlertMessage message : alertMessages) { + String sector = message.decodedAlert.get(SECTOR_ID).toString(); + String pe = message.decodedAlert.get(PHYSICALELEMENT).toString(); + if (dataTree.getParameterNode(sector, pe) == null) { + /* + * When a sector or element arrives that is not known reinit the + * tree to ensure no nodes are missing. + */ + try { + initTree(derParLibrary); + } catch (DataCubeException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + } + return; + } + } + } } 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 55204a29b3..41f30e9b68 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 @@ -100,6 +100,7 @@ import com.vividsolutions.jts.geom.Coordinate; * rules. * Apr 09, 2014 2947 bsteffen Improve flexibility of sat derived * parameters, implement ImageProvider + * May 06, 2014 njensen Improve error message * * * @@ -257,7 +258,7 @@ public class SatResource extends initializeFirstFrame((SatelliteRecord) pdo); } catch (VizException e) { throw new IllegalStateException( - "Unable to initialize the satellite resource"); + "Unable to initialize the satellite resource", e); } initialized = true; } diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/resources/com.raytheon.edex.plugin.gfe.properties b/edexOsgi/com.raytheon.edex.plugin.gfe/resources/com.raytheon.edex.plugin.gfe.properties index a5529c1a1c..da3c8dac1c 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/resources/com.raytheon.edex.plugin.gfe.properties +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/resources/com.raytheon.edex.plugin.gfe.properties @@ -1,2 +1,2 @@ # The number of smart init threads to use -smartinit.threads=2 +smartinit.threads=1 diff --git a/edexOsgi/com.raytheon.edex.plugin.text/res/spring/text-ingest.xml b/edexOsgi/com.raytheon.edex.plugin.text/res/spring/text-ingest.xml index ba7acf67c8..09c6394bcd 100644 --- a/edexOsgi/com.raytheon.edex.plugin.text/res/spring/text-ingest.xml +++ b/edexOsgi/com.raytheon.edex.plugin.text/res/spring/text-ingest.xml @@ -86,8 +86,35 @@ --> + + + + text + + + + + + + + + + + + + + + + java.lang.Throwable + + + + + @@ -134,31 +161,6 @@ - - - - text - - - - - - - - - - - - - - - - java.lang.Throwable - - - - - diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java index 7a40edd823..1ed01e29bb 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java @@ -36,6 +36,7 @@ import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.gridcoverage.GridCoverage; import com.raytheon.uf.common.gridcoverage.convert.GridCoverageConverter; import com.raytheon.uf.common.parameter.Parameter; +import com.raytheon.uf.common.parameter.ParameterConverter; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @@ -106,7 +107,7 @@ public class GridInfoRecord extends PersistableDataObject { @ManyToOne @PrimaryKeyJoinColumn - @DataURI(position = 4, embedded = true) + @DataURI(position = 4, converter = ParameterConverter.class) @DynamicSerializeElement private Parameter parameter; diff --git a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java b/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java index b7ecd7d3bb..6479a8a49b 100644 --- a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java +++ b/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java @@ -34,7 +34,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; @@ -71,7 +70,6 @@ public class Parameter extends PersistableDataObject implements @Id @DynamicSerializeElement @XmlElement - @DataURI(position = 0) private String abbreviation; @Column(nullable = false) diff --git a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java b/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java new file mode 100644 index 0000000000..7ebeab9c80 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java @@ -0,0 +1,59 @@ +/** + * 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.parameter; + +import com.raytheon.uf.common.dataplugin.annotations.DataURIFieldConverter; +import com.raytheon.uf.common.parameter.lookup.ParameterLookup; + +/** + * A DataURIFieldConverter that ensures that a String parameter abbreviation + * will be looked up to potentially contain all the fields. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 6, 2014  2060       njensen     Initial creation
+ * 
+ * 
+ * + * @author njensen + * @version 1.0 + */ + +public class ParameterConverter implements DataURIFieldConverter { + + @Override + public String toString(Parameter field) { + return field.getAbbreviation(); + } + + @Override + public Parameter fromString(String string) { + Parameter p = ParameterLookup.getInstance().getParameter(string); + if (p == null) { + p = new Parameter(string); + } + return p; + } + +} diff --git a/edexOsgi/com.raytheon.uf.edex.dat.utils/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.dat.utils/META-INF/MANIFEST.MF index c3cbd9a5dc..d74ea2f075 100644 --- a/edexOsgi/com.raytheon.uf.edex.dat.utils/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.dat.utils/META-INF/MANIFEST.MF @@ -2,11 +2,10 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: DatUtils Plug-in Bundle-SymbolicName: com.raytheon.uf.edex.dat.utils -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Bundle-Vendor: RAYTHEON Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Import-Package: com.raytheon.uf.common.dataplugin.ffmp, - com.raytheon.uf.common.dataplugin.grid, +Import-Package: com.raytheon.uf.common.dataplugin.grid, com.raytheon.uf.common.dataplugin.scan.data, com.raytheon.uf.common.localization, com.raytheon.uf.common.monitor.xml, @@ -14,7 +13,6 @@ Import-Package: com.raytheon.uf.common.dataplugin.ffmp, org.apache.commons.logging Export-Package: com.raytheon.uf.edex.dat.utils Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.2", - com.raytheon.uf.common.dataplugin.ffmp;bundle-version="1.12.2", com.raytheon.uf.common.monitor;bundle-version="1.12.2", - com.raytheon.uf.common.dataplugin.shef;bundle-version="1.12.1174", - com.raytheon.uf.edex.menus;bundle-version="1.0.0" + com.raytheon.uf.edex.menus;bundle-version="1.0.0", + com.raytheon.uf.common.parameter diff --git a/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java b/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java index 539109ba4c..b4703b2e96 100644 --- a/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java +++ b/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java @@ -1,5 +1,3 @@ -package com.raytheon.uf.edex.dat.utils; - /** * This software was developed and / or modified by Raytheon Company, * pursuant to Contract DG133W-05-CQ-1067 with the US Government. @@ -19,6 +17,9 @@ package com.raytheon.uf.edex.dat.utils; * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ + +package com.raytheon.uf.edex.dat.utils; + import java.util.ArrayList; import java.util.Calendar; import java.util.Date; diff --git a/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPreURIFilter.java b/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPreURIFilter.java index 44aa25f548..6e26ea1b1f 100644 --- a/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPreURIFilter.java +++ b/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPreURIFilter.java @@ -19,10 +19,13 @@ **/ package com.raytheon.uf.edex.ohd.pproc; +import com.raytheon.uf.common.dataplugin.annotations.DataURI; +import com.raytheon.uf.common.dataplugin.grid.GridConstants; import com.raytheon.uf.common.dataplugin.message.DataURINotificationMessage; /** - * TODO Add Description + * Filters URIs for Satellite Precip and generates an xmrg file if the filter + * matches. * *
  * 
@@ -30,8 +33,9 @@ import com.raytheon.uf.common.dataplugin.message.DataURINotificationMessage;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Sep 10, 2009            snaples     Initial creation
- * Feb 12, 2010  4635      snaples     Updated to match more generically.
+ * Feb 12, 2010 4635       snaples     Updated to match more generically.
  * Feb 15, 2013 1638       mschenke    Moved DataURINotificationMessage to uf.common.dataplugin
+ * May 05, 2014 2060       njensen     Cleanup
  * 
  * 
* @@ -41,22 +45,22 @@ import com.raytheon.uf.common.dataplugin.message.DataURINotificationMessage; public class SatPreURIFilter { - DataURINotificationMessage message; + private static final String AUTOSPE = "AUTOSPE"; - String outpath = ""; + private String startFilter; - static final String AUTOSPE = "AUTOSPE"; + private SatPrecipFileBuilder builder; - public SatPreURIFilter() { + public SatPreURIFilter() throws Exception { + startFilter = DataURI.SEPARATOR + GridConstants.GRID; + builder = new SatPrecipFileBuilder(); } - public void matchURI(DataURINotificationMessage msg) { - message = msg; - - if (message instanceof DataURINotificationMessage) { + public void matchURI(DataURINotificationMessage msg) throws Exception { + if (msg instanceof DataURINotificationMessage) { String uri = ""; - for (String data : message.getDataURIs()) { - if (data.startsWith("/grid")) { + for (String data : msg.getDataURIs()) { + if (data.startsWith(startFilter)) { if (data.contains(AUTOSPE)) { uri = data; break; @@ -68,10 +72,7 @@ public class SatPreURIFilter { } } if (uri.length() > 1) { - SatPrecipFileBuilder sb = new SatPrecipFileBuilder(uri); - sb.createSatPre(); - } else { - return; + builder.createSatPre(uri); } } } diff --git a/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPrecipFileBuilder.java b/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPrecipFileBuilder.java index 61b2715eb3..a23aa8d668 100644 --- a/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPrecipFileBuilder.java +++ b/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/pproc/SatPrecipFileBuilder.java @@ -22,42 +22,43 @@ package com.raytheon.uf.edex.ohd.pproc; import java.awt.Rectangle; import java.io.File; import java.io.IOException; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.TimeZone; import javax.measure.converter.UnitConverter; import javax.measure.unit.SI; import javax.measure.unit.Unit; -import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.datastorage.records.ShortDataRecord; import com.raytheon.uf.common.hydro.spatial.HRAP; import com.raytheon.uf.common.hydro.spatial.HRAPCoordinates; import com.raytheon.uf.common.mpe.util.XmrgFile; import com.raytheon.uf.common.mpe.util.XmrgFile.XmrgHeader; import com.raytheon.uf.common.ohd.AppsDefaults; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.units.UnitConv; import com.raytheon.uf.edex.database.plugin.PluginDao; import com.raytheon.uf.edex.database.plugin.PluginFactory; /** - * TODO Add Description + * Builder for xmrg files that contain satellite precip data. * *
  * 
  * SOFTWARE HISTORY
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- * Sep 8, 2009            snaples     Initial creation
+ * Sep 08, 2009            snaples     Initial creation
  * Feb 15, 2013 1638       mschenke    Moved DataURINotificationMessage to uf.common.dataplugin
- * Mar 19, 2014 17109     snaples     Removed code that adds 1 hour to grid reftime, was not needed.
+ * Mar 19, 2014 17109      snaples     Removed code that adds 1 hour to grid reftime, was not needed.
+ * May 05, 2014 2060       njensen     Major cleanup and remove dependency on grid dataURI
+ * 
  * 
  * 
* @@ -67,25 +68,8 @@ import com.raytheon.uf.edex.database.plugin.PluginFactory; public class SatPrecipFileBuilder { - Rectangle extent = null; - - XmrgFile xmfile = null; - - GridRecord gr = null; - - private IDataRecord dataRec; - - private String uri = ""; - - private String outputPath = ""; - - private short[] data; - - private static final SimpleDateFormat sdf = new SimpleDateFormat( - "yyyyMMddHH"); - static { - sdf.setTimeZone(TimeZone.getTimeZone("GMT")); - } + private static final IUFStatusHandler logger = UFStatus + .getHandler(SatPrecipFileBuilder.class); private static final String FILEPRE = "SATPRE"; @@ -99,70 +83,81 @@ public class SatPrecipFileBuilder { private static final String USER = "SANmdY"; - private Date grReftime = null; + private Rectangle extent = null; private int height; private int width; - private static int minX; + private int minX; - private static int minY; + private int minY; - private static int maxX; + private int maxY; - private static int maxY; + private SimpleDateFormat sdf; - public SatPrecipFileBuilder(String datauri) { - uri = datauri; - } + private String outputPath; - public void createSatPre() { - try { - getGridRecord(); - } catch (PluginException e) { - e.printStackTrace(); - } - float[] fa = null; - fa = new float[((float[]) gr.getMessageData()).length]; - fa = (float[]) gr.getMessageData(); - String gribUnit = gr.getParameter().getUnitString(); - UnitConverter cv = null; - Unit gi = Unit.ONE; - try { - gi = UnitConv.deserializer(gribUnit); - } catch (ParseException e) { - e.printStackTrace(); - } - Unit xOut = SI.MILLIMETER; - cv = gi.getConverterTo(xOut); - data = new short[fa.length]; - int k = 0; - for (int i = 0; i < height; i++) { - for (int j = 0; j < width; j++) { - if (fa[k] < 0) { - fa[k] = 0; - } - data[(i * width) + j] = (short) (cv.convert(fa[k]) * 100.0); - k++; - } - } - fa = null; - createXmrgFile(); - } + public SatPrecipFileBuilder() throws Exception { + extent = HRAPCoordinates.getHRAPCoordinates(); + maxY = (int) (HRAP.getInstance().getNy() - extent.getMinY()); + minY = (int) (maxY - extent.getHeight()); + minX = (int) extent.getMinX(); + width = (int) (extent.getWidth()); + height = (int) (extent.getHeight()); - private void createXmrgFile() { + sdf = new SimpleDateFormat("yyyyMMddHH"); + sdf.setTimeZone(TimeUtil.GMT_TIME_ZONE); AppsDefaults appsDefaults = AppsDefaults.getInstance(); outputPath = appsDefaults.getToken("mpe_satpre_dir"); - File op = new File(outputPath); - if (op.exists() == false) { - op.mkdir(); + File outputDir = new File(outputPath); + if (!outputDir.exists()) { + outputDir.mkdirs(); } - op = null; + } + + /** + * Retrieves a grid record, converts the data to millimeters, and stores it + * to an xmrg file. + * + * @param uri + * the data URI of the grid record + */ + public void createSatPre(String uri) { + try { + GridRecord gr = getGridRecord(uri); + float[] fa = (float[]) gr.getMessageData(); + String gribUnit = gr.getParameter().getUnitString(); + UnitConverter cv = null; + Unit gi = UnitConv.deserializer(gribUnit); + Unit xOut = SI.MILLIMETER; + cv = gi.getConverterTo(xOut); + short[] data = new short[fa.length]; + int k = 0; + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + if (fa[k] < 0) { + fa[k] = 0; + } + data[(i * width) + j] = (short) (cv.convert(fa[k]) * 100.0); + k++; + } + } + fa = null; + createXmrgFile(data, gr.getDataTime().getRefTime()); + } catch (Exception e) { + logger.error("Error creating sat precip xmrg file for URI " + uri, + e); + } + } + + private void createXmrgFile(short[] data, Date grReftime) + throws IOException { String fname = outputPath + File.separatorChar + FILEPRE + sdf.format(grReftime) + "z"; - xmfile = new XmrgFile(fname); + XmrgFile xmfile = new XmrgFile(fname); XmrgHeader xmhead = new XmrgHeader(); xmhead.setValidDate(grReftime); xmhead.setSaveDate(grReftime); @@ -174,63 +169,34 @@ public class SatPrecipFileBuilder { xmfile.setHeader(xmhead); xmfile.setHrapExtent(extent); xmfile.setData(data); - try { - xmfile.save(fname); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + xmfile.save(fname); } /** - * get Populated grib record + * Get Populated grid record * * @param uri + * the uri of the grid record * @return */ - public void getGridRecord() throws PluginException { - try { - extent = HRAPCoordinates.getHRAPCoordinates(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - HRAP hr = HRAP.getInstance(); - - maxY = (int) (hr.getNy() - extent.getMinY()); - minY = (int) (maxY - extent.getHeight()); - minX = (int) extent.getMinX(); - maxX = (int) extent.getMaxX(); - width = (int) (extent.getWidth()); - height = (int) (extent.getHeight()); + private GridRecord getGridRecord(String uri) throws Exception { + GridRecord gr = new GridRecord(uri); + PluginDao gd = PluginFactory.getInstance().getPluginDao( + gr.getPluginName()); + IDataStore dataStore = gd.getDataStore(gr); int[] minIndex = { minX, minY }; int[] maxIndex = { minX + width, minY + height }; - - gr = new GridRecord(uri); - PluginDao gd = PluginFactory.getInstance().getPluginDao( - gr.getPluginName()); - gr = (GridRecord) gd.getMetadata(uri); - IDataStore dataStore = gd.getDataStore(gr); - - try { - dataRec = dataStore.retrieve(uri, "Data", - Request.buildSlab(minIndex, maxIndex)); - } catch (Exception se) { - se.printStackTrace(); - } + IDataRecord dataRec = dataStore.retrieve(uri, "Data", + Request.buildSlab(minIndex, maxIndex)); if (dataRec instanceof FloatDataRecord) { gr.setMessageData(((FloatDataRecord) dataRec).getFloatData()); - } else if (dataRec instanceof ShortDataRecord) { - gr.setMessageData(((ShortDataRecord) dataRec).getShortData()); } else { gr.setMessageData(dataRec); } - // this get the reftime of the record - grReftime = gr.getDataTime().getRefTime(); - long millis = grReftime.getTime(); - grReftime.setTime(millis); + + return gr; } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/res/spring/modelsounding-ingest.xml b/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/res/spring/modelsounding-ingest.xml index 518b24d3c4..f1e08678f6 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/res/spring/modelsounding-ingest.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/res/spring/modelsounding-ingest.xml @@ -86,7 +86,10 @@
- +