trinidad_dbpool 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/History.txt +8 -0
- data/README.md +18 -14
- data/Rakefile +0 -1
- data/lib/trinidad_dbpool/webapp_extension.rb +25 -12
- data/lib/trinidad_dbpool.rb +1 -1
- data/trinidad-libs/tomcat-dbcp.jar +0 -0
- data/trinidad-libs/tomcat-jdbc.jar +0 -0
- metadata +8 -21
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 4f93eef63246340486ea0ecca09eb0d944cc9ca7
|
|
4
|
+
data.tar.gz: 3ec1c314d6ea8046125d506cfa364629248fffa6
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 846038f43082dbcb7e5f190921227284869a078062ecbe4185ca81dc3d1b20d9074404d42f9e9d180fa6193b1bfe7486f8171c0521b3b8a40bc5b457b40b6573
|
|
7
|
+
data.tar.gz: d334c5d8ecd37cf8b9b8ae7ef910b7eb86525e63d55051ca8b855988a1516cd78d19f3661cd24e1c03a9822fe160bcb79c814e23feb5b96e6c941b044acb1e7a
|
data/History.txt
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
== 0.7.0 (2013-12-11)
|
|
2
|
+
|
|
3
|
+
**NOTE:** tomcat-dbcp.jar contains patched Commons-DBCP pool implementation !
|
|
4
|
+
We're now switching to tomcat-jdbc.jar (which we kind of assumed we're using).
|
|
5
|
+
|
|
6
|
+
* packaged in tomcat-jdbc.jar (from 7.0.47) bundle version 1.1.0.1
|
|
7
|
+
* updated tomcat-dbcp.jar (keeping it for a while for compatibility)
|
|
8
|
+
|
|
1
9
|
== 0.5.0 (2013-06-28)
|
|
2
10
|
|
|
3
11
|
* updated tomcat-dbcp.jar to 7.0.41 ... due recent fixes in 7.0.39 / 7.0.40 :
|
data/README.md
CHANGED
|
@@ -29,23 +29,27 @@ http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html
|
|
|
29
29
|
web_apps:
|
|
30
30
|
default:
|
|
31
31
|
extensions:
|
|
32
|
-
mysql_dbpool:
|
|
33
|
-
jndi: 'jdbc/
|
|
34
|
-
url: 'localhost:3306/
|
|
35
|
-
username:
|
|
36
|
-
password:
|
|
37
|
-
maxActive:
|
|
38
|
-
|
|
39
|
-
maxWait:
|
|
32
|
+
mysql_dbpool: # EXTENSION NAME AS KEY
|
|
33
|
+
jndi: 'jdbc/MySampleDB' # name (linked with database.yml)
|
|
34
|
+
url: 'localhost:3306/sample' # database URL (or full jdbc: URL)
|
|
35
|
+
username: root
|
|
36
|
+
password: root
|
|
37
|
+
maxActive: 100 # maximum number of connections managed by the pool
|
|
38
|
+
initialSize: 10 # initial number of connections created in the pool
|
|
39
|
+
maxWait: 10000 # ms the pool waits for a connection to be returned
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
**jndi**, **url** are mandatory (as well **username** and **password** if your
|
|
43
43
|
database server + driver requires authentication), while other supported
|
|
44
|
-
configuration options might be found here in Tomcat's
|
|
44
|
+
configuration options might be found here in Tomcat's JDBC pool documentation :
|
|
45
45
|
|
|
46
|
-
http://tomcat.apache.org/tomcat-7.0-doc/
|
|
46
|
+
http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Common_Attributes
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
**NOTE:** starting version 0.7 we switched to using Tomcat's JDBC pool which
|
|
49
|
+
is simpler and more performant pool designed specifically for Tomcat/Trinidad.
|
|
50
|
+
|
|
51
|
+
If you insist on using [DBCP](http://commons.apache.org/dbcp/configuration.html)
|
|
52
|
+
set the (deprecated) *pool: dbcp* option along side your pool configuration ...
|
|
49
53
|
|
|
50
54
|
If you happen to be using *SQLite* on production you'll need an absolute path :
|
|
51
55
|
|
|
@@ -60,11 +64,11 @@ If you happen to be using *SQLite* on production you'll need an absolute path :
|
|
|
60
64
|
|
|
61
65
|
```yml
|
|
62
66
|
production:
|
|
63
|
-
adapter:
|
|
64
|
-
jndi: java:/comp/env/jdbc/
|
|
67
|
+
adapter: mysql
|
|
68
|
+
jndi: java:/comp/env/jdbc/MySampleDB
|
|
65
69
|
# (Java) JDBC driver class name is detected for built-in adapters that
|
|
66
70
|
# activerecord-jdbc-adapter supports, specify for a "generic" adapter
|
|
67
|
-
#driver: com.mysql.jdbc.Driver
|
|
71
|
+
# driver: com.mysql.jdbc.Driver
|
|
68
72
|
```
|
|
69
73
|
|
|
70
74
|
do not forget to delete **pool** setup part since there's no need for it ...
|
data/Rakefile
CHANGED
|
@@ -2,22 +2,35 @@ module Trinidad
|
|
|
2
2
|
module Extensions
|
|
3
3
|
class DbpoolWebAppExtension < WebAppExtension
|
|
4
4
|
|
|
5
|
-
def configure(tomcat,
|
|
5
|
+
def configure(tomcat, context)
|
|
6
6
|
case @options
|
|
7
7
|
when Hash
|
|
8
|
-
[create_resource(tomcat,
|
|
8
|
+
[create_resource(tomcat, context, @options)]
|
|
9
9
|
when Array
|
|
10
|
-
@options.map { |opts| create_resource tomcat,
|
|
10
|
+
@options.map { |opts| create_resource tomcat, context, opts }
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
protected
|
|
15
15
|
|
|
16
|
-
def create_resource tomcat,
|
|
16
|
+
def create_resource tomcat, context, options
|
|
17
17
|
jndi, url = options.delete(:jndi), options.delete(:url)
|
|
18
18
|
url = protocol + url unless %r{^#{protocol}} =~ url
|
|
19
19
|
options[:url] = url
|
|
20
20
|
|
|
21
|
+
resource_factory = options.key?(:factory) ? options.delete(:factory) :
|
|
22
|
+
'org.apache.tomcat.jdbc.pool.DataSourceFactory'
|
|
23
|
+
if pool = options.delete(:pool) # pool: dbcp (backwards compatibility)
|
|
24
|
+
begin
|
|
25
|
+
load File.expand_path("../../../trinidad-libs/tomcat-#{pool}.jar", __FILE__)
|
|
26
|
+
resource_factory = nil
|
|
27
|
+
rescue LoadError
|
|
28
|
+
context.logger.warn "The `pool: #{pool}` option is not supported, please remove it"
|
|
29
|
+
else
|
|
30
|
+
context.logger.info "Using deprecated `pool: #{pool}` configuration option, consider removing it"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
21
34
|
load_driver
|
|
22
35
|
|
|
23
36
|
driver_name = options.delete(:driver) || options.delete(:driverName) ||
|
|
@@ -31,16 +44,16 @@ module Trinidad
|
|
|
31
44
|
# maxActive="100" maxIdle="30" maxWait="10000"
|
|
32
45
|
# username="root" password="secret" />
|
|
33
46
|
resource = Trinidad::Tomcat::ContextResource.new
|
|
34
|
-
resource.set_auth(options.delete(:auth)) if options.
|
|
35
|
-
resource.set_description(options.delete(:description)) if options.
|
|
47
|
+
resource.set_auth(options.delete(:auth)) if options.key?(:auth)
|
|
48
|
+
resource.set_description(options.delete(:description)) if options.key?(:description)
|
|
36
49
|
resource.set_name(jndi)
|
|
37
|
-
resource.set_type('javax.sql.DataSource')
|
|
38
|
-
|
|
39
|
-
options.each { |key, value| resource.set_property(key.to_s, value.to_s) }
|
|
50
|
+
resource.set_type(options.delete(:type) || 'javax.sql.DataSource')
|
|
51
|
+
resource.set_property('factory', resource_factory) if resource_factory
|
|
40
52
|
resource.set_property('driverClassName', driver_name)
|
|
53
|
+
options.each { |key, value| resource.set_property(key.to_s, value.to_s) }
|
|
41
54
|
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
context.naming_resources.add_resource(resource)
|
|
56
|
+
context.naming_resources = resource.naming_resources
|
|
44
57
|
|
|
45
58
|
resource
|
|
46
59
|
end
|
|
@@ -49,4 +62,4 @@ module Trinidad
|
|
|
49
62
|
|
|
50
63
|
end
|
|
51
64
|
end
|
|
52
|
-
end
|
|
65
|
+
end
|
data/lib/trinidad_dbpool.rb
CHANGED
|
Binary file
|
|
Binary file
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trinidad_dbpool
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 0.7.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- David Calavera
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
11
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: trinidad_jars
|
|
@@ -18,29 +17,25 @@ dependencies:
|
|
|
18
17
|
- - '>='
|
|
19
18
|
- !ruby/object:Gem::Version
|
|
20
19
|
version: 1.2.4
|
|
21
|
-
none: false
|
|
22
20
|
requirement: !ruby/object:Gem::Requirement
|
|
23
21
|
requirements:
|
|
24
22
|
- - '>='
|
|
25
23
|
- !ruby/object:Gem::Version
|
|
26
24
|
version: 1.2.4
|
|
27
|
-
none: false
|
|
28
25
|
prerelease: false
|
|
29
26
|
type: :runtime
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: rspec
|
|
32
29
|
version_requirements: !ruby/object:Gem::Requirement
|
|
33
30
|
requirements:
|
|
34
|
-
- -
|
|
31
|
+
- - ~>
|
|
35
32
|
- !ruby/object:Gem::Version
|
|
36
33
|
version: '2.10'
|
|
37
|
-
none: false
|
|
38
34
|
requirement: !ruby/object:Gem::Requirement
|
|
39
35
|
requirements:
|
|
40
|
-
- -
|
|
36
|
+
- - ~>
|
|
41
37
|
- !ruby/object:Gem::Version
|
|
42
38
|
version: '2.10'
|
|
43
|
-
none: false
|
|
44
39
|
prerelease: false
|
|
45
40
|
type: :development
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
|
@@ -50,13 +45,11 @@ dependencies:
|
|
|
50
45
|
- - '>='
|
|
51
46
|
- !ruby/object:Gem::Version
|
|
52
47
|
version: '0.10'
|
|
53
|
-
none: false
|
|
54
48
|
requirement: !ruby/object:Gem::Requirement
|
|
55
49
|
requirements:
|
|
56
50
|
- - '>='
|
|
57
51
|
- !ruby/object:Gem::Version
|
|
58
52
|
version: '0.10'
|
|
59
|
-
none: false
|
|
60
53
|
prerelease: false
|
|
61
54
|
type: :development
|
|
62
55
|
description: Addon to support database pools in Trinidad
|
|
@@ -72,12 +65,14 @@ files:
|
|
|
72
65
|
- lib/trinidad_dbpool.rb
|
|
73
66
|
- lib/trinidad_dbpool/webapp_extension.rb
|
|
74
67
|
- trinidad-libs/tomcat-dbcp.jar
|
|
68
|
+
- trinidad-libs/tomcat-jdbc.jar
|
|
75
69
|
- README.md
|
|
76
70
|
- History.txt
|
|
77
71
|
- LICENSE
|
|
78
72
|
- Rakefile
|
|
79
73
|
homepage: http://github.com/trinidad/trinidad_dbpool_extension
|
|
80
74
|
licenses: []
|
|
75
|
+
metadata: {}
|
|
81
76
|
post_install_message:
|
|
82
77
|
rdoc_options: []
|
|
83
78
|
require_paths:
|
|
@@ -86,24 +81,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
86
81
|
requirements:
|
|
87
82
|
- - '>='
|
|
88
83
|
- !ruby/object:Gem::Version
|
|
89
|
-
segments:
|
|
90
|
-
- 0
|
|
91
84
|
version: '0'
|
|
92
|
-
hash: 2
|
|
93
|
-
none: false
|
|
94
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
86
|
requirements:
|
|
96
87
|
- - '>='
|
|
97
88
|
- !ruby/object:Gem::Version
|
|
98
|
-
segments:
|
|
99
|
-
- 0
|
|
100
89
|
version: '0'
|
|
101
|
-
hash: 2
|
|
102
|
-
none: false
|
|
103
90
|
requirements: []
|
|
104
91
|
rubyforge_project:
|
|
105
|
-
rubygems_version: 1.
|
|
92
|
+
rubygems_version: 2.1.9
|
|
106
93
|
signing_key:
|
|
107
|
-
specification_version:
|
|
94
|
+
specification_version: 4
|
|
108
95
|
summary: Addon to support database pools in Trinidad
|
|
109
96
|
test_files: []
|