caruby-core 2.1.2 → 2.1.3

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.md CHANGED
@@ -1,6 +1,10 @@
1
1
  This history lists major release themes. See the GitHub Commits (https://github.com/caruby/core)
2
2
  for change details.
3
3
 
4
+ 2.1.3 / 2012-06-18
5
+ ------------------
6
+ * Split up access properties.
7
+
4
8
  2.1.2 / 2012-06-12
5
9
  ------------------
6
10
  * Support caSmall.
data/LEGAL CHANGED
@@ -1,5 +1,4 @@
1
1
  LEGAL NOTICE INFORMATION
2
2
  ------------------------
3
-
4
3
  All the files in this distribution are covered under either the MIT
5
4
  license (see the file LICENSE).
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Oregon Health & Science University
1
+ Copyright (c) 2012 Oregon Health & Science University
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
data/README.md CHANGED
@@ -1,20 +1,17 @@
1
1
  caRuby: Simplifying caBIG(TM)
2
2
  =============================
3
-
4
3
  **Home**: [http://caruby.rubyforge.org](http://caruby.rubyforge.org)
5
4
  **Git**: [http://github.com/caruby/core](http://github.com/caruby/core)
6
5
  **Author**: OHSU Knight Cancer Institute
7
- **Copyright**: 2010, 2011
6
+ **Copyright**: 2012
8
7
  **License**: MIT License
9
8
 
10
9
  Synopsis
11
10
  --------
12
-
13
11
  caRuby presents a JRuby facade that simplifies interaction with caBIG applications.
14
12
 
15
13
  Feature List
16
14
  ------------
17
-
18
15
  1. caCORE API wrapper.
19
16
 
20
17
  2. Resolves persistence dependencies.
@@ -32,12 +29,10 @@ is installed.
32
29
 
33
30
  Usage
34
31
  -----
35
-
36
32
  See the project [Home](http://caruby.rubyforge.org) Page for usage examples.
37
33
 
38
34
  Copyright
39
35
  ---------
40
-
41
- caRuby © 2010, 2011 by [Oregon Health & Science University](http://www.ohsu.edu/xd/health/services/cancer/index.cfm).
36
+ caRuby © 2012 by [Oregon Health & Science University](http://www.ohsu.edu/xd/health/services/cancer/index.cfm).
42
37
  caRuby is licensed under the MIT license. Please see the LICENSE and LEGAL
43
38
  files for more information.
@@ -6,6 +6,19 @@ module CaRuby
6
6
  # Use of this class requires the dbi gem.
7
7
  # SQLExecutor is an auxiliary utility class and is not used by the rest of the CaRuby API.
8
8
  class SQLExecutor
9
+ # The database connection access options.
10
+ ACCESS_OPTS = [
11
+ [:database_host, '--database_host HOST', 'the database host name'],
12
+ [:database_port, '--database_port PORT', Integer, 'the database port number'],
13
+ [:database, '--database NAME', 'the database name'],
14
+ [:database_url, '--database_url URL', 'the database connection URL'],
15
+ [:database_type, '--database_type TYPE', 'the database type (mysql or oracle)'],
16
+ [:database_driver, '--database_driver DRIVER', 'the database driver string'],
17
+ [:database_driver_class, '--database_driver_class CLASS', 'the JDBC database driver class name'],
18
+ [:database_user, '--database_user USER', 'the database login user'],
19
+ [:database_password, '--database_password PSWD', 'the database login password']
20
+ ]
21
+
9
22
  # Creates a new SQLExecutor with the given options.
10
23
  #
11
24
  # The default database host is the application :host property value, which in turn
@@ -18,19 +31,19 @@ module CaRuby
18
31
  # The default database driver class is +com.mysql.jdbc.Driver+ for MySQL,
19
32
  # +oracle.jdbc.OracleDriver+ for Oracle.
20
33
  #
21
- # The default database URI is +dbi:+_db_driver_+://+_db_host_+:+_db_port_+/+_db_name_.
34
+ # The default database url is +_db_driver_+://+_db_host_+:+_db_port_+/+_db_name_.
22
35
  #
23
36
  # @param [Hash] opts the connect options
24
- # @option opts [String] :database the mandatory database name
25
- # @option opts [String] :database_user the mandatory database username (not the application login name)
26
- # @option opts [String] :database_password the optional database password (not the application login password)
27
- # @option opts [String] :database_type the optional database type (default +mysql+)
28
- # @option opts [String] :database_host the optional database host
29
- # @option opts [Integer] :database_port the optional database port number
30
- # @option opts [String] :database_driver the optional DBI connect driver string, e.g. +jdbc:mysql+
31
- # @option opts [String] :database_url the optional database connection URL
32
- # @option opts [String] :database_driver_class the optional DBI connect driver class name
33
- # @raise [CaRuby::ConfigurationError] if an option is invalid
37
+ # @option opts [String] :database the database name
38
+ # @option opts [String] :database_user the database username (not the application login name)
39
+ # @option opts [String] :database_password the database password (not the application login password)
40
+ # @option opts [String] :database_type the database type (default +mysql+)
41
+ # @option opts [String] :database_host the database host
42
+ # @option opts [Integer] :database_port the database port number
43
+ # @option opts [String] :database_driver the JDBC driver string, e.g. +jdbc:mysql+
44
+ # @option opts [String] :database_url the database connection URL
45
+ # @option opts [String] :database_driver_class the connect driver class name
46
+ # @raise [CaRuby::ConfigurationError] if neither the database url nor its constituent options are specified
34
47
  def initialize(opts)
35
48
  if opts.empty? then
36
49
  raise CaRuby::ConfigurationError.new("The caRuby database connection properties were not found.")
@@ -50,9 +63,8 @@ module CaRuby
50
63
  raise_missing_option_error(:database)
51
64
  end
52
65
  end
53
- @dbi_url = 'dbi:' + @db_url
54
66
  @username = Options.get(:database_user, opts) { raise_missing_option_error(:database_user) }
55
- @password = Options.get(:database_password, opts)
67
+ @password = Options.get(:database_password, opts) { raise_missing_option_error(:database_password) }
56
68
  @driver_class = Options.get(:database_driver_class, opts, default_driver_class(db_type))
57
69
  # The effective connection options.
58
70
  eff_opts = {
@@ -10,6 +10,7 @@ require 'caruby/database/operation'
10
10
  require 'caruby/database/reader'
11
11
  require 'caruby/database/writer'
12
12
  require 'caruby/database/persistifier'
13
+ require 'caruby/database/sql_executor'
13
14
 
14
15
  module CaRuby
15
16
  # Database operation error.
@@ -41,22 +42,13 @@ module CaRuby
41
42
  class Database
42
43
  include Reader, Writer, Persistifier
43
44
 
44
- # The application and database connection access command line options.
45
+ # The application and database connection options.
45
46
  ACCESS_OPTS = [
46
47
  [:user, '-u USER', '--user USER', 'the application login user'],
47
48
  [:password, '-p PSWD', '--password PSWD', 'the application login password'],
48
49
  [:host, '--host HOST', 'the application host name'],
49
50
  [:port, '--port PORT', 'the application port number'],
50
- [:classpath, '--classpath PATH', 'the application client classpath'],
51
- [:database_host, '--database_host HOST', 'the database host name'],
52
- [:database_port, '--database_port PORT', Integer, 'the database port number'],
53
- [:database, '--database NAME', 'the database name'],
54
- [:database_url, '--database_url URL', 'the database connection URL'],
55
- [:database_type, '--database_type TYPE', 'the database type (mysql or oracle)'],
56
- [:database_driver, '--database_driver DRIVER', 'the database driver string'],
57
- [:database_driver_class, '--database_driver_class CLASS', 'the database driver class name'],
58
- [:database_user, '--database_user USER', 'the database login user'],
59
- [:database_password, '--database_password PSWD', 'the database login password']
51
+ [:classpath, '--classpath PATH', 'the application client classpath']
60
52
  ]
61
53
 
62
54
  attr_reader :operations
@@ -1,3 +1,3 @@
1
1
  module CaRuby
2
- VERSION = "2.1.2"
2
+ VERSION = "2.1.3"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: caruby-core
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.1.2
5
+ version: 2.1.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - OHSU
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-06-12 00:00:00 Z
13
+ date: 2012-07-17 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler