Class: Iravat::IrAwsConfigManager
- Inherits:
-
Object
- Object
- Iravat::IrAwsConfigManager
- Defined in:
- lib/awsconf/ir_aws_config_manager.rb
Overview
require ‘./ir_module’
Instance Method Summary collapse
- #getPathFromXML(path) ⇒ Object
-
#initialize(confXMLPath = IRAVAT_AWS_CONFIG_XML_PATH) ⇒ IrAwsConfigManager
constructor
Constructor: takes default configuration from preconfigured path unless changed by caller.
- #loadConfigurationFile ⇒ Object
Constructor Details
#initialize(confXMLPath = IRAVAT_AWS_CONFIG_XML_PATH) ⇒ IrAwsConfigManager
Constructor: takes default configuration from preconfigured path unless changed by caller.
11 12 13 14 15 |
# File 'lib/awsconf/ir_aws_config_manager.rb', line 11 def initialize(confXMLPath=IRAVAT_AWS_CONFIG_XML_PATH) $ir_logger=IrLogger.new(IRAVAT_AWS_CONFIG_LOGGER) $logger=$ir_logger.getLog4rLogger() @confXMLPath=confXMLPath end |
Instance Method Details
#getPathFromXML(path) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/awsconf/ir_aws_config_manager.rb', line 34 def getPathFromXML(path) nodeSet= @xmlDom.xpath(path) if(nodeSet.nil?) $logger.error("Nothing present in path:" + path) return "" end #TODO Add multi node if(nodeSet.length() != 1) $logger.error("Bad XML configuration file:" + @confXMLPath + " for path " + path) return "" end return nodeSet[0].text end |
#loadConfigurationFile ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/awsconf/ir_aws_config_manager.rb', line 18 def loadConfigurationFile() begin @xmlDom = Nokogiri::XML(File.open(@confXMLPath).read) if(@xmlDom.nil?) #$log.error("XML DOM is null") $logger.error("AWS XML parsing resulted in error. Document is null.") end rescue Nokogiri::XML::SyntaxError # $log.error("Exception raised while parsing XML file") $logger.error("Exception raised while parsing XML file") return end end |