From 692ec623b22eeac06bd3d4de3e6942072bf416cc Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Thu, 13 Mar 2014 11:45:49 -0500 Subject: [PATCH] Issue #2907 split edex.redbook plugin into common and edex redbook plugins Change-Id: If9f56b7891276410d54880387701cf6ff6291ffe Former-commit-id: cc1cb28eedde5089f6eb3fcbfd630c63f27a230e [formerly 62923fbae80131fab6256923bc32bc46e46940ba] Former-commit-id: 087307a781d78cc65a7e248c63e5182385aed10b --- .../feature.xml | 2 +- .../META-INF/MANIFEST.MF | 8 +- cave/com.raytheon.viz.redbook/plugin.xml | 4 +- .../viz/redbook/blocks/AbstractTextBlock.java | 18 ++- .../viz/redbook/blocks/AlphaNumBlock.java | 11 +- .../viz/redbook/blocks/PlotDataBlock.java | 9 +- .../redbook/blocks/PlotParametersBlock.java | 12 +- .../blocks/RedbookProjectionBlock.java | 16 ++- .../redbook/blocks/ShortLongVectorsBlock.java | 12 +- .../viz/redbook/rsc/RedbookFrame.java | 25 ++-- .../viz/redbook/rsc/RedbookResource.java | 4 +- .../viz/redbook/rsc/RedbookResourceData.java | 6 +- .../rsc/RedbookUpperAirResource.java | 4 +- .../rsc/RedbookUpperAirResourceData.java | 4 +- .../META-INF/MANIFEST.MF | 8 +- .../res/conf/RedbookBlocks.properties | 4 - .../res/spring/redbook-common.xml | 2 +- .../edex/plugin/redbook/RedbookDecoder.java | 12 +- .../edex/plugin/redbook/RedbookSeparator.java | 13 +- .../edex/plugin/redbook/dao/RedbookDao.java | 6 +- .../plugin/redbook/decoder/RedbookParser.java | 54 ++++---- .../.classpath | 7 + .../.project | 28 ++++ .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 14 ++ .../build.properties | 5 + .../res/conf/RedbookBlocks.properties | 4 + .../dataplugin/redbook}/RedbookRecord.java | 4 +- .../redbook}/blocks/Block_004_004.java | 30 ++-- .../redbook}/blocks/Block_004_005.java | 17 ++- .../redbook}/blocks/Block_004_016.java | 57 +++++--- .../redbook}/blocks/Block_004_017.java | 65 +++++---- .../redbook}/blocks/DefaultBlock.java | 13 +- .../redbook}/blocks/EndOfProductBlock.java | 13 +- .../redbook}/blocks/ProductIdBlock.java | 130 ++++++++++-------- .../redbook}/blocks/RedbookBlock.java | 60 ++++---- .../redbook}/blocks/RedbookBlockBuilder.java | 41 +++--- .../redbook}/blocks/RedbookBlockHeader.java | 4 +- .../feature.xml | 7 + tests/.classpath | 1 + .../plugin/redbook/RedbookDecoderTest.java | 8 +- 41 files changed, 456 insertions(+), 293 deletions(-) delete mode 100644 edexOsgi/com.raytheon.edex.plugin.redbook/res/conf/RedbookBlocks.properties create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.redbook/.classpath create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.redbook/.project create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.redbook/.settings/org.eclipse.jdt.core.prefs create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.redbook/META-INF/MANIFEST.MF create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.redbook/build.properties create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.redbook/res/conf/RedbookBlocks.properties rename edexOsgi/{com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common => com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook}/RedbookRecord.java (98%) rename edexOsgi/{com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common => com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook}/blocks/Block_004_004.java (80%) rename edexOsgi/{com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common => com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook}/blocks/Block_004_005.java (83%) rename edexOsgi/{com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common => com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook}/blocks/Block_004_016.java (88%) rename edexOsgi/{com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common => com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook}/blocks/Block_004_017.java (81%) rename edexOsgi/{com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common => com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook}/blocks/DefaultBlock.java (82%) rename edexOsgi/{com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common => com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook}/blocks/EndOfProductBlock.java (83%) rename edexOsgi/{com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common => com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook}/blocks/ProductIdBlock.java (71%) rename edexOsgi/{com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common => com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook}/blocks/RedbookBlock.java (84%) rename edexOsgi/{com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common => com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook}/blocks/RedbookBlockBuilder.java (76%) rename edexOsgi/{com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common => com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook}/blocks/RedbookBlockHeader.java (92%) diff --git a/cave/com.raytheon.uf.viz.dataplugins.feature/feature.xml b/cave/com.raytheon.uf.viz.dataplugins.feature/feature.xml index 541c99a8ca..af78b441fb 100644 --- a/cave/com.raytheon.uf.viz.dataplugins.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.dataplugins.feature/feature.xml @@ -185,7 +185,7 @@ unpack="false"/> diff --git a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/AbstractTextBlock.java b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/AbstractTextBlock.java index 5dda170c8b..c1a7b3abf1 100644 --- a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/AbstractTextBlock.java +++ b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/AbstractTextBlock.java @@ -21,8 +21,8 @@ package com.raytheon.viz.redbook.blocks; import java.nio.ByteBuffer; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlock; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlockHeader; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlock; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlockHeader; import com.raytheon.viz.redbook.rsc.RedbookLegend; import com.raytheon.viz.redbook.rsc.RedbookLegend.Type; @@ -33,8 +33,10 @@ import com.raytheon.viz.redbook.rsc.RedbookLegend.Type; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Mar 18, 2010 #3260 dfriedma Initial creation + * Mar 18, 2010 3260 dfriedma Initial creation * Apr 29, 2013 1958 bgonzale New class RedbookBlockHeader. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common + * and edex redbook plugins * * * @@ -43,19 +45,21 @@ import com.raytheon.viz.redbook.rsc.RedbookLegend.Type; */ public abstract class AbstractTextBlock extends RedbookBlock { - + protected int origXPos; + protected int origYPos; - + public AbstractTextBlock(RedbookBlockHeader header, ByteBuffer data) { super(header, data); } - + public abstract TextBlock getTextBlock(); public TextBlock determineTextBlockType(RedbookLegend legend) { TextBlock textBlock = getTextBlock(); - RedbookLegend.Type type = legend.isLegend(textBlock.text, origXPos, origYPos); + RedbookLegend.Type type = legend.isLegend(textBlock.text, origXPos, + origYPos); textBlock.isLegend = type == Type.LEGEND; if (type == Type.GRAPHIC) legend.addCoordinate(origXPos, origYPos); diff --git a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/AlphaNumBlock.java b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/AlphaNumBlock.java index 39de1a594f..2626556b67 100644 --- a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/AlphaNumBlock.java +++ b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/AlphaNumBlock.java @@ -24,7 +24,7 @@ import java.nio.ByteBuffer; import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlockHeader; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlockHeader; import com.vividsolutions.jts.geom.Coordinate; /** @@ -34,8 +34,10 @@ import com.vividsolutions.jts.geom.Coordinate; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * May 22, 2008 #1162 chammack Initial creation + * May 22, 2008 1162 chammack Initial creation * Apr 29, 2013 1958 bgonzale New class RedbookBlockHeader. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common + * and edex redbook plugins * * * @@ -44,7 +46,7 @@ import com.vividsolutions.jts.geom.Coordinate; */ public class AlphaNumBlock extends AbstractTextBlock { - + private final TextBlock textBlock; public AlphaNumBlock(RedbookBlockHeader header, ByteBuffer data, @@ -55,7 +57,7 @@ public class AlphaNumBlock extends AbstractTextBlock { int posX = (data.getShort() & 0xFFFF); int posY = maxY - (data.getShort() & 0xFFFF); - + origXPos = posX; origYPos = posY; @@ -93,6 +95,7 @@ public class AlphaNumBlock extends AbstractTextBlock { /** * @return the textBlock */ + @Override public TextBlock getTextBlock() { return this.textBlock; } diff --git a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/PlotDataBlock.java b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/PlotDataBlock.java index f166595a19..709f2e500d 100644 --- a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/PlotDataBlock.java +++ b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/PlotDataBlock.java @@ -24,7 +24,7 @@ import java.nio.ByteBuffer; import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlockHeader; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlockHeader; import com.vividsolutions.jts.geom.Coordinate; /** @@ -37,8 +37,10 @@ import com.vividsolutions.jts.geom.Coordinate; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * May 22, 2008 #1162 chammack Initial creation + * May 22, 2008 1162 chammack Initial creation * Apr 29, 2013 1958 bgonzale New class RedbookBlockHeader. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common + * and edex redbook plugins * * * @@ -61,7 +63,7 @@ public class PlotDataBlock extends AbstractTextBlock { int posX = (data.getShort() & 0xFFFF); int posY = maxY - (data.getShort() & 0xFFFF); - + origXPos = posX; origYPos = posY; @@ -102,6 +104,7 @@ public class PlotDataBlock extends AbstractTextBlock { /** * @return the textBlock */ + @Override public TextBlock getTextBlock() { return this.textBlock; } diff --git a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/PlotParametersBlock.java b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/PlotParametersBlock.java index 325da05f82..82d62f827b 100644 --- a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/PlotParametersBlock.java +++ b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/PlotParametersBlock.java @@ -21,18 +21,20 @@ package com.raytheon.viz.redbook.blocks; import java.nio.ByteBuffer; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlock; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlockHeader; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlock; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlockHeader; /** * Implements the redbook plot parameter block * *
  * SOFTWARE HISTORY
- * Date			Ticket#		Engineer	Description
+ * Date         Ticket#     Engineer    Description
  * ------------	----------	-----------	--------------------------
- * May 22, 2008	#1162		chammack	Initial creation
- * Apr 29, 2013 1958        bgonzale    New class RedbookBlockHeader.
+ * May 22, 2008 1162        chammack    Initial creation
+ * Apr 29, 2013 1958        bgonzale    New class RedbookBlockHeader
+ * Mar 13, 2014	2907      	njensen    	split edex.redbook plugin into common and
+ *                                      edex redbook plugins
  * 
  * 
* diff --git a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/RedbookProjectionBlock.java b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/RedbookProjectionBlock.java index c017d218fa..141a0901eb 100644 --- a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/RedbookProjectionBlock.java +++ b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/RedbookProjectionBlock.java @@ -31,8 +31,8 @@ import org.opengis.referencing.datum.PixelInCell; import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; -import com.raytheon.edex.plugin.redbook.common.blocks.Block_004_017; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlockHeader; +import com.raytheon.uf.common.dataplugin.redbook.blocks.Block_004_017; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlockHeader; import com.raytheon.uf.common.geospatial.MapUtil; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.GeometryFactory; @@ -43,10 +43,12 @@ import com.vividsolutions.jts.geom.Point; * *
  * SOFTWARE HISTORY
- * Date			Ticket#		Engineer	Description
+ * Date         Ticket#     Engineer    Description
  * ------------	----------	-----------	--------------------------
- * May 27, 2008	#1162		chammack	Initial creation
- * Apr 29, 2013 1958        bgonzale    New class RedbookBlockHeader.
+ * May 27, 2008 1162        chammack    Initial creation
+ * Apr 29, 2013 1958        bgonzale    New class RedbookBlockHeader
+ * Mar 13, 2014	2907      	njensen    	split edex.redbook plugin into common and
+ *                                      edex redbook plugins
  * 
  * 
* @@ -96,8 +98,8 @@ public class RedbookProjectionBlock extends Block_004_017 { MathTransform mt2 = gg.getGridToCRS(PixelInCell.CELL_CENTER); DefaultMathTransformFactory dmtf = new DefaultMathTransformFactory(); - MathTransform mt = dmtf.createConcatenatedTransform(mt2, toProj - .inverse()); + MathTransform mt = dmtf.createConcatenatedTransform(mt2, + toProj.inverse()); return mt; } diff --git a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/ShortLongVectorsBlock.java b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/ShortLongVectorsBlock.java index e4b98e3bc9..d2b9d74da2 100644 --- a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/ShortLongVectorsBlock.java +++ b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/blocks/ShortLongVectorsBlock.java @@ -25,8 +25,8 @@ import java.util.List; import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlock; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlockHeader; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlock; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlockHeader; import com.raytheon.viz.redbook.rsc.RedbookLegend; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; @@ -40,8 +40,10 @@ import com.vividsolutions.jts.geom.LineString; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * May 22, 2008 #1162 chammack Initial creation + * May 22, 2008 1162 chammack Initial creation * Apr 29, 2013 1958 bgonzale New class RedbookBlockHeader. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common + * and edex redbook plugins * * * @@ -54,8 +56,8 @@ public class ShortLongVectorsBlock extends RedbookBlock { protected Geometry geometry; public ShortLongVectorsBlock(RedbookBlockHeader header, - java.nio.ByteBuffer data, MathTransform mt, - int maxX, int maxY, RedbookLegend legend) { + java.nio.ByteBuffer data, MathTransform mt, int maxX, int maxY, + RedbookLegend legend) { super(header, data); List geometries = new ArrayList(); diff --git a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/rsc/RedbookFrame.java b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/rsc/RedbookFrame.java index 78f3e66f0f..59ae6fad98 100644 --- a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/rsc/RedbookFrame.java +++ b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/rsc/RedbookFrame.java @@ -36,10 +36,10 @@ import org.opengis.referencing.datum.PixelInCell; import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.TransformException; -import com.raytheon.edex.plugin.redbook.common.blocks.Block_004_016; -import com.raytheon.edex.plugin.redbook.common.blocks.DefaultBlock; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlockBuilder; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlockHeader; +import com.raytheon.uf.common.dataplugin.redbook.blocks.Block_004_016; +import com.raytheon.uf.common.dataplugin.redbook.blocks.DefaultBlock; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlockBuilder; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlockHeader; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.datastorage.records.ByteDataRecord; import com.raytheon.uf.common.geospatial.MapUtil; @@ -88,11 +88,12 @@ import com.vividsolutions.jts.geom.Coordinate; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * May 29, 2008 1162 chammack Initial creation - * Jan 28, 2010 4224 M. Huang Added Line Style, Line Width - * menu choice + * Jan 28, 2010 4224 M. Huang Added Line Style, Line Width menu choice * Apr 29, 2013 1958 bgonzale New class RedbookBlockHeader. * May 21, 2013 2001 njensen Fixed error handling - * Jul 19, 2013 DR 16401 D. Friedman Fix unknown block processing. + * Jul 19, 2013 16401 D. Friedman Fix unknown block processing. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common + * and edex redbook plugins * * * @@ -329,12 +330,10 @@ public class RedbookFrame implements IRenderable { public void paint(IGraphicsTarget target, PaintProperties paintProps) throws VizException { - target.drawWireframeShape( - this.wireframeShape, - this.redbookResource.getCapability(ColorableCapability.class) - .getColor(), - (float) this.redbookResource.getCapability( - OutlineCapability.class).getOutlineWidth(), + target.drawWireframeShape(this.wireframeShape, this.redbookResource + .getCapability(ColorableCapability.class).getColor(), + this.redbookResource.getCapability(OutlineCapability.class) + .getOutlineWidth(), this.redbookResource.getCapability(OutlineCapability.class) .getLineStyle()); diff --git a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/rsc/RedbookResource.java b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/rsc/RedbookResource.java index b8a65d9b74..3db50d9b98 100644 --- a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/rsc/RedbookResource.java +++ b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/rsc/RedbookResource.java @@ -28,8 +28,8 @@ import java.util.Set; import org.apache.commons.lang.Validate; import org.opengis.referencing.crs.CoordinateReferenceSystem; -import com.raytheon.edex.plugin.redbook.common.RedbookRecord; import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataplugin.redbook.RedbookRecord; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.IDataStore; @@ -66,6 +66,8 @@ import com.raytheon.viz.redbook.rsc.RedbookFrame.RedbookStatus; * ------------ ---------- ----------- -------------------------- * May 28, 2008 1162 chammack Initial creation * May 21, 2013 2001 njensen Fixed display of messages + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common + * and edex redbook plugins * * * diff --git a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/rsc/RedbookResourceData.java b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/rsc/RedbookResourceData.java index 1a57246443..bc24021ae6 100644 --- a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/rsc/RedbookResourceData.java +++ b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbook/rsc/RedbookResourceData.java @@ -25,8 +25,8 @@ import javax.xml.bind.annotation.XmlAttribute; import org.apache.commons.lang.Validate; -import com.raytheon.edex.plugin.redbook.common.RedbookRecord; import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataplugin.redbook.RedbookRecord; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.LoadProperties; @@ -39,7 +39,9 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Feb 18, 2009 chammack Initial creation + * Feb 18, 2009 chammack Initial creation + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * diff --git a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbookua/rsc/RedbookUpperAirResource.java b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbookua/rsc/RedbookUpperAirResource.java index f7e6463d95..a84e9e944b 100644 --- a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbookua/rsc/RedbookUpperAirResource.java +++ b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbookua/rsc/RedbookUpperAirResource.java @@ -33,8 +33,8 @@ import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.opengis.referencing.crs.CoordinateReferenceSystem; -import com.raytheon.edex.plugin.redbook.common.RedbookRecord; import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataplugin.redbook.RedbookRecord; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.IDataStore; @@ -86,6 +86,8 @@ import com.vividsolutions.jts.geom.Coordinate; * ------------ ---------- ----------- -------------------------- * Mar 24, 2010 1029 dfriedma Initial creation * Jul 24, 2013 2203 njensen Synchronized init and dispose of frames + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * diff --git a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbookua/rsc/RedbookUpperAirResourceData.java b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbookua/rsc/RedbookUpperAirResourceData.java index 4445a18a38..37a36c2399 100644 --- a/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbookua/rsc/RedbookUpperAirResourceData.java +++ b/cave/com.raytheon.viz.redbook/src/com/raytheon/viz/redbookua/rsc/RedbookUpperAirResourceData.java @@ -24,8 +24,8 @@ import javax.xml.bind.annotation.XmlAccessorType; import org.apache.commons.lang.Validate; -import com.raytheon.edex.plugin.redbook.common.RedbookRecord; import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataplugin.redbook.RedbookRecord; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.viz.redbook.rsc.RedbookResourceData; @@ -39,6 +39,8 @@ import com.raytheon.viz.redbook.rsc.RedbookResourceData; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 24, 2010 1029 dfriedma Initial creation + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.edex.plugin.redbook/META-INF/MANIFEST.MF index d6025ad540..dd73487ef7 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.edex.plugin.redbook/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Redbook Plug-in Bundle-SymbolicName: com.raytheon.edex.plugin.redbook -Bundle-Version: 1.12.1174.qualifier +Bundle-Version: 1.14.0.qualifier Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization Bundle-Vendor: RAYTHEON Require-Bundle: com.raytheon.edex.common, @@ -11,10 +11,8 @@ Require-Bundle: com.raytheon.edex.common, com.raytheon.uf.common.localization;bundle-version="1.12.1174", com.raytheon.uf.common.status;bundle-version="1.12.1174", com.raytheon.uf.edex.ndm;bundle-version="1.14.0", - com.raytheon.uf.edex.menus;bundle-version="1.0.0" + com.raytheon.uf.edex.menus;bundle-version="1.0.0", + com.raytheon.uf.common.dataplugin.redbook;bundle-version="1.14.0" Export-Package: com.raytheon.edex.plugin.redbook, - com.raytheon.edex.plugin.redbook.common, - com.raytheon.edex.plugin.redbook.common.blocks, com.raytheon.edex.plugin.redbook.decoder Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Import-Package: org.apache.commons.logging diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/res/conf/RedbookBlocks.properties b/edexOsgi/com.raytheon.edex.plugin.redbook/res/conf/RedbookBlocks.properties deleted file mode 100644 index 97b1025d00..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/res/conf/RedbookBlocks.properties +++ /dev/null @@ -1,4 +0,0 @@ -001_001=com.raytheon.edex.plugin.redbook.common.blocks.ProductIdBlock -001_002=com.raytheon.edex.plugin.redbook.common.blocks.EndOfProductBlock -004_016=com.raytheon.edex.plugin.redbook.common.blocks.Block_004_016 -004_017=com.raytheon.edex.plugin.redbook.common.blocks.Block_004_017 diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/res/spring/redbook-common.xml b/edexOsgi/com.raytheon.edex.plugin.redbook/res/spring/redbook-common.xml index 6c4abd252f..11dcc70fb0 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/res/spring/redbook-common.xml +++ b/edexOsgi/com.raytheon.edex.plugin.redbook/res/spring/redbook-common.xml @@ -10,7 +10,7 @@ - + diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/RedbookDecoder.java b/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/RedbookDecoder.java index f5651117af..a65a0b9ea9 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/RedbookDecoder.java +++ b/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/RedbookDecoder.java @@ -25,13 +25,15 @@ import java.util.Date; import com.raytheon.edex.esb.Headers; import com.raytheon.edex.exception.DecoderException; import com.raytheon.edex.plugin.AbstractDecoder; -import com.raytheon.edex.plugin.redbook.common.RedbookRecord; import com.raytheon.edex.plugin.redbook.dao.RedbookDao; import com.raytheon.edex.plugin.redbook.decoder.RedbookParser; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginException; +import com.raytheon.uf.common.dataplugin.redbook.RedbookRecord; import com.raytheon.uf.common.status.IPerformanceStatusHandler; +import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.PerformanceStatus; +import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.time.util.ITimer; import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.database.plugin.PluginFactory; @@ -56,6 +58,8 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader; * Mar 19, 2013 1785 bgonzale Added performance status handler and * added status to decode. * Aug 30, 2013 2298 rjpeter Make getPluginName abstract + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * @author jkorman @@ -94,6 +98,9 @@ public class RedbookDecoder extends AbstractDecoder { // Name of the plugin controlling this decoder. private final String PLUGIN_NAME; + private static final IUFStatusHandler logger = UFStatus + .getHandler(RedbookDecoder.class); + private final IPerformanceStatusHandler perfLog = PerformanceStatus .getHandler("Redbook:"); @@ -150,8 +157,6 @@ public class RedbookDecoder extends AbstractDecoder { if (report != null) { report.setPersistenceTime(new Date()); try { - report.constructDataURI(); - reports = createMergedRecordList(report); } catch (PluginException e) { logger.error(traceId + "- Error constructing datauri", @@ -220,7 +225,6 @@ public class RedbookDecoder extends AbstractDecoder { // and the Wes2Bridge archiver properly finds these backdated // records backDatedRecord.setPersistenceTime(new Date()); - backDatedRecord.constructDataURI(); } catch (PluginException e) { logger.error(traceId + "Could not create back-dated copy of " + record.getDataURI(), e); diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/RedbookSeparator.java b/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/RedbookSeparator.java index 6181b0a0ed..53f2d82a37 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/RedbookSeparator.java +++ b/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/RedbookSeparator.java @@ -22,11 +22,10 @@ package com.raytheon.edex.plugin.redbook; import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import com.raytheon.edex.esb.Headers; import com.raytheon.edex.plugin.AbstractRecordSeparator; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.edex.wmo.message.WMOHeader; /** @@ -39,14 +38,17 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader; * ------------ ---------- ----------- -------------------------- * 20080512 1131 jkorman Initial implementation. * 20080529 1131 jkorman Added traceId constructor and getter + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * @author jkorman * @version 1.0 */ public class RedbookSeparator extends AbstractRecordSeparator { - /** The logger */ - private Log logger = LogFactory.getLog(getClass()); + + private static final IUFStatusHandler logger = UFStatus + .getHandler(RedbookSeparator.class); private WMOHeader wmoHeader = null; @@ -68,6 +70,7 @@ public class RedbookSeparator extends AbstractRecordSeparator { * @return The next observation record as a String. */ // @Override + @Override public Object next() { byte[] data = null; if (hasNext()) { diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/dao/RedbookDao.java b/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/dao/RedbookDao.java index 7b958bfd42..ef91f971af 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/dao/RedbookDao.java +++ b/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/dao/RedbookDao.java @@ -22,9 +22,9 @@ package com.raytheon.edex.plugin.redbook.dao; import java.io.FileNotFoundException; import java.util.List; -import com.raytheon.edex.plugin.redbook.common.RedbookRecord; import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.persist.IPersistable; +import com.raytheon.uf.common.dataplugin.redbook.RedbookRecord; import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.records.IDataRecord; @@ -43,7 +43,9 @@ import com.raytheon.uf.edex.database.plugin.PluginDao; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * 20080512 1131 jkorman Initial implementation. + * May 12, 2008 1131 jkorman Initial implementation. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * @author jkorman diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/decoder/RedbookParser.java b/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/decoder/RedbookParser.java index c4cec2c31f..4477bd6162 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/decoder/RedbookParser.java +++ b/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/decoder/RedbookParser.java @@ -26,13 +26,12 @@ import java.util.Calendar; import java.util.Date; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.raytheon.edex.plugin.redbook.common.RedbookRecord; -import com.raytheon.edex.plugin.redbook.common.blocks.ProductIdBlock; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlock; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlockBuilder; +import com.raytheon.uf.common.dataplugin.redbook.RedbookRecord; +import com.raytheon.uf.common.dataplugin.redbook.blocks.ProductIdBlock; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlock; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlockBuilder; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.edex.decodertools.time.TimeTools; import com.raytheon.uf.edex.wmo.message.WMOHeader; @@ -47,11 +46,13 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * 20080512 1131 jkorman Initial implementation. - * 20080529 1131 jkorman Added traceId, implemented in logger. - * 20101022 6424 kshrestha Added fcsttime - * 20110516 8296 mhuang fixed fcsttime problem + * May 12, 2008 1131 jkorman Initial implementation. + * May 29, 2008 1131 jkorman Added traceId, implemented in logger. + * Oct 22, 2010 6424 kshrestha Added fcsttime + * May 16, 2011 8296 mhuang fixed fcsttime problem * Apr 29, 2013 1958 bgonzale Refactored to improve performance. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * @author jkorman @@ -61,7 +62,8 @@ public class RedbookParser { private static final RedbookBlockBuilder blockBuilder = new RedbookBlockBuilder(); - private final Log logger = LogFactory.getLog(getClass()); + private static final IUFStatusHandler logger = UFStatus + .getHandler(RedbookParser.class); // private Calendar issueDate = null; @@ -89,7 +91,7 @@ public class RedbookParser { int min = hdr.getMinute(); int fcstTime = rRecord.getFcstHours() * 3600; - + Calendar wmoTime = TimeTools.copy(rRecord.getTimeObs()); if (day - wmoTime.get(Calendar.DAY_OF_MONTH) < 0) { @@ -99,15 +101,16 @@ public class RedbookParser { wmoTime.set(Calendar.HOUR_OF_DAY, hour); wmoTime.set(Calendar.MINUTE, min); - long binnedTime = getBinnedTime(traceId, hdr, wmoTime.getTimeInMillis()); + long binnedTime = getBinnedTime(traceId, hdr, + wmoTime.getTimeInMillis()); DataTime dt = null; - - if ( fcstTime > 0 ) + + if (fcstTime > 0) dt = new DataTime(new Date(binnedTime), fcstTime); else - dt = new DataTime(new Date(binnedTime)); - + dt = new DataTime(new Date(binnedTime)); + rRecord.setDataTime(dt); String cor = hdr.getBBBIndicator(); @@ -129,10 +132,11 @@ public class RedbookParser { /** * - * @param hdr + * @param hdr * @param separator */ - private RedbookRecord internalParse(String traceId, byte[] redbookMsg, WMOHeader hdr) { + private RedbookRecord internalParse(String traceId, byte[] redbookMsg, + WMOHeader hdr) { RedbookRecord record = null; @@ -205,7 +209,7 @@ public class RedbookParser { return record; } - + public int getForecastTime(String traceId, WMOHeader hdr) { RedbookFcstMap.MapFcstHr xmlInfo = redbookFcstMap.get(hdr.getTtaaii()); @@ -215,8 +219,8 @@ public class RedbookParser { } return 0; } - - public long getBinnedTime(String traceId, WMOHeader hdr, long timeMillis) { + + public long getBinnedTime(String traceId, WMOHeader hdr, long timeMillis) { try { long period = 43200 * 1000; // default period is 12 hours long offset = 0; @@ -239,6 +243,6 @@ public class RedbookParser { logger.error(traceId + " - Error in parser - mappingFCST: ", e); } return timeMillis; - } - + } + } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/.classpath b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/.project b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/.project new file mode 100644 index 0000000000..7fd693dcbb --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.common.dataplugin.redbook + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..c537b63063 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..eb2bb480b1 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Redbook +Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.redbook +Bundle-Version: 1.14.0.qualifier +Bundle-Vendor: RAYTHEON +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Export-Package: com.raytheon.uf.common.dataplugin.redbook, + com.raytheon.uf.common.dataplugin.redbook.blocks +Require-Bundle: com.raytheon.uf.common.serialization, + javax.persistence, + com.raytheon.uf.common.dataplugin, + com.raytheon.uf.common.status +Import-Package: com.raytheon.uf.common.util diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/build.properties b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/build.properties new file mode 100644 index 0000000000..5791d48d5f --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + res/ diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/res/conf/RedbookBlocks.properties b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/res/conf/RedbookBlocks.properties new file mode 100644 index 0000000000..90449e4ca1 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/res/conf/RedbookBlocks.properties @@ -0,0 +1,4 @@ +001_001=com.raytheon.uf.common.dataplugin.redbook.blocks.ProductIdBlock +001_002=com.raytheon.uf.common.dataplugin.redbook.blocks.EndOfProductBlock +004_016=com.raytheon.uf.common.dataplugin.redbook.blocks.Block_004_016 +004_017=com.raytheon.uf.common.dataplugin.redbook.blocks.Block_004_017 diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/RedbookRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/RedbookRecord.java similarity index 98% rename from edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/RedbookRecord.java rename to edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/RedbookRecord.java index e02a4a9b9c..8918edc32b 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/RedbookRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/RedbookRecord.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.edex.plugin.redbook.common; +package com.raytheon.uf.common.dataplugin.redbook; import java.util.Arrays; import java.util.Calendar; @@ -68,6 +68,8 @@ import com.raytheon.uf.common.time.DataTime; * PluginDataObject. * Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Nov 04, 2013 2361 njensen Remove XML annotations + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/Block_004_004.java b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/Block_004_004.java similarity index 80% rename from edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/Block_004_004.java rename to edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/Block_004_004.java index f41a9c6694..139fa35a66 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/Block_004_004.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/Block_004_004.java @@ -17,26 +17,29 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.edex.plugin.redbook.common.blocks; +package com.raytheon.uf.common.dataplugin.redbook.blocks; import java.nio.ByteBuffer; -/**TODO Add Description +/** + * TODO Add Description * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- * 20080512           1131 jkorman     Initial implementation.
- * Apr 29, 2013 1958       bgonzale    Added class RedbookBlockHeader,
- *                                     and nested Factory class.
+ * May 12, 2008 1131       jkorman     Initial implementation.
+ * Apr 29, 2013 1958       bgonzale    Added class RedbookBlockHeader, and
+ *                                     nested Factory class.
+ * Mar 13, 2014 2907       njensen     split edex.redbook plugin into common and
+ *                                     edex redbook plugins
  * 
  * 
- * + * * @author jkorman - * @version 1.0 + * @version 1.0 */ public class Block_004_004 extends RedbookBlock { @@ -57,23 +60,24 @@ public class Block_004_004 extends RedbookBlock { public Block_004_004(RedbookBlockHeader header, ByteBuffer data) { super(header, data); populate(data); - if(hasChkSum()) { + if (hasChkSum()) { data.getShort(); } } private void populate(ByteBuffer data) { - if(hasLength()) { + if (hasLength()) { dropShortsFromTheBuffer(data); } } - + /** * */ + @Override public StringBuilder toString(StringBuilder sb) { sb = super.toString(sb); - + return sb; } } diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/Block_004_005.java b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/Block_004_005.java similarity index 83% rename from edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/Block_004_005.java rename to edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/Block_004_005.java index 7983497b1b..885f80627e 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/Block_004_005.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/Block_004_005.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.edex.plugin.redbook.common.blocks; +package com.raytheon.uf.common.dataplugin.redbook.blocks; import java.nio.ByteBuffer; @@ -30,9 +30,11 @@ import java.nio.ByteBuffer; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * 20080512 1131 jkorman Initial implementation. - * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, - * and nested Factory class. + * May 12, 2008 1131 jkorman Initial implementation. + * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, and + * nested Factory class. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * @@ -58,7 +60,7 @@ public class Block_004_005 extends RedbookBlock { public Block_004_005(RedbookBlockHeader header, ByteBuffer data) { super(header, data); populate(data); - if(hasChkSum()) { + if (hasChkSum()) { data.getShort(); } } @@ -68,13 +70,14 @@ public class Block_004_005 extends RedbookBlock { dropShortsFromTheBuffer(data); } } - + /** * */ + @Override public StringBuilder toString(StringBuilder sb) { sb = super.toString(sb); - + return sb; } } diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/Block_004_016.java b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/Block_004_016.java similarity index 88% rename from edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/Block_004_016.java rename to edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/Block_004_016.java index a913b41efc..3ee0d27673 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/Block_004_016.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/Block_004_016.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.edex.plugin.redbook.common.blocks; +package com.raytheon.uf.common.dataplugin.redbook.blocks; import java.nio.ByteBuffer; @@ -30,9 +30,11 @@ import java.nio.ByteBuffer; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * 20080512 1131 jkorman Initial implementation. - * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, - * and nested Factory class. + * May 12, 2008 1131 jkorman Initial implementation. + * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, and + * nested Factory class. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * @@ -43,31 +45,43 @@ import java.nio.ByteBuffer; public class Block_004_016 extends RedbookBlock { private int piSet; + private int coordinateFlag; + private int scaleFactor; + private int areaCode; + private int labelCode; private int refM1coord; + private int refN1coord; - + private int refM2coord; + private int refN2coord; private int refM3coord; + private int refN3coord; private int vtMonth; + private int vtDay; + private int vtHour; + private int vtMinute; - + private int evtMonth; + private int evtDay; + private int evtHour; + private int evtMinute; - - + public static class Factory implements RedbookBlockFactory { @Override public RedbookBlock createBlock(RedbookBlockHeader header, @@ -84,13 +98,13 @@ public class Block_004_016 extends RedbookBlock { public Block_004_016(RedbookBlockHeader header, ByteBuffer data) { super(header, data); populate(data); - if(hasChkSum()) { + if (hasChkSum()) { data.getShort(); } } private void populate(ByteBuffer data) { - + piSet = (data.get() & 0xFF); coordinateFlag = (data.get() & 0xFF); scaleFactor = (data.getShort() & 0xFFFF); @@ -99,7 +113,7 @@ public class Block_004_016 extends RedbookBlock { refM1coord = (data.getShort() & 0xFFFF); refN1coord = (data.getShort() & 0xFFFF); - + refM2coord = (data.getShort() & 0xFFFF); refN2coord = (data.getShort() & 0xFFFF); @@ -110,35 +124,38 @@ public class Block_004_016 extends RedbookBlock { vtDay = (data.get() & 0xFF); vtHour = (data.get() & 0xFF); vtMinute = (data.get() & 0xFF); - + evtMonth = (data.get() & 0xFF); evtDay = (data.get() & 0xFF); evtHour = (data.get() & 0xFF); evtMinute = (data.get() & 0xFF); } - + /** * */ + @Override public StringBuilder toString(StringBuilder sb) { sb = super.toString(sb); sb.append(" piSet="); sb.append(piSet); sb.append(":CF_"); - if(coordinateFlag == 0) { + if (coordinateFlag == 0) { sb.append("LL"); - } else if(coordinateFlag == 1) { + } else if (coordinateFlag == 1) { sb.append("IJ"); - } else if(coordinateFlag == 2) { + } else if (coordinateFlag == 2) { sb.append("XY"); } else { sb.append("??"); } sb.append(":TM_"); - sb.append(String.format("%02d%02d%02d%02d",vtMonth,vtDay,vtHour,vtMinute)); + sb.append(String.format("%02d%02d%02d%02d", vtMonth, vtDay, vtHour, + vtMinute)); sb.append(":"); - sb.append(String.format("%02d%02d%02d%02d",evtMonth,evtDay,evtHour,evtMinute)); - + sb.append(String.format("%02d%02d%02d%02d", evtMonth, evtDay, evtHour, + evtMinute)); + return sb; } @@ -274,5 +291,5 @@ public class Block_004_016 extends RedbookBlock { public int getEvtMinute() { return evtMinute; } - + } diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/Block_004_017.java b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/Block_004_017.java similarity index 81% rename from edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/Block_004_017.java rename to edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/Block_004_017.java index 17ed0384c2..e95ec6cce1 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/Block_004_017.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/Block_004_017.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.edex.plugin.redbook.common.blocks; +package com.raytheon.uf.common.dataplugin.redbook.blocks; import java.nio.ByteBuffer; @@ -30,9 +30,11 @@ import java.nio.ByteBuffer; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * 20080512 1131 jkorman Initial implementation. - * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, - * and nested Factory class. + * May 12, 2008 1131 jkorman Initial implementation. + * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, and + * nested Factory class. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * @@ -43,21 +45,29 @@ import java.nio.ByteBuffer; public class Block_004_017 extends RedbookBlock { private float ulLat; + private float ulLon; + private float urLat; + private float urLon; + private float lrLat; + private float lrLon; + private float llLat; + private float llLon; private float lon1; + private float lat1; + private float lat2; - + private String projName; - - + public static class Factory implements RedbookBlockFactory { @Override public RedbookBlock createBlock(RedbookBlockHeader header, @@ -74,57 +84,58 @@ public class Block_004_017 extends RedbookBlock { public Block_004_017(RedbookBlockHeader header, ByteBuffer data) { super(header, data); populateProj(data); - if(hasChkSum()) { + if (hasChkSum()) { data.getShort(); } } private void populateProj(ByteBuffer data) { - + data.get(); - + int sel = (data.get() & 0xFF); - if(sel >= 1) { + if (sel >= 1) { ulLat = getFloat2(data); ulLon = getFloat2(data); } - if(sel >= 2) { + if (sel >= 2) { urLat = getFloat2(data); urLon = getFloat2(data); } - if(sel >= 3) { + if (sel >= 3) { lrLat = getFloat2(data); lrLon = getFloat2(data); } - if(sel >= 4) { + if (sel >= 4) { llLat = getFloat2(data); llLon = getFloat2(data); } - + lon1 = getFloat2(data); lat1 = getFloat2(data); lat2 = getFloat2(data); - - char [] c = new char [6]; - for(int i = 0;i < c.length;i++) { - c[i] = (char)(data.get() & 0xFF); + + char[] c = new char[6]; + for (int i = 0; i < c.length; i++) { + c[i] = (char) (data.get() & 0xFF); } projName = new String(c); - + // empty read! data.getShort(); } - + /** * */ + @Override public StringBuilder toString(StringBuilder sb) { sb = super.toString(sb); - sb.append(String.format(" ul[%2.2f:%2.2f]", ulLat,ulLon)); - sb.append(String.format(",ur[%2.2f:%2.2f]", urLat,urLon)); - sb.append(String.format(",ll[%2.2f:%2.2f]", llLat,llLon)); - sb.append(String.format(",ur[%2.2f:%2.2f]", urLat,urLon)); - + sb.append(String.format(" ul[%2.2f:%2.2f]", ulLat, ulLon)); + sb.append(String.format(",ur[%2.2f:%2.2f]", urLat, urLon)); + sb.append(String.format(",ll[%2.2f:%2.2f]", llLat, llLon)); + sb.append(String.format(",ur[%2.2f:%2.2f]", urLat, urLon)); + sb.append(projName); return sb; } @@ -212,5 +223,5 @@ public class Block_004_017 extends RedbookBlock { public String getProjName() { return projName; } - + } diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/DefaultBlock.java b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/DefaultBlock.java similarity index 82% rename from edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/DefaultBlock.java rename to edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/DefaultBlock.java index 38223f0ee6..130bdecc58 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/DefaultBlock.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/DefaultBlock.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.edex.plugin.redbook.common.blocks; +package com.raytheon.uf.common.dataplugin.redbook.blocks; import java.nio.ByteBuffer; @@ -30,9 +30,11 @@ import java.nio.ByteBuffer; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * 20080512 1131 jkorman Initial implementation. - * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, - * and nested Factory class. + * May 12, 2008 1131 jkorman Initial implementation. + * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, and + * nested Factory class. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * @@ -57,7 +59,7 @@ public class DefaultBlock extends RedbookBlock { */ public DefaultBlock(RedbookBlockHeader header, ByteBuffer data) { super(header, data); - if(hasLength()) { + if (hasLength()) { dropShortsFromTheBuffer(data); } } @@ -65,6 +67,7 @@ public class DefaultBlock extends RedbookBlock { /** * */ + @Override public StringBuilder toString(StringBuilder sb) { sb = super.toString(sb); return sb; diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/EndOfProductBlock.java b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/EndOfProductBlock.java similarity index 83% rename from edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/EndOfProductBlock.java rename to edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/EndOfProductBlock.java index 4b4fcc25fa..f0b5d0fb2d 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/EndOfProductBlock.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/EndOfProductBlock.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.edex.plugin.redbook.common.blocks; +package com.raytheon.uf.common.dataplugin.redbook.blocks; import java.nio.ByteBuffer; @@ -30,9 +30,11 @@ import java.nio.ByteBuffer; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * 20080512 1131 jkorman Initial implementation. - * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, - * and nested Factory class. + * May 12, 2008 1131 jkorman Initial implementation. + * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, and + * nested Factory class. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * @@ -57,7 +59,7 @@ public class EndOfProductBlock extends RedbookBlock { */ public EndOfProductBlock(RedbookBlockHeader header, ByteBuffer data) { super(header, data); - if(hasChkSum()) { + if (hasChkSum()) { data.getShort(); } } @@ -73,6 +75,7 @@ public class EndOfProductBlock extends RedbookBlock { /** * */ + @Override public StringBuilder toString(StringBuilder sb) { sb = super.toString(sb); return sb; diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/ProductIdBlock.java b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/ProductIdBlock.java similarity index 71% rename from edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/ProductIdBlock.java rename to edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/ProductIdBlock.java index ee784624e5..d18ad3aa09 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/ProductIdBlock.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/ProductIdBlock.java @@ -17,12 +17,12 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.edex.plugin.redbook.common.blocks; +package com.raytheon.uf.common.dataplugin.redbook.blocks; import java.nio.ByteBuffer; import java.util.Calendar; -import com.raytheon.uf.edex.decodertools.time.TimeTools; +import com.raytheon.uf.common.time.util.TimeUtil; /** * TODO Add Description @@ -33,9 +33,11 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * 20080512 1131 jkorman Initial implementation. - * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, - * and nested Factory class. + * May 12, 2008 1131 jkorman Initial implementation. + * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, and + * nested Factory class. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * @@ -46,28 +48,29 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; public class ProductIdBlock extends RedbookBlock { private static final String TM_FMT = "%04d%02d%02d%02d%02d"; + private static final int BLOCK_LEN = 34; private static final int ORIG_ID_SIZE = 4; - + private static final int PRODM_ID_SIZE = 9; private static final int PRODC_ID_SIZE = 6; private String originatorId; - + private String productId; - + private Integer retentionHours; - + private Calendar productFileTime; private String prodFileTime; - + private Integer fileIndicator; - + private Integer fcstHours; - + public static class Factory implements RedbookBlockFactory { @Override public RedbookBlock createBlock(RedbookBlockHeader header, @@ -84,101 +87,104 @@ public class ProductIdBlock extends RedbookBlock { super(header, data); int blockLen = (hasChkSum()) ? BLOCK_LEN : BLOCK_LEN - 2; - if(data.remaining() >= blockLen) { - char [] pId = new char [ORIG_ID_SIZE]; - for(int i = 0;i < pId.length;i++) { + if (data.remaining() >= blockLen) { + char[] pId = new char[ORIG_ID_SIZE]; + for (int i = 0; i < pId.length; i++) { char c = (char) (data.get() & 0xFF); - if(c > 0) { - pId[i] = c; + if (c > 0) { + pId[i] = c; } else { - pId[i] = '.'; + pId[i] = '.'; } } // originatorId = new String(pId); // Until I figure out what's actually being sent here. originatorId = null; - + // classification -- empty read for now! data.get(); retentionHours = (data.get() & 0xFF); fileIndicator = (data.get() & 0xFF); StringBuilder sb = new StringBuilder(); - pId = new char [PRODM_ID_SIZE]; - for(int i = 0;i < pId.length;i++) { + pId = new char[PRODM_ID_SIZE]; + for (int i = 0; i < pId.length; i++) { char c = (char) (data.get() & 0xFF); - if(c > 0) { - pId[i] = c; + if (c > 0) { + pId[i] = c; } else { - pId[i] = '.'; + pId[i] = '.'; } } sb.append(pId); - + int year = (data.getShort() & 0xFFFF); int month = (data.get() & 0xFF); int day = (data.get() & 0xFF); int hour = (data.get() & 0xFF); int minute = (data.get() & 0xFF); - prodFileTime = String.format(TM_FMT,year,month,day,hour,minute); - - Calendar t = TimeTools.getBaseCalendar(year, month, day); - if(t != null) { - t.set(Calendar.HOUR_OF_DAY,hour); - t.set(Calendar.MINUTE,minute); - - productFileTime = t; - } + prodFileTime = String + .format(TM_FMT, year, month, day, hour, minute); - pId = new char [PRODC_ID_SIZE]; - for(int i = 0;i < pId.length;i++) { + Calendar t = TimeUtil.newGmtCalendar(); + t.set(Calendar.YEAR, year); + t.set(Calendar.MONTH, month); + t.set(Calendar.DAY_OF_MONTH, day); + t.set(Calendar.HOUR_OF_DAY, hour); + t.set(Calendar.MINUTE, minute); + t.set(Calendar.SECOND, 0); + t.set(Calendar.MILLISECOND, 0); + + productFileTime = t; + + pId = new char[PRODC_ID_SIZE]; + for (int i = 0; i < pId.length; i++) { char c = (char) (data.get() & 0xFF); - if(c > 0) { - pId[i] = c; + if (c > 0) { + pId[i] = c; } else { - pId[i] = '.'; + pId[i] = '.'; } } sb.append(pId); productId = sb.toString(); parseFcstHours(); - + // Just read over the checksum for now. - if(hasChkSum()) { + if (hasChkSum()) { data.getShort(); } } } private void parseFcstHours() { - if((productId != null) && (productId.length() > 7)) { - + if ((productId != null) && (productId.length() > 7)) { + Integer fcstHour = null; try { - fcstHour = new Integer(productId.substring(4,7)); - } catch(NumberFormatException nfe) { + fcstHour = new Integer(productId.substring(4, 7)); + } catch (NumberFormatException nfe) { // nothing } - if(fcstHour != null) { - if(fcstHour < 300) { + if (fcstHour != null) { + if (fcstHour < 300) { fcstHours = fcstHour; } else if (fcstHour < 400) { - + } else if (fcstHour < 500) { - + } else if (fcstHour == 999) { fcstHours = null; } } } } - - - + /** * */ + @Override public StringBuilder toString(StringBuilder sb) { sb = super.toString(sb); sb.append(":"); @@ -196,7 +202,8 @@ public class ProductIdBlock extends RedbookBlock { } /** - * @param originatorId the originatorId to set + * @param originatorId + * the originatorId to set */ public void setOriginatorId(String originatorId) { this.originatorId = originatorId; @@ -210,7 +217,8 @@ public class ProductIdBlock extends RedbookBlock { } /** - * @param productId the productId to set + * @param productId + * the productId to set */ public void setProductId(String productId) { this.productId = productId; @@ -224,7 +232,8 @@ public class ProductIdBlock extends RedbookBlock { } /** - * @param retentionHours the retentionHours to set + * @param retentionHours + * the retentionHours to set */ public void setRetentionHours(Integer retentionHours) { this.retentionHours = retentionHours; @@ -238,7 +247,8 @@ public class ProductIdBlock extends RedbookBlock { } /** - * @param productFileTime the productFileTime to set + * @param productFileTime + * the productFileTime to set */ public void setProductFileTime(Calendar productFileTime) { this.productFileTime = productFileTime; @@ -252,7 +262,8 @@ public class ProductIdBlock extends RedbookBlock { } /** - * @param fileIndicator the fileIndicator to set + * @param fileIndicator + * the fileIndicator to set */ public void setFileIndicator(Integer fileIndicator) { this.fileIndicator = fileIndicator; @@ -266,10 +277,11 @@ public class ProductIdBlock extends RedbookBlock { } /** - * @param fcstHours the fcstHours to set + * @param fcstHours + * the fcstHours to set */ public void setFcstHours(Integer fcstHours) { this.fcstHours = fcstHours; } - + } diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/RedbookBlock.java b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/RedbookBlock.java similarity index 84% rename from edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/RedbookBlock.java rename to edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/RedbookBlock.java index 72accd5c56..46a729dc5a 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/RedbookBlock.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/RedbookBlock.java @@ -17,13 +17,10 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.edex.plugin.redbook.common.blocks; +package com.raytheon.uf.common.dataplugin.redbook.blocks; import java.nio.ByteBuffer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - /** * * @@ -34,10 +31,12 @@ import org.apache.commons.logging.LogFactory; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * 20080512 1131 jkorman Initial implementation. - * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, - * and nested Factory interface. + * May 12, 2008 1131 jkorman Initial implementation. + * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, and + * nested Factory interface. * May 06, 2013 1979 bgonzale Catch Header at the end of buffer. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * @@ -47,23 +46,20 @@ import org.apache.commons.logging.LogFactory; public abstract class RedbookBlock { - @SuppressWarnings("unused") - private final Log logger = LogFactory.getLog(getClass()); - private static final int LEN_MASK = 0x8000; - + private static final int CHKSUM_MASK = 0x4000; - + private static final int LENGTH_MASK = 0x3FFF; - + private boolean hasLength = false; - + private boolean hasChkSum = false; - + private RedbookBlockHeader header; private final int length; - + public interface RedbookBlockFactory { public abstract RedbookBlock createBlock(RedbookBlockHeader header, ByteBuffer data); @@ -74,7 +70,7 @@ public abstract class RedbookBlock { * @param separator */ public RedbookBlock(RedbookBlockHeader header, ByteBuffer data) { - + this.header = header; hasLength = ((this.header.hdr & LEN_MASK) == 0 && data.hasRemaining()); @@ -117,7 +113,8 @@ public abstract class RedbookBlock { } /** - * @param hasLength the hasLength to set + * @param hasLength + * the hasLength to set */ public void setHasLength(boolean hasLength) { this.hasLength = hasLength; @@ -131,39 +128,42 @@ public abstract class RedbookBlock { } /** - * @param hasChkSum the hasChkSum to set + * @param hasChkSum + * the hasChkSum to set */ public void setHasChkSum(boolean hasChkSum) { this.hasChkSum = hasChkSum; } - + public StringBuilder toString(StringBuilder sb) { - if(sb == null) { + if (sb == null) { sb = new StringBuilder(); } sb.append((hasLength) ? 'L' : '.'); sb.append((hasChkSum) ? 'C' : '.'); sb.append(':'); - - sb.append(String.format("%05d:mode=%02X:submode=%02X",length,header.mode,header.subMode)); - + + sb.append(String.format("%05d:mode=%02X:submode=%02X", length, + header.mode, header.subMode)); + return sb; } - + /** * */ + @Override public String toString() { return toString((StringBuilder) null).toString(); } - + public static float getFloat2(ByteBuffer dataBuf) { float f = Float.NaN; - - if(dataBuf.remaining() >= 2) { - + + if (dataBuf.remaining() >= 2) { + short s = dataBuf.getShort(); - + f = s / 100.0f; } return f; diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/RedbookBlockBuilder.java b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/RedbookBlockBuilder.java similarity index 76% rename from edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/RedbookBlockBuilder.java rename to edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/RedbookBlockBuilder.java index 0b4fab5d50..e598954b35 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/RedbookBlockBuilder.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/RedbookBlockBuilder.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.edex.plugin.redbook.common.blocks; +package com.raytheon.uf.common.dataplugin.redbook.blocks; import java.io.IOException; import java.nio.ByteBuffer; @@ -25,12 +25,10 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; -import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlock.RedbookBlockFactory; +import com.raytheon.uf.common.dataplugin.redbook.blocks.RedbookBlock.RedbookBlockFactory; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.util.PropertiesUtil; -import com.raytheon.uf.common.util.ReflectionException; -import com.raytheon.uf.common.util.ReflectionUtil; /** * @@ -42,12 +40,14 @@ import com.raytheon.uf.common.util.ReflectionUtil; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * 20080516 1131 jkorman Initial Coding. - * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, - * and moved reflective calls to the - * mapping population method. Map now - * contains factory objects. - * Jul 19, 2013 DR 16401 D. Friedman Fix end-of-product block decoding. + * May 16, 2008 1131 jkorman Initial Coding. + * Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader, and moved + * reflective calls to the mapping + * population method. Map now contains + * factory objects. + * Jul 19, 2013 16401 D. Friedman Fix end-of-product block decoding. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * @@ -55,6 +55,7 @@ import com.raytheon.uf.common.util.ReflectionUtil; * @version 1.0 */ public class RedbookBlockBuilder { + private static final IUFStatusHandler statusHandler = UFStatus .getHandler(RedbookBlockBuilder.class); @@ -100,11 +101,12 @@ public class RedbookBlockBuilder { byte rawMode = dataBuffer.get(); byte rawSubMode = dataBuffer.get(); - /* Must have at least MIN_REMAINING, - * but allow the the end-of-product block (mode=1,sub=2) + /* + * Must have at least MIN_REMAINING, but allow the the end-of-product + * block (mode=1,sub=2) */ - if (dataBuffer.remaining() >= MIN_REMAINING || - (rawMode == 1 && rawSubMode == 2)) { + if (dataBuffer.remaining() >= MIN_REMAINING + || (rawMode == 1 && rawSubMode == 2)) { header = new RedbookBlockHeader(rawHdr, rawMode, rawSubMode); } else { header = RedbookBlockHeader.DEFAULT; @@ -127,12 +129,11 @@ public class RedbookBlockBuilder { + FACTORY_NAME; try { - RedbookBlockFactory factory = ReflectionUtil - .newInstanceOfAssignableType( - RedbookBlockFactory.class, factoryClassName); - - blockFactoryMap.put((String) key, factory); - } catch (ReflectionException e) { + Class factoryClass = Class.forName(factoryClassName); + RedbookBlockFactory factory = (RedbookBlockFactory) factoryClass + .newInstance(); + blockFactoryMap.put(key, factory); + } catch (Exception e) { statusHandler.error("Could not instantiate " + factoryClassName, e); } diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/RedbookBlockHeader.java b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/RedbookBlockHeader.java similarity index 92% rename from edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/RedbookBlockHeader.java rename to edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/RedbookBlockHeader.java index 2dbe1f1358..7092aa7f81 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/src/com/raytheon/edex/plugin/redbook/common/blocks/RedbookBlockHeader.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.redbook/src/com/raytheon/uf/common/dataplugin/redbook/blocks/RedbookBlockHeader.java @@ -17,7 +17,7 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.edex.plugin.redbook.common.blocks; +package com.raytheon.uf.common.dataplugin.redbook.blocks; /** * @@ -31,6 +31,8 @@ package com.raytheon.edex.plugin.redbook.common.blocks; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 25 APR 2013 bgonzale Initial Coding. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * * diff --git a/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml index 5f6129c8a4..7d07365813 100644 --- a/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml @@ -219,6 +219,13 @@ install-size="0" version="0.0.0" unpack="false"/> + + + diff --git a/tests/unit/com/raytheon/edex/plugin/redbook/RedbookDecoderTest.java b/tests/unit/com/raytheon/edex/plugin/redbook/RedbookDecoderTest.java index a43fbcfbb0..11c4754488 100644 --- a/tests/unit/com/raytheon/edex/plugin/redbook/RedbookDecoderTest.java +++ b/tests/unit/com/raytheon/edex/plugin/redbook/RedbookDecoderTest.java @@ -43,8 +43,8 @@ import org.junit.Test; import com.raytheon.edex.esb.Headers; import com.raytheon.edex.exception.DecoderException; -import com.raytheon.edex.plugin.redbook.common.RedbookRecord; import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataplugin.redbook.RedbookRecord; import com.raytheon.uf.common.localization.PathManagerFactoryTest; import com.raytheon.uf.common.util.FileUtil; @@ -58,8 +58,10 @@ import com.raytheon.uf.common.util.FileUtil; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Apr 22, 2013 1958 bgonzale Initial creation - * May 08, 2013 2000 djohnson Ignore broken test. + * Apr 22, 2013 1958 bgonzale Initial creation + * May 08, 2013 2000 djohnson Ignore broken test. + * Mar 13, 2014 2907 njensen split edex.redbook plugin into common and + * edex redbook plugins * * *