Change-Id: I8f2ff0b687020a9df0bb033088daa51a7ecd3c83 Updated per review comments Former-commit-id: 4ddd7491140b62a93b85e63ff02a51369e150c11
This commit is contained in:
parent
adbf370067
commit
5a870497f1
9 changed files with 86 additions and 2 deletions
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.raytheon.edex.plugin.binlightning.legacy</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,8 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: LegacyLightningDecoder
|
||||
Bundle-SymbolicName: com.raytheon.edex.plugin.binlightning.legacy
|
||||
Bundle-Version: 1.16.0
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Fragment-Host: com.raytheon.edex.plugin.binlightning;bundle-version="1.14.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
|
@ -0,0 +1,4 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
|
@ -22,6 +22,13 @@ package com.raytheon.edex.plugin.binlightning.impl;
|
|||
|
||||
import static com.raytheon.edex.plugin.binlightning.impl.IBinLightningDecoder.*;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import com.raytheon.edex.plugin.binlightning.BinLightningDecoder;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
||||
/**
|
||||
* Read from the message data source, isolate and create a decoder for the
|
||||
* current sub-message. In the event that the message decoder can not be
|
||||
|
@ -34,6 +41,8 @@ import static com.raytheon.edex.plugin.binlightning.impl.IBinLightningDecoder.*;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 20070810 379 jkorman Initial Coding from prototype.
|
||||
* 20160116 18408 Wufeng Zhou Remove direct dependency on bit shifting decoder
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -42,6 +51,8 @@ import static com.raytheon.edex.plugin.binlightning.impl.IBinLightningDecoder.*;
|
|||
*/
|
||||
public class BinLightningFactory
|
||||
{
|
||||
private static final IUFStatusHandler logger = UFStatus.getHandler(BinLightningDecoder.class);
|
||||
|
||||
/**
|
||||
* Read from the message data source, isolate and create a decoder for the
|
||||
* current sub-message. In the event that the message decoder can not be
|
||||
|
@ -60,12 +71,14 @@ public class BinLightningFactory
|
|||
{
|
||||
case FLASH_RPT :
|
||||
{
|
||||
decoder = new FlashLightningDecoder(msgData,count);
|
||||
String className = "com.raytheon.edex.plugin.binlightning.impl.FlashLightningDecoder";
|
||||
decoder = loadDecoderInstance(className, msgData, count);
|
||||
break;
|
||||
}
|
||||
case RT_FLASH_RPT :
|
||||
{
|
||||
decoder = new RTLightningDecoder(msgData,count);
|
||||
String className = "com.raytheon.edex.plugin.binlightning.impl.RTLightningDecoder";
|
||||
decoder = loadDecoderInstance(className, msgData, count);
|
||||
break;
|
||||
}
|
||||
case OTHER_RPT :
|
||||
|
@ -90,4 +103,20 @@ public class BinLightningFactory
|
|||
return decoder;
|
||||
}
|
||||
|
||||
private static IBinLightningDecoder loadDecoderInstance(String className, IBinDataSource msgData, int count) {
|
||||
IBinLightningDecoder decoder = null;
|
||||
try {
|
||||
Class<?> clazz = BinLightningFactory.class.getClassLoader().loadClass(className);
|
||||
Class<?>[] types = {IBinDataSource.class, Integer.TYPE};
|
||||
Constructor<?> constructor = clazz.getConstructor(types);
|
||||
Object[] parameters = {msgData, count};
|
||||
decoder = (IBinLightningDecoder)constructor.newInstance(parameters);
|
||||
logger.info("Loaded legacy binlightning decoder class " + className);
|
||||
} catch (ClassNotFoundException | InstantiationException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
logger.error("Fail to load binlightning decoder class " + className + ". FYI, this is error only if you are authorized: " + e.getMessage());
|
||||
decoder = new LightningErrorDecoder(UNIMPLEMENTED_DECODER);
|
||||
}
|
||||
return decoder;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,4 +31,12 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.edex.plugin.binlightning.legacy"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
fragment="true"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
|
Loading…
Add table
Reference in a new issue