Merge "Issue #3500 back port of loadConfig.py to fix gfe starup issue" into omaha_14.2.4

Former-commit-id: 4e6bbb4be4 [formerly 4e6bbb4be4 [formerly ae980bfccfedab3091b2708fae0dc36764dbffcb]]
Former-commit-id: 4285719a08
Former-commit-id: 6c3cafda59
This commit is contained in:
Ron Anderson 2014-08-25 14:04:41 -05:00 committed by Gerrit Code Review
commit 566db58f13

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