Issue #2361 remove ISerializableObject from redbook and hydro
Change-Id: Ib48dea5d734f19a9919da9fea752b5e0f38a2141 Former-commit-id: 2626a79c976ac016352a091bdf66890e929edc85
This commit is contained in:
parent
9b9d57bc94
commit
6064000389
8 changed files with 40 additions and 63 deletions
|
@ -1,2 +0,0 @@
|
|||
com.raytheon.viz.hydro.timeseries.ShefIssueXML
|
||||
com.raytheon.viz.hydro.appsdefaults.SHEFAppsDefaultsXML
|
|
@ -23,6 +23,8 @@ import java.io.File;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXB;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
|
@ -39,8 +41,6 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -58,6 +58,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Jan 26, 2011 mpduff Initial creation
|
||||
* Dec 07, 2012 1353 rferrel Make non-blocking dialog.
|
||||
* Aug 09, 2013 2033 mschenke Switched File.separator to IPathManager.SEPARATOR
|
||||
* Nov 04, 2013 2361 njensen Use JAXB instead of SerializationUtil
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -170,17 +171,14 @@ public class SHEFAppsDefaultsDlg extends CaveSWTDialog {
|
|||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
System.out.println("Searching for " + CONFIG_FILE_NAME);
|
||||
File file = pm.getStaticFile(this.CONFIG_FILE_NAME);
|
||||
String configPath = null;
|
||||
if (file != null) {
|
||||
configPath = file.getAbsolutePath();
|
||||
try {
|
||||
SHEFAppsDefaultsXML xml = SerializationUtil
|
||||
.jaxbUnmarshalFromXmlFile(SHEFAppsDefaultsXML.class,
|
||||
configPath);
|
||||
SHEFAppsDefaultsXML xml = JAXB.unmarshal(file,
|
||||
SHEFAppsDefaultsXML.class);
|
||||
for (String token : xml.getTokenList()) {
|
||||
tokenList.add(token);
|
||||
}
|
||||
} catch (SerializationException e) {
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getMessage(), e);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -28,7 +28,9 @@ 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.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
||||
/**
|
||||
* Shef Issue Configuration Manager.
|
||||
|
@ -40,6 +42,7 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 28, 2011 mpduff Initial creation
|
||||
* Nov 04, 2013 2361 njensen Use JAXBManager for XML
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,6 +51,13 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
|
|||
*/
|
||||
|
||||
public class ShefIssueMgr {
|
||||
|
||||
private static final SingleTypeJAXBManager<ShefIssueXML> jaxb = SingleTypeJAXBManager
|
||||
.createWithoutException(ShefIssueXML.class);
|
||||
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ShefIssueMgr.class);
|
||||
|
||||
private static ShefIssueMgr instance = null;
|
||||
|
||||
private ShefIssueXML xml = null;
|
||||
|
@ -69,10 +79,11 @@ public class ShefIssueMgr {
|
|||
}
|
||||
|
||||
private void readXML() {
|
||||
LocalizationFile file = null;
|
||||
try {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
Map<LocalizationLevel, LocalizationFile> shefIssueMap = pm.getTieredLocalizationFile(LocalizationType.COMMON_STATIC, "hydro" + File.separatorChar + "shefIssue.xml");
|
||||
LocalizationFile file = null;
|
||||
|
||||
|
||||
if (shefIssueMap.containsKey(LocalizationLevel.SITE)) {
|
||||
file = shefIssueMap.get(LocalizationLevel.SITE);
|
||||
|
@ -81,13 +92,13 @@ public class ShefIssueMgr {
|
|||
}
|
||||
|
||||
if (file != null) {
|
||||
xml = (ShefIssueXML) SerializationUtil
|
||||
.jaxbUnmarshalFromXmlFile(file.getFile().getAbsolutePath());
|
||||
xml = jaxb
|
||||
.unmarshalFromXmlFile(file.getFile());
|
||||
} else {
|
||||
xml = new ShefIssueXML();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.error("Error reading " + file.getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,11 +130,11 @@ public class ShefIssueMgr {
|
|||
if (xml == null) {
|
||||
xml = new ShefIssueXML();
|
||||
}
|
||||
SerializationUtil.jaxbMarshalToXmlFile(xml, newXmlFile
|
||||
jaxb.marshalToXmlFile(xml, newXmlFile
|
||||
.getFile().getAbsolutePath());
|
||||
newXmlFile.save();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.error("Error writing " + newXmlFile.getName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
com.raytheon.viz.redbook.RedbookWMOMap
|
||||
com.raytheon.viz.redbook.rsc.RedbookProductBrowserDataDefinition
|
|
@ -22,14 +22,13 @@ package com.raytheon.viz.redbook;
|
|||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.xml.bind.JAXB;
|
||||
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.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
|
||||
/**
|
||||
* Returns the redbook WMO prefix to human readable name
|
||||
|
@ -39,6 +38,7 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 30, 2008 chammack Initial creation
|
||||
* Nov 04, 2013 2361 njensen Use JAXB instead of SerializationUtil
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -47,10 +47,10 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
|
|||
*/
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class RedbookWMOMap implements ISerializableObject {
|
||||
public class RedbookWMOMap {
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public static class Info implements ISerializableObject {
|
||||
public static class Info {
|
||||
public String name;
|
||||
|
||||
@XmlElement(required = false)
|
||||
|
@ -63,8 +63,8 @@ public class RedbookWMOMap implements ISerializableObject {
|
|||
File file = PathManagerFactory.getPathManager().getStaticFile(
|
||||
"redbook/redbookMapping.xml");
|
||||
try {
|
||||
RedbookWMOMap map = (RedbookWMOMap) SerializationUtil
|
||||
.jaxbUnmarshalFromXmlFile(file.getAbsolutePath());
|
||||
RedbookWMOMap map = JAXB.unmarshal(file, RedbookWMOMap.class);
|
||||
|
||||
// add ability for comma separated values in xml file
|
||||
RedbookWMOMap secondMap = new RedbookWMOMap();
|
||||
secondMap.mapping = new HashMap<String, Info>();
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
com.raytheon.edex.plugin.redbook.common.RedbookRecord
|
||||
com.raytheon.edex.plugin.redbook.decoder.RedbookFcstMap
|
|
@ -31,14 +31,9 @@ import javax.persistence.SequenceGenerator;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.hibernate.annotations.Index;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
|
||||
|
@ -72,6 +67,7 @@ import com.raytheon.uf.common.time.DataTime;
|
|||
* May 07, 2013 1869 bsteffen Remove dataURI column from
|
||||
* PluginDataObject.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* Nov 04, 2013 2361 njensen Remove XML annotations
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -87,8 +83,6 @@ import com.raytheon.uf.common.time.DataTime;
|
|||
*/
|
||||
@org.hibernate.annotations.Table(appliesTo = "redbook", indexes = { @Index(name = "redbook_refTimeIndex", columnNames = {
|
||||
"refTime", "forecastTime" }) })
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
public class RedbookRecord extends PersistablePluginDataObject implements
|
||||
IPersistable, Cloneable {
|
||||
|
@ -99,57 +93,48 @@ public class RedbookRecord extends PersistablePluginDataObject implements
|
|||
|
||||
// Time of the observation.
|
||||
@Column
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Calendar timeObs;
|
||||
|
||||
@DataURI(position = 1)
|
||||
@Column(length = 8)
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String wmoTTAAii;
|
||||
|
||||
// Text of the WMO header
|
||||
@Column(length = 16)
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String wmoCCCCdt;
|
||||
|
||||
// Correction indicator from wmo header
|
||||
@DataURI(position = 3)
|
||||
@Column(length = 8)
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String corIndicator;
|
||||
|
||||
@Column
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Integer retentionHours;
|
||||
|
||||
@DataURI(position = 5)
|
||||
@Column
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Integer fcstHours;
|
||||
|
||||
// varchar(15)
|
||||
@DataURI(position = 2)
|
||||
@Column(length = 15)
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String productId;
|
||||
|
||||
@DataURI(position = 6)
|
||||
@Column
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Integer fileId;
|
||||
|
||||
// varchar(4)
|
||||
@DataURI(position = 4)
|
||||
@Column(length = 4)
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String originatorId;
|
||||
|
||||
|
@ -335,16 +320,6 @@ public class RedbookRecord extends PersistablePluginDataObject implements
|
|||
this.redBookData = redBookData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the IDecoderGettable reference for this record.
|
||||
*
|
||||
* @return This class does not implement IDecoderGettable, return null.
|
||||
*/
|
||||
@Override
|
||||
public IDecoderGettable getDecoderGettable() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a mostly shallow copy of the RedbookRecord with the reference
|
||||
* time set back one minute. Clears the id and dataURI fields of the
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.edex.plugin.redbook.decoder;
|
|||
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.xml.bind.JAXB;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
@ -33,9 +34,6 @@ 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.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -51,6 +49,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Apr 29, 2013 1958 bgonzale Map is loaded once, and then
|
||||
* not loaded again unless the mapping
|
||||
* file changes.
|
||||
* Nov 04, 2013 2361 njensen Use JAXB for XML instead of SerializationUtil
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -59,7 +58,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
*/
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class RedbookFcstMap implements ISerializableObject {
|
||||
public class RedbookFcstMap {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RedbookFcstMap.class);
|
||||
|
||||
|
@ -90,9 +90,8 @@ public class RedbookFcstMap implements ISerializableObject {
|
|||
private static RedbookFcstMap load(LocalizationFile xmlFile) {
|
||||
RedbookFcstMap loadedMap = null;
|
||||
try {
|
||||
loadedMap = SerializationUtil.jaxbUnmarshalFromXmlFile(
|
||||
RedbookFcstMap.class, xmlFile.getFile().getAbsolutePath());
|
||||
} catch (SerializationException e) {
|
||||
loadedMap = JAXB.unmarshal(xmlFile.getFile(), RedbookFcstMap.class);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getMessage(), e);
|
||||
}
|
||||
return loadedMap;
|
||||
|
|
Loading…
Add table
Reference in a new issue