Issue #2574 fix DatabaseQuery conversion of grid coverage objects.

Change-Id: I06b98101960775ebe76dcd5d4c4b562f43990309

Former-commit-id: 89de68386a [formerly fb1480b30d] [formerly 7e5349bbff] [formerly cc5d9edc92 [formerly 7e5349bbff [formerly 33033c354a783ab58d89599eb78355c6b354594f]]]
Former-commit-id: cc5d9edc92
Former-commit-id: 5acc5053cf8a5d78052a11afbf56473f1be1d712 [formerly 23a26f5d4a]
Former-commit-id: 8a3bbbca50
This commit is contained in:
Ben Steffensmeier 2013-12-16 14:18:51 -06:00
parent 609d5ca4b6
commit e6606cb28b
7 changed files with 69 additions and 48 deletions

View file

@ -2,9 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: Grid Bundle-Name: Grid
Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.grid Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.grid
Bundle-Version: 1.0.0.qualifier Bundle-Version: 1.13.0.qualifier
Bundle-Vendor: RAYTHEON Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Export-Package: com.raytheon.uf.common.dataplugin.grid, Export-Package: com.raytheon.uf.common.dataplugin.grid,
com.raytheon.uf.common.dataplugin.grid.dataquery, com.raytheon.uf.common.dataplugin.grid.dataquery,
@ -14,22 +15,22 @@ Export-Package: com.raytheon.uf.common.dataplugin.grid,
com.raytheon.uf.common.dataplugin.grid.request, com.raytheon.uf.common.dataplugin.grid.request,
com.raytheon.uf.common.dataplugin.grid.units, com.raytheon.uf.common.dataplugin.grid.units,
com.raytheon.uf.common.dataplugin.grid.util com.raytheon.uf.common.dataplugin.grid.util
Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", Require-Bundle: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.gridcoverage;bundle-version="1.0.0";visibility:=reexport, com.raytheon.uf.common.gridcoverage;visibility:=reexport,
com.raytheon.uf.common.parameter;bundle-version="1.0.0";visibility:=reexport, com.raytheon.uf.common.parameter;visibility:=reexport,
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174";visibility:=reexport, com.raytheon.uf.common.dataplugin.level;visibility:=reexport,
com.raytheon.uf.common.serialization;bundle-version="1.12.1174", com.raytheon.uf.common.serialization,
com.raytheon.uf.common.geospatial, com.raytheon.uf.common.geospatial,
com.raytheon.uf.common.localization, com.raytheon.uf.common.localization,
com.raytheon.uf.common.datastorage, com.raytheon.uf.common.datastorage,
com.raytheon.uf.common.comm;bundle-version="1.12.1174", com.raytheon.uf.common.comm,
com.raytheon.uf.common.dataquery;bundle-version="1.0.0", com.raytheon.uf.common.dataquery,
com.raytheon.uf.common.util;bundle-version="1.12.1174", com.raytheon.uf.common.util,
com.raytheon.uf.common.dataaccess;bundle-version="1.0.0", com.raytheon.uf.common.dataaccess,
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174", com.raytheon.uf.common.serialization.comm,
com.raytheon.uf.common.status;bundle-version="1.12.1174", com.raytheon.uf.common.status,
com.raytheon.uf.common.style,
org.apache.commons.beanutils,
javax.measure, javax.measure,
javax.persistence;bundle-version="1.0.0", javax.persistence,
org.hibernate;bundle-version="1.0.0" org.hibernate
Import-Package: com.raytheon.uf.common.style,
com.raytheon.uf.common.style.level

View file

@ -35,7 +35,6 @@ import javax.persistence.UniqueConstraint;
import org.hibernate.annotations.Index; import org.hibernate.annotations.Index;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.Level;
@ -60,7 +59,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* May 21, 2012 bsteffen Initial creation * May 21, 2012 bsteffen Initial creation
* Apr 04, 2013 1846 bkowal Added an index on refTime and * Apr 04, 2013 1846 bkowal Added an index on refTime and
* forecastTime * forecastTime
@ -68,6 +67,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* May 07, 2013 1869 bsteffen Remove dataURI column from * May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject. * PluginDataObject.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Dec 16, 2013 2574 bsteffen Remove getDecoderGettable.
* *
* </pre> * </pre>
* *
@ -184,11 +184,6 @@ public class GridRecord extends PersistablePluginDataObject implements
getInfoNotNull().setEnsembleId(ensembleId); getInfoNotNull().setEnsembleId(ensembleId);
} }
@Override
public IDecoderGettable getDecoderGettable() {
return null;
}
@Override @Override
public ISpatialObject getSpatialObject() { public ISpatialObject getSpatialObject() {
return getLocation(); return getLocation();

View file

@ -43,8 +43,9 @@ import com.raytheon.uf.common.status.UFStatus;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Feb 27, 2012 bsteffen Initial creation * Feb 27, 2012 bsteffen Initial creation
* Dec 16, 2013 2574 bsteffen Update deprecated method call.
* *
* </pre> * </pre>
* *
@ -97,8 +98,8 @@ public class DatasetInfoLookup {
return; return;
} }
try { try {
Object obj = manager.unmarshalFromXmlFile(file.getFile()); DatasetInfoSet set = manager.unmarshalFromXmlFile(
DatasetInfoSet set = (DatasetInfoSet) obj; DatasetInfoSet.class, file.getFile());
for (DatasetInfo info : set.getInfos()) { for (DatasetInfo info : set.getInfos()) {
infoMap.put(info.getDatasetId(), info); infoMap.put(info.getDatasetId(), info);
} }

View file

@ -61,10 +61,11 @@ import com.vividsolutions.jts.geom.Coordinate;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Nov 14, 2012 bsteffen Initial creation * Nov 14, 2012 bsteffen Initial creation
* Jan 14, 2013 1469 bkowal No longer needs to retrieve the location * Jan 14, 2013 1469 bkowal No longer needs to retrieve the location
* of the hdf5 data directory. * of the hdf5 data directory.
* Dec 16, 2013 2574 bsteffen Fixed bugs in setRequestArea.
* *
* </pre> * </pre>
* *
@ -193,9 +194,9 @@ public class GridDataRetriever {
double lat2) throws GridCoverageException { double lat2) throws GridCoverageException {
SubGrid subGrid = new SubGrid(); SubGrid subGrid = new SubGrid();
subGrid.setLowerLeftLat(Math.min(lat1, lat2)); subGrid.setLowerLeftLat(Math.min(lat1, lat2));
subGrid.setLowerLeftLon(Math.min(lat1, lat2)); subGrid.setLowerLeftLon(Math.min(lon1, lon1));
subGrid.setUpperRightLat(Math.min(lat1, lat2)); subGrid.setUpperRightLat(Math.max(lat1, lat2));
subGrid.setUpperRightLon(Math.min(lat1, lat2)); subGrid.setUpperRightLon(Math.max(lon2, lon2));
requestCoverage = record.getLocation().trim(subGrid); requestCoverage = record.getLocation().trim(subGrid);
int[] minIndex = { subGrid.getUpperLeftX(), subGrid.getUpperLeftY() }; int[] minIndex = { subGrid.getUpperLeftX(), subGrid.getUpperLeftY() };
int[] maxIndex = { subGrid.getUpperLeftX() + subGrid.getNX(), int[] maxIndex = { subGrid.getUpperLeftX() + subGrid.getNX(),
@ -321,7 +322,7 @@ public class GridDataRetriever {
} }
} }
private File findStorageLocation() throws StorageException { private File findStorageLocation() {
IHDFFilePathProvider pathProvider = record.getHDFPathProvider(); IHDFFilePathProvider pathProvider = record.getHDFPathProvider();
String path = pathProvider.getHDFPath(record.getPluginName(), record); String path = pathProvider.getHDFPath(record.getPluginName(), record);

View file

@ -5,6 +5,7 @@ Bundle-SymbolicName: com.raytheon.uf.common.gridcoverage
Bundle-Version: 1.13.0.qualifier Bundle-Version: 1.13.0.qualifier
Bundle-Vendor: RAYTHEON Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Export-Package: com.raytheon.uf.common.gridcoverage, Export-Package: com.raytheon.uf.common.gridcoverage,
com.raytheon.uf.common.gridcoverage.convert, com.raytheon.uf.common.gridcoverage.convert,
@ -19,4 +20,5 @@ Require-Bundle: com.raytheon.uf.common.serialization,
com.raytheon.uf.common.status, com.raytheon.uf.common.status,
com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataquery, com.raytheon.uf.common.dataquery,
org.apache.commons.lang org.apache.commons.lang,
org.apache.commons.beanutils

View file

@ -19,6 +19,9 @@
**/ **/
package com.raytheon.uf.common.gridcoverage.convert; package com.raytheon.uf.common.gridcoverage.convert;
import org.apache.commons.beanutils.ConversionException;
import org.apache.commons.beanutils.Converter;
import com.raytheon.uf.common.dataplugin.annotations.DataURIFieldConverter; import com.raytheon.uf.common.dataplugin.annotations.DataURIFieldConverter;
import com.raytheon.uf.common.gridcoverage.GridCoverage; import com.raytheon.uf.common.gridcoverage.GridCoverage;
import com.raytheon.uf.common.gridcoverage.lookup.GridCoverageLookup; import com.raytheon.uf.common.gridcoverage.lookup.GridCoverageLookup;
@ -42,7 +45,7 @@ import com.raytheon.uf.common.gridcoverage.lookup.GridCoverageLookup;
* @version 1.0 * @version 1.0
*/ */
public class GridCoverageConverter implements DataURIFieldConverter { public class GridCoverageConverter implements DataURIFieldConverter, Converter {
@Override @Override
public String toString(Object field) { public String toString(Object field) {
@ -71,6 +74,19 @@ public class GridCoverageConverter implements DataURIFieldConverter {
} }
} }
@Override
public GridCoverage convert(Class clazz, Object value) {
if (value instanceof Integer) {
return fromInteger((Integer) value);
} else if (value instanceof String) {
return fromString((String) value);
} else {
throw new ConversionException("Cannot convert "
+ String.valueOf(value) + " of type "
+ value.getClass().getSimpleName() + " to a GridCoverage.");
}
}
public GridCoverage fromInteger(Integer integer) { public GridCoverage fromInteger(Integer integer) {
if (integer != null) { if (integer != null) {
GridCoverage result = GridCoverageLookup.getInstance().getCoverage( GridCoverage result = GridCoverageLookup.getInstance().getCoverage(

View file

@ -29,4 +29,9 @@
<constructor-arg value="com.raytheon.uf.common.gridcoverage" /> <constructor-arg value="com.raytheon.uf.common.gridcoverage" />
<constructor-arg ref="gridcoverageProperties" /> <constructor-arg ref="gridcoverageProperties" />
</bean> </bean>
<bean class="com.raytheon.uf.common.util.ConvertUtil" factory-method="registerConverter">
<constructor-arg><bean class="com.raytheon.uf.common.gridcoverage.convert.GridCoverageConverter"/></constructor-arg>
<constructor-arg><value>com.raytheon.uf.common.gridcoverage.GridCoverage</value></constructor-arg>
</bean>
</beans> </beans>