Merge branch 'omaha_14.3.1' into omaha_14.4.1

Conflicts:
	edexOsgi/com.raytheon.uf.common.dataplugin/src/com/raytheon/uf/common/dataplugin/annotations/DataURIFieldConverter.java
	edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Cape.py
	edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Dcape.py
	edexOsgi/com.raytheon.uf.common.derivparam.python/utility/common_static/base/derivedParameters/functions/Filter.py
	edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/context/ContextManager.java
	edexOsgi/com.raytheon.uf.edex.ingest/res/spring/persist-ingest.xml

Former-commit-id: 03908ba8ae [formerly ddd6e35478] [formerly e37e40ed19] [formerly b7a1bda98c [formerly e37e40ed19 [formerly 396a7cbfefed07cd25e4f8b1f028c566a06e4065]]]
Former-commit-id: b7a1bda98c
Former-commit-id: d3c134610c7a2e642c723287f1d8135b292eb22c [formerly 9591532ffd]
Former-commit-id: 7a7c1167c2
This commit is contained in:
Steve Harris 2014-05-07 16:01:53 -05:00
commit f1032ccc05
19 changed files with 370 additions and 207 deletions

View file

@ -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
*
* </pre>
*
@ -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

View file

@ -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()
*
* </pre>
*
@ -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<DrawingToolLayer> getAllDrawingLayers() {
Collection<DrawingToolLayer> rval;
if (layerMap != null) {
synchronized (layerMap) {
rval = new ArrayList<DrawingToolLayer>(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(

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

View file

@ -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
*
* </pre>
*
@ -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<DrawingToolLayer> getAllLayers() {
Collection<DrawingToolLayer> 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:

View file

@ -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()
*
* </pre>
*
@ -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<Geometry>(
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;

View file

@ -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.
*
* </pre>
*
@ -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<SourceComp>();
@ -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));
}
/*

View file

@ -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

View file

@ -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.
*
* </pre>
*
* @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<DataTime> timeAgnosticQuery(Map<String, RequestConstraint> query) {
/* Returning null means no data will be time agnostic. */
@ -226,4 +235,26 @@ public class SatelliteInventory extends AbstractInventory {
}
}
@Override
public void alertArrived(Collection<AlertMessage> 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;
}
}
}
}

View file

@ -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
*
* </pre>
*
@ -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;
}

View file

@ -1,2 +1,2 @@
# The number of smart init threads to use
smartinit.threads=2
smartinit.threads=1

View file

@ -86,8 +86,35 @@
-->
<!--
Text routes
Text routes.
If an internal route (see ContextManager.INTERNAL_ENDPOINT_TYPES) is being sent data from another internal
route in the same context it needs to come after the route that sends it data for proper startup/shutdown order.
-->
<route id="textUndecodedIngestRoute">
<from uri="jms-durable:queue:Ingest.Text?concurrentConsumers=2" />
<setHeader headerName="pluginName">
<constant>text</constant>
</setHeader>
<doTry>
<pipeline>
<bean ref="stringToFile" />
<bean ref="textDecoder" method="decodeFile" />
<bean ref="processUtil" method="log"/>
<multicast>
<!-- This route needs to go to Mark's -->
<to uri="direct:textToWatchWarn"/>
<to uri="direct:textSerializeRoute" />
<to uri="direct:textPurgeAccumulate" />
<to uri="vm:autoFaxRoute" />
</multicast>
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:text?level=INFO"/>
</doCatch>
</doTry>
</route>
<route id="textDirectDecodedIngestRoute">
<from uri="direct-vm:textDirectDecodedIngestRoute" />
<setHeader headerName="pluginName">
@ -134,31 +161,6 @@
</doTry>
</route>
<route id="textUndecodedIngestRoute">
<from uri="jms-durable:queue:Ingest.Text?concurrentConsumers=2" />
<setHeader headerName="pluginName">
<constant>text</constant>
</setHeader>
<doTry>
<pipeline>
<bean ref="stringToFile" />
<bean ref="textDecoder" method="decodeFile" />
<bean ref="processUtil" method="log"/>
<multicast>
<!-- This route needs to go to Mark's -->
<to uri="direct:textToWatchWarn"/>
<to uri="direct:textSerializeRoute" />
<to uri="direct:textPurgeAccumulate" />
<to uri="vm:autoFaxRoute" />
</multicast>
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:text?level=INFO"/>
</doCatch>
</doTry>
</route>
<route id="textToWatchWarnRoute">
<from uri="direct:textToWatchWarn" />
<bean ref="textDecoder" method="transformToProductIds" />

View file

@ -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<Integer> {
@ManyToOne
@PrimaryKeyJoinColumn
@DataURI(position = 4, embedded = true)
@DataURI(position = 4, converter = ParameterConverter.class)
@DynamicSerializeElement
private Parameter parameter;

View file

@ -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)

View file

@ -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.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 6, 2014 2060 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class ParameterConverter implements DataURIFieldConverter<Parameter> {
@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;
}
}

View file

@ -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

View file

@ -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;

View file

@ -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.
*
* <pre>
*
@ -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
*
* </pre>
*
@ -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);
}
}
}

View file

@ -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.
*
* <pre>
*
* 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
*
*
* </pre>
*
@ -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;
}
}

View file

@ -86,7 +86,10 @@
<bean ref="modelsoundingPersistenceManager" method="run"/>
</route>
<!-- Copy of persist route without the log call -->
<!--
Copy of persist route without the log call.
This route must come after the timer route for proper startup/shutdown order.
-->
<route id="modelSoundingPersistIndexAlert">
<from uri="direct-vm:modelSoundingPersistIndexAlert"/>
<bean ref="persist" method="persist"/>