diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractDataFactory.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractDataFactory.java index de61eaf852..f5ded2b3a6 100644 --- a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractDataFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractDataFactory.java @@ -28,6 +28,11 @@ import java.util.Map; import com.raytheon.uf.common.dataaccess.IDataFactory; import com.raytheon.uf.common.dataaccess.IDataRequest; import com.raytheon.uf.common.dataaccess.exception.InvalidIdentifiersException; +import com.raytheon.uf.common.dataaccess.exception.UnsupportedOutputTypeException; +import com.raytheon.uf.common.dataaccess.geom.IGeometryData; +import com.raytheon.uf.common.dataaccess.grid.IGridData; +import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.common.time.TimeRange; /** * @@ -44,7 +49,8 @@ import com.raytheon.uf.common.dataaccess.exception.InvalidIdentifiersException; * Feb 14, 2013 1614 bsteffen Refactor data access framework to use * single request. * Feb 19, 2012 1552 mpduff Implement IDataFactory. - * + * Jan 14, 2014 2667 mnash Change getGridData and getGeometryData methods + * to throw exception by default * * * @author njensen @@ -104,4 +110,39 @@ public abstract class AbstractDataFactory implements IDataFactory { } } + /** + * Default implementation throws an {@link UnsupportedOutputTypeException} + */ + @Override + public IGridData[] getGridData(IDataRequest request, DataTime... times) { + throw new UnsupportedOutputTypeException(request.getDatatype(), "grid"); + } + + /** + * Default implementation throws an {@link UnsupportedOutputTypeException} + */ + public IGridData[] getGridData(IDataRequest request, TimeRange timeRange) { + throw new UnsupportedOutputTypeException(request.getDatatype(), "grid"); + } + + /** + * Default implementation throws an {@link UnsupportedOutputTypeException} + */ + @Override + public IGeometryData[] getGeometryData(IDataRequest request, + DataTime... times) { + throw new UnsupportedOutputTypeException(request.getDatatype(), + "geometry"); + } + + /** + * Default implementation throws an {@link UnsupportedOutputTypeException} + */ + @Override + public IGeometryData[] getGeometryData(IDataRequest request, + TimeRange timeRange) { + throw new UnsupportedOutputTypeException(request.getDatatype(), + "geometry"); + } + } diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractDataPluginFactory.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractDataPluginFactory.java index 2e196f1c6f..4f6b08a680 100644 --- a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractDataPluginFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractDataPluginFactory.java @@ -27,6 +27,7 @@ import java.util.Map; import com.raytheon.uf.common.dataaccess.IDataRequest; import com.raytheon.uf.common.dataaccess.exception.DataRetrievalException; import com.raytheon.uf.common.dataaccess.exception.TimeAgnosticDataException; +import com.raytheon.uf.common.dataaccess.exception.UnsupportedOutputTypeException; import com.raytheon.uf.common.dataaccess.geom.IGeometryData; import com.raytheon.uf.common.dataaccess.grid.IGridData; import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; @@ -53,7 +54,8 @@ import com.raytheon.uf.common.time.TimeRange; * Feb 14, 2013 1614 bsteffen Refactor data access framework to use * single request. * Nov 26, 2013 2537 bsteffen Fix NPEs for dataTimes and timeRange requests. - * + * Jan 14, 2014 2667 mnash Change getGridData and getGeometryData methods + * to throw exception by default * * * @@ -61,8 +63,7 @@ import com.raytheon.uf.common.time.TimeRange; * @version 1.0 */ -public abstract class AbstractDataPluginFactory - extends AbstractDataFactory { +public abstract class AbstractDataPluginFactory extends AbstractDataFactory { protected static final String FIELD_DATATIME = "dataTime"; @@ -269,15 +270,18 @@ public abstract class AbstractDataPluginFactory return dbQueryRequest; } - protected abstract IGridData[] getGridData(IDataRequest request, - DbQueryResponse dbQueryResponse); + protected IGridData[] getGridData(IDataRequest request, + DbQueryResponse dbQueryResponse) { + throw new UnsupportedOutputTypeException(request.getDatatype(), "grid"); + } - protected abstract IGeometryData[] getGeometryData(IDataRequest request, - DbQueryResponse dbQueryResponse); + protected IGeometryData[] getGeometryData(IDataRequest request, + DbQueryResponse dbQueryResponse) { + throw new UnsupportedOutputTypeException(request.getDatatype(), + "geometry"); + } protected abstract Map buildConstraintsFromRequest( IDataRequest request); - - } diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractGeometryDatabaseFactory.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractGeometryDatabaseFactory.java index ffab1f10c7..3043c9e654 100644 --- a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractGeometryDatabaseFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractGeometryDatabaseFactory.java @@ -29,9 +29,7 @@ import com.raytheon.uf.common.dataaccess.IDataFactory; import com.raytheon.uf.common.dataaccess.IDataRequest; import com.raytheon.uf.common.dataaccess.exception.DataRetrievalException; import com.raytheon.uf.common.dataaccess.exception.TimeAgnosticDataException; -import com.raytheon.uf.common.dataaccess.exception.UnsupportedOutputTypeException; import com.raytheon.uf.common.dataaccess.geom.IGeometryData; -import com.raytheon.uf.common.dataaccess.grid.IGridData; import com.raytheon.uf.common.dataaccess.util.DatabaseQueryUtil; import com.raytheon.uf.common.dataaccess.util.DatabaseQueryUtil.QUERY_MODE; import com.raytheon.uf.common.dataplugin.level.Level; @@ -54,7 +52,7 @@ import com.vividsolutions.jts.geom.Geometry; * Jan 29, 2013 bkowal Initial creation * Feb 14, 2013 1614 bsteffen Refactor data access framework to use * single request. - * + * Jan 14, 2014 2667 mnash Remove getGridData methods * * * @author bkowal @@ -151,16 +149,6 @@ public abstract class AbstractGeometryDatabaseFactory extends request); } - @Override - public IGridData[] getGridData(IDataRequest request, DataTime... times) { - throw new UnsupportedOutputTypeException(request.getDatatype(), "grid"); - } - - @Override - public IGridData[] getGridData(IDataRequest request, TimeRange timeRange) { - throw new UnsupportedOutputTypeException(request.getDatatype(), "grid"); - } - /** * Runs a query to retrieve Data Times from the database. * diff --git a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractGridDataPluginFactory.java b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractGridDataPluginFactory.java index 898ed9c239..2ffbeecf44 100644 --- a/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractGridDataPluginFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/impl/AbstractGridDataPluginFactory.java @@ -27,8 +27,6 @@ import org.geotools.coverage.grid.GridGeometry2D; import com.raytheon.uf.common.dataaccess.IDataRequest; import com.raytheon.uf.common.dataaccess.exception.DataRetrievalException; -import com.raytheon.uf.common.dataaccess.exception.UnsupportedOutputTypeException; -import com.raytheon.uf.common.dataaccess.geom.IGeometryData; import com.raytheon.uf.common.dataaccess.grid.IGridData; import com.raytheon.uf.common.dataaccess.util.PDOUtil; import com.raytheon.uf.common.dataplugin.PluginDataObject; @@ -49,7 +47,7 @@ import com.raytheon.uf.common.datastorage.records.IDataRecord; * Jan 17, 2013 bsteffen Initial creation * Feb 14, 2013 1614 bsteffen Refactor data access framework to use * single request. - * + * Jan 14, 2014 2667 mnash Remove getGeometryData methods * * * @author bsteffen @@ -82,8 +80,7 @@ public abstract class AbstractGridDataPluginFactory extends "The objects returned by the DbQueryRequest are not of type PluginDataObject as expected."); } - PluginDataObject pdo = (PluginDataObject) resultMap - .get(null); + PluginDataObject pdo = (PluginDataObject) resultMap.get(null); IDataRecord dataRecord = getDataRecord(pdo); @@ -102,14 +99,6 @@ public abstract class AbstractGridDataPluginFactory extends return gridData.toArray(new IGridData[gridData.size()]); } - protected IGeometryData[] getGeometryData(IDataRequest request, - DbQueryResponse dbQueryResponse) { - // Subtypes can optionally support geometry by overriding this, default - // is to not support geometry data. - throw new UnsupportedOutputTypeException(request.getDatatype(), - "geometry"); - } - protected IDataRecord getDataRecord(PluginDataObject pdo) { try { return PDOUtil.getDataRecord(pdo, "Data", Request.ALL); @@ -142,5 +131,4 @@ public abstract class AbstractGridDataPluginFactory extends IDataRequest request, PluginDataObject pdo, GridGeometry2D gridGeometry, IDataRecord dataRecord); - } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/dataaccess/FFMPGeometryFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/dataaccess/FFMPGeometryFactory.java index cd4462fe82..9618dfee52 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/dataaccess/FFMPGeometryFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/dataaccess/FFMPGeometryFactory.java @@ -28,9 +28,7 @@ import javax.measure.unit.Unit; import com.raytheon.uf.common.dataaccess.IDataRequest; import com.raytheon.uf.common.dataaccess.exception.DataRetrievalException; -import com.raytheon.uf.common.dataaccess.exception.UnsupportedOutputTypeException; import com.raytheon.uf.common.dataaccess.geom.IGeometryData; -import com.raytheon.uf.common.dataaccess.grid.IGridData; import com.raytheon.uf.common.dataaccess.impl.AbstractDataPluginFactory; import com.raytheon.uf.common.dataaccess.impl.DefaultGeometryData; import com.raytheon.uf.common.dataaccess.util.DatabaseQueryUtil; @@ -67,6 +65,7 @@ import com.vividsolutions.jts.geom.Geometry; * Apr 16, 2013 1912 bsteffen Initial bulk hdf5 access for ffmp * Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL * Aug,20, 2013 2250 mnash Change some methods that were not working in all cases + * Jan,14, 2014 2667 mnash Remove getGridData method * * * @@ -105,17 +104,6 @@ public class FFMPGeometryFactory extends AbstractDataPluginFactory { public FFMPGeometryFactory() { } - /** - * Not Supported. - */ - @Override - protected IGridData[] getGridData(IDataRequest request, - DbQueryResponse dbQueryResponse) { - // Not currently handled - throw new UnsupportedOutputTypeException(request.getDatatype(), - PLUGIN_NAME); - } - /** * {@inheritDoc} */ diff --git a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/dataaccess/PointDataAccessFactory.java b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/dataaccess/PointDataAccessFactory.java index d26b9ffd1c..5c6ad382e0 100644 --- a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/dataaccess/PointDataAccessFactory.java +++ b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/dataaccess/PointDataAccessFactory.java @@ -36,17 +36,14 @@ import com.raytheon.uf.common.comm.CommunicationException; import com.raytheon.uf.common.dataaccess.DataAccessLayer; import com.raytheon.uf.common.dataaccess.IDataRequest; import com.raytheon.uf.common.dataaccess.exception.DataRetrievalException; -import com.raytheon.uf.common.dataaccess.exception.UnsupportedOutputTypeException; import com.raytheon.uf.common.dataaccess.geom.IGeometryData; import com.raytheon.uf.common.dataaccess.geom.IGeometryData.Type; -import com.raytheon.uf.common.dataaccess.grid.IGridData; import com.raytheon.uf.common.dataaccess.impl.AbstractDataPluginFactory; import com.raytheon.uf.common.dataaccess.impl.DefaultGeometryData; import com.raytheon.uf.common.dataplugin.level.LevelFactory; import com.raytheon.uf.common.dataplugin.level.MasterLevel; import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.pointdata.PointDataConstants; import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataDescription; @@ -69,7 +66,7 @@ import com.vividsolutions.jts.geom.GeometryFactory; * ------------- -------- ----------- -------------------------- * Oct 31, 2013 2502 bsteffen Initial creation * Nov 26, 2013 2537 bsteffen Minor code cleanup. - * + * Jan,14, 2014 2667 mnash Remove getGridData method * * * @author bsteffen @@ -145,27 +142,6 @@ public class PointDataAccessFactory extends AbstractDataPluginFactory { return getGeometryData(request, dbQueryRequest); } - @Override - protected IGeometryData[] getGeometryData(IDataRequest request, - DbQueryResponse dbQueryResponse) { - /* - * Since the public getGeometryData methods have been overriden, this is - * now unreachable code, but since it is an abstract method in the super - * class it must be implemented. - */ - throw new UnsupportedOperationException( - "This method should be unreachable"); - } - - @Override - protected IGridData[] getGridData(IDataRequest request, - DbQueryResponse dbQueryResponse) { - /* - * Point data cannot be gridded, so don't even try. - */ - throw new UnsupportedOutputTypeException(request.getDatatype(), "grid"); - } - @Override protected Map buildConstraintsFromRequest( IDataRequest request) { @@ -208,7 +184,7 @@ public class PointDataAccessFactory extends AbstractDataPluginFactory { "Unable to complete the PointDataRequestMessage for request: " + request, e); } - if(pdc == null){ + if (pdc == null) { return new IGeometryData[0]; } LevelFactory lf = LevelFactory.getInstance();