diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleLoaderGetter.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleLoaderGetter.java deleted file mode 100644 index 74d9c3df01..0000000000 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleLoaderGetter.java +++ /dev/null @@ -1,83 +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.uf.viz.core.reflect; - -import org.eclipse.osgi.framework.internal.core.AbstractBundle; -import org.eclipse.osgi.framework.internal.core.BundleHost; -import org.eclipse.osgi.internal.loader.BundleLoader; -import org.eclipse.osgi.internal.loader.BundleLoaderProxy; -import org.eclipse.osgi.service.resolver.BundleDescription; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleReference; - -/** - * Utility class to get the BundleLoader object associated with a Bundle, to - * potentially synchronize against that object. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Aug 13, 2014 3500       bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - * @see BundleSynchronizer - */ -public class BundleLoaderGetter { - - private BundleLoaderGetter() { - } - - /** - * Attempts to retrieve the BundleLoader associated with the bundle. Returns - * the BundleLoader or null if it could not be retrieved. - * - * @param bundle - * the bundle to retrieve the associated BundleLoader for - * @return the BundleLoader or null - */ - @SuppressWarnings("restriction") - protected static BundleLoader getBundleLoader(Bundle bundle) { - BundleLoader rval = null; - if (bundle instanceof AbstractBundle) { - BundleDescription bundleDesc = ((AbstractBundle) bundle) - .getBundleDescription(); - if (bundleDesc != null) { - Object o = bundleDesc.getUserObject(); - if (!(o instanceof BundleLoaderProxy)) { - if (o instanceof BundleReference) - o = ((BundleReference) o).getBundle(); - if (o instanceof BundleHost) - o = ((BundleHost) o).getLoaderProxy(); - } - if (o instanceof BundleLoaderProxy) { - rval = ((BundleLoaderProxy) o).getBundleLoader(); - } - } - } - return rval; - } - -} diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleReflections.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleReflections.java index a39a53ddad..d965f88f5b 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleReflections.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleReflections.java @@ -49,6 +49,7 @@ import org.reflections.util.ConfigurationBuilder; * Jan 22, 2014 2062 bsteffen Handle bundles with no wiring. * Apr 16, 2014 3018 njensen Synchronize against BundleRepository * Aug 13, 2014 3500 bclement uses BundleSynchronizer + * Aug 22, 2014 3500 bclement removed sync on OSGi internals * * * @@ -61,17 +62,11 @@ public class BundleReflections { private final Reflections reflections; public BundleReflections(Bundle bundle, Scanner scanner) throws IOException { - final ConfigurationBuilder cb = new ConfigurationBuilder(); - final BundleWiring bundleWiring = bundle.adapt(BundleWiring.class); + ConfigurationBuilder cb = new ConfigurationBuilder(); + BundleWiring bundleWiring = bundle.adapt(BundleWiring.class); if (bundleWiring != null) { - BundleSynchronizer.runSynchedWithBundle(new Runnable() { - @Override - public void run() { - cb.addClassLoader(bundleWiring.getClassLoader()); - - } - }, bundle); + cb.addClassLoader(bundleWiring.getClassLoader()); cb.addUrls(FileLocator.getBundleFile(bundle).toURI().toURL()); cb.setScanners(scanner); diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleRepositoryGetter.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleRepositoryGetter.java deleted file mode 100644 index 36262c6311..0000000000 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleRepositoryGetter.java +++ /dev/null @@ -1,83 +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.uf.viz.core.reflect; - -import java.lang.reflect.Field; - -import org.eclipse.osgi.framework.internal.core.AbstractBundle; -import org.eclipse.osgi.framework.internal.core.BundleRepository; -import org.eclipse.osgi.framework.internal.core.Framework; -import org.osgi.framework.Bundle; - -/** - * Utility class to get the BundleRepository object associated with a Bundle, to - * potentially synchronize against that object. - * - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Apr 17, 2014            njensen     Initial creation
- * Aug 13, 2014 3500       bclement    moved documentation over to BundleSynchronizer
- * 
- * 
- * - * @author njensen - * @version 1.0 - * @see BundleSynchronizer - */ -public class BundleRepositoryGetter { - - private BundleRepositoryGetter() { - - } - - /** - * Attempts to retrieve the BundleRepository associated with the bundle's - * framework. Returns the BundleRepository or null if it could not be - * retrieved. - * - * @param bundle - * the bundle to retrieve the associated BundleRepository for - * @return the BundleRepository or null - */ - @SuppressWarnings("restriction") - protected static BundleRepository getFrameworkBundleRepository(Bundle bundle) { - BundleRepository bundleRepo = null; - if (bundle instanceof AbstractBundle) { - try { - AbstractBundle ab = (AbstractBundle) bundle; - Field bundleRepoField = Framework.getField(Framework.class, - BundleRepository.class, true); - bundleRepo = (BundleRepository) bundleRepoField.get(ab - .getFramework()); - } catch (Throwable t) { - // intentionally log to console and proceed anyway - t.printStackTrace(); - } - } - - return bundleRepo; - } - -} diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleSynchronizer.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleSynchronizer.java deleted file mode 100644 index 9f1db071c0..0000000000 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/BundleSynchronizer.java +++ /dev/null @@ -1,96 +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.uf.viz.core.reflect; - -import org.eclipse.osgi.framework.internal.core.BundleRepository; -import org.eclipse.osgi.internal.loader.BundleLoader; -import org.osgi.framework.Bundle; - -/** - * If a call to BundleWiring.getClassLoader() is invoked on a thread other than - * main/UI thread, then there is a possible deadlock if the application shuts - * down while the BundleWiring.getClassLoader() call is still going. The - * BundleLoader and BundleRepository of the Framework are the primary resources - * that are in contention in this deadlock scenario, due to the BundleRepository - * being used as a synchronization lock both deep in - * bundleWiring.getClassloader() and in Framework shutdown code. The other - * resource used as a synchronization lock and causing the deadlock is the - * BundleLoader associated with the bundle. When BundleLoader.findClass() is - * called, it results in a lock on the BundleLoader and then a lock on the - * BundleRepository. This happens when the DefaultClassLoader loads a class. - * - * Therefore to avoid this deadlock, if you are going to call - * BundleWiring.getClassLoader() you should attempt synchronize against the - * BundleLoader and the BundleRepository. This will ensure the call to - * getClassLoader() can finish and then release synchronization locks of both - * the BundleRepository and BundleLoader. - * - * If we fail to get the BundleLoader or BundleRepository, then you should - * proceed onwards anyway because the odds of the application shutting down at - * the same time as the call to BundleWiring.getClassLoader() is still running - * is low. Even if that occurs, the odds are further reduced that the two - * threads will synchronize against the BundleLoader and the BundleRepository at - * the same time and deadlock. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Aug 13, 2014 3500       bclement     Initial creation
- * 
- * 
- * - * @author bclement - * @version 1.0 - */ -public class BundleSynchronizer { - - private BundleSynchronizer() { - } - - /** - * Attempts to synchronize with the bundle's BundleLoader and - * BundleRepository objects before running the runner. If either the - * BundleLoader or the BundleRepository are unable to be retrieved from the - * bundle, the runner is ran anyway since the likelihood of a deadlock is - * relatively small. - * - * @param runner - * @param bundle - * @see BundleLoaderGetter#getBundleLoader(Bundle) - * @see BundleRepositoryGetter#getFrameworkBundleRepository(Bundle) - */ - protected static void runSynchedWithBundle(Runnable runner, Bundle bundle) { - BundleRepository repo = BundleRepositoryGetter - .getFrameworkBundleRepository(bundle); - BundleLoader loader = BundleLoaderGetter.getBundleLoader(bundle); - if (repo != null && loader != null) { - synchronized (loader) { - synchronized (repo) { - runner.run(); - } - } - } else { - runner.run(); - } - } -} diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java index a6c40caf79..e02f2dad87 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/reflect/SubClassLocator.java @@ -58,6 +58,7 @@ import com.raytheon.uf.viz.core.Activator; * Feb 03, 2013 2764 bsteffen Use OSGi API to get dependencies. * Apr 17, 2014 3018 njensen Synchronize against BundleRepository * Aug 13, 2014 3500 bclement uses BundleSynchronizer + * Aug 22, 2014 3500 bclement removed sync on OSGi internals * * * @@ -265,20 +266,12 @@ public class SubClassLocator implements ISubClassLocator { */ private Set> loadClassesFromCache(Bundle bundle, Collection classNames) { - final BundleWiring bundleWiring = bundle.adapt(BundleWiring.class); + BundleWiring bundleWiring = bundle.adapt(BundleWiring.class); if (bundleWiring == null) { return Collections.emptySet(); } - final ClassLoader[] loaderHolder = new ClassLoader[1]; - BundleSynchronizer.runSynchedWithBundle(new Runnable() { - @Override - public void run() { - loaderHolder[0] = bundleWiring.getClassLoader(); - } - }, bundle); - - ClassLoader loader = loaderHolder[0]; + ClassLoader loader = bundleWiring.getClassLoader(); if (loader == null) { return Collections.emptySet(); } diff --git a/cave/com.raytheon.viz.gfe/python/utility/loadConfig.py b/cave/com.raytheon.viz.gfe/python/utility/loadConfig.py index a81999cea6..8316ba36d8 100644 --- a/cave/com.raytheon.viz.gfe/python/utility/loadConfig.py +++ b/cave/com.raytheon.viz.gfe/python/utility/loadConfig.py @@ -27,11 +27,13 @@ # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- # 12/11/09 njensen Initial Creation. +# 08/21/14 3500 bclement fixed loadPreferences except block # # # import types +import LogStream from java.util import HashMap, ArrayList from java.lang import String, Float, Integer, Boolean @@ -48,8 +50,7 @@ def loadPreferences(config): Activator.getDefault().setPreferenceStore(prefs) return prefs except Exception, e: - LogStream.logProblem("Unknown or improper config file: ", - configFile, " for user: ", userName) + LogStream.logProblem("Unknown or improper config file: ", config) raise Exception, e diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/GfeClient.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/GfeClient.java index a5f28611f8..d68778ffbe 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/GfeClient.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/GfeClient.java @@ -62,6 +62,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; * which was adding an empty string into the * python path causing python to look in user's * current default directory for modules. + * Aug 22, 2014 3500 bclement override postStartupActions() * * * @@ -196,4 +197,17 @@ public class GfeClient extends AbstractCAVEComponent { return new HashSet(Arrays.asList("-site", "-server", "-mode", "-time")); } + + + /* (non-Javadoc) + * @see com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent#postStartupActions() + */ + @Override + protected void postStartupActions() { + /* + * GFE client does not require the default post startup actions (ie + * ProcedureXMLManager being initialized) + */ + } + } diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java index ffba76fc63..c2056fcca9 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java +++ b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java @@ -99,6 +99,7 @@ import com.raytheon.viz.core.units.UnitRegistrar; * startup * Dec 10, 2013 2602 bsteffen Start loading ProcedureXmlManager in * startComponent. + * Aug 22, 2014 3500 bclement moved ProcedureXMLManager initialization to postStartupActions() * * * @@ -259,7 +260,7 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent { startInternal(componentName); } - ProcedureXmlManager.inititializeAsync(); + postStartupActions(); if (workbenchAdvisor != null) { returnCode = PlatformUI.createAndRunWorkbench(display, @@ -303,6 +304,14 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent { return IApplication.EXIT_OK; } + /** + * perform any additional initialization after the component has been + * started + */ + protected void postStartupActions() { + ProcedureXmlManager.inititializeAsync(); + } + /** * Get the workbench advisor for the application * diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/python/GfePyIncludeUtil.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/python/GfePyIncludeUtil.java index 0c5e24fbd5..516fed06d6 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/python/GfePyIncludeUtil.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/python/GfePyIncludeUtil.java @@ -39,6 +39,7 @@ import com.raytheon.uf.common.util.FileUtil; * Feb 27, 2013 #1447 dgilling Re-factor based on PythonPathIncludeUtil. * Mar 11, 2013 #1759 dgilling Add method getGfeConfigLF(). * Sep 16, 2013 #1759 dgilling Move tests and autotests to GfeCavePyIncludeUtil. + * Aug 22, 2014 3500 bclement added python path in getConfigIncludePath() * * * @author njensen @@ -287,6 +288,7 @@ public class GfePyIncludeUtil extends PythonIncludePathUtil { } public static String getConfigIncludePath(boolean includeUser) { + String pythonPath = GfePyIncludeUtil.getCommonPythonIncludePath(); String baseDir = getPath(PATH_MANAGER.getContext( LocalizationType.CAVE_STATIC, LocalizationLevel.BASE), CONFIG); String siteDir = getPath(PATH_MANAGER.getContext( @@ -295,9 +297,10 @@ public class GfePyIncludeUtil extends PythonIncludePathUtil { String userDir = getPath(PATH_MANAGER.getContext( LocalizationType.CAVE_STATIC, LocalizationLevel.USER), CONFIG); - return PyUtil.buildJepIncludePath(userDir, siteDir, baseDir); + return PyUtil.buildJepIncludePath(userDir, siteDir, baseDir, + pythonPath); } else { - return PyUtil.buildJepIncludePath(siteDir, baseDir); + return PyUtil.buildJepIncludePath(siteDir, baseDir, pythonPath); } }