rboss 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/bin/jboss-profile +1 -1
- data/bin/rboss-cli +8 -2
- data/bin/twiddle +3 -3
- data/lib/rboss.rb +6 -2
- data/lib/rboss/bin/command_actions.rb +3 -2
- data/lib/rboss/cli/jboss_cli.rb +3 -3
- data/lib/rboss/cli/mappings.rb +12 -2
- data/lib/rboss/cli/mappings/resources/connector.yaml +10 -35
- data/lib/rboss/cli/mappings/resources/datasource.yaml +19 -26
- data/lib/rboss/cli/mappings/resources/jdbc_driver.yaml +0 -1
- data/lib/rboss/cli/mappings/resources/server.yaml +151 -34
- data/lib/rboss/cli/resource.rb +18 -10
- data/lib/rboss/component_processor.rb +87 -85
- data/lib/rboss/components/component.rb +2 -2
- data/lib/rboss/components/datasource.rb +1 -1
- data/lib/rboss/components/deploy_folder.rb +1 -1
- data/lib/rboss/components/hypersonic_replacer.rb +1 -1
- data/lib/rboss/components/jbossweb.rb +1 -1
- data/lib/rboss/components/jmx.rb +1 -1
- data/lib/rboss/components/mod_cluster.rb +1 -1
- data/lib/rboss/components/org/6.0/deploy_folder.rb +1 -1
- data/lib/rboss/components/org/jmx.rb +1 -1
- data/lib/rboss/components/profile_folder.rb +1 -1
- data/lib/rboss/components/resource.rb +1 -1
- data/lib/rboss/components/restore_slimming.rb +3 -3
- data/lib/rboss/components/run_conf.rb +4 -4
- data/lib/rboss/components/service_script.rb +1 -1
- data/lib/rboss/components/slimming.rb +1 -1
- data/lib/rboss/components/soa-p/hypersonic_replacer.rb +1 -1
- data/lib/rboss/components/soa-p/jmx.rb +1 -1
- data/lib/rboss/components/xadatasource.rb +2 -2
- data/lib/rboss/file_processor.rb +70 -66
- data/lib/rboss/jboss_path.rb +1 -1
- data/lib/rboss/jboss_profile.rb +28 -27
- data/lib/rboss/plaftorm.rb +64 -0
- data/lib/rboss/resources/run.conf.bat.erb +60 -0
- data/lib/rboss/twiddle/base_monitor.rb +2 -2
- data/lib/rboss/twiddle/mbean.rb +1 -1
- data/lib/rboss/twiddle/monitor.rb +26 -39
- data/lib/rboss/twiddle/twiddle.rb +3 -2
- data/lib/rboss/utils.rb +0 -62
- data/lib/rboss/version.rb +1 -1
- data/lib/rboss/view/colorizers.rb +20 -0
- data/lib/rboss/view/formatters.rb +21 -0
- data/lib/rboss/view/health_checkers.rb +41 -0
- data/lib/rboss/view/table_builder.rb +93 -0
- data/test/test_helper.rb +1 -1
- metadata +8 -6
- data/lib/rboss/cli.rb +0 -22
- data/lib/rboss/cli/colorizers.rb +0 -22
- data/lib/rboss/cli/formatters.rb +0 -17
- data/lib/rboss/cli/health_checkers.rb +0 -43
@@ -28,13 +28,13 @@ require "rexml/document"
|
|
28
28
|
|
29
29
|
include REXML
|
30
30
|
|
31
|
-
module
|
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
|
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
|
data/lib/rboss/file_processor.rb
CHANGED
@@ -25,83 +25,87 @@ require "fileutils"
|
|
25
25
|
require "ostruct"
|
26
26
|
require "logger"
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
62
|
-
|
63
|
+
@actions = {}
|
64
|
+
end
|
63
65
|
|
64
|
-
|
65
|
-
|
66
|
-
|
66
|
+
def register type, actions
|
67
|
+
@handlers[type] = actions
|
68
|
+
end
|
67
69
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
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
|
-
|
77
|
-
|
78
|
-
|
78
|
+
def copy_to file
|
79
|
+
@actions[@current_file][:copy] = file.to_s
|
80
|
+
end
|
79
81
|
|
80
|
-
|
81
|
-
|
82
|
-
|
82
|
+
def return
|
83
|
+
@actions[@current_file][:return] = true
|
84
|
+
end
|
83
85
|
|
84
|
-
|
85
|
-
|
86
|
-
|
86
|
+
def to_load &block
|
87
|
+
@actions[@current_file][:to_load] = block
|
88
|
+
end
|
87
89
|
|
88
|
-
|
89
|
-
|
90
|
-
|
90
|
+
def to_store &block
|
91
|
+
@actions[@current_file][:to_store] = block
|
92
|
+
end
|
91
93
|
|
92
|
-
|
93
|
-
|
94
|
-
|
94
|
+
def to_process &block
|
95
|
+
@actions[@current_file][:to_process] = block
|
96
|
+
end
|
95
97
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
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
|
data/lib/rboss/jboss_path.rb
CHANGED
data/lib/rboss/jboss_profile.rb
CHANGED
@@ -30,14 +30,14 @@ require "yummi"
|
|
30
30
|
require "ostruct"
|
31
31
|
require "fileutils"
|
32
32
|
|
33
|
-
module
|
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
|
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
|
55
|
+
# :resource => binded to a RBoss::Resource
|
56
56
|
#
|
57
|
-
# :jmx => binded to a
|
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
|
60
|
+
# :datasource => binded to a RBoss::Datasource
|
61
61
|
#
|
62
|
-
# :xa_datasource => binded to a
|
62
|
+
# :xa_datasource => binded to a RBoss::XADatasource
|
63
63
|
#
|
64
|
-
# :default_ds => binded to a
|
64
|
+
# :default_ds => binded to a RBoss::HypersonicReplacer
|
65
65
|
#
|
66
|
-
# :mod_cluster => binded to a
|
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
|
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
|
84
|
+
# :slimming => binded to a RBoss::Slimming
|
85
85
|
#
|
86
|
-
# :init_script => binded to a
|
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 =
|
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 =>
|
241
|
+
:type => RBoss::ProfileFolder,
|
241
242
|
:priority => @@install
|
242
243
|
|
243
244
|
register :deploy_folder,
|
244
245
|
|
245
|
-
:type =>
|
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 =>
|
253
|
+
:type => RBoss::Resource,
|
253
254
|
:priority => @@pre_setup,
|
254
255
|
:multiple_instances => true
|
255
256
|
|
256
257
|
register :jmx,
|
257
258
|
|
258
|
-
:type =>
|
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 =>
|
270
|
+
:type => RBoss::Datasource,
|
270
271
|
:priority => @@setup,
|
271
272
|
:multiple_instances => true
|
272
273
|
|
273
274
|
register :xa_datasource,
|
274
275
|
|
275
|
-
:type =>
|
276
|
+
:type => RBoss::XADatasource,
|
276
277
|
:priority => @@setup,
|
277
278
|
:multiple_instances => true
|
278
279
|
|
279
280
|
register :default_ds,
|
280
281
|
|
281
|
-
:type =>
|
282
|
+
:type => RBoss::HypersonicReplacer,
|
282
283
|
:priority => @@setup
|
283
284
|
|
284
285
|
register :mod_cluster,
|
285
286
|
|
286
|
-
:type =>
|
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 =>
|
305
|
+
:type => RBoss::JBossWeb,
|
305
306
|
:priority => @@setup
|
306
307
|
|
307
308
|
register :run_conf,
|
308
309
|
|
309
|
-
:type =>
|
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 =>
|
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 =>
|
325
|
+
:type => RBoss::Slimming,
|
325
326
|
:priority => @@post_setup
|
326
327
|
|
327
328
|
register :restore,
|
328
329
|
|
329
|
-
:type =>
|
330
|
+
:type => RBoss::Restore,
|
330
331
|
:priority => @@post_setup + 5
|
331
332
|
|
332
333
|
register :init_script,
|
333
334
|
|
334
|
-
:type =>
|
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
|