Omaha #3548 PluginDataObjectFilter fails to start in spring
Change-Id: Ia69c93c5bab1c730c3c4bad6781823f989bc1641 Former-commit-id: 4d059172e0d822a2fb740d602265da6a91e15ccc
This commit is contained in:
parent
7920053e2f
commit
735cafee83
2 changed files with 30 additions and 37 deletions
|
@ -24,13 +24,11 @@ import static com.raytheon.uf.common.localization.LocalizationContext.Localizati
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.bind.JAXBException;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
@ -45,7 +43,7 @@ import com.raytheon.uf.common.localization.LocalizationContext;
|
||||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
import com.raytheon.uf.common.serialization.JAXBManager;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractFilterElement;
|
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractFilterElement;
|
||||||
|
@ -65,6 +63,7 @@ import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
|
||||||
* 1/10/2013 15497 wkwock Initial creation
|
* 1/10/2013 15497 wkwock Initial creation
|
||||||
* 2/13/2013 1584 mpduff Fix creation of "dummy" config.
|
* 2/13/2013 1584 mpduff Fix creation of "dummy" config.
|
||||||
* 08/08/2013 16408 wkwock Use different metar.cfg file and options
|
* 08/08/2013 16408 wkwock Use different metar.cfg file and options
|
||||||
|
* 09/09/2014 3548 mapeters Replaced SerializationUtil usage with JAXBManager.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -113,37 +112,31 @@ public class MetarToShefFilter {
|
||||||
byte[] data = new byte[(int) srcFile.length()];
|
byte[] data = new byte[(int) srcFile.length()];
|
||||||
|
|
||||||
InputStream stream = getInputStream(srcFile);
|
InputStream stream = getInputStream(srcFile);
|
||||||
try {
|
stream.read(data);
|
||||||
stream.read(data);
|
stream.close();
|
||||||
stream.close();
|
JAXBManager jaxb = new JAXBManager(
|
||||||
Object obj = SerializationUtil
|
PluginDataObjectFilter.class,
|
||||||
.unmarshalFromXml(new String(data));
|
MetarToShefFilter.class);
|
||||||
if (obj instanceof PluginDataObjectFilter) {
|
Object obj = jaxb.unmarshalFromXml(new String(data));
|
||||||
logger.info("Found " + filterConfigFile
|
if (obj instanceof PluginDataObjectFilter) {
|
||||||
+ " is PluginDataObjectFilter");
|
logger.info("Found " + filterConfigFile
|
||||||
PluginDataObjectFilter pdof = (PluginDataObjectFilter) obj;
|
+ " is PluginDataObjectFilter");
|
||||||
MetarToShefRun mtsr = new MetarToShefRun();
|
PluginDataObjectFilter pdof = (PluginDataObjectFilter) obj;
|
||||||
mtsr.setConfigFileName(METAR_CFG);
|
MetarToShefRun mtsr = new MetarToShefRun();
|
||||||
mtsr.setMetarToShefOptions(metarToShefOptions);
|
mtsr.setConfigFileName(METAR_CFG);
|
||||||
mtsr.setFilterElements(pdof.getFilterElements());
|
mtsr.setMetarToShefOptions(metarToShefOptions);
|
||||||
mtsr.setFilterName(pdof.getFilterName());
|
mtsr.setFilterElements(pdof.getFilterElements());
|
||||||
this.metarToShefRun.add(mtsr);
|
mtsr.setFilterName(pdof.getFilterName());
|
||||||
} else if (obj instanceof MetarToShefFilter) {
|
this.metarToShefRun.add(mtsr);
|
||||||
MetarToShefFilter filter = (MetarToShefFilter) obj;
|
} else if (obj instanceof MetarToShefFilter) {
|
||||||
this.metarToShefRun = filter.metarToShefRun;
|
MetarToShefFilter filter = (MetarToShefFilter) obj;
|
||||||
logger.info("Found " + filterConfigFile
|
this.metarToShefRun = filter.metarToShefRun;
|
||||||
+ " is MetarToShefFilter");
|
logger.info("Found " + filterConfigFile
|
||||||
} else {
|
+ " is MetarToShefFilter");
|
||||||
logger.error("Found " + filterConfigFile
|
} else {
|
||||||
+ " is "
|
logger.error("Found " + filterConfigFile + " is "
|
||||||
+ obj.getClass().getCanonicalName());
|
+ obj.getClass().getCanonicalName());
|
||||||
createDummyFilter();
|
createDummyFilter();
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
logger.error("Unable to read filter config", e);
|
|
||||||
} catch (JAXBException e) {
|
|
||||||
logger.error("Unable to unmarshall filter config",
|
|
||||||
e);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.error(String.format(ERROR_2_FMT,
|
logger.error(String.format(ERROR_2_FMT,
|
||||||
|
@ -159,7 +152,7 @@ public class MetarToShefFilter {
|
||||||
// Could not create PathManager
|
// Could not create PathManager
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error creating filter.", e);
|
logger.error("Error creating filter from " + filterConfigFile, e);
|
||||||
createDummyFilter();
|
createDummyFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
* Jul 23, 2014 3410 bclement location changed to floats
|
* Jul 23, 2014 3410 bclement location changed to floats
|
||||||
* Aug 28, 2014 3548 mapeters Replaced use of SerializationUtil
|
* Aug 28, 2014 3548 mapeters Replaced use of SerializationUtil
|
||||||
* with SingleTypeJAXBManager
|
* with SingleTypeJAXBManager
|
||||||
|
* Sep 09, 2014 3548 mapeters Improved constructor's error messages.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -94,7 +95,6 @@ public class PluginDataObjectFilter extends AbstractObsFilter {
|
||||||
filterDir = manager.getFile(context, FILTERS_DIR);
|
filterDir = manager.getFile(context, FILTERS_DIR);
|
||||||
if (filterDir.exists()) {
|
if (filterDir.exists()) {
|
||||||
File srcFile = new File(filterDir, filterConfigFile);
|
File srcFile = new File(filterDir, filterConfigFile);
|
||||||
|
|
||||||
SingleTypeJAXBManager<PluginDataObjectFilter> jaxb = new SingleTypeJAXBManager<PluginDataObjectFilter>(
|
SingleTypeJAXBManager<PluginDataObjectFilter> jaxb = new SingleTypeJAXBManager<PluginDataObjectFilter>(
|
||||||
PluginDataObjectFilter.class);
|
PluginDataObjectFilter.class);
|
||||||
PluginDataObjectFilter filter = jaxb
|
PluginDataObjectFilter filter = jaxb
|
||||||
|
@ -116,7 +116,7 @@ public class PluginDataObjectFilter extends AbstractObsFilter {
|
||||||
// Could not create PathManager
|
// Could not create PathManager
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error creating filter.", e);
|
logger.error("Error creating filter from " + filterConfigFile, e);
|
||||||
createDummyFilter();
|
createDummyFilter();
|
||||||
}
|
}
|
||||||
logger.info("Filter name = " + getFilterName());
|
logger.info("Filter name = " + getFilterName());
|
||||||
|
|
Loading…
Add table
Reference in a new issue