Issue #2907 split edex.redbook plugin into common and edex redbook plugins

Change-Id: If9f56b7891276410d54880387701cf6ff6291ffe

Former-commit-id: 087307a781 [formerly 62923fbae80131fab6256923bc32bc46e46940ba]
Former-commit-id: cc1cb28eed
This commit is contained in:
Nate Jensen 2014-03-13 11:45:49 -05:00
parent d8edb8e91b
commit daf6997a59
41 changed files with 456 additions and 293 deletions

View file

@ -185,7 +185,7 @@
unpack="false"/>
<plugin
id="com.raytheon.edex.plugin.redbook"
id="com.raytheon.uf.common.dataplugin.redbook"
download-size="0"
install-size="0"
version="0.0.0"

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Redbook Plug-in
Bundle-SymbolicName: com.raytheon.viz.redbook;singleton:=true
Bundle-Version: 1.12.1174.qualifier
Bundle-Version: 1.14.0.qualifier
Bundle-Activator: com.raytheon.viz.redbook.Activator
Bundle-Vendor: Raytheon
Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.uf.common.serialization
@ -14,10 +14,10 @@ Require-Bundle: org.apache.batik,
com.raytheon.viz.ui,
org.apache.commons.lang,
com.raytheon.uf.common.serialization,
com.raytheon.edex.plugin.redbook,
com.raytheon.uf.common.pointdata;bundle-version="1.11.26",
com.raytheon.viz.pointdata;bundle-version="1.11.26",
com.raytheon.uf.viz.productbrowser;bundle-version="1.11.31"
com.raytheon.viz.pointdata,
com.raytheon.uf.viz.productbrowser;bundle-version="1.11.31",
com.raytheon.uf.common.dataplugin.redbook;bundle-version="1.14.0"
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.viz.redbook,
com.raytheon.viz.redbook.blocks,

View file

@ -25,14 +25,14 @@
<resource
class="com.raytheon.viz.redbook.rsc.RedbookResource"
name="RedbookResource"
recordClass="com.raytheon.edex.plugin.redbook.common.RedbookRecord"
recordClass="com.raytheon.uf.common.dataplugin.redbook.RedbookRecord"
renderingOrderId="PLOT"
resourceType="PLAN_VIEW">
</resource>
<resource
class="com.raytheon.viz.redbookua.rsc.RedbookUpperAirResource"
name="RedbookUpperAirResource"
recordClass="com.raytheon.edex.plugin.redbook.common.RedbookRecord"
recordClass="com.raytheon.uf.common.dataplugin.redbook.RedbookRecord"
renderingOrderId="PLOT"
resourceType="PLAN_VIEW">
</resource>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,7 +10,7 @@
<property name="pluginName" ref="redbookPluginName" />
<property name="pluginFQN" value="com.raytheon.edex.plugin.redbook" />
<property name="dao" value="com.raytheon.edex.plugin.redbook.dao.RedbookDao" />
<property name="record" value="com.raytheon.edex.plugin.redbook.common.RedbookRecord" />
<property name="record" value="com.raytheon.uf.common.dataplugin.redbook.RedbookRecord" />
</bean>
<bean factory-bean="pluginRegistry" factory-method="register">

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.common.dataplugin.redbook</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

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

View file

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

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
res/

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -219,6 +219,13 @@
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.dataplugin.redbook"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.edex.plugin.sfcobs"

View file

@ -162,5 +162,6 @@
<classpathentry kind="lib" path="lib/servlet-api-2.5.jar"/>
<classpathentry kind="lib" path="lib/jetty-security-7.6.14.v20131031.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.edex.plugin.taf"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.uf.common.dataplugin.redbook"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

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