Issue #2361 Get common.monitor plugin away from using global JAXB context and ISerializableObject

Change-Id: Ic5e4926d97629e9f43990d1585da59eb7ef30650

Former-commit-id: ee134db130 [formerly 3f24b9e424] [formerly ee134db130 [formerly 3f24b9e424] [formerly 42fee320ab [formerly e574d96b347d79fe7aaa0f8dded8c93af1191fdd]]]
Former-commit-id: 42fee320ab
Former-commit-id: 82e0af6a9c [formerly 160d1fbb01]
Former-commit-id: 25bdea7759
This commit is contained in:
Nate Jensen 2013-10-03 13:04:09 -05:00
parent 96672be561
commit 3a28687ca2
67 changed files with 1328 additions and 1373 deletions

View file

@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@ -84,7 +83,8 @@ public class CombinationsFileUtil {
public static String SAVED_COMBO_DIR = FileUtil.join("gfe", "comboData");
private static final SingleTypeJAXBManager<ComboData> jaxb = initializeJAXB();
private static final SingleTypeJAXBManager<ComboData> jaxb = SingleTypeJAXBManager
.createWithoutException(ComboData.class);
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@ -124,23 +124,6 @@ public class CombinationsFileUtil {
}
}
/**
* Initializes the JAXB manager for reading/writing ComboData to/from XML.
*
* @return the JAXBManager
*/
private static SingleTypeJAXBManager<ComboData> initializeJAXB() {
SingleTypeJAXBManager<ComboData> retVal = null;
try {
retVal = new SingleTypeJAXBManager<ComboData>(ComboData.class);
} catch (JAXBException e) {
statusHandler
.error("Error initializing ComboData JAXBManager, combinations files will not work",
e);
}
return retVal;
}
/**
* Gets the saved combo files for the menus in text formatter
*

View file

@ -22,7 +22,6 @@ package com.raytheon.uf.common.dataplugin.gfe.reference;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@ -86,7 +85,8 @@ public class ReferenceData {
private static final GeometryFactory geometryFactory = new GeometryFactory();
private static final SingleTypeJAXBManager<ReferenceData> jaxb = initializeJAXB();
private static final SingleTypeJAXBManager<ReferenceData> jaxb = SingleTypeJAXBManager
.createWithoutException(ReferenceData.class);
public enum RefType {
NONE, QUERY, POLYGON, QUERY_POLYGON
@ -112,25 +112,6 @@ public class ReferenceData {
private CoordinateType coordType;
/**
* Initializes the JAXB manager for reading/writing ReferenceData to/from
* XML.
*
* @return the JAXBManager
*/
private static SingleTypeJAXBManager<ReferenceData> initializeJAXB() {
SingleTypeJAXBManager<ReferenceData> retVal = null;
try {
retVal = new SingleTypeJAXBManager<ReferenceData>(
ReferenceData.class);
} catch (JAXBException e) {
statusHandler
.error("Error initializing ReferenceData JAXBManager, edit areas will not work",
e);
}
return retVal;
}
/**
* Returns the JAXBManager that handles ReferenceData
*

View file

@ -25,7 +25,6 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@ -35,8 +34,6 @@ import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.common.serialization.adapters.CoordAdapter;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.MultiPoint;
@ -69,10 +66,8 @@ public class SampleData implements Cloneable {
private static final String LINE_STRING_COORDINATE_PATTERN = "\\s*(-?\\d+(?:\\.\\d+)?)\\s+(-?\\d+(?:\\.\\d+)?)\\s*";
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(SampleData.class);
private static final SingleTypeJAXBManager<SampleData> jaxb = initializeJAXB();
private static final SingleTypeJAXBManager<SampleData> jaxb = SingleTypeJAXBManager
.createWithoutException(SampleData.class);
private SampleId sampleId;
@ -80,23 +75,6 @@ public class SampleData implements Cloneable {
@DynamicSerializeElement
private List<Coordinate> points;
/**
* Initializes the JAXB manager for reading/writing SampleData to/from XML.
*
* @return the JAXBManager
*/
private static SingleTypeJAXBManager<SampleData> initializeJAXB() {
SingleTypeJAXBManager<SampleData> retVal = null;
try {
retVal = new SingleTypeJAXBManager<SampleData>(SampleData.class);
} catch (JAXBException e) {
statusHandler
.error("Error initializing SampleData JAXBManager, sample sets will not work",
e);
}
return retVal;
}
/**
* Returns the JAXBManager that handles SampleData
*

View file

@ -1 +0,0 @@
com.raytheon.uf.common.monitor.cpg.MonitorStateXML

View file

@ -23,12 +23,11 @@ import java.io.File;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.monitor.cpg.MonitorStateXML;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
/**
* Monitor State Configuration XML File Manager.
@ -39,6 +38,7 @@ import com.raytheon.uf.common.monitor.cpg.MonitorStateXML;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 05, 2009 dhladky Initial creation
* Oct 01, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
@ -47,23 +47,28 @@ import com.raytheon.uf.common.monitor.cpg.MonitorStateXML;
*/
public class MonitorStateConfigurationManager {
/** Path to Monitoring Area Configuration XML. */
private static final String CONFIG_FILE_NAME = "monitoring"
+ File.separatorChar + "MonitorPluginState.xml";
private static final SingleTypeJAXBManager<MonitorStateXML> jaxb = SingleTypeJAXBManager
.createWithoutException(MonitorStateXML.class);
/** Singleton instance of this class */
private static MonitorStateConfigurationManager instance = null;
/** Path to Monitoring Area Configuration XML. */
private static final String CONFIG_FILE_NAME = "monitoring" + File.separatorChar + "MonitorPluginState.xml";
/**
* Monitoring State Configuration XML object.
*/
private MonitorStateXML configXml;
/* Private Constructor */
private MonitorStateConfigurationManager() {
configXml = new MonitorStateXML();
readConfigXml();
}
/**
* Get an instance of this singleton.
*
@ -73,10 +78,10 @@ public class MonitorStateConfigurationManager {
if (instance == null) {
instance = new MonitorStateConfigurationManager();
}
return instance;
}
/**
* Save the XML configuration data to the current XML file name.
*/
@ -99,29 +104,28 @@ public class MonitorStateConfigurationManager {
try {
System.out.println("Saving -- "
+ newXmlFile.getFile().getAbsolutePath());
SerializationUtil.jaxbMarshalToXmlFile(configXml, newXmlFile
.getFile().getAbsolutePath());
jaxb.marshalToXmlFile(configXml, newXmlFile.getFile()
.getAbsolutePath());
newXmlFile.save();
} catch (Exception e) {
e.printStackTrace();
}
readConfigXml();
}
/**
* Read the XML configuration data for the current XML file name.
*/
public void readConfigXml() {
try {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.BASE);
LocalizationContext lc = pm.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.BASE);
File file = pm.getFile(lc, CONFIG_FILE_NAME);
System.out.println("Reading -- "
+ file.getAbsolutePath());
MonitorStateXML configXmltmp = (MonitorStateXML) SerializationUtil
.jaxbUnmarshalFromXmlFile(file.getAbsolutePath());
System.out.println("Reading -- " + file.getAbsolutePath());
MonitorStateXML configXmltmp = jaxb.unmarshalFromXmlFile(file
.getAbsolutePath());
configXml = configXmltmp;
} catch (Exception e) {
@ -129,69 +133,76 @@ public class MonitorStateConfigurationManager {
System.err.println("No configuration file found");
}
}
/**
* FFMP state
*
* @return
*/
public boolean getFFMPState() {
return configXml.isFfmp();
}
/**
* CWAT state
*
* @return
*/
public boolean getCWATState() {
return configXml.isCwat();
}
/**
* VIL state
*
* @return
*/
public boolean getVILState() {
return configXml.isVil();
}
/**
* QPF state
*
* @return
*/
public boolean getQPFState() {
return configXml.isQpf();
}
/**
* Fog state
*
* @return
*/
public boolean getFogState() {
return configXml.isFog();
}
/**
* Fog state
*
* @return
*/
public boolean getPrecipRateState() {
return configXml.isPrecipRate();
}
/**
* Fog state
*
* @return
*/
public boolean getScanState() {
return configXml.isScan();
}
/**
* Fog state
*
* @return
*/
public boolean getFSSState(){
public boolean getFSSState() {
return configXml.isFssobs();
}
}

View file

@ -1,42 +0,0 @@
com.raytheon.uf.common.monitor.scan.LightningReport
com.raytheon.uf.common.monitor.scan.LightningStrike
com.raytheon.uf.common.monitor.scan.ThreatReport
com.raytheon.uf.common.monitor.scan.VILReport
com.raytheon.uf.common.monitor.scan.ThreatLocation
com.raytheon.uf.common.monitor.xml.MonAreaConfigXML
com.raytheon.uf.common.monitor.xml.AreaIdXML
com.raytheon.uf.common.monitor.xml.StationIdXML
com.raytheon.uf.common.monitor.xml.FFMPTemplateXML
com.raytheon.uf.common.monitor.xml.FFMPSourceConfigXML
com.raytheon.uf.common.monitor.xml.SourceXML
com.raytheon.uf.common.monitor.xml.FFMPRunConfigXML
com.raytheon.uf.common.monitor.xml.VGBXML
com.raytheon.uf.common.monitor.xml.DomainXML
com.raytheon.uf.common.monitor.xml.FFMPRunXML
com.raytheon.uf.common.monitor.xml.ProductXML
com.raytheon.uf.common.monitor.xml.ProductRunXML
com.raytheon.uf.common.monitor.xml.FFFGDataXML
com.raytheon.uf.common.monitor.xml.FFFGSourceXML
com.raytheon.uf.common.monitor.xml.FFFGSourceItemXML
com.raytheon.uf.common.monitor.xml.FFTIDataXML
com.raytheon.uf.common.monitor.xml.FreezingLevelXML
com.raytheon.uf.common.monitor.xml.FreezingLevelEntry
com.raytheon.uf.common.monitor.scan.xml.SCANConfigCellXML
com.raytheon.uf.common.monitor.scan.xml.SCANConfigMesoXML
com.raytheon.uf.common.monitor.scan.xml.SCANConfigTvsXML
com.raytheon.uf.common.monitor.scan.xml.SCANConfigDmdXML
com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML
com.raytheon.uf.common.monitor.scan.xml.SCANMonitorConfigXML
com.raytheon.uf.common.monitor.scan.xml.SCANTrendSetsXML
com.raytheon.uf.common.monitor.scan.xml.SCANTrendSetXML
com.raytheon.uf.common.monitor.scan.xml.CWATLocationsXML
com.raytheon.uf.common.monitor.scan.xml.ScanAlarmXML
com.raytheon.uf.common.monitor.xml.SCANModelParameterXML
com.raytheon.uf.common.monitor.xml.SCANSiteRunConfigXML
com.raytheon.uf.common.monitor.xml.SCANSiteXML
com.raytheon.uf.common.monitor.xml.SourceIngestConfigXML
com.raytheon.uf.common.monitor.xml.SourceOverrideDataKeyXML
com.raytheon.uf.common.monitor.xml.SourceOverrideParamXML
com.raytheon.uf.common.monitor.xml.SourceOverrideXML

View file

@ -1,4 +1,5 @@
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.
@ -26,44 +27,61 @@ import org.opengis.referencing.crs.ProjectedCRS;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
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.scan.ScanUtils;
import com.raytheon.uf.common.monitor.scan.ThreatLocation;
import com.raytheon.uf.common.monitor.scan.xml.CWATLocationsXML;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.vividsolutions.jts.geom.Coordinate;
/**
* Manages the configurations for CWAT locations
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* --/--/---- Initial creation
* Oct 02, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
* @author lvenable
* @version 1.0
*/
public class CWATLocationConfigManager {
private static final SingleTypeJAXBManager<CWATLocationsXML> jaxb = SingleTypeJAXBManager
.createWithoutException(CWATLocationsXML.class);
/**
* FFMP Source Configuration XML object.
*/
protected CWATLocationsXML configXml;
/**
* Site coordinate
*/
public Coordinate siteCoor = null;
/**
* Site Name
*/
public String siteName = null;
/**
* Site CRS
*/
public ProjectedCRS crs = null;
/** Singleton instance of this class */
private static CWATLocationConfigManager instance = null;
/* Private Constructor */
private CWATLocationConfigManager() {
configXml = new CWATLocationsXML();
@ -81,15 +99,19 @@ public class CWATLocationConfigManager {
return instance;
}
/**
* Read the XML configuration data for the current XML file name with coordinate
* Read the XML configuration data for the current XML file name with
* coordinate
*/
public void readConfigXml(Coordinate siteCoor, String siteName, ProjectedCRS crs) {
public void readConfigXml(Coordinate siteCoor, String siteName,
ProjectedCRS crs) {
this.siteCoor = siteCoor;
this.siteName = siteName;
this.crs = crs;
readConfigXml();
}
/**
* Read the XML configuration data for the current XML file name.
*/
@ -98,18 +120,20 @@ public class CWATLocationConfigManager {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext lc = pm.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
File file = pm.getFile(lc, "cwat" + File.separatorChar + getSiteName() + "Locations.xml");
File file = pm.getFile(lc, "cwat" + File.separatorChar
+ getSiteName() + "Locations.xml");
System.out.println("Reading -- " + file.getAbsolutePath());
CWATLocationsXML configXmltmp = (CWATLocationsXML) SerializationUtil
.jaxbUnmarshalFromXmlFile(file.getAbsolutePath());
CWATLocationsXML configXmltmp = jaxb.unmarshalFromXmlFile(file
.getAbsolutePath());
configXml = configXmltmp;
} catch (Exception e) {
System.err.println("No CWAT locations file found");
// create a new one
ArrayList<ThreatLocation> locations = ScanUtils.getCWASites(getSiteCoor(), getCRS());
ArrayList<ThreatLocation> locations = ScanUtils.getCWASites(
getSiteCoor(), getCRS());
configXml = new CWATLocationsXML();
configXml.setThreats(locations);
// writes one to site
@ -125,28 +149,27 @@ public class CWATLocationConfigManager {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.SITE);
LocalizationFile newXmlFile = pm.getLocalizationFile(lc,
"cwat" + File.separatorChar + getSiteName() + "Locations.xml");
LocalizationFile newXmlFile = pm.getLocalizationFile(lc, "cwat"
+ File.separatorChar + getSiteName() + "Locations.xml");
if (newXmlFile.getFile().getParentFile().exists() == false) {
//System.out.println("Creating new directory");
// System.out.println("Creating new directory");
if (newXmlFile.getFile().getParentFile().mkdirs() == false) {
//System.out.println("Could not create new directory...");
// System.out.println("Could not create new directory...");
}
}
try {
System.out.println("Saving -- "
+ newXmlFile.getFile().getAbsolutePath());
SerializationUtil.jaxbMarshalToXmlFile(configXml, newXmlFile
.getFile().getAbsolutePath());
jaxb.marshalToXmlFile(configXml, newXmlFile.getFile()
.getAbsolutePath());
newXmlFile.save();
} catch (Exception e) {
e.printStackTrace();
}
}
public Coordinate getSiteCoor() {
return siteCoor;
@ -155,7 +178,7 @@ public class CWATLocationConfigManager {
public void setSiteCoor(Coordinate siteCoor) {
this.siteCoor = siteCoor;
}
public String getSiteName() {
return siteName;
}
@ -163,7 +186,7 @@ public class CWATLocationConfigManager {
public void setSiteCoor(String siteName) {
this.siteName = siteName;
}
public ProjectedCRS getCRS() {
return crs;
}
@ -174,6 +197,7 @@ public class CWATLocationConfigManager {
/**
* Get the list of threat locations
*
* @return
*/
public ArrayList<ThreatLocation> getLocations() {

View file

@ -30,7 +30,7 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.xml.FFFGDataXML;
import com.raytheon.uf.common.monitor.xml.FFFGSourceItemXML;
import com.raytheon.uf.common.monitor.xml.FFFGSourceXML;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
/**
*
@ -42,7 +42,8 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 10, 2010 #4517 lvenable Initial creation
* Mar 10, 2010 #4517 lvenable Initial creation
* Oct 02, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
@ -50,6 +51,10 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
* @version 1.0
*/
public class FFFGXmlMgr {
private static final SingleTypeJAXBManager<FFFGDataXML> jaxb = SingleTypeJAXBManager
.createWithoutException(FFFGDataXML.class);
/**
* Data XML.
*/
@ -151,8 +156,7 @@ public class FFFGXmlMgr {
.getAbsolutePath();
// System.out.println("*** reading XML path = " + path);
dataXML = (FFFGDataXML) SerializationUtil
.jaxbUnmarshalFromXmlFile(path);
dataXML = jaxb.unmarshalFromXmlFile(path);
setForcingConfigured();
} catch (Exception e) {
// e.printStackTrace();
@ -196,8 +200,7 @@ public class FFFGXmlMgr {
try {
System.out.println("--- Saving XML path = "
+ locFile.getFile().getAbsolutePath());
SerializationUtil.jaxbMarshalToXmlFile(dataXML, locFile.getFile()
.getAbsolutePath());
jaxb.marshalToXmlFile(dataXML, locFile.getFile().getAbsolutePath());
locFile.save();
} catch (Exception e) {
e.printStackTrace();

View file

@ -41,12 +41,11 @@ import com.raytheon.uf.common.monitor.xml.ProductRunXML;
import com.raytheon.uf.common.monitor.xml.SourceOverrideXML;
import com.raytheon.uf.common.monitor.xml.SourceXML;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
/**
* FFMPRunConfigurationManager
*
@ -58,6 +57,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* 2012-09-04 DR 14404 gzhang Fixing ConcurrentModificationException
* Apr 26, 2013 1954 bsteffen Minor code cleanup throughout FFMP.
* Aug 13, 2013 1742 dhladky Concurrent mod exception on update fixed
* Oct 02, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
@ -67,8 +67,13 @@ public class FFMPRunConfigurationManager implements ILocalizationFileObserver {
/** Path to FFMP Source config. */
private static final String CONFIG_FILE_NAME = "ffmp"
+ IPathManager.SEPARATOR
+ "FFMPRunConfig.xml";
+ IPathManager.SEPARATOR + "FFMPRunConfig.xml";
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPRunConfigurationManager.class);
private static final SingleTypeJAXBManager<FFMPRunConfigXML> jaxb = SingleTypeJAXBManager
.createWithoutException(FFMPRunConfigXML.class);
/**
* FFMP Run Configuration XML object.
@ -78,12 +83,9 @@ public class FFMPRunConfigurationManager implements ILocalizationFileObserver {
protected boolean isPopulated;
private LocalizationFile lf = null;
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPRunConfigurationManager.class);
private CopyOnWriteArrayList<MonitorConfigListener> listeners = new CopyOnWriteArrayList<MonitorConfigListener>();
/** Singleton instance of this class */
private static FFMPRunConfigurationManager instance = new FFMPRunConfigurationManager();
@ -146,7 +148,7 @@ public class FFMPRunConfigurationManager implements ILocalizationFileObserver {
FFMPRunConfigXML configXmltmp = null;
configXmltmp = SerializationUtil.jaxbUnmarshalFromXmlFile(FFMPRunConfigXML.class, file.getAbsolutePath());
configXmltmp = jaxb.unmarshalFromXmlFile(file.getAbsolutePath());
configXml = configXmltmp;
isPopulated = true;
@ -176,14 +178,14 @@ public class FFMPRunConfigurationManager implements ILocalizationFileObserver {
try {
// System.out.println("Saving -- "
// + newXmlFile.getFile().getAbsolutePath());
SerializationUtil.jaxbMarshalToXmlFile(configXml, newXmlFile
.getFile().getAbsolutePath());
jaxb.marshalToXmlFile(configXml, newXmlFile.getFile()
.getAbsolutePath());
newXmlFile.save();
lf = newXmlFile;
} catch (Exception e) {
statusHandler
.handle(Priority.ERROR, "Couldn't save config file.", e);
statusHandler.handle(Priority.ERROR, "Couldn't save config file.",
e);
}
}
@ -282,10 +284,8 @@ public class FFMPRunConfigurationManager implements ILocalizationFileObserver {
}
} catch (SerializationException e) {
statusHandler.handle(
Priority.WARN,
"FFMPRunConfigurationManager: "
+ message.getFileName()
statusHandler.handle(Priority.WARN,
"FFMPRunConfigurationManager: " + message.getFileName()
+ " couldn't be updated.", e);
}
}

View file

@ -38,7 +38,7 @@ import com.raytheon.uf.common.monitor.xml.FFMPSourceConfigXML;
import com.raytheon.uf.common.monitor.xml.ProductXML;
import com.raytheon.uf.common.monitor.xml.SourceXML;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -54,6 +54,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* 2012-09-04 DR 14404 gzhang Fixing ConcurrentModificationException
* Apr 26, 2013 1954 bsteffen Minor code cleanup throughout FFMP.
* Aug 18, 2013 1742 dhladky Concurrent mod exception on update fixed
* Oct 02, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
@ -66,6 +67,16 @@ public class FFMPSourceConfigurationManager implements
private static final String CONFIG_FILE_NAME = "ffmp"
+ IPathManager.SEPARATOR + "FFMPSourceConfig.xml";
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPSourceConfigurationManager.class);
// This needs to initialize before the instance since the constructor will
// makes use of JAXB. JVM spec 12.4.2 step 9 indicates this will
// initialize ahead of the instance since it is earlier in
// in the text source.
private static final SingleTypeJAXBManager<FFMPSourceConfigXML> jaxb = SingleTypeJAXBManager
.createWithoutException(FFMPSourceConfigXML.class);
/**
* FFMP Source Configuration XML object.
*/
@ -85,12 +96,9 @@ public class FFMPSourceConfigurationManager implements
private List<String> accumulators = null;
private LocalizationFile lf = null;
private List<MonitorConfigListener> listeners = new CopyOnWriteArrayList<MonitorConfigListener>();
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPSourceConfigurationManager.class);
/* Private Constructor */
private FFMPSourceConfigurationManager() {
configXml = new FFMPSourceConfigXML();
@ -127,8 +135,7 @@ public class FFMPSourceConfigurationManager implements
lf.addFileUpdatedObserver(this);
File file = lf.getFile();
FFMPSourceConfigXML configXmltmp = SerializationUtil
.jaxbUnmarshalFromXmlFile(FFMPSourceConfigXML.class, file);
FFMPSourceConfigXML configXmltmp = jaxb.unmarshalFromXmlFile(file);
configXml = configXmltmp;
@ -144,12 +151,10 @@ public class FFMPSourceConfigurationManager implements
FFMPSourceConfigXML configXmltmp = null;
try {
configXmltmp = SerializationUtil
.jaxbUnmarshalFromXmlFile(FFMPSourceConfigXML.class,
file);
configXmltmp = jaxb.unmarshalFromXmlFile(file);
} catch (SerializationException e1) {
statusHandler.handle(Priority.ERROR,
"Couldn't serialize file.", e1);
"Couldn't deserialize file.", e1);
}
configXml = configXmltmp;
@ -169,20 +174,19 @@ public class FFMPSourceConfigurationManager implements
LocalizationFile newXmlFile = pm.getLocalizationFile(lc,
CONFIG_FILE_NAME);
File file = newXmlFile.getFile();
if (file.getParentFile().exists() == false) {
file.getParentFile().mkdirs();
}
try {
SerializationUtil.jaxbMarshalToXmlFile(configXml,
file.getAbsolutePath());
jaxb.marshalToXmlFile(configXml, file.getAbsolutePath());
newXmlFile.save();
lf = newXmlFile;
lf.addFileUpdatedObserver(this);
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"Couldn't save config file.", e);
statusHandler.handle(Priority.ERROR, "Couldn't save config file.",
e);
}
}
@ -490,8 +494,10 @@ public class FFMPSourceConfigurationManager implements
fl.configChanged(new MonitorConfigEvent(this));
}
} catch (Exception e) {
statusHandler.handle(Priority.WARN,
"FFMPSourceConfigurationManager: " + message.getFileName()
statusHandler.handle(
Priority.WARN,
"FFMPSourceConfigurationManager: "
+ message.getFileName()
+ " couldn't be updated.", e);
}
}

View file

@ -35,7 +35,7 @@ import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
import com.raytheon.uf.common.monitor.events.MonitorConfigListener;
import com.raytheon.uf.common.monitor.xml.FFMPTemplateXML;
import com.raytheon.uf.common.monitor.xml.VGBXML;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -49,8 +49,9 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 12, 2009 lvenable Initial creation
* Oct 25, 2012 DR 15514 gzhang Adding getHucLevelsInArray()
* Oct 25, 2012 DR 15514 gzhang Adding getHucLevelsInArray()
* Aug 18, 2013 1742 dhladky Concurrent mod exception on update fixed
* Oct 02, 2013 2361 njensen Use JAXBManager for XML
* </pre>
*
* @author dhladky
@ -64,6 +65,9 @@ public class FFMPTemplateConfigurationManager implements
private static final String CONFIG_FILE_NAME = "ffmp" + File.separatorChar
+ "FFMPTemplateConfig.xml";
private static final SingleTypeJAXBManager<FFMPTemplateXML> jaxb = SingleTypeJAXBManager
.createWithoutException(FFMPTemplateXML.class);
/**
* FFMP Source Configuration XML object.
*/
@ -77,10 +81,10 @@ public class FFMPTemplateConfigurationManager implements
private LocalizationFile lf = null;
private CopyOnWriteArrayList<MonitorConfigListener> listeners = new CopyOnWriteArrayList<MonitorConfigListener>();
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPTemplateConfigurationManager.class);
/* Private Constructor */
private FFMPTemplateConfigurationManager() {
configXml = new FFMPTemplateXML();
@ -126,9 +130,8 @@ public class FFMPTemplateConfigurationManager implements
}
File file = lf.getFile();
FFMPTemplateXML configXmltmp = SerializationUtil
.jaxbUnmarshalFromXmlFile(FFMPTemplateXML.class,
file.getAbsolutePath());
FFMPTemplateXML configXmltmp = jaxb.unmarshalFromXmlFile(file
.getAbsolutePath());
configXml = configXmltmp;
}
@ -154,14 +157,14 @@ public class FFMPTemplateConfigurationManager implements
try {
// System.out.println("Saving -- "
// + newXmlFile.getFile().getAbsolutePath());
SerializationUtil.jaxbMarshalToXmlFile(configXml, newXmlFile
.getFile().getAbsolutePath());
jaxb.marshalToXmlFile(configXml, newXmlFile.getFile()
.getAbsolutePath());
newXmlFile.save();
lf = newXmlFile;
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"Couldn't save config file.", e);
statusHandler.handle(Priority.ERROR, "Couldn't save config file.",
e);
}
}
@ -277,39 +280,40 @@ public class FFMPTemplateConfigurationManager implements
/**
* DR 15514: based on getHucLevels()
*/
public String[] getHucLevelsInArray() {
Integer hucNum = 4;
Boolean isVirtual = true;
String[] result = null;
java.util.concurrent.locks.ReentrantLock lock = new java.util.concurrent.locks.ReentrantLock();
synchronized(configXml){
hucNum = getNumberOfHuc();
isVirtual = getVirtual();
}
lock.lock();
try{
java.util.List<String> list = new ArrayList<String>();
list.add("ALL");
list.add("COUNTY");
if(isVirtual){
list.add("VIRTUAL");
}
for (int i = hucNum - 1; i >= 0; i--){
list.add("HUC"+i);
}
result = list.toArray(new String[]{});
}finally{
if(result==null) result = new String[]{};// guaranteed not null
lock.unlock();
}
public String[] getHucLevelsInArray() {
Integer hucNum = 4;
Boolean isVirtual = true;
String[] result = null;
java.util.concurrent.locks.ReentrantLock lock = new java.util.concurrent.locks.ReentrantLock();
synchronized (configXml) {
hucNum = getNumberOfHuc();
isVirtual = getVirtual();
}
lock.lock();
try {
java.util.List<String> list = new ArrayList<String>();
list.add("ALL");
list.add("COUNTY");
if (isVirtual) {
list.add("VIRTUAL");
}
for (int i = hucNum - 1; i >= 0; i--) {
list.add("HUC" + i);
}
result = list.toArray(new String[] {});
} finally {
if (result == null)
result = new String[] {};// guaranteed not null
lock.unlock();
}
return result;
}

View file

@ -33,21 +33,46 @@ import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.xml.FFTIDataXML;
import com.raytheon.uf.common.monitor.xml.FFTISettingXML;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
/**
* Singleton data manager for FFTI.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* --/--/---- Initial creation
* Oct 02, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
* @author lvenable
* @version 1.0
*/
public class FFTIDataManager implements ILocalizationFileObserver {
/** Path to FFTI config. */
private static final String CONFIG_FILE_NAME = "ffmp" + File.separatorChar
+ "FFTIData.xml";
// This needs to initialize before the instance since the constructor will
// makes use of JAXB. JVM spec 12.4.2 step 9 indicates this will
// initialize ahead of the instance since it is earlier in
// in the text source.
private static final SingleTypeJAXBManager<FFTIDataXML> jaxb = SingleTypeJAXBManager
.createWithoutException(FFTIDataXML.class);
/** Singleton instance of this class */
private static FFTIDataManager instance = new FFTIDataManager();
/**
* FFTI Source Configuration XML object.
*/
protected FFTIDataXML configXml;
/** Singleton instance of this class */
private static FFTIDataManager instance = new FFTIDataManager();
private LocalizationFile lf = null;
/* Private Constructor */
@ -78,15 +103,13 @@ public class FFTIDataManager implements ILocalizationFileObserver {
File file = lf.getFile();
SerializationUtil.jaxbUnmarshalFromXmlFile(file.getAbsolutePath());
FFTIDataXML configXmltmp = (FFTIDataXML) SerializationUtil
.jaxbUnmarshalFromXmlFile(file.getAbsolutePath());
FFTIDataXML configXmltmp = jaxb.unmarshalFromXmlFile(file
.getAbsolutePath());
configXml = configXmltmp;
} catch (Exception e) {
System.err
.println("No SITE FFTI Source configuration file found.");
System.err.println("No SITE FFTI Source configuration file found.");
}
}
@ -112,8 +135,8 @@ public class FFTIDataManager implements ILocalizationFileObserver {
try {
// System.out.println("Saving -- "
// + newXmlFile.getFile().getAbsolutePath());
SerializationUtil.jaxbMarshalToXmlFile(configXml, newXmlFile
.getFile().getAbsolutePath());
jaxb.marshalToXmlFile(configXml, newXmlFile.getFile()
.getAbsolutePath());
newXmlFile.save();
lf = newXmlFile;
@ -130,7 +153,7 @@ public class FFTIDataManager implements ILocalizationFileObserver {
public void setCwaList(ArrayList<String> cwaList) {
this.configXml.getCwa().setCwaList(cwaList);
}
public void addCwa(String cwa) {
this.configXml.getCwa().addCwa(cwa);
}
@ -142,7 +165,7 @@ public class FFTIDataManager implements ILocalizationFileObserver {
public ArrayList<FFTISettingXML> getSettingList() {
return this.configXml.getSettingList();
}
public void addSetting(FFTISettingXML setting) {
this.configXml.addSetting(setting);
}
@ -158,7 +181,7 @@ public class FFTIDataManager implements ILocalizationFileObserver {
e.printStackTrace();
}
}
public void clear() {
configXml = new FFTIDataXML();
}

View file

@ -35,7 +35,7 @@ import com.raytheon.uf.common.monitor.xml.AreaIdXML;
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
import com.raytheon.uf.common.monitor.xml.MonAreaConfigXML;
import com.raytheon.uf.common.monitor.xml.StationIdXML;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -54,6 +54,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Apr 29, 2011 DR#8986 zhao Read in Counties instead of Forecast Zones
* Feb 21 2012 14413 zhao add code handling "adjacent areas"
* Nov 20 2012 1297 skorolev Cleaned code
* Oct 02 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
@ -80,6 +81,9 @@ public abstract class MonitorConfigurationManager {
*/
public static final String MARINE_ZONE_TABLE = "mapdata.marinezones";
private static final SingleTypeJAXBManager<MonAreaConfigXML> jaxb = SingleTypeJAXBManager
.createWithoutException(MonAreaConfigXML.class);
/**
* Monitoring Area Configuration XML object.
*/
@ -131,8 +135,8 @@ public abstract class MonitorConfigurationManager {
pm.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.SITE), filename)
.getAbsolutePath();
MonAreaConfigXML configXmltmp = (MonAreaConfigXML) SerializationUtil
.jaxbUnmarshalFromXmlFile(monitorAreaFilePath.toString());
MonAreaConfigXML configXmltmp = jaxb
.unmarshalFromXmlFile(monitorAreaFilePath.toString());
configXml = configXmltmp;
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
@ -147,8 +151,8 @@ public abstract class MonitorConfigurationManager {
pm.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.SITE), adjAreaFilename)
.getAbsolutePath();
MonAreaConfigXML configXmltmp = (MonAreaConfigXML) SerializationUtil
.jaxbUnmarshalFromXmlFile(adjacentAreaFilePath.toString());
MonAreaConfigXML configXmltmp = jaxb
.unmarshalFromXmlFile(adjacentAreaFilePath.toString());
adjAreaConfigXml = configXmltmp;
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
@ -249,8 +253,8 @@ public abstract class MonitorConfigurationManager {
newXmlFile.getFile().getParentFile().mkdirs();
}
try {
SerializationUtil.jaxbMarshalToXmlFile(configXml, newXmlFile
.getFile().getAbsolutePath());
jaxb.marshalToXmlFile(configXml, newXmlFile.getFile()
.getAbsolutePath());
newXmlFile.save();
} catch (Exception e) {
statusHandler.handle(Priority.ERROR, e.getMessage());
@ -273,8 +277,8 @@ public abstract class MonitorConfigurationManager {
newXmlFile.getFile().getParentFile().mkdirs();
}
try {
SerializationUtil.jaxbMarshalToXmlFile(adjAreaConfigXml, newXmlFile
.getFile().getAbsolutePath());
jaxb.marshalToXmlFile(adjAreaConfigXml, newXmlFile.getFile()
.getAbsolutePath());
newXmlFile.save();
} catch (Exception e) {
statusHandler.handle(Priority.ERROR, e.getMessage());

View file

@ -20,7 +20,7 @@ import com.raytheon.uf.common.monitor.xml.SCANModelParameterXML;
import com.raytheon.uf.common.monitor.xml.SCANSiteRunConfigXML;
import com.raytheon.uf.common.monitor.xml.SCANSiteXML;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -34,9 +34,10 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02/07/2009 2037 dhladky Initial Creation.
* 02/07/2009 2037 dhladky Initial Creation.
* 02/25/13 1660 dhladky Fixed configuration bug in scan.
* Aug 13, 2013 1742 dhladky Concurrent mod exception on update fixed
* Oct 02, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
@ -44,25 +45,31 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* @version 1.0
*/
public class SCANRunSiteConfigurationManager implements
ILocalizationFileObserver {
/** Path to FFMP Source config. */
private static final String CONFIG_FILE_NAME = "scan" + File.separatorChar
+ "SCANRunSiteConfig.xml";
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(SCANRunSiteConfigurationManager.class);
.getHandler(SCANRunSiteConfigurationManager.class);
// This needs to initialize before the instance since the constructor will
// makes use of JAXB. JVM spec 12.4.2 step 9 indicates this will
// initialize ahead of the instance since it is earlier in
// in the text source.
private static final SingleTypeJAXBManager<SCANSiteRunConfigXML> jaxb = SingleTypeJAXBManager
.createWithoutException(SCANSiteRunConfigXML.class);
/** Singleton instance of this class */
private static SCANRunSiteConfigurationManager instance = new SCANRunSiteConfigurationManager();
/**
* SCAN Configuration XML object.
*/
protected SCANSiteRunConfigXML configXml;
/** Singleton instance of this class */
private static SCANRunSiteConfigurationManager instance = new SCANRunSiteConfigurationManager();
private LocalizationFile lf = null;
private List<MonitorConfigListener> listeners = new CopyOnWriteArrayList<MonitorConfigListener>();
@ -76,7 +83,8 @@ public class SCANRunSiteConfigurationManager implements
try {
readConfigXml();
} catch (Exception e) {
statusHandler.handle(Priority.ERROR, "Can not read the SCAN configuration", e);
statusHandler.handle(Priority.ERROR,
"Can not read the SCAN configuration", e);
}
}
@ -103,19 +111,22 @@ public class SCANRunSiteConfigurationManager implements
File file = lf.getFile();
// System.out.println("Reading -- " + file.getAbsolutePath());
if (!file.exists()) {
statusHandler.handle(Priority.WARN, "SCANRunSiteConfigurationManager: "
statusHandler.handle(
Priority.WARN,
"SCANRunSiteConfigurationManager: "
+ file.getAbsolutePath() + " does not exist.");
try {
createValidConfig();
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,"SCANRunSiteConfigurationManager: Couldn't create valid runnable configuration");
statusHandler
.handle(Priority.ERROR,
"SCANRunSiteConfigurationManager: Couldn't create valid runnable configuration");
}
}
SCANSiteRunConfigXML configXmltmp = null;
configXmltmp = SerializationUtil
.jaxbUnmarshalFromXmlFile(SCANSiteRunConfigXML.class, file.getAbsolutePath());
configXmltmp = jaxb.unmarshalFromXmlFile(file.getAbsolutePath());
configXml = configXmltmp;
isPopulated = true;
@ -152,15 +163,16 @@ public class SCANRunSiteConfigurationManager implements
try {
// System.out.println("Saving -- "
// + newXmlFile.getFile().getAbsolutePath());
SerializationUtil.jaxbMarshalToXmlFile(configXml, newXmlFile
.getFile().getAbsolutePath());
jaxb.marshalToXmlFile(configXml, newXmlFile.getFile()
.getAbsolutePath());
newXmlFile.save();
setPopulated(true);
lf = newXmlFile;
} catch (Exception e) {
statusHandler.handle(Priority.WARN, "SCANRunSiteConfigurationManager: "
+ newXmlFile.getName() + " couldn't be saved.", e);
statusHandler.handle(Priority.WARN,
"SCANRunSiteConfigurationManager: " + newXmlFile.getName()
+ " couldn't be saved.", e);
}
}

View file

@ -31,7 +31,7 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.scan.ScanUtils;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.common.site.xml.AdjacentWfoXML;
import com.raytheon.uf.common.site.xml.CwaXML;
import com.raytheon.uf.common.status.IUFStatusHandler;
@ -50,6 +50,7 @@ import com.vividsolutions.jts.io.WKBReader;
* ------------ ---------- ----------- --------------------------
* Dec 22, 2009 mpduff Initial creation
* Jul 24, 2013 2219 mpduff Improve error handling.
* Oct 02, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
@ -58,9 +59,16 @@ import com.vividsolutions.jts.io.WKBReader;
*/
public class AdjacentWfoMgr {
private final IUFStatusHandler statusHandler = UFStatus
/** Path to Adjacent WFO XML. */
private static final String fileName = "allAdjacentWFOs.xml";
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(AdjacentWfoMgr.class);
private static final SingleTypeJAXBManager<AdjacentWfoXML> jaxb = SingleTypeJAXBManager
.createWithoutException(AdjacentWfoXML.class);
/** Configuration XML. */
private AdjacentWfoXML adjXML = null;
@ -70,9 +78,6 @@ public class AdjacentWfoMgr {
private ArrayList<String> idList = null;
/** Path to Adjacent WFO XML. */
private static final String fileName = "allAdjacentWFOs.xml";
/** Adjacent area geometry */
private Geometry geoAdjAreas = null;
@ -105,8 +110,7 @@ public class AdjacentWfoMgr {
statusHandler.debug("**** path = " + path);
adjXML = SerializationUtil.jaxbUnmarshalFromXmlFile(
AdjacentWfoXML.class, path);
adjXML = jaxb.unmarshalFromXmlFile(path);
ArrayList<CwaXML> list = adjXML.getAreaIds();
for (CwaXML cx : list) {

View file

@ -1,4 +1,5 @@
package com.raytheon.uf.common.monitor.scan;
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
@ -18,87 +19,100 @@ package com.raytheon.uf.common.monitor.scan;
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.vividsolutions.jts.geom.Coordinate;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
/**
* A report of lightning
*
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* --/--/---- Initial Creation
* Oct 02, 2013 2361 njensen Removed XML annotations
* </pre>
*
*
*/
@DynamicSerialize
public class LightningReport implements ISerializableObject {
@XmlElement
public class LightningReport {
@DynamicSerializeElement
private int totalPosStrikes = 0;
@XmlElement
private int totalPosStrikes = 0;
@DynamicSerializeElement
private int totalCGStrikes = 0;
@XmlElement
private int totalCGStrikes = 0;
@DynamicSerializeElement
private int cgRate = 0;
@XmlElement
private int cgRate = 0;
@DynamicSerializeElement
private double percentPos = 0.0;
@XmlElement
private double percentPos = 0.0;
@DynamicSerializeElement
private double lat = 0.0;
@XmlElement
private double lat = 0.0;
@DynamicSerializeElement
private double lon = 0.0;
public LightningReport() {
private double lon = 0.0;
public LightningReport() {
}
public LightningReport(Coordinate location) {
this.lat = location.y;
this.lon = location.x;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLat() {
return lat;
}
public void setLon(double lon) {
this.lon = lon;
}
public double getLon() {
return lon;
}
public int getTotalPosStrikes() {
return totalPosStrikes;
}
public void setTotalPosStrikes(int totalPosStrikes) {
this.totalPosStrikes = totalPosStrikes;
}
public int getTotalCGStrikes() {
return totalCGStrikes;
}
public void setTotalCGStrikes(int totalCGStrikes) {
this.totalCGStrikes = totalCGStrikes;
}
public int getCgRate() {
return cgRate;
}
public void setCgRate(int cgRate) {
this.cgRate = cgRate;
}
public double getPercentPos() {
return percentPos;
}
public void setPercentPos(double percentPos) {
this.percentPos = percentPos;
}
public LightningReport(Coordinate location) {
this.lat = location.y;
this.lon = location.x;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLat() {
return lat;
}
public void setLon(double lon) {
this.lon = lon;
}
public double getLon() {
return lon;
}
public int getTotalPosStrikes() {
return totalPosStrikes;
}
public void setTotalPosStrikes(int totalPosStrikes) {
this.totalPosStrikes = totalPosStrikes;
}
public int getTotalCGStrikes() {
return totalCGStrikes;
}
public void setTotalCGStrikes(int totalCGStrikes) {
this.totalCGStrikes = totalCGStrikes;
}
public int getCgRate() {
return cgRate;
}
public void setCgRate(int cgRate) {
this.cgRate = cgRate;
}
public double getPercentPos() {
return percentPos;
}
public void setPercentPos(double percentPos) {
this.percentPos = percentPos;
}
}

View file

@ -19,12 +19,6 @@
**/
package com.raytheon.uf.common.monitor.scan;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -36,7 +30,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 05/12/2009 2307 dhladky Initial Creation.
* 05/12/2009 2307 dhladky Initial Creation.
* 10/02/2013 2361 njensen Removed XML annotations
*
* </pre>
*
@ -44,138 +39,160 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class LightningStrike implements ISerializableObject {
@XmlElement
public class LightningStrike {
@DynamicSerializeElement
public Double lat = 0.0;
@XmlElement
public Double lat = 0.0;
@DynamicSerializeElement
public Double lon = 0.0;
@XmlElement
public Double lon = 0.0;
@DynamicSerializeElement
public int intensity = 0;
@XmlElement
public int intensity = 0;
@DynamicSerializeElement
public int strikeType = 0;
@XmlElement
public int strikeType = 0;
@DynamicSerializeElement
public int msgType = 0;
@XmlElement
public int msgType = 0;
@DynamicSerializeElement
public int strikeCount = 0;
/**
* Public lightning strike
* @param lat
* @param lon
* @param intensity
* @param strikeType
* @param msgType
* @param strikeCount
*/
public LightningStrike(Double lat, Double lon, int intensity, int strikeType, int msgType, int strikeCount) {
this.lat = lat;
this.lon = lon;
this.intensity = intensity;
this.strikeType = strikeType;
this.msgType = msgType;
this.strikeCount = strikeCount;
}
/**
* Serializable
*/
public LightningStrike() {
public int strikeCount = 0;
/**
* Public lightning strike
*
* @param lat
* @param lon
* @param intensity
* @param strikeType
* @param msgType
* @param strikeCount
*/
public LightningStrike(Double lat, Double lon, int intensity,
int strikeType, int msgType, int strikeCount) {
this.lat = lat;
this.lon = lon;
this.intensity = intensity;
this.strikeType = strikeType;
this.msgType = msgType;
this.strikeCount = strikeCount;
}
/**
* Gets the lat
* @return
*/
public Double getLat() {
return lat;
}
/**
* sets the lat
* @param lat
*/
public void setLat(Double lat) {
this.lat = lat;
}
/**
* Gets the lon
* @return
*/
public Double getLon() {
return lon;
}
/**
* set the lon
* @param lon
*/
public void setLon(Double lon) {
this.lon = lon;
}
/**
* gets the intensity (polarity) of the strike
* @return
*/
public int getIntensity() {
return intensity;
}
/**
* Set the intensity (polarity) of strike
* @param intensity
*/
public void setIntensity(int intensity) {
this.intensity = intensity;
}
/**
* Get the type of strike
* @return
*/
public int getStrikeType() {
return strikeType;
}
/**
* Set the type of the strike
* @param strikeType
*/
public void setStrikeType(int strikeType) {
this.strikeType = strikeType;
}
/**
* get the type of the message
* @return
*/
public int getMsgType() {
return msgType;
}
/**
* Set the type of the message
* @param msgType
*/
public void setMsgType(int msgType) {
this.msgType = msgType;
}
/**
* Get the total strike count
* @return
*/
public int getStrikeCount() {
return strikeCount;
}
/**
* Set the total strike count
* @param strikeCount
*/
public void setStrikeCount(int strikeCount) {
this.strikeCount = strikeCount;
}
/**
* Serializable
*/
public LightningStrike() {
}
/**
* Gets the lat
*
* @return
*/
public Double getLat() {
return lat;
}
/**
* sets the lat
*
* @param lat
*/
public void setLat(Double lat) {
this.lat = lat;
}
/**
* Gets the lon
*
* @return
*/
public Double getLon() {
return lon;
}
/**
* set the lon
*
* @param lon
*/
public void setLon(Double lon) {
this.lon = lon;
}
/**
* gets the intensity (polarity) of the strike
*
* @return
*/
public int getIntensity() {
return intensity;
}
/**
* Set the intensity (polarity) of strike
*
* @param intensity
*/
public void setIntensity(int intensity) {
this.intensity = intensity;
}
/**
* Get the type of strike
*
* @return
*/
public int getStrikeType() {
return strikeType;
}
/**
* Set the type of the strike
*
* @param strikeType
*/
public void setStrikeType(int strikeType) {
this.strikeType = strikeType;
}
/**
* get the type of the message
*
* @return
*/
public int getMsgType() {
return msgType;
}
/**
* Set the type of the message
*
* @param msgType
*/
public void setMsgType(int msgType) {
this.msgType = msgType;
}
/**
* Get the total strike count
*
* @return
*/
public int getStrikeCount() {
return strikeCount;
}
/**
* Set the total strike count
*
* @param strikeCount
*/
public void setStrikeCount(int strikeCount) {
this.strikeCount = strikeCount;
}
}

View file

@ -24,7 +24,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.vividsolutions.jts.geom.Coordinate;
@ -48,28 +47,31 @@ import com.vividsolutions.jts.geom.Coordinate;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class ThreatLocation implements ISerializableObject {
public class ThreatLocation {
@XmlElement
@DynamicSerializeElement
public String locationName = null;
@XmlElement
@DynamicSerializeElement
public String wfoName = null;
@XmlElement
@DynamicSerializeElement
public Double lat = null;
@XmlElement
@DynamicSerializeElement
public Double lon = null;
/**
* For thrift
*/
public ThreatLocation() {
}
/**
* For actual use
*/
@ -79,7 +81,7 @@ public class ThreatLocation implements ISerializableObject {
this.lat = coor.y;
this.lon = coor.x;
}
public String getLocationName() {
return locationName;
}
@ -87,23 +89,23 @@ public class ThreatLocation implements ISerializableObject {
public void setLocationName(String locationName) {
this.locationName = locationName;
}
public Double getLat() {
return lat;
}
public void setLat(Double lat) {
this.lat = lat;
}
public Double getLon() {
return lon;
}
public void setLon(Double lon) {
this.lon = lon;
}
public Coordinate getCoor() {
return new Coordinate(getLon(), getLat(), 0.0);
}

View file

@ -19,16 +19,9 @@
**/
package com.raytheon.uf.common.monitor.scan;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* CWA ThreatReport per SCAN grid box
*
@ -37,7 +30,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 01/06/2009 2037 dhladky Initial Creation.
* 01/06/2009 2037 dhladky Initial Creation.
* 10/02/2013 2361 njensen Removed XML annotations
*
* </pre>
*
@ -45,80 +39,77 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class ThreatReport implements ISerializableObject {
@XmlElement
public class ThreatReport {
@DynamicSerializeElement
private boolean threat = false;
@XmlElement
private boolean threat = false;
@DynamicSerializeElement
private int condition = -1;
@XmlElement
private int condition = -1;
@DynamicSerializeElement
private boolean cellWithinTenNm = false;
@XmlElement
private boolean cellWithinTenNm = false;
@DynamicSerializeElement
private boolean highRefWithinTenNm = false;
@XmlElement
private boolean highRefWithinTenNm = false;
@DynamicSerializeElement
private boolean coincidentVil = false;
@XmlElement
private boolean coincidentVil = false;
@DynamicSerializeElement
private boolean vilWithinTenNm = false;
@XmlElement
private boolean vilWithinTenNm = false;
@DynamicSerializeElement
private boolean strongVilCell = false;
@XmlElement
private boolean strongVilCell = false;
@DynamicSerializeElement
private boolean ltgActiveCell = false;
@XmlElement
private boolean ltgActiveCell = false;
@DynamicSerializeElement
private double ovhdVilPct = 0;
@XmlElement
private double ovhdVilPct = 0;
@DynamicSerializeElement
private int totalCvr = 0;
@XmlElement
private int totalCvr = 0;
@DynamicSerializeElement
private double lgtPct = 0;
@XmlElement
private double lgtPct = 0;
@DynamicSerializeElement
private double mdtPct = 0;
@XmlElement
private double mdtPct = 0;
@DynamicSerializeElement
private double hvyPct = 0;
@XmlElement
private double hvyPct = 0;
@DynamicSerializeElement
private double areaPct = 0;
@XmlElement
private double areaPct = 0;
@DynamicSerializeElement
private int cgCountThirtyNm = 0;
@XmlElement
private int cgCountThirtyNm = 0;
@DynamicSerializeElement
private int cgNearSite = 0;
@XmlElement
private int cgNearSite = 0;
@DynamicSerializeElement
private int cgRateTenNm = 0;
@XmlElement
private int cgRateTenNm = 0;
@DynamicSerializeElement
private String vilMessage = null;
@XmlElement
@DynamicSerializeElement
private String lgtMessage = null;
@XmlElement
@DynamicSerializeElement
private String tstormMessage = null;
@XmlElement
@DynamicSerializeElement
private String threatMessage = null;
/**
* public constructor
*/
public ThreatReport() {
}
public boolean isThreat() {
@ -288,12 +279,13 @@ public class ThreatReport implements ISerializableObject {
public void setThreatMessage(String threatMessage) {
this.threatMessage = threatMessage;
}
/**
* debugger only
*/
public String toString() {
return getThreatMessage()+ " "+getTstormMessage()+ " "+getLgtMessage();
return getThreatMessage() + " " + getTstormMessage() + " "
+ getLgtMessage();
}
}

View file

@ -20,12 +20,6 @@ package com.raytheon.uf.common.monitor.scan;
* further licensing information.
**/
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.vividsolutions.jts.geom.Coordinate;
@ -38,39 +32,33 @@ import com.vividsolutions.jts.geom.Coordinate;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 06/02/2009 2037 dhladky Initial Creation.
* 06/02/2009 2037 dhladky Initial Creation.
* 10/02/2013 2361 njensen Removed XML annotations
*
* </pre>
*
* @author dhladky
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class VILReport implements ISerializableObject {
@XmlElement
@DynamicSerialize
public class VILReport {
@DynamicSerializeElement
private int totalLgt = 0;
@XmlElement
@DynamicSerializeElement
private int totalMdt = 0;
@XmlElement
@DynamicSerializeElement
private int totalHvy = 0;
@XmlElement
@DynamicSerializeElement
private int ovhdLgt = 0;
@XmlElement
@DynamicSerializeElement
private int ovhdMdt = 0;
@XmlElement
@DynamicSerializeElement
private int ovhdHvy = 0;

View file

@ -25,6 +25,8 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.xml.bind.JAXBException;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
@ -34,7 +36,13 @@ import com.raytheon.uf.common.monitor.data.CommonTableConfig.SortDirection;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanThresholdColor;
import com.raytheon.uf.common.monitor.scan.xml.SCANAbstractXML;
import com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.monitor.scan.xml.SCANConfigCellXML;
import com.raytheon.uf.common.monitor.scan.xml.SCANConfigDmdXML;
import com.raytheon.uf.common.monitor.scan.xml.SCANConfigMesoXML;
import com.raytheon.uf.common.monitor.scan.xml.SCANConfigTvsXML;
import com.raytheon.uf.common.serialization.JAXBManager;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/**
* Abstract class used for common configuration data for the CELL, DMD, MESO,
@ -45,8 +53,9 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 21, 2009 3039 lvenable Initial creation
* Apr 25, 2013 1926 njensen Improved initialization speed
* Oct 21, 2009 3039 lvenable Initial creation
* Apr 25, 2013 1926 njensen Improved initialization speed
* Oct 02, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
@ -54,6 +63,12 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
* @version 1.0
*/
public abstract class AbsConfigMgr {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(AbsConfigMgr.class);
protected static final JAXBManager jaxb = initializeJAXB();
/**
* Map of attribute names and SCANAttributesXML.
*/
@ -70,6 +85,19 @@ public abstract class AbsConfigMgr {
// protected String defaultConfigXml = null;
protected String currentConfigFileName = null;
private static JAXBManager initializeJAXB() {
JAXBManager retVal = null;
try {
retVal = new JAXBManager(SCANConfigCellXML.class,
SCANConfigDmdXML.class, SCANConfigMesoXML.class,
SCANConfigTvsXML.class);
} catch (JAXBException e) {
statusHandler.error(
"Error initializing JAXBManager for SCAN configs", e);
}
return retVal;
}
/**
* Constructor.
*
@ -121,8 +149,8 @@ public abstract class AbsConfigMgr {
LocalizationType.CAVE_STATIC, LocalizationLevel.BASE),
getFullDefaultConfigName());
}
cfgXML = SerializationUtil.jaxbUnmarshalFromXmlFile(
SCANAbstractXML.class, lfile.getFile());
cfgXML = jaxb.unmarshalFromXmlFile(SCANAbstractXML.class,
lfile.getFile());
return cfgXML;
} catch (Exception e) {
e.printStackTrace();
@ -150,8 +178,8 @@ public abstract class AbsConfigMgr {
IPathManager pm = PathManagerFactory.getPathManager();
String path = pm.getStaticFile(newConfigFile).getAbsolutePath();
cfgXML = SerializationUtil.jaxbUnmarshalFromXmlFile(
SCANAbstractXML.class, path.toString());
cfgXML = jaxb.unmarshalFromXmlFile(SCANAbstractXML.class,
path.toString());
return cfgXML;
} catch (Exception e) {

View file

@ -25,11 +25,10 @@ import java.util.LinkedHashMap;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML;
import com.raytheon.uf.common.monitor.scan.xml.SCANConfigCellXML;
@ -38,63 +37,57 @@ import com.raytheon.uf.common.monitor.scan.xml.SCANConfigCellXML;
* Configuration manager for the CELL table.
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 2, 2009 #3039 lvenable Initial creation
*
* Dec 2, 2009 #3039 lvenable Initial creation
* Oct 2, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
*
* @author lvenable
* @version 1.0
*/
public class CellConfigMgr extends AbsConfigMgr
{
public class CellConfigMgr extends AbsConfigMgr {
/**
* CELL configuration manager XML.
*/
private SCANConfigCellXML cellCfgXML;
/**
* Default configuration file name.
*/
private final String defaultConfigFileName = "SCANconfig_cellTable.xml";
/**
* Constructor.
*/
public CellConfigMgr()
{
public CellConfigMgr() {
super();
}
}
/**
* Initialize method.
*/
@Override
protected void init()
{
protected void init() {
currentConfigFileName = defaultConfigFileName;
loadDefaultConfig();
if (cellCfgXML == null)
{
if (cellCfgXML == null) {
System.out.println("cellCfgXML is null");
}
else
{
} else {
System.out.println("--- " + cellCfgXML.getDefaultRank());
}
}
}
/**
* Get the attributes XML.
*/
@Override
public ArrayList<SCANAttributesXML> getAttributes()
{
public ArrayList<SCANAttributesXML> getAttributes() {
return cellCfgXML.getAttributesData();
}
@ -102,73 +95,65 @@ public class CellConfigMgr extends AbsConfigMgr
* Load the default configuration.
*/
@Override
public void loadDefaultConfig()
{
public void loadDefaultConfig() {
currentConfigFileName = defaultConfigFileName;
cellCfgXML = (SCANConfigCellXML)readDefaultConfig();
createAttributeMap(getAttributes());
cellCfgXML = (SCANConfigCellXML) readDefaultConfig();
createAttributeMap(getAttributes());
}
/**
* Load a new configuration.
*/
@Override
public void loadNewConfig(String newCfgName)
{
public void loadNewConfig(String newCfgName) {
currentConfigFileName = newCfgName;
cellCfgXML = (SCANConfigCellXML)readExistingConfig();
createAttributeMap(getAttributes());
cellCfgXML = (SCANConfigCellXML) readExistingConfig();
createAttributeMap(getAttributes());
}
/**
* Save the current configuration.
*/
@Override
public void saveConfig()
{
public void saveConfig() {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
String newFileName = getExistingConfigFilePath();
LocalizationFile locFile = pm.getLocalizationFile(context, newFileName);
if (locFile.getFile().getParentFile().exists() == false)
{
if (locFile.getFile().getParentFile().exists() == false) {
System.out.println("Creating new directory");
if (locFile.getFile().getParentFile().mkdirs() == false)
{
if (locFile.getFile().getParentFile().mkdirs() == false) {
System.out.println("Could not create new directory...");
}
}
try
{
System.out.println("Saving -- " + locFile.getFile().getAbsolutePath());
SerializationUtil.jaxbMarshalToXmlFile(cellCfgXML, locFile.getFile().getAbsolutePath());
try {
System.out.println("Saving -- "
+ locFile.getFile().getAbsolutePath());
jaxb.marshalToXmlFile(cellCfgXML, locFile.getFile()
.getAbsolutePath());
locFile.save();
}
catch (Exception e)
{
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* Check if the tips should be shown.
*/
@Override
public boolean showTips()
{
public boolean showTips() {
return cellCfgXML.getTipsOption();
}
}
/**
* Set the show tips flag.
*/
@Override
public void setShowTips(boolean showFlag)
{
public void setShowTips(boolean showFlag) {
cellCfgXML.setTipsOption(showFlag);
}
@ -176,15 +161,14 @@ public class CellConfigMgr extends AbsConfigMgr
* Get the path to the configuration files.
*/
@Override
public String getConfigPath()
{
public String getConfigPath() {
String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder();
sb.append("scan").append(fs);
sb.append("config").append(fs);
sb.append("cellTableConfig").append(fs);
sb.append("cellTableConfig").append(fs);
return sb.toString();
}
@ -192,8 +176,7 @@ public class CellConfigMgr extends AbsConfigMgr
* Get the full default configuration file name.
*/
@Override
public String getFullDefaultConfigName()
{
public String getFullDefaultConfigName() {
return getConfigPath() + defaultConfigFileName;
}
@ -201,75 +184,69 @@ public class CellConfigMgr extends AbsConfigMgr
* Get the default configuration name.
*/
@Override
public String getDefaultConfigName()
{
public String getDefaultConfigName() {
return defaultConfigFileName;
}
/**
* Get the clutter control attribute name.
*
* @return The clutter control attribute name.
*/
public String getClutterControl()
{
public String getClutterControl() {
return cellCfgXML.getClutterControl();
}
/**
* Get the radius interpolation.
*
* @return The radius interpolation.
*/
public String getRadVar()
{
public String getRadVar() {
return cellCfgXML.getRadVar();
}
/**
* Get a linked map of clutter control attribute and the associated units.
* @return A linked map of clutter control attribute and the associated units.
*
* @return A linked map of clutter control attribute and the associated
* units.
*/
public LinkedHashMap<String, String> getClutterAttributes()
{
public LinkedHashMap<String, String> getClutterAttributes() {
LinkedHashMap<String, String> attrUnitsMap = new LinkedHashMap<String, String>();
ArrayList<SCANAttributesXML> attrArray = getAttributes();
for (SCANAttributesXML attrXML : attrArray)
{
if (attrXML.getClutter() == true)
{
ArrayList<SCANAttributesXML> attrArray = getAttributes();
for (SCANAttributesXML attrXML : attrArray) {
if (attrXML.getClutter() == true) {
attrUnitsMap.put(attrXML.getAttrName(), attrXML.getUnits());
}
}
return attrUnitsMap;
}
/**
* Get the SCAN CELL configuration data.
*
* @return SCAN CELL configuration data.
*/
public SCANConfigCellXML getScanCellCfgXML()
{
public SCANConfigCellXML getScanCellCfgXML() {
return cellCfgXML;
}
public void setAlarmsDisabled(boolean flag)
{
public void setAlarmsDisabled(boolean flag) {
cellCfgXML.setAlarmsDisabled(flag);
}
public boolean getAlarmsDisabled()
{
public boolean getAlarmsDisabled() {
return cellCfgXML.getAlarmsDisabled();
}
public void setAlarmBell(boolean flag)
{
public void setAlarmBell(boolean flag) {
cellCfgXML.setAlarmBell(flag);
}
public boolean getAlarmBell()
{
public boolean getAlarmBell() {
return cellCfgXML.getAlarmBell();
}
}

View file

@ -25,11 +25,10 @@ import java.util.LinkedHashMap;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML;
import com.raytheon.uf.common.monitor.scan.xml.SCANConfigDmdXML;
@ -38,25 +37,25 @@ import com.raytheon.uf.common.monitor.scan.xml.SCANConfigDmdXML;
* Configuration manager for the DMD table.
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 2, 2009 #3039 lvenable Initial creation
*
* Dec 2, 2009 #3039 lvenable Initial creation
* Oct 2, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
*
* @author lvenable
* @version 1.0
*/
public class DmdConfigMgr extends AbsConfigMgr
{
public class DmdConfigMgr extends AbsConfigMgr {
/**
* DMD configuration manager XML.
*/
private SCANConfigDmdXML dmdCfgXML;
/**
* Default configuration file name.
*/
@ -65,26 +64,21 @@ public class DmdConfigMgr extends AbsConfigMgr
/**
* Constructor.
*/
public DmdConfigMgr()
{
public DmdConfigMgr() {
super();
}
}
/**
* Initialize method.
*/
@Override
protected void init()
{
protected void init() {
currentConfigFileName = defaultConfigFileName;
loadDefaultConfig();
if (dmdCfgXML == null)
{
if (dmdCfgXML == null) {
System.out.println("dmdCfgXML is null");
}
else
{
} else {
System.out.println("--- " + dmdCfgXML.getDefaultRank());
}
}
@ -93,8 +87,7 @@ public class DmdConfigMgr extends AbsConfigMgr
* Get the attributes XML.
*/
@Override
public ArrayList<SCANAttributesXML> getAttributes()
{
public ArrayList<SCANAttributesXML> getAttributes() {
return dmdCfgXML.getAttributesData();
}
@ -102,10 +95,9 @@ public class DmdConfigMgr extends AbsConfigMgr
* Load the default configuration.
*/
@Override
public void loadDefaultConfig()
{
public void loadDefaultConfig() {
currentConfigFileName = defaultConfigFileName;
dmdCfgXML = (SCANConfigDmdXML)readDefaultConfig();
dmdCfgXML = (SCANConfigDmdXML) readDefaultConfig();
createAttributeMap(getAttributes());
}
@ -113,78 +105,70 @@ public class DmdConfigMgr extends AbsConfigMgr
* Load a new configuration.
*/
@Override
public void loadNewConfig(String newCfgName)
{
public void loadNewConfig(String newCfgName) {
currentConfigFileName = newCfgName;
dmdCfgXML = (SCANConfigDmdXML)readExistingConfig();
createAttributeMap(getAttributes());
dmdCfgXML = (SCANConfigDmdXML) readExistingConfig();
createAttributeMap(getAttributes());
}
/**
* Save the current configuration.
*/
@Override
public void saveConfig()
{
public void saveConfig() {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
String newFileName = getExistingConfigFilePath();
LocalizationFile locFile = pm.getLocalizationFile(context, newFileName);
if (locFile.getFile().getParentFile().exists() == false)
{
if (locFile.getFile().getParentFile().exists() == false) {
System.out.println("Creating new directory");
if (locFile.getFile().getParentFile().mkdirs() == false)
{
if (locFile.getFile().getParentFile().mkdirs() == false) {
System.out.println("Could not create new directory...");
}
}
try
{
System.out.println("Saving -- " + locFile.getFile().getAbsolutePath());
SerializationUtil.jaxbMarshalToXmlFile(dmdCfgXML, locFile.getFile().getAbsolutePath());
try {
System.out.println("Saving -- "
+ locFile.getFile().getAbsolutePath());
jaxb.marshalToXmlFile(dmdCfgXML, locFile.getFile()
.getAbsolutePath());
locFile.save();
}
catch (Exception e)
{
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* Check if the tips should be shown.
*/
@Override
public boolean showTips()
{
public boolean showTips() {
return dmdCfgXML.getTipsOption();
}
/**
* Set the show tips flag.
*/
@Override
public void setShowTips(boolean showFlag)
{
public void setShowTips(boolean showFlag) {
dmdCfgXML.setTipsOption(showFlag);
}
/**
* Get the path to the configuration files.
*/
@Override
public String getConfigPath()
{
public String getConfigPath() {
String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder();
sb.append("scan").append(fs);
sb.append("config").append(fs);
sb.append("dmdTableConfig").append(fs);
sb.append("dmdTableConfig").append(fs);
return sb.toString();
}
@ -192,8 +176,7 @@ public class DmdConfigMgr extends AbsConfigMgr
* Get the full default configuration file name.
*/
@Override
public String getFullDefaultConfigName()
{
public String getFullDefaultConfigName() {
return getConfigPath() + "SCANconfig_dmdTable.xml";
}
@ -201,75 +184,69 @@ public class DmdConfigMgr extends AbsConfigMgr
* Get the default configuration name.
*/
@Override
public String getDefaultConfigName()
{
public String getDefaultConfigName() {
return defaultConfigFileName;
}
/**
* Get the clutter control attribute name.
*
* @return The clutter control attribute name.
*/
public String getClutterControl()
{
public String getClutterControl() {
return dmdCfgXML.getClutterControl();
}
/**
* Get the radius interpolation.
*
* @return The radius interpolation.
*/
public String getRadVar()
{
public String getRadVar() {
return dmdCfgXML.getRadVar();
}
/**
* Get a linked map of clutter control attribute and the associated units.
* @return A linked map of clutter control attribute and the associated units.
*
* @return A linked map of clutter control attribute and the associated
* units.
*/
public LinkedHashMap<String, String> getClutterAttributes()
{
public LinkedHashMap<String, String> getClutterAttributes() {
LinkedHashMap<String, String> attrUnitsMap = new LinkedHashMap<String, String>();
ArrayList<SCANAttributesXML> attrArray = getAttributes();
for (SCANAttributesXML attrXML : attrArray)
{
if (attrXML.getClutter() == true)
{
ArrayList<SCANAttributesXML> attrArray = getAttributes();
for (SCANAttributesXML attrXML : attrArray) {
if (attrXML.getClutter() == true) {
attrUnitsMap.put(attrXML.getAttrName(), attrXML.getUnits());
}
}
return attrUnitsMap;
}
/**
* Get the SCAN DMD configuration data.
*
* @return SCAN DMD configuration data.
*/
public SCANConfigDmdXML getScanDmdCfgXML()
{
public SCANConfigDmdXML getScanDmdCfgXML() {
return this.dmdCfgXML;
}
public void setAlarmsDisabled(boolean flag)
{
public void setAlarmsDisabled(boolean flag) {
dmdCfgXML.setAlarmsDisabled(flag);
}
public boolean getAlarmsDisabled()
{
public boolean getAlarmsDisabled() {
return dmdCfgXML.getAlarmsDisabled();
}
public void setAlarmBell(boolean flag)
{
public void setAlarmBell(boolean flag) {
dmdCfgXML.setAlarmBell(flag);
}
public boolean getAlarmBell()
{
public boolean getAlarmBell() {
return dmdCfgXML.getAlarmBell();
}
}

View file

@ -24,11 +24,10 @@ import java.util.ArrayList;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML;
import com.raytheon.uf.common.monitor.scan.xml.SCANConfigMesoXML;
@ -37,54 +36,51 @@ import com.raytheon.uf.common.monitor.scan.xml.SCANConfigMesoXML;
* Configuration manager for the MESO table.
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 3, 2009 #3039 lvenable Initial creation
*
* Dec 3, 2009 #3039 lvenable Initial creation
* Oct 2, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
*
* @author lvenable
* @version 1.0
*/
public class MesoConfigMgr extends AbsConfigMgr
{
public class MesoConfigMgr extends AbsConfigMgr {
/**
* MESO configuration manager XML.
*/
private SCANConfigMesoXML mesoCfgXML;
/**
* Default configuration file name.
*/
private final String defaultConfigFileName = "SCANconfig_mesoTable.xml";
/**
* Constructor.
*/
public MesoConfigMgr()
{
public MesoConfigMgr() {
super();
}
/**
* Initialize method.
*/
@Override
protected void init()
{
protected void init() {
currentConfigFileName = defaultConfigFileName;
loadDefaultConfig();
loadDefaultConfig();
}
/**
* Get the attributes XML.
*/
@Override
public ArrayList<SCANAttributesXML> getAttributes()
{
public ArrayList<SCANAttributesXML> getAttributes() {
return mesoCfgXML.getAttributesData();
}
@ -92,21 +88,19 @@ public class MesoConfigMgr extends AbsConfigMgr
* Load the default configuration.
*/
@Override
public void loadDefaultConfig()
{
public void loadDefaultConfig() {
currentConfigFileName = defaultConfigFileName;
mesoCfgXML = (SCANConfigMesoXML)readDefaultConfig();
createAttributeMap(getAttributes());
mesoCfgXML = (SCANConfigMesoXML) readDefaultConfig();
createAttributeMap(getAttributes());
}
/**
* Load a new configuration.
*/
@Override
public void loadNewConfig(String newCfgName)
{
public void loadNewConfig(String newCfgName) {
currentConfigFileName = newCfgName;
mesoCfgXML = (SCANConfigMesoXML)readExistingConfig();
mesoCfgXML = (SCANConfigMesoXML) readExistingConfig();
createAttributeMap(getAttributes());
}
@ -114,64 +108,56 @@ public class MesoConfigMgr extends AbsConfigMgr
* Save the current configuration.
*/
@Override
public void saveConfig()
{
public void saveConfig() {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
String newFileName = getExistingConfigFilePath();
LocalizationFile locFile = pm.getLocalizationFile(context, newFileName);
if (locFile.getFile().getParentFile().exists() == false)
{
if (locFile.getFile().getParentFile().mkdirs() == false)
{
if (locFile.getFile().getParentFile().exists() == false) {
if (locFile.getFile().getParentFile().mkdirs() == false) {
System.out.println("Could not create new directory...");
}
}
try
{
SerializationUtil.jaxbMarshalToXmlFile(mesoCfgXML, locFile.getFile().getAbsolutePath());
try {
jaxb.marshalToXmlFile(mesoCfgXML, locFile.getFile()
.getAbsolutePath());
locFile.save();
}
catch (Exception e)
{
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* Check if the tips should be shown.
*/
@Override
public boolean showTips()
{
public boolean showTips() {
return mesoCfgXML.getTipsOption();
}
/**
* Set the show tips flag.
*/
@Override
public void setShowTips(boolean showFlag)
{
public void setShowTips(boolean showFlag) {
mesoCfgXML.setTipsOption(showFlag);
}
/**
* Get the path to the configuration files.
*/
@Override
public String getConfigPath()
{
public String getConfigPath() {
String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder();
sb.append("scan").append(fs);
sb.append("config").append(fs);
sb.append("mesoTableConfig").append(fs);
sb.append("mesoTableConfig").append(fs);
return sb.toString();
}
@ -179,26 +165,24 @@ public class MesoConfigMgr extends AbsConfigMgr
* Get the full default configuration file name.
*/
@Override
public String getFullDefaultConfigName()
{
public String getFullDefaultConfigName() {
return getConfigPath() + defaultConfigFileName;
}
}
/**
* Get the default configuration name.
*/
@Override
public String getDefaultConfigName()
{
public String getDefaultConfigName() {
return defaultConfigFileName;
}
/**
* Get the SCAN MESO configuration data.
*
* @return SCAN MESO configuration data.
*/
public SCANConfigMesoXML getScanMesoCfgXML()
{
public SCANConfigMesoXML getScanMesoCfgXML() {
return mesoCfgXML;
}
}

View file

@ -23,55 +23,68 @@ import java.io.File;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.monitor.scan.xml.SCANMonitorConfigXML;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
/**
*
* Configuration manager for SCAN monitor
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* --/--/---- Initial creation
* Oct 02, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
* @author lvenable
* @version 1.0
*/
public class SCANMonitorConfig {
private static final SingleTypeJAXBManager<SCANMonitorConfigXML> jaxb = SingleTypeJAXBManager
.createWithoutException(SCANMonitorConfigXML.class);
public class SCANMonitorConfig
{
private SCANMonitorConfigXML scanMonitorCfg;
public SCANMonitorConfig()
{
public SCANMonitorConfig() {
readScanMonitorConfig();
}
public double getCellTilt()
{
public double getCellTilt() {
return scanMonitorCfg.getCellTilt();
}
public double getDmdTilt()
{
public double getDmdTilt() {
return scanMonitorCfg.getDmdTilt();
}
public String[] getPlugins()
{
public String[] getPlugins() {
return scanMonitorCfg.getPlugins().split(" ");
}
public int getInterval()
{
public int getInterval() {
return scanMonitorCfg.getInterval();
}
private void readScanMonitorConfig()
{
private void readScanMonitorConfig() {
scanMonitorCfg = null;
try
{
try {
String fs = String.valueOf(File.separatorChar);
IPathManager pm = PathManagerFactory.getPathManager();
String path = pm.getStaticFile("scan" + fs + "config" + fs
+ "SCANMonitorConfig.xml").getAbsolutePath();
scanMonitorCfg = (SCANMonitorConfigXML) SerializationUtil.jaxbUnmarshalFromXmlFile(path.toString());
}
catch (Exception e)
{
String path = pm.getStaticFile(
"scan" + fs + "config" + fs + "SCANMonitorConfig.xml")
.getAbsolutePath();
scanMonitorCfg = jaxb.unmarshalFromXmlFile(path.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

View file

@ -26,266 +26,263 @@ import java.util.Set;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.scan.xml.SCANTrendSetXML;
import com.raytheon.uf.common.monitor.scan.xml.SCANTrendSetsXML;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
/**
*
* Manages the Trend Sets configuration. This will handle either CELL or DMD trend sets.
* Manages the Trend Sets configuration. This will handle either CELL or DMD
* trend sets.
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 3, 2009 #3039 lvenable Initial creation
*
* Dec 3, 2009 #3039 lvenable Initial creation
* Oct 2, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
*
* @author lvenable
* @version 1.0
*/
public class TrendSetConfigMgr
{
public class TrendSetConfigMgr {
private static final SingleTypeJAXBManager<SCANTrendSetsXML> jaxb = SingleTypeJAXBManager
.createWithoutException(SCANTrendSetsXML.class);
/**
* Configuration XML.
*/
private String configXml = null;
/**
* Full XML file path.
*/
private String fullXMLFilePath = null;
/**
* Trend sets XML.
*/
private SCANTrendSetsXML trendSets;
/**
* Linked hash map of trend set names and the associated attributes.
*/
private LinkedHashMap<String, String> trendSetMap;
/**
* Constructor.
* @param defCfgXML Default configuration XML name.
*
* @param defCfgXML
* Default configuration XML name.
*/
public TrendSetConfigMgr(String defCfgXML)
{
public TrendSetConfigMgr(String defCfgXML) {
this.configXml = defCfgXML;
init();
}
/**
* Initialize method.
*/
private void init()
{
private void init() {
trendSetMap = new LinkedHashMap<String, String>();
readDefaultConfig();
updateTrendSetHashMap();
}
/**
* Read in the default configuration trend set XML.
*/
private void readDefaultConfig()
{
try
{
IPathManager pm = PathManagerFactory.getPathManager();
fullXMLFilePath = pm.getStaticFile(getFullConfigFileNameStr()).getAbsolutePath();
trendSets = (SCANTrendSetsXML) SerializationUtil.jaxbUnmarshalFromXmlFile(fullXMLFilePath);
}
catch (Exception e)
{
private void readDefaultConfig() {
try {
IPathManager pm = PathManagerFactory.getPathManager();
fullXMLFilePath = pm.getStaticFile(getFullConfigFileNameStr())
.getAbsolutePath();
trendSets = jaxb.unmarshalFromXmlFile(fullXMLFilePath);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
/**
* Update the trend sets hashmap by re-reading in the data.
*/
private void updateTrendSetHashMap()
{
private void updateTrendSetHashMap() {
trendSetMap.clear();
ArrayList<SCANTrendSetXML> trendSetArray = trendSets.getTrendSets();
for (int i = 0; i < trendSetArray.size(); i++)
{
trendSetMap.put(trendSetArray.get(i).getName(), trendSetArray.get(i).getAttributes());
}
}
for (int i = 0; i < trendSetArray.size(); i++) {
trendSetMap.put(trendSetArray.get(i).getName(), trendSetArray
.get(i).getAttributes());
}
}
/**
* Get the full path/file name of the configuration XML.
*
* @return Full file name and path.
*/
private String getFullConfigFileNameStr()
{
private String getFullConfigFileNameStr() {
String fs = String.valueOf(File.separatorChar);
String fileNameStr = "scan" + fs + "config" + fs + "trendSets" + fs + configXml;
String fileNameStr = "scan" + fs + "config" + fs + "trendSets" + fs
+ configXml;
return fileNameStr;
}
/**
* Get the trend sets map.
*
* @return The trend sets map.
*/
public final LinkedHashMap<String, String> getTrendSetMap()
{
public final LinkedHashMap<String, String> getTrendSetMap() {
return trendSetMap;
}
/**
* Get the trend sets configuration XML.
*
* @return The trend sets configuration XML.
*/
public SCANTrendSetsXML getTrendSets()
{
public SCANTrendSetsXML getTrendSets() {
return trendSets;
}
/**
* Save the trend sets.
*/
public void saveTrendSets()
{
ArrayList<SCANTrendSetXML> updateTrendSetArray = trendSets.getTrendSets();
public void saveTrendSets() {
ArrayList<SCANTrendSetXML> updateTrendSetArray = trendSets
.getTrendSets();
updateTrendSetArray.clear();
Set<String> keys = trendSetMap.keySet();
for (String key : keys)
{
for (String key : keys) {
SCANTrendSetXML newTrendSet = new SCANTrendSetXML();
newTrendSet.setName(key);
newTrendSet.setAttributes(trendSetMap.get(key));
updateTrendSetArray.add(newTrendSet);
}
trendSets.setTrendSets(updateTrendSetArray);
/*
* Generate the array to save from the hashmap.
*/
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
LocalizationFile locFile = pm.getLocalizationFile(context, getFullConfigFileNameStr());
if (locFile.getFile().exists() == false)
{
if (locFile.getFile().getParentFile().mkdirs() == false)
{
System.out.println("Did not not create directory(ies): " + locFile.getFile().getAbsolutePath());
LocalizationContext context = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
LocalizationFile locFile = pm.getLocalizationFile(context,
getFullConfigFileNameStr());
if (locFile.getFile().exists() == false) {
if (locFile.getFile().getParentFile().mkdirs() == false) {
System.out.println("Did not not create directory(ies): "
+ locFile.getFile().getAbsolutePath());
}
}
try
{
SerializationUtil.jaxbMarshalToXmlFile(trendSets, locFile.getFile().getAbsolutePath());
locFile.save();
}
catch (Exception e)
{
try {
jaxb.marshalToXmlFile(trendSets, locFile.getFile()
.getAbsolutePath());
locFile.save();
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* Remove a trend set.
* @param name Trend set name to remove.
*
* @param name
* Trend set name to remove.
*/
public void removeTrendSet(String name)
{
public void removeTrendSet(String name) {
trendSetMap.remove(name);
}
/**
* Add/Update a trend set.
*
* @param name
* @param attibute
*/
public void addUpdateTrendSet(String name, String attibute)
{
trendSetMap.put(name, attibute);
public void addUpdateTrendSet(String name, String attibute) {
trendSetMap.put(name, attibute);
}
/**
* Get a list of trend sets that do not have at least 2 attributes.
*
* @return Array on trend set names.
*/
public String[] getInvalidAttributeNumber()
{
public String[] getInvalidAttributeNumber() {
ArrayList<String> invalidTrends = new ArrayList<String>();
Set<String> keys = trendSetMap.keySet();
for (String key : keys)
{
for (String key : keys) {
String[] attrs = trendSetMap.get(key).split(",");
if (attrs.length < 2)
{
if (attrs.length < 2) {
invalidTrends.add(key);
}
}
}
return invalidTrends.toArray(new String[0]);
}
/**
* Get a string array of attributes for the specified trend set name.
* @param trendName Trend set name.
*
* @param trendName
* Trend set name.
* @return String array of attributes.
*/
public String[] getAttributes(String trendName)
{
if (trendSetMap.containsKey(trendName) == true)
{
public String[] getAttributes(String trendName) {
if (trendSetMap.containsKey(trendName) == true) {
String[] attrs = trendSetMap.get(trendName).split(",");
return attrs;
}
return new String[]{};
return new String[] {};
}
/**
* Get an array on trend set names.
*
* @return Array of trend set names.
*/
public String[] getTrendSetNames()
{
public String[] getTrendSetNames() {
ArrayList<String> trendNames = new ArrayList<String>();
Set<String> keys = trendSetMap.keySet();
for (String key : keys)
{
for (String key : keys) {
trendNames.add(key);
}
return trendNames.toArray(new String[0]);
}
/**
* Reload the configuration.
*/
public void reloadConfiguration()
{
public void reloadConfiguration() {
readDefaultConfig();
updateTrendSetHashMap();
}

View file

@ -24,11 +24,10 @@ import java.util.ArrayList;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML;
import com.raytheon.uf.common.monitor.scan.xml.SCANConfigTvsXML;
@ -37,54 +36,51 @@ import com.raytheon.uf.common.monitor.scan.xml.SCANConfigTvsXML;
* Configuration manager for the TVS table.
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 3, 2009 #3039 lvenable Initial creation
*
* Dec 3, 2009 #3039 lvenable Initial creation
* Oct 2, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
*
* @author lvenable
* @version 1.0
*/
public class TvsConfigMgr extends AbsConfigMgr
{
public class TvsConfigMgr extends AbsConfigMgr {
/**
* TVS configuration manager XML.
*/
private SCANConfigTvsXML tvsCfgXML;
/**
* Default configuration file name.
*/
private final String defaultConfigFileName = "SCANconfig_tvsTable.xml";
/**
* Constructor.
*/
public TvsConfigMgr()
{
public TvsConfigMgr() {
super();
}
/**
* Initialize method.
*/
@Override
protected void init()
{
protected void init() {
currentConfigFileName = defaultConfigFileName;
loadDefaultConfig();
loadDefaultConfig();
}
/**
* Get the attributes XML.
*/
@Override
public ArrayList<SCANAttributesXML> getAttributes()
{
public ArrayList<SCANAttributesXML> getAttributes() {
return tvsCfgXML.getAttributesData();
}
@ -92,21 +88,19 @@ public class TvsConfigMgr extends AbsConfigMgr
* Load the default configuration.
*/
@Override
public void loadDefaultConfig()
{
public void loadDefaultConfig() {
currentConfigFileName = defaultConfigFileName;
tvsCfgXML = (SCANConfigTvsXML)readDefaultConfig();
createAttributeMap(getAttributes());
tvsCfgXML = (SCANConfigTvsXML) readDefaultConfig();
createAttributeMap(getAttributes());
}
/**
* Load a new configuration.
*/
@Override
public void loadNewConfig(String newCfgName)
{
public void loadNewConfig(String newCfgName) {
currentConfigFileName = newCfgName;
tvsCfgXML = (SCANConfigTvsXML)readExistingConfig();
tvsCfgXML = (SCANConfigTvsXML) readExistingConfig();
createAttributeMap(getAttributes());
}
@ -114,68 +108,61 @@ public class TvsConfigMgr extends AbsConfigMgr
* Save the current configuration.
*/
@Override
public void saveConfig()
{
public void saveConfig() {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
String newFileName = getExistingConfigFilePath();
LocalizationFile locFile = pm.getLocalizationFile(context, newFileName);
if (locFile.getFile().getParentFile().exists() == false)
{
if (locFile.getFile().getParentFile().exists() == false) {
System.out.println("TVS - Creating new directory");
if (locFile.getFile().getParentFile().mkdirs() == false)
{
if (locFile.getFile().getParentFile().mkdirs() == false) {
System.out.println("TVS - Could not create new directory...");
}
}
try
{
System.out.println("Saving -- " + locFile.getFile().getAbsolutePath());
SerializationUtil.jaxbMarshalToXmlFile(tvsCfgXML, locFile.getFile().getAbsolutePath());
try {
System.out.println("Saving -- "
+ locFile.getFile().getAbsolutePath());
jaxb.marshalToXmlFile(tvsCfgXML, locFile.getFile()
.getAbsolutePath());
locFile.save();
}
catch (Exception e)
{
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Check if the tips should be shown.
*/
@Override
public boolean showTips()
{
public boolean showTips() {
return tvsCfgXML.getTipsOption();
}
/**
* Set the show tips flag.
*/
@Override
public void setShowTips(boolean showFlag)
{
public void setShowTips(boolean showFlag) {
tvsCfgXML.setTipsOption(showFlag);
}
/**
* Get the path to the configuration files.
*/
@Override
public String getConfigPath()
{
public String getConfigPath() {
String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder();
sb.append("scan").append(fs);
sb.append("config").append(fs);
sb.append("tvsTableConfig").append(fs);
sb.append("tvsTableConfig").append(fs);
return sb.toString();
}
@ -183,8 +170,7 @@ public class TvsConfigMgr extends AbsConfigMgr
* Get the full default configuration file name.
*/
@Override
public String getFullDefaultConfigName()
{
public String getFullDefaultConfigName() {
return getConfigPath() + defaultConfigFileName;
}
@ -192,17 +178,16 @@ public class TvsConfigMgr extends AbsConfigMgr
* Get the default configuration name.
*/
@Override
public String getDefaultConfigName()
{
public String getDefaultConfigName() {
return defaultConfigFileName;
}
/**
* Get the SCAN TVS configuration data.
*
* @return SCAN TVS configuration data.
*/
public SCANConfigTvsXML getScanTvsCfgXML()
{
public SCANConfigTvsXML getScanTvsCfgXML() {
return tvsCfgXML;
}
}

View file

@ -1,6 +1,5 @@
package com.raytheon.uf.common.monitor.scan.xml;
import java.util.ArrayList;
import javax.xml.bind.annotation.XmlAccessType;
@ -10,7 +9,7 @@ import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.monitor.scan.ThreatLocation;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* CWAT locations Configuration XML .
*
@ -29,14 +28,15 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlRootElement(name = "CWATLocationsXML")
@XmlAccessorType(XmlAccessType.NONE)
public class CWATLocationsXML implements ISerializableObject {
@XmlElements( { @XmlElement(name = "threats", type = ThreatLocation.class) })
public class CWATLocationsXML {
@XmlElements({ @XmlElement(name = "threats", type = ThreatLocation.class) })
private ArrayList<ThreatLocation> threats;
public ArrayList<ThreatLocation> getThreats() {
return threats;
}
public void setThreats(ArrayList<ThreatLocation> threats) {
this.threats = threats;
}

View file

@ -19,11 +19,7 @@
**/
package com.raytheon.uf.common.monitor.scan.xml;
//import com.raytheon.uf.common.serialization.ISerializableObject;
public abstract class SCANAbstractXML
{
public SCANAbstractXML()
{
public abstract class SCANAbstractXML {
public SCANAbstractXML() {
}
}

View file

@ -23,67 +23,63 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE)
public class SCANAttributesXML implements ISerializableObject
{
public class SCANAttributesXML {
@XmlElement(name = "AttrName")
private String attrName;
@XmlElement(name = "Low")
private double low;
@XmlElement(name = "Mid")
private double mid;
@XmlElement(name = "Upper")
private double upper;
@XmlElement(name = "Rank")
private String rank;
@XmlElement(name = "Trend")
private boolean trend;
@XmlElement(name = "TimeHeight")
private boolean timeHeight;
@XmlElement(name = "Colored")
private boolean colored;
@XmlElement(name = "Clutter")
private boolean clutter;
@XmlElement(name = "InTable")
private boolean inTable;
@XmlElement(name = "Min")
private double min;
@XmlElement(name = "Interval")
private double interval;
@XmlElement(name = "Range")
private double range;
@XmlElement(name = "Alarm")
private int alarm;
@XmlElement(name = "AbsAlarm")
private int absAlarm;
// @XmlElement(name = "AlarmDisabled")
// private boolean alarmDisabled;
// @XmlElement(name = "AlarmDisabled")
// private boolean alarmDisabled;
@XmlElement(name = "HasAlarm")
private boolean hasAlarm;
@XmlElement(name = "Units")
private String units;
public SCANAttributesXML()
{
public SCANAttributesXML() {
}
public String getAttrName() {
@ -206,13 +202,13 @@ public class SCANAttributesXML implements ISerializableObject
this.absAlarm = absAlarm;
}
// public boolean getAlarmDisabled() {
// return alarmDisabled;
// }
//
// public void setAlarmDisabled(boolean alarmDisabled) {
// this.alarmDisabled = alarmDisabled;
// }
// public boolean getAlarmDisabled() {
// return alarmDisabled;
// }
//
// public void setAlarmDisabled(boolean alarmDisabled) {
// this.alarmDisabled = alarmDisabled;
// }
public boolean getHasAlarm() {
return hasAlarm;

View file

@ -27,12 +27,10 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlRootElement(name = "ScanConfigCellTable")
@XmlAccessorType(XmlAccessType.NONE)
public class SCANConfigCellXML extends SCANAbstractXML implements
ISerializableObject {
public class SCANConfigCellXML extends SCANAbstractXML {
@XmlElement(name = "LinkToFrame")
private boolean linkToFrame;

View file

@ -27,53 +27,49 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlRootElement(name = "ScanConfigDMDTable")
@XmlAccessorType(XmlAccessType.NONE)
public class SCANConfigDmdXML extends SCANAbstractXML implements ISerializableObject
{
public class SCANConfigDmdXML extends SCANAbstractXML {
@XmlElement(name = "LinkToFrame")
private boolean linkToFrame;
@XmlElement(name = "VertOption")
private boolean vertOption;
@XmlElement(name = "TipsOption")
private boolean tipsOption;
@XmlElement(name = "FilterOption")
private boolean filterOption;
@XmlElement(name = "ZoomFactor")
private int zoomFactor;
@XmlElement(name = "OverlapOpt")
private boolean overlapOpt;
@XmlElement(name = "TrackOpt")
private boolean trackOpt;
@XmlElement(name = "ClutterControl")
private String clutterControl;
@XmlElement(name = "DefaultRank")
private String defaultRank;
@XmlElement(name = "RadVar")
private String radVar;
@XmlElement(name = "AlarmsDisabled")
private boolean alarmsDisabled;
@XmlElement(name = "AlarmBellOn")
private boolean alarmBellOn;
@XmlElements( { @XmlElement(name = "Attribute", type = SCANAttributesXML.class) })
@XmlElements({ @XmlElement(name = "Attribute", type = SCANAttributesXML.class) })
private ArrayList<SCANAttributesXML> attributesData;
public SCANConfigDmdXML()
{
public SCANConfigDmdXML() {
}
public boolean getLinkToFrame() {
@ -155,7 +151,7 @@ public class SCANConfigDmdXML extends SCANAbstractXML implements ISerializableOb
public void setRadVar(String radVar) {
this.radVar = radVar;
}
public boolean getAlarmsDisabled() {
return alarmsDisabled;
}
@ -163,7 +159,7 @@ public class SCANConfigDmdXML extends SCANAbstractXML implements ISerializableOb
public void setAlarmsDisabled(boolean alarmsDisabled) {
this.alarmsDisabled = alarmsDisabled;
}
public boolean getAlarmBell() {
return alarmBellOn;
}

View file

@ -27,35 +27,31 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlRootElement(name = "ScanConfigMesoTable")
@XmlAccessorType(XmlAccessType.NONE)
public class SCANConfigMesoXML extends SCANAbstractXML implements ISerializableObject
{
public class SCANConfigMesoXML extends SCANAbstractXML {
@XmlElement(name = "LinkToFrame")
private boolean linkToFrame;
@XmlElement(name = "VertOption")
private boolean vertOption;
@XmlElement(name = "TipsOption")
private boolean tipsOption;
@XmlElement(name = "FilterOption")
private boolean filterOption;
@XmlElement(name = "ZoomFactor")
private int zoomFactor;
@XmlElement(name = "DefaultRank")
private String defaultRank;
@XmlElements( { @XmlElement(name = "Attribute", type = SCANAttributesXML.class) })
@XmlElements({ @XmlElement(name = "Attribute", type = SCANAttributesXML.class) })
private ArrayList<SCANAttributesXML> attributesData;
public SCANConfigMesoXML()
{
public SCANConfigMesoXML() {
}
public boolean getLinkToFrame() {

View file

@ -27,35 +27,31 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlRootElement(name = "ScanConfigTvsTable")
@XmlAccessorType(XmlAccessType.NONE)
public class SCANConfigTvsXML extends SCANAbstractXML implements ISerializableObject
{
public class SCANConfigTvsXML extends SCANAbstractXML {
@XmlElement(name = "LinkToFrame")
private boolean linkToFrame;
@XmlElement(name = "VertOption")
private boolean vertOption;
@XmlElement(name = "TipsOption")
private boolean tipsOption;
@XmlElement(name = "FilterOption")
private boolean filterOption;
@XmlElement(name = "ZoomFactor")
private int zoomFactor;
@XmlElement(name = "DefaultRank")
private String defaultRank;
@XmlElements( { @XmlElement(name = "Attribute", type = SCANAttributesXML.class) })
@XmlElements({ @XmlElement(name = "Attribute", type = SCANAttributesXML.class) })
private ArrayList<SCANAttributesXML> attributesData;
public SCANConfigTvsXML()
{
public SCANConfigTvsXML() {
}
public boolean getLinkToFrame() {

View file

@ -24,26 +24,22 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlRootElement(name = "ScanMonitorConfig")
@XmlAccessorType(XmlAccessType.NONE)
public class SCANMonitorConfigXML implements ISerializableObject
{
public class SCANMonitorConfigXML {
@XmlElement(name = "CellTilt")
private double cellTilt;
@XmlElement(name = "DmdTilt")
private double dmdTilt;
@XmlElement(name = "Interval")
private int interval;
@XmlElement(name = "Plugins")
private String plugins;
public SCANMonitorConfigXML()
{
public SCANMonitorConfigXML() {
}
public double getCellTilt() {
@ -68,13 +64,13 @@ public class SCANMonitorConfigXML implements ISerializableObject
public void setInterval(int interval) {
this.interval = interval;
}
}
public String getPlugins() {
return plugins;
}
public void setPlugins(String plugins) {
this.plugins = plugins;
}
}
}

View file

@ -23,20 +23,16 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE)
public class SCANTrendSetXML implements ISerializableObject
{
public class SCANTrendSetXML {
@XmlElement(name = "Name")
private String name;
@XmlElement(name = "Attributes")
private String attributes;
public SCANTrendSetXML()
{
public SCANTrendSetXML() {
}
public String getName() {

View file

@ -27,26 +27,21 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlRootElement(name = "TrendSets")
@XmlAccessorType(XmlAccessType.NONE)
public class SCANTrendSetsXML implements ISerializableObject
{
@XmlElements( { @XmlElement(name = "TrendSet", type = SCANTrendSetXML.class) })
public class SCANTrendSetsXML {
@XmlElements({ @XmlElement(name = "TrendSet", type = SCANTrendSetXML.class) })
private ArrayList<SCANTrendSetXML> trendSets;
public SCANTrendSetsXML()
{
public SCANTrendSetsXML() {
}
public ArrayList<SCANTrendSetXML> getTrendSets()
{
public ArrayList<SCANTrendSetXML> getTrendSets() {
return trendSets;
}
public void setTrendSets(ArrayList<SCANTrendSetXML> trendSets)
{
public void setTrendSets(ArrayList<SCANTrendSetXML> trendSets) {
this.trendSets = trendSets;
}
}

View file

@ -24,41 +24,37 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* Scan Alarm XML class.
*
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 21, 2010 lvenable Initial creation
*
*
* Date Ticket# Engineer Description ------------ ---------- -----------
* -------------------------- Nov 21, 2010 lvenable Initial creation
*
* </pre>
*
*
* @author lvenable
* @version 1.0
* @version 1.0
*/
@XmlRootElement(name = "ScanAlarms")
@XmlAccessorType(XmlAccessType.NONE)
public class ScanAlarmXML implements ISerializableObject
{
public class ScanAlarmXML {
@XmlElement(name = "CELL")
private int cellAlarmTime;
@XmlElement(name = "DMD")
private int dmdAlarmTime;
@XmlElement(name = "MESO")
private int mesoAlarmTime;
@XmlElement(name = "TVS")
private int tvsAlarmTime;
public ScanAlarmXML()
{
public ScanAlarmXML() {
}
public int getCellAlarmTime() {
@ -91,5 +87,5 @@ public class ScanAlarmXML implements ISerializableObject
public void setTvsAlarmTime(int tvsArlarmTime) {
this.tvsAlarmTime = tvsArlarmTime;
}
}
}

View file

@ -27,8 +27,6 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* Monitoring area configuration xml.
*
@ -45,23 +43,23 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class AreaIdXML implements ISerializableObject {
@XmlElements( { @XmlElement(name = "StationID", type = StationIdXML.class) })
public class AreaIdXML {
@XmlElements({ @XmlElement(name = "StationID", type = StationIdXML.class) })
private ArrayList<StationIdXML> stationIds = new ArrayList<StationIdXML>();
@XmlAttribute(name = "id")
private String areaId;
@XmlAttribute(name = "type")
private ZoneType type;
@XmlAttribute(name = "cLat", required = false)
private Double cLat;
@XmlAttribute(name = "cLon", required = false)
private Double cLon;
public enum ZoneType {
MARITIME, REGULAR;
};
@ -85,7 +83,8 @@ public class AreaIdXML implements ISerializableObject {
}
/**
* @param areaId the areaId to set
* @param areaId
* the areaId to set
*/
public void setAreaId(String areaId) {
this.areaId = areaId;
@ -103,7 +102,8 @@ public class AreaIdXML implements ISerializableObject {
}
/**
* @param type the type to set
* @param type
* the type to set
*/
public void setType(ZoneType type) {
this.type = type;
@ -117,7 +117,8 @@ public class AreaIdXML implements ISerializableObject {
}
/**
* @param lat the cLat to set
* @param lat
* the cLat to set
*/
public void setCLat(Double lat) {
cLat = lat;
@ -131,7 +132,8 @@ public class AreaIdXML implements ISerializableObject {
}
/**
* @param lon the cLon to set
* @param lon
* the cLon to set
*/
public void setCLon(Double lon) {
cLon = lon;

View file

@ -29,7 +29,6 @@ import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.monitor.config.ValueNameIdData;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
*
@ -51,7 +50,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
*/
@XmlRootElement(name = "FFFGData")
@XmlAccessorType(XmlAccessType.NONE)
public class FFFGDataXML implements ISerializableObject {
public class FFFGDataXML {
@XmlElement(name = "ExpDateTimeInMillis")
private Long expTimeInMillis;

View file

@ -23,44 +23,41 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
*
* This class holds the Source Item XML data.
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 10, 2010 #4517 lvenable Initial creation
*
*
* </pre>
*
*
* @author lvenable
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class FFFGSourceItemXML implements ISerializableObject
{
public class FFFGSourceItemXML {
@XmlAttribute(name = "type")
private String type;
@XmlAttribute(name = "name")
private String name;
@XmlAttribute(name = "id")
private Long id;
@XmlAttribute(name = "value")
private String value;
public FFFGSourceItemXML()
{
public FFFGSourceItemXML() {
}
public String getType() {
return type;
}

View file

@ -29,7 +29,6 @@ import javax.xml.bind.annotation.XmlElements;
import com.raytheon.uf.common.monitor.config.FFFGConfig.GuidSectType;
import com.raytheon.uf.common.monitor.config.ValueNameIdData;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
*
@ -50,7 +49,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class FFFGSourceXML implements ISerializableObject {
public class FFFGSourceXML {
@XmlElement(name = "SourceName")
private String sourceName;

View file

@ -27,8 +27,6 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* VGB's
*
@ -46,9 +44,9 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
*/
@XmlRootElement(name = "FFMPRunConfig")
@XmlAccessorType(XmlAccessType.NONE)
public class FFMPRunConfigXML implements ISerializableObject {
@XmlElements( { @XmlElement(name = "runner", type = FFMPRunXML.class) })
public class FFMPRunConfigXML {
@XmlElements({ @XmlElement(name = "runner", type = FFMPRunXML.class) })
private ArrayList<FFMPRunXML> runner;
public ArrayList<FFMPRunXML> getFFMPRun() {
@ -58,7 +56,7 @@ public class FFMPRunConfigXML implements ISerializableObject {
public void setFFMPRun(ArrayList<FFMPRunXML> runner) {
this.runner = runner;
}
public void add(FFMPRunXML run) {
if (runner == null) {
runner = new ArrayList<FFMPRunXML>();

View file

@ -26,8 +26,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* VGB's
*
@ -44,7 +42,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class FFMPRunXML implements ISerializableObject {
public class FFMPRunXML {
@XmlElements({ @XmlElement(name = "sourceIngestConfig", type = SourceIngestConfigXML.class) })
private ArrayList<SourceIngestConfigXML> sourceIngests;
@ -57,7 +55,7 @@ public class FFMPRunXML implements ISerializableObject {
@XmlElements({ @XmlElement(name = "domain", type = DomainXML.class) })
private ArrayList<DomainXML> domains;
@XmlElement(name = "cacheDir")
private String cacheDir;
@ -214,12 +212,12 @@ public class FFMPRunXML implements ISerializableObject {
}
}
public void setCacheDir(String cacheDir) {
this.cacheDir = cacheDir;
}
public void setCacheDir(String cacheDir) {
this.cacheDir = cacheDir;
}
public String getCacheDir() {
return cacheDir;
}
public String getCacheDir() {
return cacheDir;
}
}

View file

@ -28,6 +28,7 @@ package com.raytheon.uf.common.monitor.xml;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 01, 2010 dhladky Initial creation
* Oct 02, 2013 2361 njensen Use JAXBManager for XML
*
* </pre>
*
@ -43,11 +44,9 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlRootElement(name = "FFMPSourceConfig")
@XmlAccessorType(XmlAccessType.NONE)
public class FFMPSourceConfigXML implements ISerializableObject {
public class FFMPSourceConfigXML {
@XmlElements({ @XmlElement(name = "source", type = SourceXML.class) })
private ArrayList<SourceXML> source;

View file

@ -25,11 +25,26 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* The FFMP Template configuration
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* --/--/---- Initial creation
*
*
* </pre>
*
* @author dhladky
* @version 1.0
*/
@XmlRootElement(name = "FFMPTemplate")
@XmlAccessorType(XmlAccessType.NONE)
public class FFMPTemplateXML implements ISerializableObject {
public class FFMPTemplateXML {
@XmlAttribute(name = "hucDepth")
private Integer hucDepth;

View file

@ -4,10 +4,8 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE)
public class FFTIAttributeXML implements ISerializableObject {
public class FFTIAttributeXML {
@XmlElement(name = "Name")
protected String attribName;

View file

@ -7,11 +7,10 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE)
public class FFTICWAsXML implements ISerializableObject {
@XmlElements ({ @XmlElement(name = "CWA", type = String.class) })
public class FFTICWAsXML {
@XmlElements({ @XmlElement(name = "CWA", type = String.class) })
private ArrayList<String> cwaList;
public FFTICWAsXML() {
@ -26,12 +25,13 @@ public class FFTICWAsXML implements ISerializableObject {
}
/**
* @param cwa the cwa to set
* @param cwa
* the cwa to set
*/
public void setCwaList(ArrayList<String> cwaList) {
this.cwaList = cwaList;
}
public void addCwa(String cwa) {
this.cwaList.add(cwa);
}

View file

@ -43,11 +43,9 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlRootElement(name = "FFTIData")
@XmlAccessorType(XmlAccessType.NONE)
public class FFTIDataXML implements ISerializableObject {
public class FFTIDataXML {
@XmlElement(name = "CWAs", type = FFTICWAsXML.class)
private FFTICWAsXML cwa;
@ -59,7 +57,7 @@ public class FFTIDataXML implements ISerializableObject {
cwa = new FFTICWAsXML();
settingList = new ArrayList<FFTISettingXML>();
}
/**
* @return the cwaList
*/
@ -89,7 +87,7 @@ public class FFTIDataXML implements ISerializableObject {
public void setSettingList(ArrayList<FFTISettingXML> settingList) {
this.settingList = settingList;
}
public void addSetting(FFTISettingXML setting) {
if (settingList == null) {
settingList = new ArrayList<FFTISettingXML>();

View file

@ -7,10 +7,9 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE)
public class FFTISetXML implements ISerializableObject {
public class FFTISetXML {
@XmlElement(name = "type")
private String type;

View file

@ -6,10 +6,9 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE)
public class FFTISettingXML implements ISerializableObject {
public class FFTISettingXML {
@XmlElement(name = "attribute", type = FFTIAttributeXML.class)
private FFTIAttributeXML attribute;

View file

@ -4,10 +4,9 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE)
public class FFTISourceSetXML implements ISerializableObject {
public class FFTISourceSetXML {
@XmlElement(name = "sourceType")
private String sourceType;

View file

@ -7,10 +7,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE)
public class FFTISourceXML implements ISerializableObject {
public class FFTISourceXML {
@XmlElements({ @XmlElement(name = "DisplayName", type = String.class) })
protected ArrayList<String> displayNameList;

View file

@ -8,7 +8,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.vividsolutions.jts.geom.Coordinate;
@ -16,7 +15,7 @@ import com.vividsolutions.jts.geom.Coordinate;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class FreezingLevelXML implements ISerializableObject {
public class FreezingLevelXML {
@DynamicSerializeElement
@XmlElement(name = "forecastHour")

View file

@ -27,8 +27,6 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* Monitoring area configuration xml.
*
@ -46,18 +44,18 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
*/
@XmlRootElement(name = "MonitorAreaConfig")
@XmlAccessorType(XmlAccessType.NONE)
public class MonAreaConfigXML implements ISerializableObject {
@XmlElements( { @XmlElement(name = "AreaID", type = AreaIdXML.class) })
public class MonAreaConfigXML {
@XmlElements({ @XmlElement(name = "AreaID", type = AreaIdXML.class) })
private ArrayList<AreaIdXML> areaIds = new ArrayList<AreaIdXML>();
@XmlElements( {@XmlElement(name = "timeWindow", type = Integer.class) })
@XmlElements({ @XmlElement(name = "timeWindow", type = Integer.class) })
private int timeWindow;
@XmlElements( {@XmlElement(name = "shipDistance", type = Integer.class) })
@XmlElements({ @XmlElement(name = "shipDistance", type = Integer.class) })
private int shipDistance;
@XmlElements( {@XmlElement(name = "useAlgorithms", type = Boolean.class) })
@XmlElements({ @XmlElement(name = "useAlgorithms", type = Boolean.class) })
private boolean useAlgorithms;
public MonAreaConfigXML() {
@ -79,7 +77,8 @@ public class MonAreaConfigXML implements ISerializableObject {
}
/**
* @param timeWindow the timeWindow to set
* @param timeWindow
* the timeWindow to set
*/
public void setTimeWindow(int timeWindow) {
this.timeWindow = timeWindow;
@ -93,7 +92,8 @@ public class MonAreaConfigXML implements ISerializableObject {
}
/**
* @param shipDistance the shipDistance to set
* @param shipDistance
* the shipDistance to set
*/
public void setShipDistance(int shipDistance) {
this.shipDistance = shipDistance;
@ -107,12 +107,13 @@ public class MonAreaConfigXML implements ISerializableObject {
}
/**
* @param useAlgorithms the useAlgorithms to set
* @param useAlgorithms
* the useAlgorithms to set
*/
public void setUseAlgorithms(boolean useAlgorithms) {
this.useAlgorithms = useAlgorithms;
}
public void addAreaId(AreaIdXML areaXml) {
areaIds.add(areaXml);
}

View file

@ -11,7 +11,6 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.SOURCE_TYPE;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* XML
@ -28,7 +27,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
*/
@XmlRootElement(name = "FFMPRunXML")
@XmlAccessorType(XmlAccessType.NONE)
public class ProductRunXML implements ISerializableObject {
public class ProductRunXML {
@XmlAttribute(name = "name")
private String productName;

View file

@ -42,10 +42,9 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE)
public class ProductXML implements ISerializableObject {
public class ProductXML {
@XmlAttribute(name = "primarySource")
protected String primarySource;

View file

@ -4,10 +4,8 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE)
public class SCANModelParameterXML implements ISerializableObject {
public class SCANModelParameterXML {
@XmlAttribute(name = "parameterName")
private String parameterName;

View file

@ -9,11 +9,10 @@ import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.radar.util.RadarsInUseUtil;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlRootElement(name = "SCANSiteRunConfig")
@XmlAccessorType(XmlAccessType.NONE)
public class SCANSiteRunConfigXML implements ISerializableObject {
public class SCANSiteRunConfigXML {
@XmlElements({ @XmlElement(name = "site") })
private ArrayList<SCANSiteXML> sites;

View file

@ -8,10 +8,8 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE)
public class SCANSiteXML implements ISerializableObject {
public class SCANSiteXML {
@XmlElement(name = "scanSite")
private String scanSite;

View file

@ -28,8 +28,6 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* XML for Source datakey contributions in FFMPRunConfig
*
@ -44,7 +42,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class SourceIngestConfigXML implements ISerializableObject {
public class SourceIngestConfigXML {
@XmlAttribute(name = "name")
protected String sourceName;

View file

@ -43,10 +43,9 @@ import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.GUIDANCE_TYPE;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.RATEORACCCUM;
import com.raytheon.uf.common.serialization.ISerializableObject;
@XmlAccessorType(XmlAccessType.NONE)
public class SourceXML implements ISerializableObject {
public class SourceXML {
@XmlElement(name = "SourceName")
protected String sourceName;
@ -87,9 +86,9 @@ public class SourceXML implements ISerializableObject {
@XmlElement(name = "interpolatedGuidanceTransition")
protected boolean interpolatedGuidanceTransition;
//@XmlElement(name = "unit") // DR 14412
// @XmlElement(name = "unit") // DR 14412
protected String unit;
public static final String UNIT_TXT = "inches"; // DR 14412
@XmlElement(name = "conversion")
@ -288,8 +287,8 @@ public class SourceXML implements ISerializableObject {
}
public String getUnit() {
if( unit == null || unit.isEmpty()) // DR 14412
unit = UNIT_TXT;
if (unit == null || unit.isEmpty()) // DR 14412
unit = UNIT_TXT;
return unit;
}
@ -420,31 +419,28 @@ public class SourceXML implements ISerializableObject {
* @param key
* @param param
* @return
*//* 2012-04-18: Old version: keep for reference: Gang Zhang
private boolean isOverride(String key, String param) {
if (sourceOverrideDataMap != null) {
if (sourceOverrideDataMap.containsKey(key)) {
if (sourceOverrideDataMap.get(key).contains(param)) {
return true;
}
}
}
return false;
}
*/
/**2012-04-18: code is from David Hladky in Omaha
* for DR 14619/14620. Gang Zhang is checked in
* Check to see if we are overridden
*/
/*
* 2012-04-18: Old version: keep for reference: Gang Zhang private boolean
* isOverride(String key, String param) { if (sourceOverrideDataMap != null)
* { if (sourceOverrideDataMap.containsKey(key)) { if
* (sourceOverrideDataMap.get(key).contains(param)) { return true; } } }
*
* return false; }
*/
/**
* 2012-04-18: code is from David Hladky in Omaha for DR 14619/14620. Gang
* Zhang is checked in Check to see if we are overridden
*
* @param key
* @param param
* @return
*/
*/
private boolean isOverride(String key, String param) {
if (sourceOverrideDataMap != null) {
if (sourceOverrideDataMap.containsKey(key)) {
for (SourceOverrideParamXML paramx: sourceOverrideDataMap.get(key)) {
for (SourceOverrideParamXML paramx : sourceOverrideDataMap
.get(key)) {
if (paramx.getParam().equals(param)) {
return true;
}
@ -453,5 +449,5 @@ public class SourceXML implements ISerializableObject {
}
return false;
}
}
}

View file

@ -23,8 +23,6 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* Monitoring area configuration xml.
*
@ -41,18 +39,18 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class StationIdXML implements ISerializableObject {
public class StationIdXML {
@XmlAttribute(name = "type")
private String type;
@XmlAttribute(name = "name")
private String name;
public static final String MARITIME = "MARITIME";
public static final String METAR = "METAR";
public static final String MESONET = "MESONET";
public StationIdXML() {
@ -74,7 +72,8 @@ public class StationIdXML implements ISerializableObject {
}
/**
* @param name the name to set
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;

View file

@ -26,8 +26,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import com.raytheon.uf.common.serialization.ISerializableObject;
/**
* VGB's
*
@ -44,9 +42,9 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class VGBXML implements ISerializableObject {
public class VGBXML {
@XmlElements( { @XmlElement(name = "vgb") } )
@XmlElements({ @XmlElement(name = "vgb") })
private ArrayList<String> lids = new ArrayList<String>();
/**
@ -57,14 +55,16 @@ public class VGBXML implements ISerializableObject {
}
/**
* @param the lids to set
* @param the
* lids to set
*/
public void setLid(ArrayList<String> lids) {
this.lids = lids;
}
/**
* Add one
*
* @param slid
*/
public void add(String lid) {

View file

@ -29,16 +29,28 @@ package com.raytheon.uf.common.serialization;
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 11, 2008 njensen Initial creation
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 11, 2008 njensen Initial creation
* Oct 02, 2013 2361 njensen Deprecated
*
* </pre>
*
* @author njensen
* @version 1.0
* @deprecated This interface is deprecated but may still be required until it
* is completely removed from the system. DynamicSerialize no longer
* requires ISerializableObjects, just use the DynamicSerialize
* annotations. JAXB/XML only requires it if you use the global JAXB
* context through {@link SerializationUtil}, however that is a
* performance hit and deprecated and you should instead create your
* own {@link JAXBManager}. Hibernate still requires
* ISerializableObject but an alternative will be provided in the
* near future.
*
*/
@Deprecated
public interface ISerializableObject {
}

View file

@ -127,7 +127,10 @@ public class JAXBManager {
* @throws JAXBException
*/
public JAXBManager(Class<?>... clazz) throws JAXBException {
long t0 = System.currentTimeMillis();
jaxbContext = JAXBContext.newInstance(clazz);
System.out.println("JAXB context with " + clazz.length
+ " classes inited in: " + (System.currentTimeMillis() - t0));
}
/**

View file

@ -23,6 +23,9 @@ import java.io.File;
import javax.xml.bind.JAXBException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/**
* A JAXBManager that only supports a single class (including any classes that
* are contained within that class). Useful when dealing specifically with an
@ -47,6 +50,9 @@ import javax.xml.bind.JAXBException;
public class SingleTypeJAXBManager<T extends Object> extends JAXBManager {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(SingleTypeJAXBManager.class);
protected Class<T> type;
/**
@ -86,4 +92,29 @@ public class SingleTypeJAXBManager<T extends Object> extends JAXBManager {
return super.unmarshalFromXmlFile(type, new File(filePath));
}
/**
* Creates a SingleTypeJAXBManager for a specified type, but catches any
* JAXBExceptions thrown and logs them. If an exception does occur, returns
* null.
*
* @param clazz
* the class of the object to read/write XML for
* @return the SingleTypeJAXBManager or null if an exception occurred
*/
public static <A> SingleTypeJAXBManager<A> createWithoutException(
Class<A> clazz) {
SingleTypeJAXBManager<A> retVal = null;
try {
retVal = new SingleTypeJAXBManager<A>(clazz);
} catch (JAXBException e) {
// technically this should only ever happen if a developer messes
// up, so we're going to print the stacktrace too as extra warning
e.printStackTrace();
statusHandler.error("Error initializing SingleTypeJAXBManager for "
+ clazz.getName(), e);
}
return retVal;
}
}