trinidad_valve_extension 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.4.0 (2011-09-22)
2
+
3
+ * Better error messaging when incorrect types or properties are configured
4
+
1
5
  == 0.3.0 (2011-09-20)
2
6
 
3
7
  * Correct hardcoded valve name to use variable
@@ -1,12 +1,12 @@
1
1
  module Trinidad
2
2
  module Extensions
3
3
  module Valve
4
- VERSION = '0.3'
4
+ VERSION = '0.4'
5
5
  end
6
6
 
7
7
  class ValveWebAppExtension < WebAppExtension
8
8
  def configure(tomcat, app_context)
9
- logger = app_context.logger
9
+ @logger = app_context.logger
10
10
 
11
11
  @options[:valves] ||= Array.new
12
12
 
@@ -16,14 +16,14 @@ module Trinidad
16
16
  class_name = valve_properties.delete 'className'
17
17
 
18
18
  if not class_name
19
- logger.warn("Tomcat valve defined without a 'className' attribute. Skipping valve definition: '#{valve_properties.inspect}'")
19
+ @logger.warn("Tomcat valve defined without a 'className' attribute. Skipping valve definition: '#{valve_properties.inspect}'")
20
20
  next
21
21
  end
22
22
 
23
23
  begin
24
24
  valve = get_valve(class_name)
25
25
  rescue NameError => e
26
- logger.warn("Tomcat valve '#{class_name}' not found. Ensure valve exists in your classpath")
26
+ @logger.warn("Tomcat valve '#{class_name}' not found. Ensure valve exists in your classpath")
27
27
  next
28
28
  end
29
29
 
@@ -42,7 +42,17 @@ module Trinidad
42
42
 
43
43
  def set_valve_properties(valve_instance, properties)
44
44
  properties.each do |option,value|
45
- valve_instance.send("#{option}=", replace_properties(value.to_s))
45
+ begin
46
+ if value.kind_of? String
47
+ value = replace_properties(value)
48
+ end
49
+ valve_instance.send("#{option}=", value)
50
+
51
+ rescue TypeError => e
52
+ @logger.warn("Incorrect type passed for property '#{option}' on valve '#{valve_instance.java_class}'. Skipping property")
53
+ rescue NoMethodError => e
54
+ @logger.warn("No settable property '#{option}' found on valve '#{valve_instance.java_class}'")
55
+ end
46
56
  end
47
57
  end
48
58
 
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'trinidad_valve_extension'
16
- s.version = '0.3'
17
- s.date = '2011-08-20'
16
+ s.version = '0.4'
17
+ s.date = '2011-08-22'
18
18
  s.rubyforge_project = 'trinidad_valve_extension'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
metadata CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 3
8
- version: "0.3"
7
+ - 4
8
+ version: "0.4"
9
9
  platform: ruby
10
10
  authors:
11
11
  - Michael Leinartas
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2011-08-20 00:00:00 -05:00
16
+ date: 2011-08-22 00:00:00 -05:00
17
17
  default_executable:
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency