trinidad_sqlite_dbpool_extension 0.4.1

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.
data/History.txt ADDED
@@ -0,0 +1,40 @@
1
+ == 0.4.1 (2012-11-29)
2
+
3
+ * updated driver jars for following :
4
+ - trinidad_mysql_dbpool_extension
5
+ - trinidad_postgresql_dbpool_extension
6
+ - trinidad_mssql_dbpool_extension
7
+ * added trinidad_sqlite_dbpool_extension
8
+
9
+ == 0.4.0 (2012-05-31)
10
+
11
+ * revised trinidad_generic_dbpool_extension :
12
+ - driver configuration option aliased as driverName
13
+ - new driverPath option for specifying driver jar in configuration
14
+ - allow driverName to be auto resolved when driverPath specified
15
+ * trinidad_postgresql_dbpool_extension with driver updated to 9.1-902
16
+ * trinidad_mysql_dbpool_extension with mysql-connector-j 5.1.20
17
+ * code cleanup, get rid of jeweler, update tomcat-dbcp.jar for trinidad_dbpool
18
+
19
+ == 0.3.0 (2011-07-01)
20
+
21
+ * Oracle connection pool extension
22
+ * Mssql connection pool extension
23
+ * Postgresql syntax error fix
24
+ * Add support for multiple pools per db extension
25
+
26
+ == 0.2.0 (2010-07-29)
27
+
28
+ * Update trinidad_dbpool_extension common gem to support Tomcat 7
29
+
30
+ == 0.1.1 (2010-05-05)
31
+
32
+ * Update trinidad_dbpool_extension common gem
33
+ * Remove adding jndi context and resource to the global tomcat context
34
+
35
+ == 0.1.0 (2010-04-04)
36
+
37
+ * First release
38
+ * General connection pool extension
39
+ * Mysql connection pool extension
40
+ * Postgresql connection pool extension
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2012 Team Trinidad and contributors http://github.com/trinidad
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.
21
+
22
+ == JDBC Driver
23
+
24
+ Included JDBC drivers are most likely distributed under different terms than
25
+ those above, please make sure you understand your driver's license terms.
data/README.rdoc ADDED
@@ -0,0 +1,94 @@
1
+ = trinidad-dbpool
2
+
3
+ Trinidad extensions to support database connection pooling on top of the
4
+ underlying Apache Tomcat container.
5
+
6
+ Please note, that such pools are usually configured as "global" and thus
7
+ shareable by multiple applications deployed on to of Trinidad server.
8
+
9
+ == Available Pools
10
+
11
+ * MySQL (trinidad_mysql_dbpool_extension)
12
+ * PostgreSQL (trinidad_postgresql_dbpool_extension)
13
+ * MS-SQL (trinidad_mssql_dbpool_extension) using (unofficial) jTDS driver
14
+ * Oracle (trinidad_oracle_dbpool_extension)
15
+ * Generic (trinidad_generic_dbpool_extension) in case your DB ain't supported
16
+
17
+ == Usage
18
+
19
+ * Install the gem e.g. `jruby -S gem install trinidad_mysql_dbpool_extension`
20
+ * Configure the pool with Trinidad's configuration file e.g. :
21
+
22
+ web_apps:
23
+ default:
24
+ extensions:
25
+ mysql_dbpool: # EXTENSION NAME AS KEY
26
+ jndi: 'jdbc/TestDB' # JNDI name
27
+ username: 'root' # database username
28
+ password: 'root' # database password
29
+ url: 'localhost:3306/javatest' # database URL (or full jdbc: URL)
30
+ maxActive: 100 # max nodes actives
31
+ maxIdle: 30 # max nodes idles
32
+ maxWait: 10000 # max nodes waiting
33
+
34
+ _jndi_, _username_, _password_ and _url_ are mandatory,
35
+ while other supported configuration options might be found here:
36
+
37
+ http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
38
+
39
+ http://commons.apache.org/dbcp/configuration.html
40
+
41
+ * Configure your rails application to use JNDI into the config/database.yml
42
+
43
+ production:
44
+ adapter: jdbc
45
+ jndi: java:/comp/env/jdbc/TestDB
46
+ driver: com.mysql.jdbc.Driver # JDBC driver is mandatory here
47
+
48
+ == Generic Pool
49
+
50
+ If there's no "official" pool for your database, or would like to use a
51
+ different version of a JDBC driver for a supported Trinidad pool, this allows
52
+ you to completely customize a pool.
53
+
54
+ NOTE: You will need a JDBC driver for your database, check the driver DB if
55
+ unsure about how to get one http://developers.sun.com/product/jdbc/drivers
56
+
57
+ Sample configuration for a DB2 database :
58
+
59
+ ---
60
+ extensions:
61
+ generic_dbpool: # EXTENSION NAME AS KEY
62
+ jndi: 'jdbc/MyDB' # JNDI name
63
+ url: 'jdbc:db2://127.0.0.1:50000/MYDB' # specify full jdbc: URL
64
+ username: 'mydb' # database username
65
+ password: 'pass' # database password
66
+ driverPath: '/opt/IBM/DB2/db2jcc4.jar' # leave out if it's on class-path
67
+ driverName: com.ibm.db2.jcc.DB2Driver # might resolve from driverPath
68
+
69
+ Beyond standard configuration options there's 2 specific options here :
70
+
71
+ * _driverPath_ should be a path to your JDBC driver archive, if you're using a
72
+ --libs jar folder with trinidad, might leave that out but make sure it's on
73
+ the class-path for each and every deployed application that requires it.
74
+
75
+ Also in case driverPath: is ommited you'll need to specify a driverName: !
76
+
77
+ * _driverName_ the class name implementing the JDBC driver interface, if you're
78
+ not sure check the .jar for a META-INF/services/java.sql.Driver file. If
79
+ present that file contains the class-name and you might leave driverName:
80
+ blank if you specified the jar path using driverPath: but you're going still
81
+ going to need the driver name in your database.yml
82
+
83
+ == Note on Patches/Pull Requests
84
+
85
+ * Fork the project.
86
+ * Make your feature addition or bug fix.
87
+ * Add tests for it. This is important so I don't break it in a
88
+ future version unintentionally.
89
+ * Send me a pull request. Bonus points for topic branches.
90
+
91
+ == Copyright
92
+
93
+ Copyright (c) 2012 [Team Trinidad](https://github.com/trinidad).
94
+ See LICENSE (http://en.wikipedia.org/wiki/MIT_License) for details.
data/Rakefile ADDED
@@ -0,0 +1,76 @@
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{
35
+ dbpool
36
+ generic_dbpool_extension
37
+ mysql_dbpool_extension
38
+ postgresql_dbpool_extension
39
+ sqlite_dbpool_extension
40
+ mssql_dbpool_extension
41
+ oracle_dbpool_extension
42
+ }
43
+ all_gems.map! { |gem| "trinidad_#{gem}" }
44
+ all_gems.each do |gem_name|
45
+ namespace gem_name do
46
+ desc "Build the #{gem_name} gem"
47
+ task :build do
48
+ build(gem_name)
49
+ end
50
+ desc "Release the #{gem_name} gem"
51
+ task :release => :build do
52
+ release(gem_name)
53
+ end
54
+ end
55
+ end
56
+
57
+ {
58
+ :build => 'Build all connection pool gems',
59
+ :release => 'Release all connection pool gems'
60
+ }.each do |t, d|
61
+ desc d
62
+ task t => all_gems.map { |name| "#{name}:#{t}" } # e.g. mysql_dbpool:build
63
+ end
64
+
65
+ desc "Clear out all built .gem files"
66
+ task :clear do
67
+ FileUtils.rm Dir["*.gem"]
68
+ FileUtils.rm_r Dir["pkg/*"] if File.exist?("pkg")
69
+ end
70
+
71
+ require 'rspec/core/rake_task'
72
+ RSpec::Core::RakeTask.new(:spec) do |spec|
73
+ spec.rspec_opts = ['--color', "--format documentation"]
74
+ end
75
+
76
+ task :default => :spec
@@ -0,0 +1,3 @@
1
+ require 'trinidad_dbpool'
2
+ load File.expand_path('../../trinidad-libs/sqlite-jdbc-3.7.2.jar', __FILE__)
3
+ require 'trinidad_sqlite_dbpool_extension/sqlite_webapp_extension'
@@ -0,0 +1,13 @@
1
+ module Trinidad
2
+ module Extensions
3
+ class SqliteDbpoolWebAppExtension < DbpoolWebAppExtension
4
+ def driver_name
5
+ 'org.sqlite.JDBC'
6
+ end
7
+
8
+ def protocol
9
+ 'jdbc:sqlite://'
10
+ end
11
+ end
12
+ end
13
+ end
Binary file
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: trinidad_sqlite_dbpool_extension
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.4.1
6
+ platform: ruby
7
+ authors:
8
+ - Karol Bucek
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-11-29 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.4.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 Sqlite database pools in Trinidad
49
+ email: self@kares.org
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files:
55
+ - LICENSE
56
+ - README.rdoc
57
+ files:
58
+ - lib/trinidad_sqlite_dbpool_extension.rb
59
+ - lib/trinidad_sqlite_dbpool_extension/sqlite_webapp_extension.rb
60
+ - trinidad-libs/sqlite-jdbc-3.7.2.jar
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.24
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: Addon to support Sqlite database pools in Trinidad
92
+ test_files: []
93
+