Module EDConfiguration :: Class EDConfiguration
[hide private]
[frames] | no frames]

Class EDConfiguration

source code

       object --+        
                |        
EDObject.EDObject --+    
                    |    
  EDLogging.EDLogging --+
                        |
                       EDConfiguration

This class handles the EDNA configuration XML files. The structure of the XML is described in the XSDataCommon data model.

If environment variable strings like "$XXX" or "${XXX}" is present in the configuration file, the strings are replaced with the corresponding environment variable content. For example, if "${CCP4} is present in the XML string, the string "${CCP4}" is replaced by the environment variable $CCP4 content.

Instance Methods [hide private]
 
__init__(self, _strFileName=None)
"Set up semaphore for thread safeness and dictionary for config files
source code
 
addConfigurationFile(self, _strFileName, _bReplace=True)
Loads an XML/JSON config file into the dictionary if not already loaded
source code
 
getPathToProjectConfigurationFile(self, _strPluginName)
This method returns the path to the Project configuration file.
source code
 
get(self, _strPluginName, default=None)
Returns the configuration for a given plugin as a dictionary.
source code
 
__contains__(self, key) source code
 
__getitem__(self, _strPluginName)
edConfig["myPlugin"] -> {}
source code
 
__setitem__(self, _strPluginName, plugin_config={})
edConfig["myPlugin"]= {"timeout":5}
source code
 
__len__(self) source code
 
getPluginListSize(self)
Returns the number of plugins configured
source code
 
getXSConfigurationItem(self, _strPluginName)
Method offering compatibility with XML structure: deprecated !!!
source code
 
setXSConfigurationItem(self, _xsPluginItem)
Compatibility with XML structure: deprecated
source code
 
getStringValue(self, _strPluginName, _strConfigurationName)
Get the configuration for one plugin and one config parameter, as a string
source code

Inherited from EDLogging.EDLogging: ASSERT, DEBUG, ERROR, WARNING, error, isVerboseDebug, log, screen, setAllLogLevels, setLogFileName, setLogFileOff, setLogLevel, setTestOff, setTestOn, setVerboseDebugOff, setVerboseDebugOn, setVerboseOff, setVerboseOn, unitTest, warning, writeErrorTrace

Inherited from EDObject.EDObject: getClassName, getId, getRunTime, getSemaphoreValue, getTimeEnd, getTimeInit, locked, setTimeEnd, setTimeInit, synchronizeOff, synchronizeOn

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
getStringParamValue(cls, _xsPluginItem, _pyStrParamName)
Returns the parameter value in a string format -> Deprecated
source code
 
getIntegerParamValue(cls, _xsPluginItem, _pyStrParamName)
Returns the parameter value in a integer format -> Deprecated
source code
Static Methods [hide private]
 
getParamItem(_xsPluginItem, _pyStrParamName)
Returns the corresponding 'paramItem' for a given plugin name -> Deprecated
source code
Class Variables [hide private]

Inherited from EDLogging.EDLogging (private): _EDObject__iId_class

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, _strFileName=None)
(Constructor)

source code 

"Set up semaphore for thread safeness and dictionary for config files

Overrides: object.__init__

getPathToProjectConfigurationFile(self, _strPluginName)

source code 

This method returns the path to the Project configuration file.

Parameters:
  • _strPluginName (python string) - Name of the module
Returns:
The path to the project configuration file

get(self, _strPluginName, default=None)

source code 

Returns the configuration for a given plugin as a dictionary.

If the plugin configuration is not in the cache the methods 'getPathToProjectConfigurationFile' and 'addConfigurationFile' are called for attempting to load the plugin configuration from a file (lazy loading).

Parameters:
  • _strPluginName - name of the plugin
  • default - optional default return value if plugin not loaded (e.g. {})
Returns:
configuration as a dict (or default value)

__setitem__(self, _strPluginName, plugin_config={})
(Index assignment operator)

source code 

edConfig["myPlugin"]= {"timeout":5}

Parameters:
  • _strPluginName - name of the plugin as a string
  • plugin_config - configuration of a whole plugin as a dict