Issue #3500 back port of loadConfig.py to fix gfe starup issue

Change-Id: I841af0ac81b86e499c0b52dedab64431e7f1ecd7

Former-commit-id: 960eb2dc29 [formerly 4314f71387] [formerly cf671dcda8 [formerly 2a0af03242692708b3e752417ca7d60d28520768]]
Former-commit-id: cf671dcda8
Former-commit-id: f9756abf0a
This commit is contained in:
Brian Clements 2014-08-25 13:34:36 -05:00
parent d2c4e847ba
commit 253b14b895

View file

@ -26,31 +26,35 @@
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 12/11/09 njensen Initial Creation.
# 08/21/14 3500 bclement fixed loadPreferences except block
#
# 12/11/09 njensen Initial Creation.
# 04/02/2014 #2729 randerso Fixed error handling in loadPreferences
#
#
import types
import LogStream
from java.util import HashMap, ArrayList
from java.lang import String, Float, Integer, Boolean
def loadPreferences(config):
try:
# import the config file
if type(config) is types.StringType:
globals = loadConfig(config)
elif type(config) is types.ModuleType:
globals = getGlobals(config)
if type(config) is types.StringType:
configName = config
mod = __import__(config)
elif type(config) is types.ModuleType:
configName = config.__name__
mod = config
globals = getGlobals(mod)
from com.raytheon.viz.gfe import Activator, PythonPreferenceStore
prefs = PythonPreferenceStore(globals)
Activator.getDefault().setPreferenceStore(prefs)
return prefs
except Exception, e:
LogStream.logProblem("Unknown or improper config file: ", config)
import LogStream
import traceback
LogStream.logProblem("Unknown or invalid config file: %s\n%s" % (configName, traceback.format_exc()))
raise Exception, e