Issue #1308 Fixed ScanUtils unneeded dependency on BinLightningDao by switching to PluginDao. Added comments to various classes and fixed bug in menu generation code that would cause menus that use checkCreation(String,String) to regenerate menus every time.
Change-Id: Icc7f89812936f97029e2a06adbc527ec658d8d9b Former-commit-id:5f0b4286ba
[formerly9aa4221fdf
] [formerlyc80dbffad8
[formerly 598e0268c95155536fb94798cc134d18b2566dbc]] Former-commit-id:c80dbffad8
Former-commit-id:0a410412db
This commit is contained in:
parent
b45ba40abf
commit
c219fcb112
7 changed files with 56 additions and 59 deletions
|
@ -178,11 +178,4 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.edex.plugin.binlightning"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
|
|
@ -25,7 +25,8 @@ import org.springframework.context.ApplicationContext;
|
|||
import org.springframework.context.support.AbstractXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* XML Application context for OSGI Bundle. Creates a class loader which uses
|
||||
* the bundle to resolve classes
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -20,7 +20,7 @@ Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.11.5",
|
|||
org.geotools;bundle-version="2.5.2",
|
||||
org.apache.commons.collections,
|
||||
com.raytheon.uf.common.geospatial;bundle-version="1.0.0",
|
||||
com.raytheon.edex.plugin.binlightning;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.localization;bundle-version="1.11.17",
|
||||
org.eclipse.swt,
|
||||
com.raytheon.uf.common.dataplugin.grib;bundle-version="1.11.26",
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.opengis.referencing.crs.ProjectedCRS;
|
|||
import org.opengis.referencing.datum.PixelInCell;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.edex.plugin.binlightning.dao.BinLightningDao;
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
|
||||
import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType;
|
||||
|
@ -57,6 +56,7 @@ import com.raytheon.uf.common.sounding.VerticalSounding;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.edex.database.plugin.PluginDao;
|
||||
import com.raytheon.uf.edex.database.plugin.PluginFactory;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
|
@ -295,13 +295,13 @@ public class ScanUtils {
|
|||
|
||||
public static String SEVERE_THUNDERSTORM_PHENSIG = "SV.W";
|
||||
|
||||
private static Map<String, String> tableStdResLevels = new HashMap<String,String>();
|
||||
|
||||
// private static String standardResolutionLevel = null;
|
||||
private static Map<String, String> tableStdResLevels = new HashMap<String, String>();
|
||||
|
||||
private static Map<String, String> tableHighResLevels = new HashMap<String,String>();
|
||||
// private static String standardResolutionLevel = null;
|
||||
|
||||
// private static String highResolutionLevel = null;
|
||||
private static Map<String, String> tableHighResLevels = new HashMap<String, String>();
|
||||
|
||||
// private static String highResolutionLevel = null;
|
||||
|
||||
private static String prevTable = "";
|
||||
|
||||
|
@ -316,7 +316,7 @@ public class ScanUtils {
|
|||
BinLightningRecord lightRec = null;
|
||||
try {
|
||||
lightRec = new BinLightningRecord(uri);
|
||||
BinLightningDao ld = (BinLightningDao) PluginFactory.getInstance()
|
||||
PluginDao ld = (PluginDao) PluginFactory.getInstance()
|
||||
.getPluginDao(lightRec.getPluginName());
|
||||
lightRec = (BinLightningRecord) ld.getMetadata(uri);
|
||||
IDataStore dataStore = ld.getDataStore(lightRec);
|
||||
|
@ -630,7 +630,7 @@ public class ScanUtils {
|
|||
return outputGrid;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static short[] reSizeGridMax(short[] inputGrid, int outputGridSize,
|
||||
int nx, int ny) {
|
||||
|
||||
|
@ -647,8 +647,9 @@ public class ScanUtils {
|
|||
for (int x = 0; x < 4; x++) {
|
||||
for (int y = 0; y < 4; y++) {
|
||||
// average the grid values
|
||||
mxValue = (short) Math.max(inputGrid[(SCAN_GRID_DIM_1KM * (i * 4 + x))
|
||||
+ (j * 4 + y)], mxValue);
|
||||
mxValue = (short) Math
|
||||
.max(inputGrid[(SCAN_GRID_DIM_1KM * (i * 4 + x))
|
||||
+ (j * 4 + y)], mxValue);
|
||||
}
|
||||
}
|
||||
outputGrid[(SCAN_GRID_DIM * i) + j] = mxValue;
|
||||
|
@ -668,8 +669,9 @@ public class ScanUtils {
|
|||
for (int x = 0; x < 2; x++) {
|
||||
for (int y = 0; y < 2; y++) {
|
||||
// average the grid values
|
||||
mxValue = (short) Math.max(inputGrid[(SCAN_GRID_DIM_2KM * (i * 2 + x))
|
||||
+ (j * 2 + y)], mxValue);
|
||||
mxValue = (short) Math
|
||||
.max(inputGrid[(SCAN_GRID_DIM_2KM * (i * 2 + x))
|
||||
+ (j * 2 + y)], mxValue);
|
||||
}
|
||||
}
|
||||
outputGrid[(SCAN_GRID_DIM * i) + j] = mxValue;
|
||||
|
@ -681,7 +683,7 @@ public class ScanUtils {
|
|||
return outputGrid;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts the raw bytes array into DBZ short arrays
|
||||
*
|
||||
|
@ -700,7 +702,8 @@ public class ScanUtils {
|
|||
* @param radRec
|
||||
* @return
|
||||
*/
|
||||
public static short[] convertToGrid(RadarRecord radRec, int gridSize, boolean max) {
|
||||
public static short[] convertToGrid(RadarRecord radRec, int gridSize,
|
||||
boolean max) {
|
||||
|
||||
short[] grid = null;
|
||||
|
||||
|
@ -735,7 +738,7 @@ public class ScanUtils {
|
|||
radRec, irow, icol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((radRec.getNumBins() * radRec.getNumRadials()) != gridSize) {
|
||||
if (max)
|
||||
grid = ScanUtils.reSizeGridMax(ogrid, gridSize,
|
||||
|
@ -1613,12 +1616,12 @@ public class ScanUtils {
|
|||
|
||||
// hail cap check
|
||||
if (rValue > hailCap) {
|
||||
return (float)(MM_TO_INCH * hailCap);
|
||||
return (float) (MM_TO_INCH * hailCap);
|
||||
}
|
||||
} else {
|
||||
return (float) rValue;
|
||||
return (float) rValue;
|
||||
}
|
||||
|
||||
|
||||
return (float) (MM_TO_INCH * rValue);
|
||||
}
|
||||
|
||||
|
@ -1845,7 +1848,7 @@ public class ScanUtils {
|
|||
*/
|
||||
public static String getStandardResolutionLevel(String tablename) {
|
||||
String resLevel = tableStdResLevels.get(tablename);
|
||||
if(resLevel == null) {
|
||||
if (resLevel == null) {
|
||||
setResolutionLevels(tablename);
|
||||
resLevel = tableStdResLevels.get(tablename);
|
||||
}
|
||||
|
@ -1861,7 +1864,7 @@ public class ScanUtils {
|
|||
*/
|
||||
public static String getHighResolutionLevel(String tablename) {
|
||||
String resLevel = tableHighResLevels.get(tablename);
|
||||
if(resLevel == null) {
|
||||
if (resLevel == null) {
|
||||
setResolutionLevels(tablename);
|
||||
resLevel = tableHighResLevels.get(tablename);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package com.raytheon.uf.edex.menus;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
@ -38,8 +37,24 @@ import com.raytheon.uf.common.localization.exception.LocalizationOpFailedExcepti
|
|||
import com.raytheon.uf.common.menus.MenuSerialization;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
||||
/**
|
||||
*
|
||||
* Abstract class for generting menu files
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 8, 2012 mschenke Initial javadoc creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author unknown
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class AbstractMenuUtil {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AbstractMenuUtil.class);
|
||||
|
@ -152,35 +167,18 @@ public abstract class AbstractMenuUtil {
|
|||
LocalizationFile olFile = pm.getLocalizationFile(caveConfigured,
|
||||
"menus" + File.separator + type + File.separator + "." + type
|
||||
+ "MenuTime");
|
||||
File ofFile = olFile.getFile();
|
||||
|
||||
File ffile = lFile.getFile();
|
||||
long useTime = ffile.lastModified();
|
||||
|
||||
long writeTime = 0;
|
||||
|
||||
// read the time from a file, and write the current time to a file
|
||||
try {
|
||||
writeTime = ofFile.lastModified();
|
||||
if (!olFile.exists()) {
|
||||
File file = olFile.getFile();
|
||||
try {
|
||||
file.createNewFile();
|
||||
olFile.write(new byte[0]);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (LocalizationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
olFile.save();
|
||||
}
|
||||
} catch (LocalizationOpFailedException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to save file to localization", e);
|
||||
return false;
|
||||
}
|
||||
long useTime = lFile.getFile().lastModified();
|
||||
long writeTime = olFile.getFile().lastModified();
|
||||
|
||||
if (writeTime < useTime) {
|
||||
try {
|
||||
// Update menu creation time file
|
||||
olFile.write(new byte[0]);
|
||||
olFile.save();
|
||||
} catch (LocalizationException e) {
|
||||
statusHandler.error("Error saving menu creation time file", e);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
statusHandler.info("Timestamp in " + fileName
|
||||
|
|
|
@ -25,7 +25,8 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Request handler for {@link MenuCreationRequest} objects. Uses
|
||||
* {@link MenuCreationRegistry} to find object that will create the menus
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -22,7 +22,8 @@ package com.raytheon.uf.edex.menus;
|
|||
import com.raytheon.uf.common.util.registry.GenericRegistry;
|
||||
|
||||
/**
|
||||
* The registry for t
|
||||
* The registry for {@link AbstractMenuUtil} objects to register they are able
|
||||
* to generate menus.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue