Omaha #4124 Implement getAvailableParameters() for satellite retrieval through DAF

Change-Id: I532640b7305ad0f5e7423a35e37abce22866ebad

Former-commit-id: 51466d91a9327b0bcfdeae9d1eadcd06df622da1
This commit is contained in:
Mark Peters 2015-02-17 17:06:45 -06:00
parent 6442e88fe3
commit e383afe23f
3 changed files with 50 additions and 36 deletions

View file

@ -32,7 +32,6 @@ import javax.measure.unit.Unit;
import org.geotools.coverage.grid.GridGeometry2D;
import com.raytheon.uf.common.comm.CommunicationException;
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.grid.IGridData;
@ -55,11 +54,11 @@ import com.raytheon.uf.common.util.mapping.Mapper;
/**
* Data access factory for accessing data from the Grid plugin as grid types.
*
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Jan 17, 2013 bsteffen Initial creation
@ -70,16 +69,16 @@ import com.raytheon.uf.common.util.mapping.Mapper;
* Sep 09, 2014 3356 njensen Remove CommunicationException
* Oct 16, 2014 3598 nabowle Accept level identifiers.
* Oct 21, 2014 3755 nabowle Add getAvailable levels and parameters.
*
*
* Feb 13, 2015 4124 mapeters Inherits IDataFactory.
*
*
* </pre>
*
*
* @author bsteffen
* @version 1.0
*/
public class GridDataAccessFactory extends AbstractGridDataPluginFactory
implements IDataFactory {
public class GridDataAccessFactory extends AbstractGridDataPluginFactory {
private static final String NAMESPACE = "namespace";
@ -183,7 +182,7 @@ public class GridDataAccessFactory extends AbstractGridDataPluginFactory
/**
* Check for possible level conflicts.
*
*
* @param levels
* The request levels. Assumed to not be null.
* @param identifiers
@ -211,7 +210,7 @@ public class GridDataAccessFactory extends AbstractGridDataPluginFactory
/**
* Copy all constraints from source to target. If target already contains a
* constraint for a key then merge the values into target.
*
*
* @param target
* @param source
*/

View file

@ -33,7 +33,6 @@ import org.geotools.coverage.grid.GridGeometry2D;
import org.geotools.geometry.jts.ReferencedEnvelope;
import org.opengis.referencing.FactoryException;
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.EnvelopeProjectionException;
@ -64,19 +63,19 @@ import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Envelope;
/**
*
*
* A data factory for getting radar data from the metadata database. There are
* currently not any required identifiers.
*
*
* Radar does not return subgrids for request envelopes like other gridded
* types. Instead data for only icaos within the request envelope are returned
* and all data for the product is used. This is done because subgridding radial
* products is complex and this is not often what a caller actually wants.
*
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Jan 23, 2013 bsteffen Initial creation
@ -91,14 +90,14 @@ import com.vividsolutions.jts.geom.Envelope;
* optional identifiers to indicate what
* fields are used for the level one and two
* values.
*
* Feb 13, 2015 4124 mapeters Inherits IDataFactory.
*
* </pre>
*
*
* @author bsteffen
* @version 1.0
*/
public class RadarGridFactory extends AbstractGridDataPluginFactory implements
IDataFactory {
public class RadarGridFactory extends AbstractGridDataPluginFactory {
private static final String PRODUCT_CODE = "productCode";
@ -180,7 +179,7 @@ public class RadarGridFactory extends AbstractGridDataPluginFactory implements
* {@value #LEVEL_ONE} or {@value #LEVEL_TWO} identifiers, those fields will
* be used. If {@value #LEVEL_ONE} is not specified, {@value #PRIMARY_ANGLE}
* will be used.
*
*
* @param radarRecord
* The radar record.
* @param request
@ -227,8 +226,8 @@ public class RadarGridFactory extends AbstractGridDataPluginFactory implements
* Theoretically two radial geometries could have the same name but
* internally different angleData but this is very unlikely and the points
* would be very nearly identical.
*
*
*
*
* @param radarRecord
* a record.
* @return A unique location name
@ -345,7 +344,7 @@ public class RadarGridFactory extends AbstractGridDataPluginFactory implements
/**
* Populate a DataSource from the raw data(byte or short) in the provided
* record.
*
*
* @param radarRecord
* @return a DataSource or null if the record is not populated or has no
* grid data.
@ -599,7 +598,7 @@ public class RadarGridFactory extends AbstractGridDataPluginFactory implements
/**
* Validates that, if specified, the {@value #LEVEL_ONE} and
* {@value #LEVEL_TWO} identifier values are supported.
*
*
* @param request
*/
private void validateLevelIdentifiers(IDataRequest request) {
@ -617,21 +616,21 @@ public class RadarGridFactory extends AbstractGridDataPluginFactory implements
}
/**
*
*
* This is used to convert data from bin,radial format to radial bin format.
*
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 25, 2013 bsteffen Initial creation
* Feb 14, 2013 1614 bsteffen refactor data access framework to use
* single request.
*
*
* </pre>
*
*
* @author bsteffen
* @version 1.0
*/

View file

@ -30,7 +30,6 @@ import javax.measure.unit.UnitFormat;
import org.geotools.coverage.grid.GridGeometry2D;
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.impl.AbstractGridDataPluginFactory;
@ -38,7 +37,9 @@ import com.raytheon.uf.common.dataaccess.impl.DefaultGridData;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord;
import com.raytheon.uf.common.dataplugin.satellite.units.SatelliteUnits;
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.numeric.source.DataSource;
/**
@ -58,14 +59,14 @@ import com.raytheon.uf.common.numeric.source.DataSource;
* Feb 04, 2014 2672 bsteffen Enable requesting subgrids.
* Jul 30, 2014 3184 njensen Renamed valid identifiers to optional
* Sep 29, 2014 3596 nabowle Always put creatingEntity in attributes.
* Feb 13, 2015 4124 mapeters Overrode getAvailableParameters(), inherits IDataFactory.
*
* </pre>
*
* @author bkowal
* @version 1.0
*/
public class SatelliteGridFactory extends AbstractGridDataPluginFactory
implements IDataFactory {
public class SatelliteGridFactory extends AbstractGridDataPluginFactory {
private static final String FIELD_CREATING_ENTITY = "creatingEntity";
@ -127,7 +128,7 @@ public class SatelliteGridFactory extends AbstractGridDataPluginFactory
/**
* Builds the base constraint map based on the supplied grid request
*
*
* @param request
* the original grid request
* @return the base constraint map
@ -172,4 +173,19 @@ public class SatelliteGridFactory extends AbstractGridDataPluginFactory
return getAvailableLocationNames(request, FIELD_SECTOR_ID);
}
/**
* Get the available parameters.
*/
@Override
public String[] getAvailableParameters(IDataRequest request) {
DbQueryRequest dbQueryRequest = buildDbQueryRequest(request);
dbQueryRequest.setDistinct(Boolean.TRUE);
dbQueryRequest.addRequestField(FIELD_PYHSICAL_ELEMENT);
DbQueryResponse dbQueryResponse = this.executeDbQueryRequest(
dbQueryRequest, request.toString());
return dbQueryResponse.getFieldObjects(FIELD_PYHSICAL_ELEMENT,
String.class);
}
}