trinidad_valve_extension 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +33 -0
- data/lib/trinidad_valve_extension.rb +11 -6
- data/trinidad_valve_extension.gemspec +1 -1
- metadata +34 -47
data/README
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
Trinidad Valve Extension
|
2
|
+
========================
|
3
|
+
|
4
|
+
# DESCRIPTION
|
5
|
+
|
6
|
+
This is an extension to allow Tomcat valves to be configured and attached to webapps running under Trinidad. Any valve accessible within the classpath can be used. Built-in Tomcat valves are available without extra dependencies. A list of available built-in valves can be found at: http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html
|
7
|
+
|
8
|
+
# INSTALLATION
|
9
|
+
|
10
|
+
jruby -S gem install trinidad_valve_extension
|
11
|
+
|
12
|
+
# CONFIGURATION
|
13
|
+
|
14
|
+
This extension will configure valves from a list of hashes that contain the properties that configure each valve. 'className' is used to define what valve class is being configured, just as when configuring tomcat using the traditional context.xml
|
15
|
+
|
16
|
+
To enable the extension, add the 'valve' element to the 'extensions' key and define at least one valve. An example of an AccessLogValve:
|
17
|
+
|
18
|
+
---
|
19
|
+
extensions:
|
20
|
+
valve:
|
21
|
+
valves:
|
22
|
+
- className: "org.apache.catalina.valves.AccessLogValve"
|
23
|
+
directory: "log"
|
24
|
+
prefix: "access_log"
|
25
|
+
fileDateFormat: ".yyyy-MM-dd"
|
26
|
+
suffix: ".log"
|
27
|
+
pattern: "%h %l %u %t \"%r\" %s %b %T %S"
|
28
|
+
|
29
|
+
|
30
|
+
You can find further information on how to write your own extension in the wiki: http://wiki.github.com/calavera/trinidad/extensions
|
31
|
+
|
32
|
+
# Copyright
|
33
|
+
Copyright (c) 2011 Michael Leinartas. See LICENSE for details.
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module Trinidad
|
2
2
|
module Extensions
|
3
3
|
module Valve
|
4
|
-
VERSION = '0.
|
4
|
+
VERSION = '0.2'
|
5
5
|
end
|
6
6
|
|
7
7
|
class ValveWebAppExtension < WebAppExtension
|
8
8
|
def configure(tomcat, app_context)
|
9
|
-
|
9
|
+
logger = app_context.logger
|
10
10
|
|
11
11
|
@options[:valves] ||= Array.new
|
12
12
|
|
@@ -16,13 +16,13 @@ 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 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
|
-
rescue NameError => e
|
25
|
+
rescue NameError => e
|
26
26
|
logger.warn("Tomcat valve '#{class_name}' not found. Ensure valve exists in your classpath")
|
27
27
|
next
|
28
28
|
end
|
@@ -30,7 +30,7 @@ module Trinidad
|
|
30
30
|
set_valve_properties(valve, valve_properties)
|
31
31
|
|
32
32
|
# Add the valve to the context using the suggested getPipeline()
|
33
|
-
app_context.
|
33
|
+
app_context.pipeline.add_valve(valve)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -42,9 +42,14 @@ 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}=", value)
|
45
|
+
valve_instance.send("#{option}=", replace_properties(value.to_s))
|
46
46
|
end
|
47
47
|
end
|
48
|
+
|
49
|
+
def replace_properties(text)
|
50
|
+
java_import 'org.apache.tomcat.util.IntrospectionUtils'
|
51
|
+
IntrospectionUtils.replace_properties(text, java.lang.System.getProperties(), nil)
|
52
|
+
end
|
48
53
|
end
|
49
54
|
end
|
50
55
|
end
|
@@ -13,7 +13,7 @@ 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.
|
16
|
+
s.version = '0.2'
|
17
17
|
s.date = '2011-08-19'
|
18
18
|
s.rubyforge_project = 'trinidad_valve_extension'
|
19
19
|
|
metadata
CHANGED
@@ -1,45 +1,37 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: trinidad_valve_extension
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
version: "0.1"
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.2'
|
5
|
+
prerelease:
|
9
6
|
platform: ruby
|
10
|
-
authors:
|
7
|
+
authors:
|
11
8
|
- Michael Leinartas
|
12
9
|
autorequire:
|
13
10
|
bindir: bin
|
14
11
|
cert_chain: []
|
15
|
-
|
16
|
-
date: 2011-08-19 00:00:00 -05:00
|
12
|
+
date: 2011-08-19 00:00:00.000000000 -05:00
|
17
13
|
default_executable:
|
18
|
-
dependencies:
|
19
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
20
16
|
name: trinidad
|
21
|
-
|
22
|
-
|
23
|
-
requirements:
|
24
|
-
- -
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
segments:
|
27
|
-
- 1
|
28
|
-
- 1
|
29
|
-
- 0
|
17
|
+
requirement: &2153328980 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
30
22
|
version: 1.1.0
|
31
23
|
type: :runtime
|
32
|
-
|
33
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2153328980
|
26
|
+
description: Trinidad extension to add and configure Tomcat valves. Built-in Tomcat
|
27
|
+
valves are always available but any valve existing in the classpath can be used
|
34
28
|
email: mleinartas@gmail.com
|
35
29
|
executables: []
|
36
|
-
|
37
30
|
extensions: []
|
38
|
-
|
39
|
-
extra_rdoc_files:
|
31
|
+
extra_rdoc_files:
|
40
32
|
- README
|
41
33
|
- LICENSE
|
42
|
-
files:
|
34
|
+
files:
|
43
35
|
- History.txt
|
44
36
|
- LICENSE
|
45
37
|
- README
|
@@ -49,32 +41,27 @@ files:
|
|
49
41
|
has_rdoc: true
|
50
42
|
homepage: http://github.com/mleinart/trinidad_valve_extension
|
51
43
|
licenses: []
|
52
|
-
|
53
44
|
post_install_message:
|
54
|
-
rdoc_options:
|
45
|
+
rdoc_options:
|
55
46
|
- --charset=UTF-8
|
56
|
-
require_paths:
|
47
|
+
require_paths:
|
57
48
|
- lib
|
58
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
|
70
|
-
- 0
|
71
|
-
version: "0"
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
72
61
|
requirements: []
|
73
|
-
|
74
62
|
rubyforge_project: trinidad_valve_extension
|
75
|
-
rubygems_version: 1.
|
63
|
+
rubygems_version: 1.6.2
|
76
64
|
signing_key:
|
77
65
|
specification_version: 2
|
78
66
|
summary: Trinidad extension to add and configure Tomcat valves
|
79
67
|
test_files: []
|
80
|
-
|