Class: Fhcap::JavaConfig

Inherits:
FHConfig show all
Defined in:
lib/fhcap/misc/java_config.rb

Instance Attribute Summary

Attributes inherited from FHConfig

#config, #file, #node

Instance Method Summary collapse

Methods inherited from FHConfig

#add, #attribute_file_content, #from_attributes_file, #has_upper_recipe_override, #is_json?, #parse_value, #to_chef_attributes

Constructor Details

#initializeJavaConfig

Returns a new instance of JavaConfig.



7
8
9
# File 'lib/fhcap/misc/java_config.rb', line 7

def initialize
  super
end

Instance Method Details

#from_file(filename, force = false, overrides = []) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fhcap/misc/java_config.rb', line 11

def from_file(filename, force=false, overrides=[])
  if File.exists?(filename) && File.readable?(filename)
    props = JavaProperties::Properties.new(filename)
    props.each do |key, value|
      key = key.to_s
      add(parse_key(key).split("."), value, force, overrides)
    end
  else
    raise IOError, "Cannot open or read #{filename}!"
  end
end

#parse_key(key) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fhcap/misc/java_config.rb', line 23

def parse_key(key)
  case key
    when 'feedhenry.domainsuffix'
      return 'feedhenry.domainsuffix.external'
    when 'digger.polling'
      return 'digger.polling.enabled'
    when 'fh.autosetup'
      return 'fh.autosetup.enabled'
    else
      return key
  end
end