Merge "Omaha #3133 remove edex dependencies from common.monitor plugin" into omaha_14.4.1

Former-commit-id: 6eba192ac26a80f8ba1402f675a7ab9e9f4dd6a5
This commit is contained in:
Nate Jensen 2014-05-13 09:17:37 -05:00 committed by Gerrit Code Review
commit 01a09b72b8
11 changed files with 111 additions and 299 deletions

View file

@ -39,7 +39,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ISortColumn;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 3, 2009 #3039 lvenable Initial creation
* Dec 3, 2009 #3039 lvenable Initial creation
*
* </pre>
*

View file

@ -25,9 +25,7 @@ import java.util.Date;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -39,8 +37,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* April 29, 2009 2037 dhladky Initial creation
* 02/01/13 1569 D. Hladky removed XML where not needed
* 04/29/2009 2037 dhladky Initial creation
* 02/01/2013 1569 D. Hladky removed XML where not needed
* 05/12/2014 3133 njensen Remove unused field
* </pre>
*
* @author dhladky
@ -50,7 +49,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@DynamicSerialize
public abstract class ScanTableData<T extends ScanTableDataRow> implements
ISerializableObject, Serializable {
Serializable {
/**
*
@ -78,8 +77,6 @@ public abstract class ScanTableData<T extends ScanTableDataRow> implements
@DynamicSerializeElement
public List<String> featureIds = null;
public SCANConfig config = null;
public ScanTableData() {
tableData = new ConcurrentHashMap<String, T>();
featureIds = new ArrayList<String>();

View file

@ -2,8 +2,8 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Monitor Plug-in
Bundle-SymbolicName: com.raytheon.uf.common.monitor
Bundle-Version: 1.12.1174.qualifier
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
Bundle-Version: 1.14.0.qualifier
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
@ -25,7 +25,6 @@ Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.11.5",
org.eclipse.swt,
com.raytheon.uf.common.sounding;bundle-version="1.12.1112",
com.raytheon.uf.common.dataplugin.bufrua;bundle-version="1.12.1112",
com.raytheon.uf.edex.pointdata;bundle-version="1.12.1112",
com.raytheon.uf.common.pointdata;bundle-version="1.12.1112",
com.raytheon.uf.common.site;bundle-version="1.0.0",
javax.measure;bundle-version="1.0.0",
@ -33,9 +32,7 @@ Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.11.5",
com.raytheon.uf.common.serialization,
org.springframework;bundle-version="2.5.6",
com.raytheon.uf.common.status;bundle-version="1.12.1174",
com.raytheon.uf.edex.database,
com.raytheon.uf.common.util;bundle-version="1.12.1174"
Import-Package: com.raytheon.uf.common.datastorage,
com.raytheon.uf.common.time,
com.raytheon.uf.edex.database.plugin
com.raytheon.uf.common.time

View file

@ -1,229 +0,0 @@
package com.raytheon.uf.common.monitor.config;
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
import com.raytheon.uf.common.monitor.events.MonitorConfigListener;
import com.raytheon.uf.common.serialization.SerializationUtil;
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.purge.PurgeRule;
import com.raytheon.uf.edex.database.purge.PurgeRuleSet;
/**
* FFMPRetentionTimeManager
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 13, 2013 1742 dhladky fixed concurrent mod exception on update
*
* </pre>
*
*/
public class FFMPRetentionTimeManager implements ILocalizationFileObserver {
/** Path to FFMP Source config. */
private static final String CONFIG_FILE_NAME = "purge" + File.separatorChar
+ "ffmpPurgeRules.xml";
private LocalizationFile lf = null;
/**
* FFMP Source Configuration XML object.
*/
protected PurgeRuleSet configXml;
private CopyOnWriteArrayList<MonitorConfigListener> listeners = new CopyOnWriteArrayList<MonitorConfigListener>();
/** Singleton instance of this class */
private static FFMPRetentionTimeManager instance = new FFMPRetentionTimeManager();
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPRetentionTimeManager.class);
/* Private Constructor */
private FFMPRetentionTimeManager() {
configXml = new PurgeRuleSet();
readConfigXml();
}
/**
* Get an instance of this singleton.
*
* @return Instance of this class
*/
public static FFMPRetentionTimeManager getInstance() {
return instance;
}
public void addListener(MonitorConfigListener fl) {
listeners.add(fl);
}
public void removeListener(MonitorConfigListener fl) {
listeners.remove(fl);
}
/**
* Read the XML configuration data for the current XML file name.
*/
public void readConfigXml() {
try {
IPathManager pm = PathManagerFactory.getPathManager();
Map<LocalizationLevel, LocalizationFile> map = pm
.getTieredLocalizationFile(LocalizationType.COMMON_STATIC,
CONFIG_FILE_NAME);
if (map.containsKey(LocalizationLevel.SITE)) {
lf = map.get(LocalizationLevel.SITE);
} else if (map.containsKey(LocalizationLevel.BASE)) {
lf = map.get(LocalizationLevel.BASE);
}
lf.addFileUpdatedObserver(this);
File file = lf.getFile();
System.out.println("Reading -- " + file.getAbsolutePath());
PurgeRuleSet configXmltmp = null;
configXmltmp = SerializationUtil.jaxbUnmarshalFromXmlFile(
PurgeRuleSet.class, file.getAbsolutePath());
configXml = configXmltmp;
} catch (Exception e) {
statusHandler
.handle(Priority.WARN,
"No SITE level purge file found.",
e);
}
}
/**
* Save the XML configuration data to the current XML file name.
*/
private void saveConfigXml() {
// Save the xml object to disk
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.SITE);
LocalizationFile newXmlFile = pm.getLocalizationFile(lc,
CONFIG_FILE_NAME);
if (newXmlFile.getFile().getParentFile().exists() == false) {
// System.out.println("Creating new directory");
if (newXmlFile.getFile().getParentFile().mkdirs() == false) {
// System.out.println("Could not create new directory...");
}
}
try {
// System.out.println("Saving -- "
// + newXmlFile.getFile().getAbsolutePath());
SerializationUtil.jaxbMarshalToXmlFile(configXml, newXmlFile
.getFile().getAbsolutePath());
newXmlFile.save();
lf = newXmlFile;
} catch (Exception e) {
statusHandler.handle(Priority.WARN,
"Couldn't save config.", e);
}
}
@Override
public void fileUpdated(FileUpdatedMessage message) {
if (message.getFileName().equals(CONFIG_FILE_NAME)) {
try {
readConfigXml();
// inform listeners
for (MonitorConfigListener fl : listeners) {
fl.configChanged(new MonitorConfigEvent(this));
}
} catch (Exception e) {
statusHandler.handle(Priority.WARN,
"FFMPRetentionTimeManager: " + message.getFileName()
+ " couldn't be updated.", e);
}
}
}
/**
* Gets the time
*
* @return
*/
public long getRetentionTime() {
List<PurgeRule> rules = configXml.getDefaultRules();
if ((rules != null) && !rules.isEmpty()) {
return rules.get(0).getPeriodInMillis();
}
return 0l;
}
/**
* Sets the retention time
*
* @param time
*/
public void setRetentionTime(String time) {
List<PurgeRule> rules = configXml.getDefaultRules();
PurgeRule rule = null;
if ((rules == null) || rules.isEmpty()) {
rule = new PurgeRule();
configXml.setDefaultRule(rule);
} else {
rule = rules.get(0);
}
rule.setPeriod(time);
saveConfigXml();
}
}

View file

@ -38,14 +38,12 @@ import org.opengis.referencing.crs.ProjectedCRS;
import org.opengis.referencing.datum.PixelInCell;
import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType;
import com.raytheon.uf.common.dataplugin.bufrua.UAObs;
import com.raytheon.uf.common.dataplugin.bufrua.UAObsAdapter;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataplugin.radar.util.RadarConstants.DHRValues;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.geospatial.CRSCache;
import com.raytheon.uf.common.geospatial.ISpatialQuery;
import com.raytheon.uf.common.geospatial.MapUtil;
@ -56,8 +54,6 @@ 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;
import com.vividsolutions.jts.geom.GeometryFactory;
@ -78,7 +74,9 @@ import com.vividsolutions.jts.io.WKTWriter;
* 02/11/2009 1981 dhladky Initial Creation.
* 09/03/2013 DR 13083 gzhang Added getZRvalue2() to fix an error.
* 12/20/2013 DR 16894 gzhang Fixed getZRvalue2() bias issue.
* 05/12/2014 3133 njensen Extracted getLightningRecord
* </pre>
*
* @author dhladky
* @version 1.0
*/
@ -305,29 +303,6 @@ public class ScanUtils {
private static String prevTable = "";
/**
* Populate the Lightning record
*
* @param uri
* @return
*/
public static BinLightningRecord getLightningRecord(String uri)
throws PluginException {
BinLightningRecord lightRec = null;
try {
lightRec = new BinLightningRecord(uri);
PluginDao ld = (PluginDao) PluginFactory.getInstance()
.getPluginDao(lightRec.getPluginName());
lightRec = (BinLightningRecord) ld.getMetadata(uri);
IDataStore dataStore = ld.getDataStore(lightRec);
lightRec.retrieveFromDataStore(dataStore);
} catch (Exception e) {
e.printStackTrace();
}
return lightRec;
}
/**
* Populate the sounding record for the listener strategy
*
@ -1349,7 +1324,7 @@ public class ScanUtils {
// only need int precision
if (totalCGStrikes > 0) {
lr.setCgRate((int) ((double) totalCGStrikes / ((double) (stop_time - start_time) / (1000.0 * 60.0))));
lr.setCgRate((int) (totalCGStrikes / ((stop_time - start_time) / (1000.0 * 60.0))));
} else {
lr.setCgRate(0);
}
@ -1927,34 +1902,35 @@ public class ScanUtils {
return returns;
}
/**
* DR 13083: the first parameter zValue will use a radar bin's raw data
* since old version handles value 66 wrong in getDecodedDHRValue(int).
*
* Usage: to be called in FFMPProcessor.processRADAR(ArrayList<SourceBinEntry>):
1). comment out fval line;
2). call ScanUtils.getZRvalue2;
3). use dataVals[j] as the first parameter in the step 2 above.
* DR 13083: the first parameter zValue will use a radar bin's raw data
* since old version handles value 66 wrong in getDecodedDHRValue(int).
*
* Usage: to be called in
* FFMPProcessor.processRADAR(ArrayList<SourceBinEntry>):
*
* 1). comment out fval line; 2). call ScanUtils.getZRvalue2; 3). use
* dataVals[j] as the first parameter in the step 2 above.
*/
public static float getZRvalue2(double zValue, double coefficent,
double hailCap, double power, double bias) {
// The Fulton et al 1998 standard NWS Z-R relationship
double rValue = 0.0f;
if (zValue >= 2) {
zValue = MIN_DHR_DBZ + ((zValue - 2) * DHR_DBZ_STEP);
zValue = MIN_DHR_DBZ + ((zValue - 2) * DHR_DBZ_STEP);
double rlogMult = Math.log10(coefficent);
rValue = /*bias* */(Math.pow(10.0, ((zValue-10.0*rlogMult)/(10.0*power))));
rValue = /* bias* */(Math.pow(10.0,
((zValue - 10.0 * rlogMult) / (10.0 * power))));
// hail cap check
if (rValue > hailCap) {
rValue = /*return (float) */(/*MM_TO_INCH * */hailCap);
rValue = /* return (float) */(/* MM_TO_INCH * */hailCap);
}
} else {
rValue = /*return */(float) rValue;
rValue = /* return */(float) rValue;
}
return (float) (bias*MM_TO_INCH * rValue);
return (float) (bias * MM_TO_INCH * rValue);
}
}

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.edex.dat.utils.ScanDataCache;
import com.raytheon.uf.edex.plugin.cwat.CWATGenerator;
import com.raytheon.uf.edex.plugin.cwat.CWATURIFilter;
import com.raytheon.uf.edex.plugin.scan.common.ScanCommonUtils;
import com.raytheon.uf.edex.plugin.scan.lightning.LightningRetriever;
import com.raytheon.uf.edex.plugin.scan.process.U500Product;
import com.raytheon.uf.edex.plugin.scan.process.U700Product;
import com.raytheon.uf.edex.plugin.scan.process.V700Product;
@ -63,7 +64,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 06/02/2009 2037 dhladky Initial Creation.
* Apr 24, 2014 2060 njensen Updates for removal of grid dataURI column
* Apr 24, 2014 2060 njensen Updates for removal of grid dataURI column
* May 12, 2014 3133 njensen Use LightningRetriever instead of ScanUtils
*
* </pre>
*
@ -402,7 +404,7 @@ public class CWATConfig {
if (obs.length != 0) {
for (int i = 0; i < obs.length; i++) {
String lgtUri = (String) obs[i];
BinLightningRecord rec = ScanUtils
BinLightningRecord rec = LightningRetriever
.getLightningRecord(lgtUri);
lgtRecs.add(rec);
cache.getLigtningData().addLightningRecord(rec);

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Scan Plug-in
Bundle-SymbolicName: com.raytheon.uf.edex.plugin.scan
Bundle-Version: 1.12.1174.qualifier
Bundle-Version: 1.14.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization, com.raytheon.uf.viz.core
@ -21,6 +21,7 @@ Require-Bundle: com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1
com.raytheon.uf.common.localization;bundle-version="1.12.1174",
com.raytheon.uf.edex.dat.utils;bundle-version="1.12.1174"
Export-Package: com.raytheon.uf.edex.plugin.scan,
com.raytheon.uf.edex.plugin.scan.lightning,
com.raytheon.uf.edex.plugin.scan.process
Import-Package: com.raytheon.uf.edex.menus,
javax.measure.converter,

View file

@ -34,7 +34,6 @@ import com.raytheon.uf.common.dataplugin.scan.data.ScanTableData;
import com.raytheon.uf.common.monitor.config.SCANRunSiteConfigurationManager;
import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
import com.raytheon.uf.common.monitor.events.MonitorConfigListener;
import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.status.IUFStatusHandler;
@ -57,6 +56,7 @@ import com.raytheon.uf.edex.dat.utils.ScanDataCache;
* ------------ ---------- ----------- --------------------------
* Feb 25, 2013 1660 D. Hladky Fixed SCAN configuration bug.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* May 12, 2014 3133 njensen Remove unused field
*
* </pre>
*
@ -80,9 +80,6 @@ public class ScanGenerator extends CompositeProductGenerator implements
/** Set of icaos to filter for */
private Set<String> icaos = null;
/** SCAN table Configuration object **/
public SCANConfig scanConfig = null;
/** run configuration manager **/
public SCANRunSiteConfigurationManager srcm = null;

View file

@ -49,7 +49,6 @@ import com.raytheon.uf.common.dataplugin.scan.data.TVSTableData;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.scan.ScanUtils;
import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.monitor.scan.xml.ScanAlarmXML;
import com.raytheon.uf.common.monitor.xml.SCANModelParameterXML;
@ -92,6 +91,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jun 21, 2013 7613 zhao Modified setGridRecords() etc.
* Oct 15, 2013 2361 njensen Use JAXBManager for XML
* Apr 24, 2014 2060 njensen Updates for removal of grid dataURI column
* May 12, 2014 3133 njensen Remove unused field
*
*
* </pre>
@ -192,9 +192,6 @@ public class ScanURIFilter extends URIFilter {
init();
}
/** SCAN table Configuration object **/
public SCANConfig scanConfig = null;
public String getWmo() {
return wmo;
}

View file

@ -0,0 +1,73 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.plugin.scan.lightning;
import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.edex.database.plugin.PluginDao;
import com.raytheon.uf.edex.database.plugin.PluginFactory;
/**
* Utility for retrieving a lightning record. Originally extracted from
* ScanUtils.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 12, 2014 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class LightningRetriever {
private LightningRetriever() {
}
/**
* Populate the Lightning record
*
* @param uri
* @return
*/
public static BinLightningRecord getLightningRecord(String uri) {
BinLightningRecord lightRec = null;
try {
lightRec = new BinLightningRecord(uri);
PluginDao ld = PluginFactory.getInstance().getPluginDao(
lightRec.getPluginName());
lightRec = (BinLightningRecord) ld.getMetadata(uri);
IDataStore dataStore = ld.getDataStore(lightRec);
lightRec.retrieveFromDataStore(dataStore);
} catch (Exception e) {
e.printStackTrace();
}
return lightRec;
}
}

View file

@ -26,9 +26,9 @@ import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.scan.data.ScanTableDataRow;
import com.raytheon.uf.common.monitor.scan.ScanUtils;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.edex.plugin.scan.ScanURIFilter;
import com.raytheon.uf.edex.plugin.scan.lightning.LightningRetriever;
/**
*
@ -38,7 +38,8 @@ import com.raytheon.uf.edex.plugin.scan.ScanURIFilter;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 05/05/2009 2037 dhladky Initial Creation.
* 05/05/2009 2037 dhladky Initial Creation.
* 05/14/2014 3133 njensen Use LightingRetriever instead of ScanUtils
*
* </pre>
*
@ -83,7 +84,7 @@ public class LightningProduct extends ScanProduct {
BinLightningRecord lightRec = null;
try {
lightRec = ScanUtils.getLightningRecord(uri);
lightRec = LightningRetriever.getLightningRecord(uri);
} catch (Exception e) {
e.printStackTrace();
}