trinidad_generic_dbpool_extension 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,22 @@
1
+ == 0.3.0 (2011-07-01)
2
+
3
+ * Oracle connection pool extension
4
+ * Mssql connection pool extension
5
+ * Postgresql syntax error fix
6
+ * Add support for multiple pools per db extension
7
+
8
+ == 0.2.0 (2010-07-29)
9
+
10
+ * Update trinidad_dbpool_extension common gem to support Tomcat 7
11
+
12
+ == 0.1.1 (2010-05-05)
13
+
14
+ * Update trinidad_dbpool_extension common gem
15
+ * Remove adding jndi context and resource to the global tomcat context
16
+
17
+ == 0.1.0 (2010-04-04)
18
+
19
+ * First release
20
+ * General connection pool extension
21
+ * Mysql connection pool extension
22
+ * Postgresql connection pool extension
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009-2012 David Calavera
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,56 @@
1
+ = trinidad-dbpool
2
+
3
+ Trinidad extensions to support database connection pools configured into the Apache Tomcat
4
+ container.
5
+
6
+ == Pools supported
7
+
8
+ * MySql (trinidad_mysql_dbpool_extension)
9
+ * PostgreSQL (trinidad_postgresql_dbpool_extension)
10
+ * Mssql (trinidad_mssql_dbpool_extension)
11
+ * Oracle (trinidad_oracle_dbpool_extension)
12
+
13
+ == Usage
14
+
15
+ * Install the extension gem, ie: jruby -S gem install trinidad_mysql_dbpool_extension
16
+ * Configure the pool into the trinidad's configuration file, ie:
17
+
18
+ web_apps:
19
+ default:
20
+ extensions:
21
+ mysql_dbpool: # EXTENSION NAME AS KEY
22
+ jndi: 'jdbc/TestDB' # jndi name
23
+ username: 'root' # database username
24
+ password: 'root' # database password
25
+ url: 'jdbc:mysql://localhost:3306/javatest' # database url
26
+ maxActive: 100 # max nodes actives
27
+ maxIdle: 30 # max nodes idles
28
+ maxWait: 10000 # max nodes waiting
29
+
30
+ _jndi_, _username_, _password_ and _url_ are mandatory, while other
31
+ configuration options can be found here:
32
+
33
+ http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
34
+
35
+ http://commons.apache.org/dbcp/configuration.html
36
+
37
+ * Configure your rails application to use jndi into the config/database.yml
38
+
39
+ production:
40
+ adapter: jdbc
41
+ jndi: java:/comp/env/jdbc/TestDB
42
+ driver: com.mysql.jdbc.Driver # jdbc driver is mandatory
43
+
44
+ == Note on Patches/Pull Requests
45
+
46
+ * Fork the project.
47
+ * Make your feature addition or bug fix.
48
+ * Add tests for it. This is important so I don't break it in a
49
+ future version unintentionally.
50
+ * Commit, do not mess with rakefile, version, or history.
51
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
52
+ * Send me a pull request. Bonus points for topic branches.
53
+
54
+ == Copyright
55
+
56
+ Copyright (c) 2010 David Calavera. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,68 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ def build(gem)
5
+ mkdir_p 'pkg'
6
+ sh "gem build #{gem}.gemspec"
7
+ mv Dir["#{gem}*.gem"].last, 'pkg'
8
+ end
9
+
10
+ def release(gem, version = nil)
11
+ unless `git branch` =~ /^\* master$/
12
+ raise "must be on master to release !"
13
+ end
14
+
15
+ if version
16
+ unless gem_file = Dir.glob("pkg/#{gem}-#{version}.gem").first
17
+ raise "#{gem}-#{version}.gem not build !"
18
+ end
19
+ else
20
+ unless gem_file = Dir.glob("pkg/#{gem}*").sort.last
21
+ raise "#{gem}*.gem not build !"
22
+ end
23
+ unless match = gem_file.match(/.*?\-(\d\.\d\.\d)\.gem/)
24
+ raise "version number not matched from: #{gem_file}"
25
+ end
26
+ version = match[1]
27
+ end
28
+
29
+ sh "git tag #{gem}-#{version}"
30
+ sh "git push origin master --tags"
31
+ sh "gem push #{gem_file}"
32
+ end
33
+
34
+ all_gems = %W{ dbpool mysql_dbpool_extension postgresql_dbpool_extension mssql_dbpool_extension oracle_dbpool_extension }
35
+ all_gems.map! { |gem| "trinidad_#{gem}" }
36
+ all_gems.each do |gem_name|
37
+ namespace gem_name do
38
+ desc "Build the #{gem_name} gem"
39
+ task :build do
40
+ build(gem_name)
41
+ end
42
+ desc "Release the #{gem_name} gem"
43
+ task :release => :build do
44
+ release(gem_name)
45
+ end
46
+ end
47
+ end
48
+
49
+ {
50
+ :build => 'Build all connection pool gems',
51
+ :release => 'Release all connection pool gems'
52
+ }.each do |t, d|
53
+ desc d
54
+ task t => all_gems.map { |name| "#{name}:#{t}" } # e.g. mysql_dbpool:build
55
+ end
56
+
57
+ desc "Clear out all built .gem files"
58
+ task :clear do
59
+ FileUtils.rm Dir["*.gem"]
60
+ FileUtils.rm_r Dir["pkg/*"] if File.exist?("pkg")
61
+ end
62
+
63
+ require 'rspec/core/rake_task'
64
+ RSpec::Core::RakeTask.new(:spec) do |spec|
65
+ spec.rspec_opts = ['--color', "--format documentation"]
66
+ end
67
+
68
+ task :default => :spec
@@ -0,0 +1,13 @@
1
+ module Trinidad
2
+ module Extensions
3
+ class GenericDbpoolWebAppExtension < DbpoolWebAppExtension
4
+ def driver_name
5
+ nil
6
+ end
7
+
8
+ def protocol
9
+ 'jdbc:'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,2 @@
1
+ require 'trinidad_dbpool'
2
+ require 'trinidad_generic_dbpool_extension/generic_webapp_extension'
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: trinidad_generic_dbpool_extension
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - Patrick Cheng
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-05-25 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: trinidad_dbpool
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.3.0
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: rspec
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "2.10"
35
+ type: :development
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: mocha
39
+ prerelease: false
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0.10"
46
+ type: :development
47
+ version_requirements: *id003
48
+ description: Addon to support generic database pools in Trinidad
49
+ email:
50
+ - patrickyccheng@gmail.com
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files:
56
+ - LICENSE
57
+ - README.rdoc
58
+ files:
59
+ - lib/trinidad_generic_dbpool_extension.rb
60
+ - lib/trinidad_generic_dbpool_extension/generic_webapp_extension.rb
61
+ - History.txt
62
+ - LICENSE
63
+ - README.rdoc
64
+ - Rakefile
65
+ homepage: http://github.com/trinidad/trinidad_dbpool_extension
66
+ licenses: []
67
+
68
+ post_install_message:
69
+ rdoc_options: []
70
+
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: "0"
85
+ requirements: []
86
+
87
+ rubyforge_project:
88
+ rubygems_version: 1.8.15
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: Addon to support generic database pools in Trinidad
92
+ test_files: []
93
+