* Basic usage: - *
- * IMicroEngine runner = MicroEngine.getInstance(type);
- *
*
*
- *
+ *
+ * IMicroEngine runner = MicroEngine.getInstance(type);
+ *
+ *
+ *
+ * + * * SOFTWARE HISTORY - * + * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 17Nov2008 1709 MW Fegan Initial creation. + * Jul 10, 2014 2914 garmendariz Remove EnvProperties * *- * + * * @author mfegan * @version 1.0 * @see com.raytheon.edex.uengine.runners.AMicroEngine - * @see com.raytheon.edex.uengine.runners.IMicroEngine + * @see com.raytheon.edex.uengine.runners.IMicroEngine */ public final class MicroEngine { @@ -56,39 +57,40 @@ public final class MicroEngine { */ private MicroEngine() { } + /** * Creates a μEngine script runner of the specified type. * - * @param type the type of script runner to create + * @param type + * the type of script runner to create * * @return the script runner * - * @throws MicroEngineException if unable to create the script runner + * @throws MicroEngineException + * if unable to create the script runner */ - public static IMicroEngine getInstance(String type) throws MicroEngineException { + public static IMicroEngine getInstance(String type) + throws MicroEngineException { String className = null; Class> aClass = null; - Configuration config = null; - String configName = "micro_engine"; IMicroEngine retVal = null; String runner = type.toLowerCase() + "_runner"; - /* get the configuration for uEngine */ - try { - config = PropertiesFactory.getInstance().getConfiguration(configName); - } catch (Exception e) { - throw new MicroEngineException("Unable to load properties for MicroEngine, type = " + type,e); - } + /* get the class name for the uEngine script runner */ - className = config.getString(runner); + className = System.getProperty(runner); if (className == null) { - throw new MicroEngineException("Unable to find class name for MicroEngine, type = " + type); + throw new MicroEngineException( + "Unable to find class name for MicroEngine, type = " + type); } + /* attempt to create the script runner class */ try { aClass = Class.forName(className); - retVal = (IMicroEngine)aClass.newInstance(); + retVal = (IMicroEngine) aClass.newInstance(); } catch (Exception e) { - throw new MicroEngineException("Unable to create MicroEngine script runner, type = " + type,e); + throw new MicroEngineException( + "Unable to create MicroEngine script runner, type = " + + type, e); } return retVal; } diff --git a/edexOsgi/com.raytheon.edex.uengine/src/com/raytheon/edex/uengine/tasks/output/FileOut.java b/edexOsgi/com.raytheon.edex.uengine/src/com/raytheon/edex/uengine/tasks/output/FileOut.java index ebb4593728..70e8b2ec97 100644 --- a/edexOsgi/com.raytheon.edex.uengine/src/com/raytheon/edex/uengine/tasks/output/FileOut.java +++ b/edexOsgi/com.raytheon.edex.uengine/src/com/raytheon/edex/uengine/tasks/output/FileOut.java @@ -29,8 +29,7 @@ import com.raytheon.edex.uengine.exception.MicroEngineException; import com.raytheon.edex.uengine.tasks.ScriptTask; import com.raytheon.uf.common.util.FileUtil; import com.raytheon.uf.common.util.StringUtil; -import com.raytheon.uf.edex.core.props.EnvProperties; -import com.raytheon.uf.edex.core.props.PropertiesFactory; +import com.raytheon.uf.edex.core.EDEXUtil; /** * FileOut task derived from original FileOut uEngine task. Writes the data out @@ -41,6 +40,7 @@ import com.raytheon.uf.edex.core.props.PropertiesFactory; * Date PR# Engineer Description * ----------- ---------- ------------ -------------------------- * Mar 29, 2007 njensen Initial Creation + * Jul 10, 2014 2914 garmendariz Remove EnvProperties * * */ @@ -79,24 +79,19 @@ public class FileOut extends ScriptTask { } private void init() { - EnvProperties envProperties = PropertiesFactory.getInstance() - .getEnvProperties(); - - String uengineOutDir = envProperties.getEnvValue("UENGINEOUTDIR"); - String defaultDataDir = envProperties.getEnvValue("DEFAULTDATADIR"); /* * make sure there is an output directory defined */ if (StringUtil.isEmptyString(destDir)) { // default to uengineOutDir - destDir = uengineOutDir; + destDir = EDEXUtil.getEdexData() + File.separator + "uEngine"; logger.debug("Defaulting destDir to: " + destDir); } else { // If the ignore default data dir flag is not true then // prepend the default data dir to the destination directory. if (!ignoreDefaultDataDir) { - destDir = defaultDataDir + destDir; + destDir = EDEXUtil.getEdexData() + File.separator + destDir; } } } diff --git a/edexOsgi/com.raytheon.edex.uengine/src/com/raytheon/edex/uengine/tasks/process/ReplayArchive.java b/edexOsgi/com.raytheon.edex.uengine/src/com/raytheon/edex/uengine/tasks/process/ReplayArchive.java deleted file mode 100644 index 8c26e0b10c..0000000000 --- a/edexOsgi/com.raytheon.edex.uengine/src/com/raytheon/edex/uengine/tasks/process/ReplayArchive.java +++ /dev/null @@ -1,397 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.edex.uengine.tasks.process; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.GregorianCalendar; -import java.util.Iterator; -import java.util.List; -import java.util.TreeSet; - -import org.apache.commons.lang.StringUtils; - -import com.raytheon.edex.uengine.tasks.ScriptTask; -import com.raytheon.uf.common.message.response.ResponseMessageGeneric; -import com.raytheon.uf.edex.core.props.EnvProperties; -import com.raytheon.uf.edex.core.props.PropertiesFactory; - -/** - * This script task will start replaying the files located in the sbnDir. - * While keeping the delays between each file. - * - *
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * 12/12/2007 561 dfitch Initial Creation - * 18Sep2008 SP#12 ebabin update to not block caller. - * - *- * - * @author dfitch - * @version 1 - */ -public class ReplayArchive extends ScriptTask -{ - private static File sbnDir = null; - - static { - EnvProperties env = PropertiesFactory.getInstance().getEnvProperties(); - String defaultDataDir = env.getEnvValue("DEFAULTDATADIR") + File.separatorChar + "sbn"; - sbnDir = new File(defaultDataDir); - } - - private List
- * + * * SOFTWARE HISTORY * * Date Ticket# Engineer Description @@ -39,20 +40,19 @@ import com.raytheon.uf.edex.core.EdexException; * @version 1 */ - public class MadisSeparator { - + private static final Pattern regex = Pattern.compile(","); - public static final String pathPrefix = EDEXUtil.EDEX_HOME + File.separatorChar + "data" + public static final String pathPrefix = EDEXUtil.getEdexData() + File.separatorChar + "madis" + File.separatorChar; private static final String pathSuffix = ".madis"; private String madisRoute; - + private int timeback; - + private static final IUFStatusHandler statusHandler = UFStatus .getHandler(MadisSeparator.class); @@ -69,15 +69,14 @@ public class MadisSeparator { } } - public void separate(byte[] inputData) - throws DecoderException { - + public void separate(byte[] inputData) throws DecoderException { + InputStream is = null; BufferedReader bfReader = null; long time = System.currentTimeMillis(); - + if (inputData != null) { - + is = new ByteArrayInputStream(inputData); bfReader = new BufferedReader(new InputStreamReader(is)); String line = null; @@ -85,13 +84,13 @@ public class MadisSeparator { MadisIngestObject mio = null; String headerLine = null; int i = 0; - + try { - + long time3 = 0l; int j = 1; - - while((line = bfReader.readLine()) != null) { + + while ((line = bfReader.readLine()) != null) { // Get the file type, D or F if (i == 0) { time3 = System.currentTimeMillis(); @@ -125,10 +124,10 @@ public class MadisSeparator { sendFile(mio); long time4 = System.currentTimeMillis(); statusHandler.handle(Priority.INFO, - "MADIS separated record wrote: "+j+" " + "MADIS separated record wrote: " + j + " " + (time4 - time3) + " ms"); } - + } catch (IOException e) { statusHandler.handle(Priority.ERROR, "Could not open MADIS CSV file!", e); @@ -137,17 +136,18 @@ public class MadisSeparator { try { bfReader.close(); } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + statusHandler.handle(Priority.PROBLEM, + e.getLocalizedMessage(), e); } } } } - + long time2 = System.currentTimeMillis(); statusHandler.handle(Priority.INFO, "MADIS separation total: " + (time2 - time) + " ms"); } - + /** * Gets the correct MADIS header type * @@ -170,14 +170,16 @@ public class MadisSeparator { "Unknown format for MADIS CSV file! " + commaSepList); } } - + /** * Writes the object to the File System + * * @param mio */ - private static void sendObject(MadisIngestObject mio, String path) throws Exception { + private static void sendObject(MadisIngestObject mio, String path) + throws Exception { FileOutputStream fos = null; - + try { File file = new File(path); file.createNewFile(); @@ -187,57 +189,62 @@ public class MadisSeparator { statusHandler.handle(Priority.PROBLEM, "Couldn't create file", e); throw new Exception("Unable to write File, FileNotFound!", e); } catch (SerializationException e) { - statusHandler.handle(Priority.PROBLEM, "Serialization exception writing file", e); + statusHandler.handle(Priority.PROBLEM, + "Serialization exception writing file", e); throw new Exception("Unable to write File, Serialization!", e); } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, "IO Exception creating file", e); + statusHandler.handle(Priority.PROBLEM, + "IO Exception creating file", e); throw new Exception("Unable to write File, IO!", e); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, "Problem closing the stream!", e); + statusHandler.handle(Priority.PROBLEM, + "Problem closing the stream!", e); } } } } - + /** * Send the path to QPID + * * @param path * @param route */ private static void sendPath(String path, String route) throws Exception { try { - EDEXUtil.getMessageProducer().sendAsyncUri( - route, path); + EDEXUtil.getMessageProducer().sendAsyncUri(route, path); } catch (EdexException e) { - statusHandler.handle(Priority.PROBLEM, - e.getLocalizedMessage(), e); - throw new Exception("Unable to send Path message, EdexException!", e); - } + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + throw new Exception("Unable to send Path message, EdexException!", + e); + } } - + /** * Get the file from the path + * * @param path * @param route */ public static MadisIngestObject getObject(String path) { - + FileInputStream fis = null; MadisIngestObject mio = null; - + try { fis = new FileInputStream(new File(path)); - mio = SerializationUtil.transformFromThrift(MadisIngestObject.class, fis); - + mio = SerializationUtil.transformFromThrift( + MadisIngestObject.class, fis); + } catch (FileNotFoundException e) { - statusHandler.handle(Priority.PROBLEM, - "Couldn't find the file", e); + statusHandler.handle(Priority.PROBLEM, "Couldn't find the file", e); } catch (SerializationException e) { - statusHandler.handle(Priority.PROBLEM, "Couldn't de-serialize the file", e); + statusHandler.handle(Priority.PROBLEM, + "Couldn't de-serialize the file", e); } finally { if (fis != null) { try { @@ -248,18 +255,20 @@ public class MadisSeparator { } } } - + return mio; } - + /** * Gets the filePath and sends to queue and disk + * * @param mio */ private void sendFile(MadisIngestObject mio) { - + StringBuilder filePath = new StringBuilder(); - filePath.append(pathPrefix).append(UUID.randomUUID().toString()).append(pathSuffix); + filePath.append(pathPrefix).append(UUID.randomUUID().toString()) + .append(pathSuffix); String path = filePath.toString(); try { sendObject(mio, path); @@ -269,7 +278,7 @@ public class MadisSeparator { "Could not write file or place message on queue!", e); } } - + /** * Cleans up any orphaned files that might be hanging around */ diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.manualIngest/src/com/raytheon/uf/edex/plugin/manualIngest/MessageGenerator.java b/edexOsgi/com.raytheon.uf.edex.plugin.manualIngest/src/com/raytheon/uf/edex/plugin/manualIngest/MessageGenerator.java index e072174c02..27d4b26f64 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.manualIngest/src/com/raytheon/uf/edex/plugin/manualIngest/MessageGenerator.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.manualIngest/src/com/raytheon/uf/edex/plugin/manualIngest/MessageGenerator.java @@ -40,7 +40,6 @@ import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.util.header.WMOHeaderFinder; import com.raytheon.uf.common.wmo.WMOTimeParser; import com.raytheon.uf.edex.core.EDEXUtil; -import com.raytheon.uf.edex.core.props.PropertiesFactory; import com.raytheon.uf.edex.distribution.DistributionPatterns; /** @@ -58,6 +57,7 @@ import com.raytheon.uf.edex.distribution.DistributionPatterns; * Sep 03, 2013 2327 rjpeter Added directory routing by plugin and date of product. * Apr 17, 2014 2942 skorolev Updated throw exception in sendFileToIngest. * May 14, 2014 2536 bclement removed TimeTools usage + * Jul 10, 2014 2914 garmendariz Remove EnvProperties * ** @@ -69,8 +69,7 @@ public class MessageGenerator implements Processor { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(MessageGenerator.class); - private static String DIR = PropertiesFactory.getInstance() - .getEnvProperties().getEnvValue("ARCHIVEDIR") + private static String DIR = System.getProperty("data.archive.root") + File.separator + "manual"; private static MessageGenerator instance = new MessageGenerator(); diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/ScanGenerator.java b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/ScanGenerator.java index 5a01e82a7a..4c96e8699e 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/ScanGenerator.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/ScanGenerator.java @@ -26,6 +26,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; +import com.raytheon.edex.site.SiteUtil; import com.raytheon.edex.urifilter.URIFilter; import com.raytheon.edex.urifilter.URIGenerateMessage; import com.raytheon.uf.common.dataplugin.message.DataURINotificationMessage; @@ -40,7 +41,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.edex.core.props.PropertiesFactory; import com.raytheon.uf.edex.cpgsrv.CompositeProductGenerator; import com.raytheon.uf.edex.dat.utils.DatMenuUtil; import com.raytheon.uf.edex.dat.utils.ScanDataCache; @@ -57,6 +57,7 @@ import com.raytheon.uf.edex.dat.utils.ScanDataCache; * Feb 25, 2013 1660 D. Hladky Fixed SCAN configuration bug. * Aug 30, 2013 2298 rjpeter Make getPluginName abstract * May 12, 2014 3133 njensen Remove unused field + * Jul 10, 2014 2914 garmendariz Remove EnvProperties * * * @@ -298,11 +299,9 @@ public class ScanGenerator extends CompositeProductGenerator implements resetFilters(); DatMenuUtil dmu = new DatMenuUtil(); - dmu.setDatSite(PropertiesFactory.getInstance().getEnvProperties() - .getEnvValue("SITENAME")); + dmu.setDatSite(SiteUtil.getSite()); dmu.setOverride(true); dmu.createMenus(); } } - } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.taf/res/conf/attributes.xml b/edexOsgi/com.raytheon.uf.edex.plugin.taf/res/conf/attributes.xml deleted file mode 100644 index 8d50a39b93..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.plugin.taf/res/conf/attributes.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - -