rboss 0.9.1 → 0.9.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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.idea/encodings.xml +5 -0
  3. data/.idea/misc.xml +5 -0
  4. data/.idea/modules.xml +9 -0
  5. data/.idea/rboss.iml +65 -0
  6. data/.idea/scopes/scope_settings.xml +5 -0
  7. data/.idea/vcs.xml +7 -0
  8. data/Gemfile +2 -2
  9. data/README.md +34 -397
  10. data/bin/rboss-cli +77 -28
  11. data/lib/rboss.rb +10 -12
  12. data/lib/rboss/cli/invoker.rb +31 -18
  13. data/lib/rboss/cli/mappings.rb +11 -10
  14. data/lib/rboss/cli/mappings/resources/connector.yaml +2 -2
  15. data/lib/rboss/cli/mappings/resources/datasource.yaml +5 -5
  16. data/lib/rboss/cli/mappings/resources/deployment-scanner.yaml +3 -3
  17. data/lib/rboss/cli/mappings/resources/interface.yaml +2 -2
  18. data/lib/rboss/cli/mappings/resources/jdbc-driver.yaml +12 -0
  19. data/lib/rboss/cli/mappings/resources/jms-queue.yaml +44 -0
  20. data/lib/rboss/cli/mappings/resources/runtime.yaml +34 -0
  21. data/lib/rboss/cli/mappings/resources/server.yaml +8 -8
  22. data/lib/rboss/cli/resource.rb +60 -37
  23. data/lib/rboss/cli/result_parser.rb +29 -5
  24. data/lib/rboss/plaftorm.rb +2 -25
  25. data/lib/rboss/utils.rb +2 -8
  26. data/lib/rboss/version.rb +1 -1
  27. data/lib/rboss/view/colorizers.rb +4 -2
  28. data/lib/rboss/view/formatters.rb +37 -0
  29. data/lib/rboss/view/table_builder.rb +2 -2
  30. data/rboss-cli-bash-completion +82 -0
  31. data/rboss.gemspec +12 -12
  32. data/rboss.iml +6 -7
  33. data/rboss.ipr +2 -11
  34. metadata +23 -53
  35. data/bin/rboss-profile +0 -125
  36. data/bin/rboss-twiddle +0 -204
  37. data/lib/rboss/bin/command_actions.rb +0 -125
  38. data/lib/rboss/cli/mappings/resources/jdbc_driver.yaml +0 -12
  39. data/lib/rboss/component_processor.rb +0 -179
  40. data/lib/rboss/components/component.rb +0 -58
  41. data/lib/rboss/components/datasource.rb +0 -179
  42. data/lib/rboss/components/deploy_folder.rb +0 -104
  43. data/lib/rboss/components/hypersonic_replacer.rb +0 -58
  44. data/lib/rboss/components/jbossweb.rb +0 -119
  45. data/lib/rboss/components/jmx.rb +0 -88
  46. data/lib/rboss/components/mod_cluster.rb +0 -81
  47. data/lib/rboss/components/org/6.0/deploy_folder.rb +0 -33
  48. data/lib/rboss/components/org/jmx.rb +0 -59
  49. data/lib/rboss/components/profile_folder.rb +0 -44
  50. data/lib/rboss/components/resource.rb +0 -52
  51. data/lib/rboss/components/restore_slimming.rb +0 -46
  52. data/lib/rboss/components/run_conf.rb +0 -90
  53. data/lib/rboss/components/run_conf.yaml +0 -22
  54. data/lib/rboss/components/service_script.rb +0 -55
  55. data/lib/rboss/components/slimming.rb +0 -107
  56. data/lib/rboss/components/slimming.yaml +0 -110
  57. data/lib/rboss/components/soa-p/hypersonic_replacer.rb +0 -79
  58. data/lib/rboss/components/soa-p/jmx.rb +0 -47
  59. data/lib/rboss/components/xadatasource.rb +0 -67
  60. data/lib/rboss/file_processor.rb +0 -111
  61. data/lib/rboss/jboss_path.rb +0 -74
  62. data/lib/rboss/jboss_profile.rb +0 -350
  63. data/lib/rboss/resources/jboss_init_redhat.sh.erb +0 -140
  64. data/lib/rboss/resources/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml +0 -282
  65. data/lib/rboss/resources/mod_cluster.sar/mod_cluster-1.1.2.Final.jar +0 -0
  66. data/lib/rboss/resources/run.conf.bat.erb +0 -60
  67. data/lib/rboss/resources/run.conf.erb +0 -62
  68. data/lib/rboss/twiddle.rb +0 -25
  69. data/lib/rboss/twiddle/base_monitor.rb +0 -88
  70. data/lib/rboss/twiddle/mbean.rb +0 -148
  71. data/lib/rboss/twiddle/monitor.rb +0 -222
  72. data/lib/rboss/twiddle/twiddle.rb +0 -87
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: Details Interfaces
3
- path: ${DOMAIN_HOST}${DOMAIN_SERVER}/interface=${NAME}
4
- scan: ls ${DOMAIN_HOST}${DOMAIN_SERVER}/interface
3
+ path: ${server}/interface=${name}
4
+ scan: ls ${server}/interface
5
5
  print:
6
6
  - title: Interfaces
7
7
  layout: vertical
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: Details JDBC Drivers
3
+ path: ${server}/subsystem=datasources/jdbc-driver=${name}
4
+ scan: ls ${server}/subsystem=datasources/jdbc-driver
5
+ print:
6
+ - title: JDBC Drivers
7
+ properties:
8
+ - driver-module-name
9
+ - driver-xa-datasource-class-name
10
+ header:
11
+ - Module Name
12
+ - XA Datasource Class
@@ -0,0 +1,44 @@
1
+ ---
2
+ description: Details JMS Queue Information
3
+ path: ${server}/subsystem=messaging/hornetq-server=default/jms-queue=${name}
4
+ scan: ls ${server}/subsystem=messaging/hornetq-server=default/jms-queue
5
+ print:
6
+ - title: Queues
7
+ layout: vertical
8
+ properties:
9
+ - entries
10
+ - messages-added
11
+ - message-count
12
+ - delivering-count
13
+ - scheduled-count
14
+ - consumer-count
15
+ - selector
16
+ - durable
17
+ - paused
18
+ - temporary
19
+ - queue-address
20
+ - dead-letter-address
21
+ - expirity-address
22
+ header:
23
+ - JNDI Names
24
+ - Total
25
+ - Currently
26
+ - Delivering
27
+ - Scheduled
28
+ - Consumers
29
+ - Selector
30
+ - Durable
31
+ - Paused
32
+ - Temporary
33
+ - Queue Address
34
+ - Dead Letter Address
35
+ - Expirity Address
36
+ format:
37
+ jndi_names: array
38
+ durable: boolean
39
+ paused: boolean
40
+ temporary: boolean
41
+ color:
42
+ durable: boolean
43
+ paused: boolean
44
+ temporary: boolean
@@ -0,0 +1,34 @@
1
+ ---
2
+ description: Details Runtime Information
3
+ path: ${server}/core-service=platform-mbean/type=runtime
4
+ print:
5
+ - title: Runtime Information
6
+ layout: vertical
7
+ properties:
8
+ - name
9
+ - vm-name
10
+ - vm-vendor
11
+ - vm-version
12
+ - spec-vendor
13
+ - spec-version
14
+ - start-time
15
+ - uptime
16
+ header:
17
+ - Name
18
+ - VM Name
19
+ - VM Vendor
20
+ - VM Version
21
+ - Spec Vendor
22
+ - Spec Version
23
+ - Start Time
24
+ - Uptime
25
+ format:
26
+ start_time: date
27
+ uptime: time
28
+ color:
29
+ name:
30
+ with: bold.white
31
+ start_time:
32
+ with: green
33
+ uptime:
34
+ with: yellow
@@ -1,10 +1,10 @@
1
1
  ---
2
- description: Detail Server Information
3
- path: ${DOMAIN_HOST}${DOMAIN_SERVER}/core-service=
2
+ description: Details Server Information
3
+ path: ${server}/core-service=
4
4
  print:
5
5
  - id: platform
6
6
  title: Operating System Information
7
- path: ${PATH}platform-mbean/type=operating-system
7
+ path: ${path}platform-mbean/type=operating-system
8
8
  properties:
9
9
  - name
10
10
  - arch
@@ -31,7 +31,7 @@ print:
31
31
 
32
32
  - id: env
33
33
  title: Server Environment Information
34
- path: ${PATH}server-environment
34
+ path: ${path}server-environment
35
35
  layout: vertical
36
36
  properties:
37
37
  - server-name
@@ -52,7 +52,7 @@ print:
52
52
  - id: memory
53
53
  title: Server Memory Usage
54
54
  layout: vertical
55
- path: ${PATH}platform-mbean/type=memory
55
+ path: ${path}platform-mbean/type=memory
56
56
  properties:
57
57
  - heap-memory-usage -> init
58
58
  - heap-memory-usage -> used
@@ -110,7 +110,7 @@ print:
110
110
 
111
111
  - id: thread
112
112
  title: Server Thread Info
113
- path: ${PATH}platform-mbean/type=threading
113
+ path: ${path}platform-mbean/type=threading
114
114
  layout: vertical
115
115
  properties:
116
116
  - thread-contention-monitoring-supported
@@ -139,7 +139,7 @@ print:
139
139
  - Total Started Thread Count
140
140
  - Daemon Thread Count
141
141
  - Current Thread CPU Time
142
- - CUrrent Thread User Time
142
+ - Current Thread User Time
143
143
 
144
144
  format:
145
145
  thread_contention_monitoring_supported: boolean
@@ -161,7 +161,7 @@ print:
161
161
 
162
162
  - id: config
163
163
  title: Server Configuration Resources
164
- path: ${PATH}server-environment
164
+ path: ${path}server-environment
165
165
  layout: vertical
166
166
  properties:
167
167
  - server-name
@@ -31,8 +31,8 @@ module RBoss
31
31
  @config = config
32
32
  @invoker = invoker
33
33
  @context = {
34
- :name => '',
35
- :read_resource => 'read-resource(include-runtime=true,recursive=true,include-defaults=true,proxies=true)'
34
+ :name => '',
35
+ :read_resource => 'read-resource(include-runtime=true,recursive=true,include-defaults=true,proxies=true)'
36
36
  }
37
37
  @context[:path] = parse(@config[:path])
38
38
  @tables = []
@@ -47,6 +47,14 @@ module RBoss
47
47
  end
48
48
  end
49
49
 
50
+ def list_resource_names(resources, arguments)
51
+ result = ''
52
+ scan.each do |resource|
53
+ result << resource << $/
54
+ end
55
+ result
56
+ end
57
+
50
58
  def read_resource(resources, arguments)
51
59
  resources ||= scan
52
60
  params = @config[:print]
@@ -63,29 +71,22 @@ module RBoss
63
71
  add_row(p)
64
72
  end
65
73
  end
66
- box = Yummi::TextBox::new
67
- box.style.border[:color] = "bold.black"
68
- width = 0
74
+ result = ''
69
75
  @tables.each do |table|
70
- width = [width, table.width].max
76
+ result << table.to_s << $/
71
77
  end
72
- @tables.each do |table|
73
- box << table.to_s
74
- box.add("-" * width, :color => "bold.black") unless table == @tables.last
75
- end
76
- box.to_s
78
+ result
77
79
  end
78
80
 
79
81
  def read_operation_names(resource_name, arguments)
80
- operations = ""
82
+ operations = ''
81
83
  with resource_name do
82
84
  result = @invoker.result("#{@context[:path]}:read-operation-names")
83
85
  result.each do |operation|
84
- operations << '- '.bold.magenta
85
- operations << operation.bold.blue << $/
86
+ operations << operation << $/
86
87
  end
87
88
  end
88
- operations.on_box
89
+ operations
89
90
  end
90
91
 
91
92
  def read_operation_description (resource_name, arguments)
@@ -95,23 +96,26 @@ module RBoss
95
96
  table = Yummi::Table::new
96
97
  buff << operation_name.bold.green << $/
97
98
  result = @invoker.result(
98
- "#{@context[:path]}:read-operation-description(name=#{operation_name})"
99
+ "#{@context[:path]}:read-operation-description(name=#{operation_name})"
99
100
  )
100
- buff << result['description'].bold.black << $/ * 2
101
+ buff << result['description'].yellow << $/ * 2
101
102
  table.title = 'Request'
102
- table.header = %w(Parameter Type Required Default)
103
- table.aliases = %w(name type required default)
104
- table.colorize('name', :with => :white)
103
+ table.header = %w(Parameter Type Required Expression Default)
104
+ table.aliases = %w(name type required expressions-allowed default)
105
+ table.colorize('name', :with => 'bold.white')
105
106
 
106
107
  table.colorize %w(type default) do |value|
107
108
  RBoss::Colorizers.type(value['type']).color_for(value)
108
109
  end
109
-
110
- table.format 'required', :using => Yummi::Formatters.boolean
111
- table.colorize 'required', :using => Yummi::Colorizers.boolean
112
- result["request-properties"] ||= {}
113
- unless result["request-properties"].empty?
114
- result["request-properties"].each do |name, detail|
110
+ table.format %w(required expressions-allowed), :using => Yummi::Formatters.boolean
111
+ table.colorize 'required', :using => Yummi::Colorizers.boolean(
112
+ :if_true => 'bold.red',
113
+ :if_false => 'white'
114
+ )
115
+ table.colorize 'expressions-allowed', :using => Yummi::Colorizers.boolean
116
+ result['request-properties'] ||= {}
117
+ unless result['request-properties'].empty?
118
+ result['request-properties'].sort.each do |name, detail|
115
119
  detail['name'] = name
116
120
  table << detail
117
121
  end
@@ -123,7 +127,7 @@ module RBoss
123
127
  table.header = %w(Parameter Type Nilable Unit)
124
128
  table.aliases = %w(name type nilable unit)
125
129
 
126
- table.colorize 'name', :with => :white
130
+ table.colorize 'name', :with => 'bold.white'
127
131
 
128
132
  table.colorize 'type' do |value|
129
133
  RBoss::Colorizers.type(value['type']).color_for(value)
@@ -131,9 +135,9 @@ module RBoss
131
135
 
132
136
  table.format 'nilable', :using => Yummi::Formatters.boolean
133
137
  table.colorize 'nilable', :using => Yummi::Colorizers.boolean
134
- result["reply-properties"] ||= {}
135
- unless result["reply-properties"].empty?
136
- result = result["reply-properties"]
138
+ result['reply-properties'] ||= {}
139
+ unless result['reply-properties'].empty?
140
+ result = result['reply-properties']
137
141
  table.description = result['description']
138
142
  table << result
139
143
  build_nested(result).each do |nested|
@@ -142,7 +146,7 @@ module RBoss
142
146
  buff << table.to_s << $/
143
147
  end
144
148
  end
145
- buff.chomp.on_box
149
+ buff.chomp
146
150
  end
147
151
 
148
152
  private
@@ -178,7 +182,12 @@ module RBoss
178
182
  data = get_data(params)
179
183
  return unless data
180
184
  data = [@context[:name]] + data if scannable?
181
- @tables[@count % @tables.size].add data
185
+ table = @tables[@count % @tables.size]
186
+ if data.first.is_a? Array
187
+ data.each {|d| table.add d}
188
+ else
189
+ table.add data
190
+ end
182
191
  @count += 1
183
192
  end
184
193
 
@@ -194,8 +203,11 @@ module RBoss
194
203
 
195
204
  def scan
196
205
  return '' unless scannable?
197
- result = @invoker.execute(parse @config[:scan])
198
- result.split "\n"
206
+ unless @resources
207
+ result = @invoker.execute(parse @config[:scan])
208
+ @resources = result.split "\n"
209
+ end
210
+ @resources
199
211
  end
200
212
 
201
213
  def scannable?
@@ -203,12 +215,23 @@ module RBoss
203
215
  end
204
216
 
205
217
  def get_data(config)
206
- command = parse((config[:command] or "${PATH}:#{@context[:read_resource]}"))
218
+ command = parse(config[:command])
207
219
  begin
208
220
  result = @invoker.result(command)
209
221
  data = []
210
- config[:properties].each do |prop|
211
- data << get_property(prop, result)
222
+ if config[:properties]
223
+ config[:properties].each do |prop|
224
+ data << get_property(prop, result)
225
+ end
226
+ else
227
+ result.each do |name, value|
228
+ if config[:header].size == 1
229
+ data << [name]
230
+ data << [value]
231
+ else
232
+ data << [name, value]
233
+ end
234
+ end
212
235
  end
213
236
  data
214
237
  rescue
@@ -68,14 +68,38 @@ module RBoss
68
68
  OBJECT = Type::new 'OBJECT'
69
69
 
70
70
  def eval_result(result)
71
- undefined = nil #prevents error because undefined means nil in result object
72
- result = result.gsub(/(\d+)L/, '\1') #removes the long type mark
73
- result = result.gsub(/expression\s/, '') #removes the expression indicator
71
+ # prevents error because undefined means nil in result object
72
+ undefined = nil
73
+ # removes the long type mark
74
+ result = result.gsub(/(\d+)L/, '\1')
75
+ # removes the expression indicator
76
+ result = result.gsub(/expression\s/, '')
77
+ # Check if the operation has failed
78
+ return if result.to_s.start_with? 'Failed'
79
+ # eval the result to a hash
74
80
  result = eval(result)
75
- raise InvocationFailed::new(result["failure-description"]) if result["outcome"] == "failed"
76
- result["result"]
81
+ raise InvocationFailed::new(result['failure-description']) if result['outcome'] == 'failed'
82
+ result['result']
83
+ end
84
+
85
+ def format(result, offset = 0)
86
+ str = ''
87
+ mod = (' ' * offset)
88
+ if result.is_a? Hash
89
+ result.each do |key, value|
90
+ str << mod << "#{key.to_s.bold.blue} : #{format value, offset + 2}" << $/
91
+ end
92
+ elsif result.is_a? Array
93
+ result.each do |row|
94
+ str << $/ << mod << "#{format row, offset + 2}"
95
+ end
96
+ else
97
+ str << result.to_s
98
+ end
99
+ str.strip.chomp
77
100
  end
78
101
 
79
102
  end
103
+
80
104
  end
81
105
  end
@@ -25,46 +25,23 @@ module RBoss
25
25
 
26
26
  if RUBY_PLATFORM['mingw'] #Windows
27
27
  module Platform
28
- def twiddle
29
- "#@jboss_home/bin/twiddle.bat"
30
- end
31
28
 
32
29
  def jboss_cli
33
30
  "#@jboss_home/bin/jboss-cli.bat"
34
31
  end
35
32
 
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
-
44
33
  def clear
45
- "cls"
34
+ 'cls'
46
35
  end
47
36
  end
48
37
  else
49
38
  module Platform
50
- def twiddle
51
- "#@jboss_home/bin/twiddle.sh"
52
- end
53
-
54
39
  def jboss_cli
55
40
  "#@jboss_home/bin/jboss-cli.sh"
56
41
  end
57
42
 
58
- def run_conf_template
59
- "#@base_dir/resources/run.conf.erb"
60
- end
61
-
62
- def run_conf
63
- "#{@jboss.profile}/run.conf"
64
- end
65
-
66
43
  def clear
67
- "clear"
44
+ 'clear'
68
45
  end
69
46
  end
70
47
  end
@@ -22,14 +22,7 @@
22
22
 
23
23
  class String
24
24
 
25
- def camelize
26
- (self.split(/_/).collect { |n| n.capitalize }).join
27
- end
28
-
29
- def uncapitalize
30
- self[0, 1].downcase + self[1..-1]
31
- end
32
-
25
+ # Converter contract. Replaces '-' to '_' and converts do a Symbol.
33
26
  def to_key
34
27
  self.gsub('-', '_').to_sym
35
28
  end
@@ -38,6 +31,7 @@ end
38
31
 
39
32
  class Symbol
40
33
 
34
+ # Converter contract. Returns +self+.
41
35
  def to_key
42
36
  self
43
37
  end