rboss 0.6.0 → 0.6.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.
Files changed (53) hide show
  1. data/README.md +2 -2
  2. data/bin/jboss-profile +1 -1
  3. data/bin/rboss-cli +8 -2
  4. data/bin/twiddle +3 -3
  5. data/lib/rboss.rb +6 -2
  6. data/lib/rboss/bin/command_actions.rb +3 -2
  7. data/lib/rboss/cli/jboss_cli.rb +3 -3
  8. data/lib/rboss/cli/mappings.rb +12 -2
  9. data/lib/rboss/cli/mappings/resources/connector.yaml +10 -35
  10. data/lib/rboss/cli/mappings/resources/datasource.yaml +19 -26
  11. data/lib/rboss/cli/mappings/resources/jdbc_driver.yaml +0 -1
  12. data/lib/rboss/cli/mappings/resources/server.yaml +151 -34
  13. data/lib/rboss/cli/resource.rb +18 -10
  14. data/lib/rboss/component_processor.rb +87 -85
  15. data/lib/rboss/components/component.rb +2 -2
  16. data/lib/rboss/components/datasource.rb +1 -1
  17. data/lib/rboss/components/deploy_folder.rb +1 -1
  18. data/lib/rboss/components/hypersonic_replacer.rb +1 -1
  19. data/lib/rboss/components/jbossweb.rb +1 -1
  20. data/lib/rboss/components/jmx.rb +1 -1
  21. data/lib/rboss/components/mod_cluster.rb +1 -1
  22. data/lib/rboss/components/org/6.0/deploy_folder.rb +1 -1
  23. data/lib/rboss/components/org/jmx.rb +1 -1
  24. data/lib/rboss/components/profile_folder.rb +1 -1
  25. data/lib/rboss/components/resource.rb +1 -1
  26. data/lib/rboss/components/restore_slimming.rb +3 -3
  27. data/lib/rboss/components/run_conf.rb +4 -4
  28. data/lib/rboss/components/service_script.rb +1 -1
  29. data/lib/rboss/components/slimming.rb +1 -1
  30. data/lib/rboss/components/soa-p/hypersonic_replacer.rb +1 -1
  31. data/lib/rboss/components/soa-p/jmx.rb +1 -1
  32. data/lib/rboss/components/xadatasource.rb +2 -2
  33. data/lib/rboss/file_processor.rb +70 -66
  34. data/lib/rboss/jboss_path.rb +1 -1
  35. data/lib/rboss/jboss_profile.rb +28 -27
  36. data/lib/rboss/plaftorm.rb +64 -0
  37. data/lib/rboss/resources/run.conf.bat.erb +60 -0
  38. data/lib/rboss/twiddle/base_monitor.rb +2 -2
  39. data/lib/rboss/twiddle/mbean.rb +1 -1
  40. data/lib/rboss/twiddle/monitor.rb +26 -39
  41. data/lib/rboss/twiddle/twiddle.rb +3 -2
  42. data/lib/rboss/utils.rb +0 -62
  43. data/lib/rboss/version.rb +1 -1
  44. data/lib/rboss/view/colorizers.rb +20 -0
  45. data/lib/rboss/view/formatters.rb +21 -0
  46. data/lib/rboss/view/health_checkers.rb +41 -0
  47. data/lib/rboss/view/table_builder.rb +93 -0
  48. data/test/test_helper.rb +1 -1
  49. metadata +8 -6
  50. data/lib/rboss/cli.rb +0 -22
  51. data/lib/rboss/cli/colorizers.rb +0 -22
  52. data/lib/rboss/cli/formatters.rb +0 -17
  53. data/lib/rboss/cli/health_checkers.rb +0 -43
@@ -22,7 +22,7 @@
22
22
 
23
23
  require_relative 'component'
24
24
 
25
- module JBoss
25
+ module RBoss
26
26
  # A class for slimming a JBoss profile
27
27
  #
28
28
  # Configuration:
@@ -22,7 +22,7 @@
22
22
 
23
23
  require 'fileutils'
24
24
 
25
- module JBoss
25
+ module RBoss
26
26
 
27
27
  # A class to replace Hypersonic in SOA-P. This class makes a build.properties file
28
28
  # and calls the ant script present in $JBOSS_HOME/tools/schema/build.xml since this
@@ -24,7 +24,7 @@
24
24
  # for compatibillity with JBoss SOA-P
25
25
  #
26
26
  # author: Marcelo Guimarães <ataxexe@gmail.com>
27
- module JBoss
27
+ module RBoss
28
28
  class JMX
29
29
 
30
30
  def defaults
@@ -28,13 +28,13 @@ require "rexml/document"
28
28
 
29
29
  include REXML
30
30
 
31
- module JBoss
31
+ module RBoss
32
32
 
33
33
  # A class to configure a JBoss XADatasource.
34
34
  #
35
35
  # The configuration will change a <xa-datasource-property> value.
36
36
  #
37
- # Configuration attributes are the same as for a JBoss::Datasource
37
+ # Configuration attributes are the same as for a RBoss::Datasource
38
38
  #
39
39
  # author: Marcelo Guimarães <ataxexe@gmail.com>
40
40
  class XADatasource < Datasource
@@ -25,83 +25,87 @@ require "fileutils"
25
25
  require "ostruct"
26
26
  require "logger"
27
27
 
28
- class FileProcessor
29
-
30
- def initialize opts = {}
31
- @logger = opts[:logger]
32
- @var = opts[:var]
33
- @logger ||= Logger::new(STDOUT)
34
- @handlers = {
35
- :plain => {
36
- :load => lambda do |file|
37
- @logger.info "Loading file #{file}"
38
- File.read(file)
39
- end,
40
- :store => lambda do |file, content|
41
- @logger.info "Saving file #{file}"
42
- File.open(file, 'w+') { |f| f.write (content) }
43
- end
44
- },
45
- :xml => {
46
- :load => lambda do |file|
47
- @logger.info "Parsing file #{file}"
48
- REXML::Document::new File::new(file)
49
- end,
50
-
51
- :store => lambda do |file, xml|
52
- @logger.info "Saving file #{file}"
53
- content = ''
54
- formatter = REXML::Formatters::Pretty::new 2
55
- formatter.write xml, content
56
- File.open(file, 'w+') { |f| f.write content }
57
- end
28
+ module RBoss
29
+
30
+ class FileProcessor
31
+
32
+ def initialize opts = {}
33
+ @logger = opts[:logger]
34
+ @var = opts[:var]
35
+ @logger ||= Logger::new(STDOUT)
36
+ @handlers = {
37
+ :plain => {
38
+ :load => lambda do |file|
39
+ @logger.info "Loading file #{file}"
40
+ File.read(file)
41
+ end,
42
+ :store => lambda do |file, content|
43
+ @logger.info "Saving file #{file}"
44
+ File.open(file, 'w+') { |f| f.write (content) }
45
+ end
46
+ },
47
+ :xml => {
48
+ :load => lambda do |file|
49
+ @logger.info "Parsing file #{file}"
50
+ REXML::Document::new File::new(file)
51
+ end,
52
+
53
+ :store => lambda do |file, xml|
54
+ @logger.info "Saving file #{file}"
55
+ content = ''
56
+ formatter = REXML::Formatters::Pretty::new 2
57
+ formatter.write xml, content
58
+ File.open(file, 'w+') { |f| f.write content }
59
+ end
60
+ }
58
61
  }
59
- }
60
62
 
61
- @actions = {}
62
- end
63
+ @actions = {}
64
+ end
63
65
 
64
- def register type, actions
65
- @handlers[type] = actions
66
- end
66
+ def register type, actions
67
+ @handlers[type] = actions
68
+ end
67
69
 
68
- def with file, type = :plain
69
- @current_file = file.to_s
70
- @actions[@current_file] = {}
71
- to_load &@handlers[type][:load]
72
- to_store &@handlers[type][:store]
73
- yield self
74
- end
70
+ def with file, type = :plain
71
+ @current_file = file.to_s
72
+ @actions[@current_file] = {}
73
+ to_load &@handlers[type][:load]
74
+ to_store &@handlers[type][:store]
75
+ yield self
76
+ end
75
77
 
76
- def copy_to file
77
- @actions[@current_file][:copy] = file.to_s
78
- end
78
+ def copy_to file
79
+ @actions[@current_file][:copy] = file.to_s
80
+ end
79
81
 
80
- def return
81
- @actions[@current_file][:return] = true
82
- end
82
+ def return
83
+ @actions[@current_file][:return] = true
84
+ end
83
85
 
84
- def to_load &block
85
- @actions[@current_file][:to_load] = block
86
- end
86
+ def to_load &block
87
+ @actions[@current_file][:to_load] = block
88
+ end
87
89
 
88
- def to_store &block
89
- @actions[@current_file][:to_store] = block
90
- end
90
+ def to_store &block
91
+ @actions[@current_file][:to_store] = block
92
+ end
91
93
 
92
- def to_process &block
93
- @actions[@current_file][:to_process] = block
94
- end
94
+ def to_process &block
95
+ @actions[@current_file][:to_process] = block
96
+ end
95
97
 
96
- def process
97
- @actions.each do |file, action|
98
- action[:obj] = action[:to_load].call file
99
- @logger.info "Processing file #{file}"
100
- action[:obj] = action[:to_process].call(action[:obj], @var) if action[:obj]
101
- file = action[:copy] if action[:copy]
102
- return action[:obj] if action[:return]
103
- action[:to_store].call file, action[:obj]
98
+ def process
99
+ @actions.each do |file, action|
100
+ action[:obj] = action[:to_load].call file
101
+ @logger.info "Processing file #{file}"
102
+ action[:obj] = action[:to_process].call(action[:obj], @var) if action[:obj]
103
+ file = action[:copy] if action[:copy]
104
+ return action[:obj] if action[:return]
105
+ action[:to_store].call file, action[:obj]
106
+ end
104
107
  end
108
+
105
109
  end
106
110
 
107
111
  end
@@ -22,7 +22,7 @@
22
22
 
23
23
  require "logger"
24
24
 
25
- module JBoss
25
+ module RBoss
26
26
 
27
27
  # A class that represents the JBoss structure.
28
28
  #
@@ -30,14 +30,14 @@ require "yummi"
30
30
  require "ostruct"
31
31
  require "fileutils"
32
32
 
33
- module JBoss
33
+ module RBoss
34
34
 
35
35
  # A Class to configure a JBoss Profile
36
36
  #
37
37
  # Basically, this class is a Component Processor with some components added to configure a JBoss profile, the built-in
38
38
  # components are:
39
39
  #
40
- # :deploy_folder => binded to a JBoss::DeployFolder
40
+ # :deploy_folder => binded to a RBoss::DeployFolder
41
41
  #
42
42
  # :cluster => a shortcut component for :run_conf, sends these attributes to it:
43
43
  # :multicast_ip => default "239.255.0.1"
@@ -52,18 +52,18 @@ module JBoss
52
52
  # To :init_script
53
53
  # :address => default "localhost", sends as :bind_address
54
54
  #
55
- # :resource => binded to a JBoss::Resource
55
+ # :resource => binded to a RBoss::Resource
56
56
  #
57
- # :jmx => binded to a JBoss::JMX, enabled by default and sends user and password
57
+ # :jmx => binded to a RBoss::JMX, enabled by default and sends user and password
58
58
  # values to :init_script
59
59
  #
60
- # :datasource => binded to a JBoss::Datasource
60
+ # :datasource => binded to a RBoss::Datasource
61
61
  #
62
- # :xa_datasource => binded to a JBoss::XADatasource
62
+ # :xa_datasource => binded to a RBoss::XADatasource
63
63
  #
64
- # :default_ds => binded to a JBoss::HypersonicReplacer
64
+ # :default_ds => binded to a RBoss::HypersonicReplacer
65
65
  #
66
- # :mod_cluster => binded to a JBoss::ModCluster
66
+ # :mod_cluster => binded to a RBoss::ModCluster
67
67
  # Defaults:
68
68
  # :path => "resources/mod_cluster.sar"
69
69
  # Move to :run_conf (for externalizing mod_cluster configuration)
@@ -74,16 +74,16 @@ module JBoss
74
74
  # :excluded_contexts
75
75
  # :auto_enable_contexts
76
76
  #
77
- # :run_conf => binded to a JBoss::RunConf
77
+ # :run_conf => binded to a RBoss::RunConf
78
78
  # Defaults:
79
79
  # :path => 'resources/run.conf.erb'
80
80
  # :stack_size => '128k'
81
81
  # :heap_size => '2048m'
82
82
  # :perm_size => '256m'
83
83
  #
84
- # :slimming => binded to a JBoss::Slimming
84
+ # :slimming => binded to a RBoss::Slimming
85
85
  #
86
- # :init_script => binded to a JBoss::ServiceScritp
86
+ # :init_script => binded to a RBoss::ServiceScritp
87
87
  # Defaults:
88
88
  # :path => 'resources/jboss_init_redhat.sh'
89
89
  # :jmx_user => "admin"
@@ -94,7 +94,8 @@ module JBoss
94
94
  # :jboss_user => "RUNASIS"
95
95
  #
96
96
  # author Marcelo Guimarães <ataxexe@gmail.com>
97
- class Profile < ComponentProcessor
97
+ class Profile < RBoss::ComponentProcessor
98
+ include RBoss::Platform
98
99
 
99
100
  # Priorities for components
100
101
  @@pre_install = 0
@@ -133,7 +134,7 @@ module JBoss
133
134
  end
134
135
  @profile = @opts[:profile].to_s
135
136
  @base_profile = @opts[:base_profile].to_s
136
- @jboss = JBoss::Path::new @jboss_home,
137
+ @jboss = RBoss::Path::new @jboss_home,
137
138
  :profile => @profile,
138
139
  :type => @opts[:type],
139
140
  :version => @opts[:version],
@@ -237,25 +238,25 @@ module JBoss
237
238
  }
238
239
 
239
240
  register :profile_folder,
240
- :type => JBoss::ProfileFolder,
241
+ :type => RBoss::ProfileFolder,
241
242
  :priority => @@install
242
243
 
243
244
  register :deploy_folder,
244
245
 
245
- :type => JBoss::DeployFolder,
246
+ :type => RBoss::DeployFolder,
246
247
  :priority => @@post_install,
247
248
  :multiple_instances => true
248
249
 
249
250
 
250
251
  register :resource,
251
252
 
252
- :type => JBoss::Resource,
253
+ :type => RBoss::Resource,
253
254
  :priority => @@pre_setup,
254
255
  :multiple_instances => true
255
256
 
256
257
  register :jmx,
257
258
 
258
- :type => JBoss::JMX,
259
+ :type => RBoss::JMX,
259
260
  :priority => @@setup,
260
261
  :send_config => {
261
262
  :to_init_script => {
@@ -266,24 +267,24 @@ module JBoss
266
267
 
267
268
  register :datasource,
268
269
 
269
- :type => JBoss::Datasource,
270
+ :type => RBoss::Datasource,
270
271
  :priority => @@setup,
271
272
  :multiple_instances => true
272
273
 
273
274
  register :xa_datasource,
274
275
 
275
- :type => JBoss::XADatasource,
276
+ :type => RBoss::XADatasource,
276
277
  :priority => @@setup,
277
278
  :multiple_instances => true
278
279
 
279
280
  register :default_ds,
280
281
 
281
- :type => JBoss::HypersonicReplacer,
282
+ :type => RBoss::HypersonicReplacer,
282
283
  :priority => @@setup
283
284
 
284
285
  register :mod_cluster,
285
286
 
286
- :type => JBoss::ModCluster,
287
+ :type => RBoss::ModCluster,
287
288
  :priority => @@setup,
288
289
  :move_config => {
289
290
  :to_run_conf => [
@@ -301,18 +302,18 @@ module JBoss
301
302
 
302
303
  register :jbossweb,
303
304
 
304
- :type => JBoss::JBossWeb,
305
+ :type => RBoss::JBossWeb,
305
306
  :priority => @@setup
306
307
 
307
308
  register :run_conf,
308
309
 
309
- :type => JBoss::RunConf,
310
+ :type => RBoss::RunConf,
310
311
  :priority => @@post_setup,
311
312
  :send_config => {
312
313
  :to_init_script => [:service_binding]
313
314
  },
314
315
  :defaults => {
315
- :template_path => "#{@base_dir}/resources/run.conf.erb",
316
+ :template_path => run_conf_template,
316
317
 
317
318
  :stack_size => '128k',
318
319
  :heap_size => '2048m',
@@ -321,17 +322,17 @@ module JBoss
321
322
 
322
323
  register :slimming,
323
324
 
324
- :type => JBoss::Slimming,
325
+ :type => RBoss::Slimming,
325
326
  :priority => @@post_setup
326
327
 
327
328
  register :restore,
328
329
 
329
- :type => JBoss::Restore,
330
+ :type => RBoss::Restore,
330
331
  :priority => @@post_setup + 5
331
332
 
332
333
  register :init_script,
333
334
 
334
- :type => JBoss::ServiceScript,
335
+ :type => RBoss::ServiceScript,
335
336
  :priority => @@final,
336
337
  :defaults => {
337
338
  :path => "#{@base_dir}/resources/jboss_init_redhat.sh.erb",
@@ -0,0 +1,64 @@
1
+ # The MIT License
2
+ #
3
+ # Copyright (c) 2011-2012 Marcelo Guimarães <ataxexe@gmail.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+
24
+ module RBoss
25
+
26
+ if RUBY_PLATFORM['mingw'] #Windows
27
+ module Platform
28
+ def twiddle
29
+ "#@jboss_home/bin/twiddle.bat"
30
+ end
31
+
32
+ def jboss_cli
33
+ "#@jboss_home/bin/jboss-cli.bat"
34
+ end
35
+
36
+ def run_conf_template
37
+ "#@base_dir/resources/run.conf.bat.erb"
38
+ end
39
+
40
+ def run_conf
41
+ "#{@jboss.profile}/run.conf.bat"
42
+ end
43
+ end
44
+ else
45
+ module Platform
46
+ def twiddle
47
+ "#@jboss_home/bin/twiddle.sh"
48
+ end
49
+
50
+ def jboss_cli
51
+ "#@jboss_home/bin/jboss-cli.sh"
52
+ end
53
+
54
+ def run_conf_template
55
+ "#@base_dir/resources/run.conf.erb"
56
+ end
57
+
58
+ def run_conf
59
+ "#{@jboss.profile}/run.conf"
60
+ end
61
+ end
62
+ end
63
+
64
+ end