Merge "Issue #2574 fix DatabaseQuery conversion of grid coverage objects. Change-Id: I06b98101960775ebe76dcd5d4c4b562f43990309" into omaha_14.2.1

Former-commit-id: 72621bcf14 [formerly 29425906ba] [formerly 66f5000243] [formerly 72621bcf14 [formerly 29425906ba] [formerly 66f5000243] [formerly 84e3cf0988 [formerly 66f5000243 [formerly 69cbbcc3c88565c35c1453412f031669306adf0f]]]]
Former-commit-id: 84e3cf0988
Former-commit-id: 68909c095c [formerly eee649c9b1] [formerly 2d09d28c746d8705ac32468202e80b2c778e0ef6 [formerly 42bd8ccde4]]
Former-commit-id: def329c30b90522d385bb738bac8a14453b5496c [formerly 3141f76bff]
Former-commit-id: cd9dec3e57
This commit is contained in:
Nate Jensen 2013-12-17 12:20:37 -06:00 committed by Gerrit Code Review
commit edec29453c
7 changed files with 69 additions and 48 deletions

View file

@ -2,9 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: 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-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Export-Package: com.raytheon.uf.common.dataplugin.grid,
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.units,
com.raytheon.uf.common.dataplugin.grid.util
Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.gridcoverage;bundle-version="1.0.0";visibility:=reexport,
com.raytheon.uf.common.parameter;bundle-version="1.0.0";visibility:=reexport,
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174";visibility:=reexport,
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
Require-Bundle: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.gridcoverage;visibility:=reexport,
com.raytheon.uf.common.parameter;visibility:=reexport,
com.raytheon.uf.common.dataplugin.level;visibility:=reexport,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.geospatial,
com.raytheon.uf.common.localization,
com.raytheon.uf.common.datastorage,
com.raytheon.uf.common.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.dataquery;bundle-version="1.0.0",
com.raytheon.uf.common.util;bundle-version="1.12.1174",
com.raytheon.uf.common.dataaccess;bundle-version="1.0.0",
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.status;bundle-version="1.12.1174",
com.raytheon.uf.common.comm,
com.raytheon.uf.common.dataquery,
com.raytheon.uf.common.util,
com.raytheon.uf.common.dataaccess,
com.raytheon.uf.common.serialization.comm,
com.raytheon.uf.common.status,
com.raytheon.uf.common.style,
org.apache.commons.beanutils,
javax.measure,
javax.persistence;bundle-version="1.0.0",
org.hibernate;bundle-version="1.0.0"
Import-Package: com.raytheon.uf.common.style,
com.raytheon.uf.common.style.level
javax.persistence,
org.hibernate

View file

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

View file

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

View file

@ -60,11 +60,12 @@ import com.vividsolutions.jts.geom.Coordinate;
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 14, 2012 bsteffen Initial creation
* Jan 14, 2013 1469 bkowal No longer needs to retrieve the location
* of the hdf5 data directory.
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Nov 14, 2012 bsteffen Initial creation
* Jan 14, 2013 1469 bkowal No longer needs to retrieve the location
* of the hdf5 data directory.
* Dec 16, 2013 2574 bsteffen Fixed bugs in setRequestArea.
*
* </pre>
*
@ -193,9 +194,9 @@ public class GridDataRetriever {
double lat2) throws GridCoverageException {
SubGrid subGrid = new SubGrid();
subGrid.setLowerLeftLat(Math.min(lat1, lat2));
subGrid.setLowerLeftLon(Math.min(lat1, lat2));
subGrid.setUpperRightLat(Math.min(lat1, lat2));
subGrid.setUpperRightLon(Math.min(lat1, lat2));
subGrid.setLowerLeftLon(Math.min(lon1, lon1));
subGrid.setUpperRightLat(Math.max(lat1, lat2));
subGrid.setUpperRightLon(Math.max(lon2, lon2));
requestCoverage = record.getLocation().trim(subGrid);
int[] minIndex = { subGrid.getUpperLeftX(), subGrid.getUpperLeftY() };
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();
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-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Export-Package: com.raytheon.uf.common.gridcoverage,
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.dataplugin,
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;
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.gridcoverage.GridCoverage;
import com.raytheon.uf.common.gridcoverage.lookup.GridCoverageLookup;
@ -42,7 +45,7 @@ import com.raytheon.uf.common.gridcoverage.lookup.GridCoverageLookup;
* @version 1.0
*/
public class GridCoverageConverter implements DataURIFieldConverter {
public class GridCoverageConverter implements DataURIFieldConverter, Converter {
@Override
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) {
if (integer != null) {
GridCoverage result = GridCoverageLookup.getInstance().getCoverage(
@ -81,7 +97,7 @@ public class GridCoverageConverter implements DataURIFieldConverter {
}
throw new UnsupportedOperationException(
"Cannot find GridCoverage with id of "
+ String.valueOf(integer));
+ String.valueOf(integer));
}
}

View file

@ -29,4 +29,9 @@
<constructor-arg value="com.raytheon.uf.common.gridcoverage" />
<constructor-arg ref="gridcoverageProperties" />
</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>