rboss 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -35,7 +35,7 @@ Combine with "watch" to get a simple and instantly monitoring:
35
35
  Retrieve property values with --get:
36
36
 
37
37
  twiddle --get webapp:jmx-console,maxSessions
38
- twiddle --get server_info,FreeMemory
38
+ twiddle --get server-info,FreeMemory
39
39
 
40
40
  Set values with --set:
41
41
 
@@ -44,11 +44,11 @@ Set values with --set:
44
44
  Execute commands with --invoke:
45
45
 
46
46
  twiddle --invoke server,shutdown
47
- twiddle --invoke web_deployment:jmx-console,stop
47
+ twiddle --invoke web-deployment:jmx-console,stop
48
48
 
49
49
  Extending mbeans
50
50
 
51
- You can use a file in ~/.rboss.twiddle for mapping new mbeans or overriding the defaults
51
+ You can use a file in ~/.rboss/twiddle.rb for mapping new mbeans or overriding the defaults
52
52
 
53
53
  JBoss::Twiddle::Monitor.defaults[:http_request] = {
54
54
  :description => 'Request for http protocol',
@@ -62,7 +62,15 @@ And use it normally
62
62
 
63
63
  You can do every action using custom mbeans
64
64
 
65
- twiddle --invoke http_request,resetCounters
65
+ twiddle --invoke http-request,resetCounters
66
+
67
+ Configurations can be saved using --save
68
+
69
+ twiddle --save jon --port 2099
70
+
71
+ And used with -c or --config
72
+
73
+ twiddle -c jon --server-config
66
74
 
67
75
  Using jboss-profile
68
76
  -----------
@@ -152,26 +160,40 @@ For saving the file, the configuration :name will be used in the form "${name}-d
152
160
  Example:
153
161
 
154
162
  - datasource:
155
- :type: postgres
156
- :attributes:
157
- :user_name: postgres
158
- :password: postgres
159
- :connection_url: jdbc:postgresql://localhost:5432/sample_database
160
- :min_pool_size: 5
161
- :max_pool_size: 15
163
+ :type: postgres
164
+ :attributes:
165
+ :user_name: postgres
166
+ :password: postgres
167
+ :connection_url: jdbc:postgresql://localhost:5432/sample_database
168
+ :min_pool_size: 5
169
+ :max_pool_size: 15
162
170
 
163
171
  ### Replacing hypersonic
164
172
 
165
173
  The same as Datasouce, but use the "default_ds" component instead.
166
174
 
167
175
  - default_ds:
168
- :type: postgres
169
- :attributes:
170
- :user_name: postgres
171
- :password: postgres
172
- :connection_url: jdbc:postgresql://localhost:5432/jboss_db
173
- :min_pool_size: 5
174
- :max_pool_size: 15
176
+ :type: postgres
177
+ :attributes:
178
+ :user_name: postgres
179
+ :password: postgres
180
+ :connection_url: jdbc:postgresql://localhost:5432/jboss_db
181
+ :min_pool_size: 5
182
+ :max_pool_size: 15
183
+
184
+ This will change the DefaultDS mapping to the desired datasource. Since JBoss SOA-Platform
185
+ already have a tool to do the work, it will be called with the correct mapped options
186
+ (see the file $SOAP_HOME/tools/schema/build.properties for the supported options)
187
+
188
+ - default_ds:
189
+ source.dir: postgresql84
190
+ db.name: jboss_soap_db
191
+ db.hostname: localhost
192
+ db.port: 5432
193
+ db.username: postgres
194
+ db.password: postgres
195
+ db.minpoolsize: 5
196
+ db.maxpoolsize: 15
175
197
 
176
198
  ### Installing mod_cluster
177
199
 
data/bin/jboss-profile CHANGED
@@ -22,7 +22,7 @@
22
22
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  # THE SOFTWARE.
24
24
 
25
- require 'rboss'
25
+ require_relative '../lib/rboss'
26
26
  require 'optparse'
27
27
  require 'yaml'
28
28
  require 'logger'
@@ -50,9 +50,7 @@ end
50
50
  opts.on('-u', '--update', 'Just update the profile folder') do
51
51
  create = false
52
52
  end
53
- opts.on('-c', '--config-file FILE',
54
- 'Defines the configuration file for the instance
55
- (see the examples for more details)') do |yaml|
53
+ opts.on('-c', '--config-file FILE', 'Defines the configuration file for the instance') do |yaml|
56
54
  config_file = File.expand_path(yaml)
57
55
  config = YAML::load File.open(config_file)
58
56
  config.each do |c|
@@ -67,6 +65,9 @@ opts.on('-d', '--debug', '--verbose', 'Displays shell commands') do
67
65
  include FileUtils::Verbose
68
66
  params[:log_level] = Logger::DEBUG
69
67
  end
68
+ opts.on("--encrypt PASSWORD", "Encrypts the given password for using with a SecureIdentityLoginModule") do |password|
69
+ params[:encrypt] = password
70
+ end
70
71
  opts.on("-h", "--help", "Shows this help message") { puts opts; exit }
71
72
  opts.parse!(ARGV) rescue abort 'Invalid Option! Use --help or -h for usage help.'
72
73
 
@@ -78,6 +79,11 @@ end
78
79
  params[:jboss_home] ||= Dir.pwd unless ENV["JBOSS_HOME"]
79
80
  profile = JBoss::Profile::new params
80
81
 
82
+ if params[:encrypt]
83
+ puts "Encrypted password: " + profile.jboss.encrypt(params.delete :encrypt)
84
+ exit
85
+ end
86
+
81
87
  if config
82
88
  config.each do |var|
83
89
  if var.is_a? Hash
data/bin/twiddle CHANGED
@@ -25,31 +25,47 @@
25
25
  require_relative '../lib/rboss'
26
26
  require 'optparse'
27
27
  require 'yaml'
28
+ require 'fileutils'
28
29
 
29
30
  params = {}
30
31
  mbeans = {}
31
32
  commands = {}
32
33
  no_details = false
34
+ servers_file = "~/.rboss/twiddle.yaml"
35
+ @servers_file = File.expand_path(servers_file)
36
+ save = false
33
37
  params[:jboss_home] = (ENV["JBOSS_HOME"] or ENV["TWIDDLE_HOME"] or Dir.pwd)
34
- exec_file = nil
38
+
35
39
  defaults = JBoss::Twiddle::Monitor::defaults
36
40
 
41
+ def load_yaml
42
+ return Hash::new unless File.exist?(@servers_file)
43
+ YAML::load_file(@servers_file)
44
+ end
45
+
37
46
  opts = OptionParser::new
38
47
  opts.on('-j', '--jboss-home PATH', 'Defines the JBOSS_HOME variable') do |home|
39
48
  params[:jboss_home] = home
40
49
  end
41
- opts.on('-s', '--server URL', 'Defines the JBoss server') do |server|
42
- params[:jboss_server] = server
50
+ opts.on('-s URL', 'Defines the JBoss server') do |server|
51
+ params[:server] = server
43
52
  end
44
53
  opts.on('--host HOST', 'Defines the JBoss host') do |host|
45
- params[:jboss_host] = host
54
+ params[:host] = host
46
55
  end
47
56
  opts.on('--port PORT', 'Defines the JBoss jnp port') do |port|
48
- params[:jboss_port] = port
57
+ params[:port] = port
58
+ end
59
+ opts.on('-c', '--config SERVER_NAME',
60
+ "Uses a configured server in #{servers_file}") do |server|
61
+ config = load_yaml[server]
62
+ abort "No configuration for #{server}" unless config
63
+ config.each do |key, value|
64
+ params[key.to_sym] = value
65
+ end
49
66
  end
50
- opts.on('-e', '--exec-file PATH',
51
- 'Defines the ruby file to exec using the vars twiddle and monitor') do |path|
52
- exec_file = File.expand_path path
67
+ opts.on('--save SERVER_NAME', "Saves the server configuration in #{servers_file}") do |server|
68
+ save = server
53
69
  end
54
70
 
55
71
  opts.on('--all', "Detail all mapped mbeans") do
@@ -62,7 +78,7 @@ opts.on('--all', "Detail all mapped mbeans") do
62
78
  end
63
79
  end
64
80
 
65
- (defaults.sort_by {|k,v| k}).each do |mbean_id, mbean|
81
+ (defaults.sort_by { |k, v| k }).each do |mbean_id, mbean|
66
82
  command = mbean_id.to_s.gsub /_/, '-'
67
83
  if mbean[:scan]
68
84
  opts.on("--#{command} [name_a,name_b,...]", Array,
@@ -84,13 +100,21 @@ opts.on('--get mbean_id[:resource_name],property', Array,
84
100
  'Gets a value to a resource that the monitor knows') do |get|
85
101
  commands[:get] = get
86
102
  end
103
+ opts.on('--query mbean_id[:resource_name],[arguments]', Array,
104
+ 'Queries the mbean') do |query|
105
+ commands[:query] = query
106
+ end
107
+ opts.on('--info mbean_id[:resource_name],[arguments]', Array,
108
+ 'List mbean info') do |info|
109
+ commands[:info] = info
110
+ end
87
111
  opts.on('--invoke mbean_id[:resource_name],method,[,args...]', Array,
88
112
  'Invokes a resoruce method') do |invoke|
89
113
  commands[:invoke] = invoke
90
114
  end
91
115
  opts.on("-l", "--list", "List the mbeans mappings") do
92
- (defaults.sort_by {|k,v| k}).each do |mbean_id, mbean|
93
- puts " - #{mbean_id}"
116
+ (defaults.sort_by { |k, v| k }).each do |mbean_id, mbean|
117
+ puts " - #{mbean_id.to_s.gsub(/_/, '-')}"
94
118
  [:description, :pattern].each do |detail|
95
119
  puts " - #{detail} : #{mbean[detail]}"
96
120
  end
@@ -101,11 +125,11 @@ end
101
125
  opts.on('--no-detail', 'Do not detail mbeans that needs a name') do
102
126
  no_details = true
103
127
  end
104
- opts.on('-u', '--jmx-user USER', 'Defines the JMX User') do |user|
105
- params[:jmx_user] = user
128
+ opts.on('-u', '--user USER', 'Defines the JMX User') do |user|
129
+ params[:user] = user
106
130
  end
107
- opts.on('-p', '--jmx-password PASSWORD', 'Defines the JMX Password') do |password|
108
- params[:jmx_password] = password
131
+ opts.on('-p', '--password PASSWORD', 'Defines the JMX Password') do |password|
132
+ params[:password] = password
109
133
  end
110
134
  opts.on("-h", "--help", "Shows this help message") do
111
135
  puts opts; exit
@@ -115,15 +139,42 @@ opts.parse!(ARGV) rescue abort 'Invalid Option! Use --help or -h for usage help.
115
139
  twiddle = JBoss::Twiddle::Invoker::new params
116
140
  monitor = twiddle.monitor
117
141
 
118
- if mbeans.empty? and commands.empty? and not exec_file
142
+ no_process = mbeans.empty? and commands.empty?
143
+
144
+ if save
145
+ config = load_yaml
146
+ config[save] ||= {}
147
+ server_config = config[save]
148
+ params.delete :jboss_home
149
+ params.each do |key, value|
150
+ server_config[key.to_s] = value
151
+ end
152
+ FileUtils::mkdir_p File.expand_path("~/.rboss")
153
+ FileUtils::touch @servers_file
154
+ f = File.open(@servers_file, 'w')
155
+ YAML::dump(config, f)
156
+ f.close
157
+ if no_process
158
+ puts "Configuration saved!"
159
+ exit
160
+ end
161
+ end
162
+
163
+ if no_process
119
164
  puts opts
120
165
  exit
121
166
  end
122
167
 
123
- eval File.read(exec_file), binding, exec_file if exec_file
124
-
125
168
  def extract resource
126
169
  mbean, name = resource.split(/:/)
170
+ mbean.gsub! /-/, '_'
171
+ [mbean, name]
172
+ end
173
+
174
+ def normalize args
175
+ args.collect do |arg|
176
+ "\"#{arg}\""
177
+ end
127
178
  end
128
179
 
129
180
  if commands[:set]
@@ -150,9 +201,25 @@ if commands[:invoke]
150
201
  puts twiddle.invoke :mbean => mbean.to_sym,
151
202
  :name => name,
152
203
  :method => array[1],
153
- :args => array[2..-1]
204
+ :args => normalize(array[2..-1])
205
+ end
206
+ if commands[:query]
207
+ array = commands[:query]
208
+ mbean, name = extract array[0]
209
+ puts twiddle.query :mbean => mbean.to_sym,
210
+ :name => name,
211
+ :args => normalize(array[1..-1])
154
212
  end
155
213
 
214
+ if commands[:info]
215
+ array = commands[:info]
216
+ mbean, name = extract array[0]
217
+ puts twiddle.info :mbean => mbean.to_sym,
218
+ :name => name,
219
+ :args => normalize(array[1..-1])
220
+ end
221
+
222
+
156
223
  mbeans.each do |mbean_id, resources|
157
224
  puts " - #{defaults[mbean_id][:description]}"
158
225
  if resources.is_a? TrueClass
@@ -86,7 +86,7 @@ module JBoss
86
86
  if @encrypt
87
87
  @user = @attributes.delete :user
88
88
  @user = @attributes.delete :user_name unless @user
89
- @password = encrypt @attributes.delete :password
89
+ @password = @jboss.encrypt @attributes.delete(:password)
90
90
  end
91
91
  processor = new_file_processor
92
92
  processor.with "#{@jboss.home}/docs/examples/jca/#{@type}-ds.xml", :xml do |action|
@@ -173,25 +173,6 @@ module JBoss
173
173
  XML
174
174
  end
175
175
 
176
- def jboss_logging_lib_path
177
- %W{#{@jboss.home}/client/jboss-logging-spi.jar #{@jboss.home}/client/jboss-logging.jar}.each do |path|
178
- return path if File.exist? path
179
- end
180
- end
181
-
182
- def jbosssx_lib_path
183
- %W{#{@jboss.home}/lib/jbosssx.jar #{@jboss.home}/common/lib/jbosssx.jar}.each do |path|
184
- return path if File.exist? path
185
- end
186
- end
187
-
188
- # Encrypts the given password using the SecureIdentityLoginModule
189
- def encrypt password
190
- cmd = "java -cp #{jboss_logging_lib_path}:#{jbosssx_lib_path} org.jboss.resource.security.SecureIdentityLoginModule #{password}"
191
- @logger.debug cmd
192
- encrypted = `#{cmd}`
193
- encrypted.chomp.split(/:/)[1].strip
194
- end
195
176
 
196
177
  end
197
178
 
@@ -39,7 +39,7 @@ module JBoss
39
39
  }.merge params
40
40
  @home = jboss_home
41
41
  @profile ="#{@home}/server/#{params[:profile]}"
42
- @profile_name = @profile.to_s
42
+ @profile_name = params[:profile].to_s
43
43
  @type = params[:type]
44
44
  @version = params[:version]
45
45
  end
@@ -48,6 +48,24 @@ module JBoss
48
48
  @home
49
49
  end
50
50
 
51
+ def jboss_logging_lib_path
52
+ %W{#{@home}/client/jboss-logging-spi.jar #{@home}/client/jboss-logging.jar}.each do |path|
53
+ return path if File.exist? path
54
+ end
55
+ end
56
+
57
+ def jbosssx_lib_path
58
+ %W{#{@home}/lib/jbosssx.jar #{@home}/common/lib/jbosssx.jar}.each do |path|
59
+ return path if File.exist? path
60
+ end
61
+ end
62
+
63
+ # Encrypts the given password using the SecureIdentityLoginModule
64
+ def encrypt password
65
+ encrypted = `java -cp #{jboss_logging_lib_path}:#{jbosssx_lib_path} org.jboss.resource.security.SecureIdentityLoginModule #{password}`
66
+ encrypted.chomp.split(/:/)[1].strip
67
+ end
68
+
51
69
  end
52
70
 
53
71
  end
data/lib/rboss/twiddle.rb CHANGED
@@ -24,6 +24,6 @@ require_relative 'twiddle/base_monitor'
24
24
  require_relative 'twiddle/mbean'
25
25
  require_relative 'twiddle/monitor'
26
26
 
27
- file = ENV["RBOSS_TWIDDLE"] || File.expand_path("~/.rboss.twiddle")
27
+ file = ENV["RBOSS_TWIDDLE"] || File.expand_path("~/.rboss/twiddle.rb")
28
28
 
29
29
  eval File.read(file), binding, file if File.exist? file
@@ -61,7 +61,17 @@ module JBoss
61
61
 
62
62
  def invoke params
63
63
  mbean = extract params
64
- mbean.send params[:method], *params[:args]
64
+ mbean.invoke params[:method], *params[:args]
65
+ end
66
+
67
+ def query params
68
+ mbean = extract params
69
+ execute :query, mbean.name, *params[:args]
70
+ end
71
+
72
+ def info params
73
+ mbean = extract params
74
+ execute :info, mbean.name, *params[:args]
65
75
  end
66
76
 
67
77
  private
@@ -28,8 +28,8 @@ module JBoss
28
28
  attr_reader :pattern
29
29
  attr_accessor :resource, :twiddle, :description
30
30
 
31
- @@__default__detail__resource__ = proc do |resources, &block|
32
- resouces = _parse_resource_ resources
31
+ @@__detail__resourced__ = proc do |resources, &block|
32
+ resouces = parse_resource resources
33
33
  details = {}
34
34
  resouces.each do |resource|
35
35
  with resource do
@@ -43,7 +43,7 @@ module JBoss
43
43
  details
44
44
  end
45
45
 
46
- @@__default__detail__ = proc do |&block|
46
+ @@__detail__ = proc do |&block|
47
47
  details = {}
48
48
  @properties.each do |property|
49
49
  details[property] = self[property].value
@@ -58,22 +58,25 @@ module JBoss
58
58
  @properties = params[:properties]
59
59
  @description = params[:description]
60
60
  if params[:scan]
61
- (class << self
61
+ (
62
+ class << self
62
63
  self
63
64
  end).send :define_method, :scan, &params[:scan]
64
- (class << self
65
+ (
66
+ class << self
65
67
  self
66
68
  end).send :define_method, :each do |&block|
67
69
  scan.each &block
68
70
  end
69
71
  end
70
72
  if params[:properties]
71
- (class << self
73
+ (
74
+ class << self
72
75
  self
73
76
  end).send :define_method,
74
77
  :detail,
75
78
  &(params[:scan] ?
76
- @@__default__detail__resource__ : @@__default__detail__)
79
+ @@__detail__resourced__ : @@__detail__)
77
80
  end
78
81
  end
79
82
 
@@ -86,13 +89,25 @@ module JBoss
86
89
  self
87
90
  end
88
91
 
92
+ def name
93
+ if pattern['#{resource}'] and not @resource
94
+ domain,name = pattern.split ':'
95
+ name.gsub! /[^,]+\{resource\}/, ''
96
+ name << "," if name.empty?
97
+ name << "*"
98
+ return "#{domain}:#{name}"
99
+ end
100
+ resource = @resource
101
+ eval("\"#{pattern}\"")
102
+ end
103
+
89
104
  def [] property
90
105
  resource = @resource
91
106
  query = eval("\"#{pattern}\"")
92
107
  result = @twiddle.execute(:get, query, property)
93
108
 
94
109
  def result.value
95
- self.split(/=/)[1]
110
+ self.split(/=/)[1..-1].join "="
96
111
  end
97
112
 
98
113
  result
@@ -104,11 +119,7 @@ module JBoss
104
119
  @twiddle.execute :set, query, property, value
105
120
  end
106
121
 
107
- def method_missing(method, *args, &block)
108
- _invoke_ method, args, block
109
- end
110
-
111
- def _invoke_ method, *args, &block
122
+ def invoke method, *args, &block
112
123
  resource = @resource
113
124
  query = eval("\"#{pattern} #{method}\"")
114
125
  return_value = @twiddle.execute :invoke, query, args
@@ -118,14 +129,14 @@ module JBoss
118
129
  return_value
119
130
  end
120
131
 
121
- def _query_ query, &block
132
+ def query query, &block
122
133
  result = @twiddle.execute(:query, query)
123
134
  return [] unless result
124
135
  result = result.split /\s+/
125
136
  block ? result.collect(&block) : result
126
137
  end
127
138
 
128
- def _parse_resource_ resources
139
+ def parse_resource resources
129
140
  return scan if resources == :all
130
141
  return [resources] unless resources.respond_to? :each
131
142
  resources
@@ -34,7 +34,7 @@ module JBoss
34
34
  :pattern => 'jboss.web:type=Manager,host=localhost,path=/#{resource}',
35
35
  :properties => %W(activeSessions maxActive),
36
36
  :scan => proc do
37
- _query_ "jboss.web:type=Manager,*" do |path|
37
+ query "jboss.web:type=Manager,*" do |path|
38
38
  path.gsub! "jboss.web:type=Manager,path=/", ""
39
39
  path.gsub! /,host=.+/, ''
40
40
  path
@@ -50,26 +50,46 @@ module JBoss
50
50
  :pattern => 'jboss.web:type=ThreadPool,name=#{resource}',
51
51
  :properties => %W(maxThreads currentThreadCount currentThreadsBusy),
52
52
  :scan => proc do
53
- _query_ "jboss.web:type=ThreadPool,*" do |path|
53
+ query "jboss.web:type=ThreadPool,*" do |path|
54
54
  path.gsub "jboss.web:type=ThreadPool,name=", ""
55
55
  end
56
56
  end
57
57
  },
58
+ :cached_connection_manager => {
59
+ :description => 'JBoss JCA cached connections',
60
+ :pattern => 'jboss.jca:service=CachedConnectionManager',
61
+ :properties => %W(InUseConnections)
62
+ },
63
+ :main_deployer => {
64
+ :description => 'Main Deployer',
65
+ :pattern => 'jboss.system:service=MainDeployer'
66
+ },
58
67
  :engine => {
59
68
  :description => 'JBossWeb engine',
60
69
  :pattern => 'jboss.web:type=Engine',
61
70
  :properties => %W(jvmRoute name defaultHost)
62
71
  },
72
+ :log4j => {
73
+ :description => 'JBoss Log4J Service',
74
+ :pattern => 'jboss.system:service=Logging,type=Log4jService',
75
+ :properties => %W(DefaultJBossServerLogThreshold)
76
+ },
77
+ :server => {
78
+ :description => 'JBoss Server specifications',
79
+ :pattern => 'jboss.system:type=Server',
80
+ :properties => %W(VersionName VersionNumber Version)
81
+ },
63
82
  :server_info => {
64
- :description => 'JBoss running info',
83
+ :description => 'JBoss Server runtime info',
65
84
  :pattern => 'jboss.system:type=ServerInfo',
66
85
  :properties => %W(ActiveThreadCount MaxMemory FreeMemory AvailableProcessors
67
- HostAddress JavaVendor JavaVersion OSName OSArch)
86
+ HostAddress JavaVendor JavaVersion JavaVMVersion
87
+ JavaVMVendor JavaVMName OSName OSArch)
68
88
  },
69
- :server => {
70
- :description => 'JBoss specifications',
71
- :pattern => 'jboss.system:type=Server',
72
- :properties => %W(VersionNumber StartDate)
89
+ :server_config => {
90
+ :description => 'JBoss Server configuration',
91
+ :pattern => 'jboss.system:type=ServerConfig',
92
+ :properties => %W(ServerName HomeDir ServerLogDir ServerHomeURL)
73
93
  },
74
94
  :system_properties => {
75
95
  :description => 'System properties',
@@ -80,7 +100,7 @@ module JBoss
80
100
  :pattern => 'jboss.web:type=GlobalRequestProcessor,name=#{resource}',
81
101
  :properties => %W(requestCount errorCount maxTime),
82
102
  :scan => proc do
83
- _query_ "jboss.web:type=ThreadPool,*" do |path|
103
+ query "jboss.web:type=ThreadPool,*" do |path|
84
104
  path.gsub "jboss.web:type=ThreadPool,name=", ""
85
105
  end
86
106
  end
@@ -91,7 +111,7 @@ module JBoss
91
111
  :properties => %W(MinSize MaxSize AvailableConnectionCount
92
112
  InUseConnectionCount ConnectionCount),
93
113
  :scan => proc do
94
- _query_ "jboss.jca:service=ManagedConnectionPool,*" do |path|
114
+ query "jboss.jca:service=ManagedConnectionPool,*" do |path|
95
115
  path.gsub "jboss.jca:service=ManagedConnectionPool,name=", ""
96
116
  end
97
117
  end
@@ -102,7 +122,7 @@ module JBoss
102
122
  :properties => %W(Name JNDIName MessageCount DeliveringCount
103
123
  ScheduledMessageCount MaxSize FullSize Clustered ConsumerCount),
104
124
  :scan => proc do
105
- _query_ "jboss.messaging.destination:service=Queue,*" do |path|
125
+ query "jboss.messaging.destination:service=Queue,*" do |path|
106
126
  path.gsub "jboss.messaging.destination:service=Queue,name=", ""
107
127
  end
108
128
  end
@@ -112,9 +132,9 @@ module JBoss
112
132
  :pattern => 'jboss.j2ee:#{resource},service=EJB3',
113
133
  :properties => %W(CreateCount RemoveCount CurrentSize AvailableCount),
114
134
  :scan => proc do
115
- result = _query_ "jboss.j2ee:*"
135
+ result = query "jboss.j2ee:*"
116
136
  (result.find_all do |path|
117
- path["service=EJB3"] && path["name="] && path["jar="]
137
+ path["service=EJB3"] && path["name="] && path["jar="] && !path["ear="]
118
138
  end).collect do |path|
119
139
  path.gsub("jboss.j2ee:", '').gsub(/,?service=EJB3/, '')
120
140
  end
@@ -131,40 +151,10 @@ module JBoss
131
151
  @mbeans
132
152
  end
133
153
 
134
- def resources mbean_id = nil, *resources
135
- @resources ||= {}
136
- return @resources unless mbean_id
137
- return @resources[mbean_id] unless resources
138
- if mbean_id.is_a? Array
139
- mbean_id.each do |id|
140
- @resources[id] = resources
141
- end
142
- else
143
- @resources[mbean_id] = resources
144
- end
145
- end
146
-
147
154
  def monitor mbean_id, params
148
155
  mbeans[mbean_id] = JBoss::MBean::new params.merge(:twiddle => @twiddle)
149
156
  end
150
157
 
151
- def with resource
152
- resource = send resource if resource.is_a? Symbol
153
- if block_given?
154
- if resource.kind_of? Array
155
- resource.each do |res|
156
- @current_resource = res
157
- yield res
158
- @current_resource = nil
159
- end
160
- else
161
- @current_resource = resource
162
- yield
163
- @current_resource = nil
164
- end
165
- end
166
- end
167
-
168
158
  def mbean mbean_id
169
159
  mbean = mbeans[mbean_id]
170
160
  if @current_resource
@@ -173,13 +163,6 @@ module JBoss
173
163
  mbean
174
164
  end
175
165
 
176
- def method_missing method, *args, &block
177
- mbean_id = method
178
- mbean = mbeans[mbean_id]
179
- resource = args[0] || @current_resource
180
- mbean.with resource
181
- end
182
-
183
166
  end
184
167
 
185
168
  end
@@ -24,29 +24,29 @@ module JBoss
24
24
  module Twiddle
25
25
  class Invoker
26
26
 
27
- attr_reader :jboss_host, :jboss_port, :jboss_home, :jmx_user, :jmx_password
27
+ attr_reader :server, :host, :port, :home, :user, :password
28
28
  attr_accessor :command
29
29
 
30
30
  def initialize params = {}
31
31
  params = {
32
32
  :jboss_home => ENV["JBOSS_HOME"],
33
- :jboss_server => nil,
34
- :jboss_host => '127.0.0.1',
35
- :jboss_port => 1099,
36
- :jmx_user => "admin",
37
- :jmx_password => "admin"
33
+ :server => nil,
34
+ :host => '127.0.0.1',
35
+ :port => 1099,
36
+ :user => "admin",
37
+ :password => "admin"
38
38
  }.merge! params
39
39
  @jboss_home = params[:jboss_home]
40
40
 
41
- @jboss_host = params[:jboss_host]
42
- @jboss_port = params[:jboss_port]
43
- @jboss_server = params[:jboss_server]
44
- @jboss_server ||= [@jboss_host, @jboss_port].join ':'
41
+ @server = params[:server]
42
+ @host = params[:host]
43
+ @port = params[:port]
44
+ @server ||= [@host, @port].join ':'
45
45
 
46
- @jmx_user = params[:jmx_user]
47
- @jmx_password = params[:jmx_password]
46
+ @user = params[:user]
47
+ @password = params[:password]
48
48
 
49
- @command = "#{@jboss_home}/bin/twiddle.sh -s #{@jboss_server} -u '#{@jmx_user}' -p '#{@jmx_password}'"
49
+ @command = "#{@jboss_home}/bin/twiddle.sh -s #{@server} -u '#{@user}' -p '#{@password}'"
50
50
  end
51
51
 
52
52
  def home
data/lib/rboss/version.rb CHANGED
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module RBoss
24
- VERSION = "0.2.3"
24
+ VERSION = "0.2.4"
25
25
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rboss
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.3
5
+ version: 0.2.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ataxexe
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-08-23 00:00:00 Z
13
+ date: 2011-09-06 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: |-
@@ -32,9 +32,6 @@ files:
32
32
  - Rakefile
33
33
  - bin/jboss-profile
34
34
  - bin/twiddle
35
- - examples/jboss_profile/jbb_profile_1.yaml
36
- - examples/jboss_profile/jbb_profile_2.yaml
37
- - examples/jboss_profile/jboss_profile.yaml
38
35
  - lib/rboss.rb
39
36
  - lib/rboss/component_processor.rb
40
37
  - lib/rboss/components/component.rb
@@ -1,32 +0,0 @@
1
- - :params:
2
- :type: org
3
- :version: 5.1
4
- :base_profile: all
5
- :profile: jbb1
6
- - mod_cluster
7
- - jms:
8
- :peer_id: 1
9
- - deploy_folder: deploy/datasources
10
- - deploy_folder: deploy/apps
11
- - resource:
12
- lib: ~/jdbc/postgresql/postgresql.jar
13
- - jmx:
14
- :password: jbb
15
- - default_ds:
16
- :type: postgres
17
- :attributes:
18
- :user_name: postgres
19
- :password: postgres
20
- :connection_url: jdbc:postgresql://localhost:5432/jboss_org_db
21
- :min_pool_size: 5
22
- :max_pool_size: 15
23
- - jboss_web:
24
- :connectors:
25
- ajp:
26
- :max_threads: 600
27
- - run_conf:
28
- :heap_size: 1024m
29
- :perm_size: 512m
30
- :stack_size: 128k
31
- - slimming:
32
- - web_console
@@ -1,32 +0,0 @@
1
- - :params:
2
- :type: org
3
- :version: 5.1
4
- :base_profile: all
5
- :profile: jbb1
6
- - mod_cluster
7
- - jms:
8
- :peer_id: 2
9
- - deploy_folder: deploy/datasources
10
- - deploy_folder: deploy/apps
11
- - resource:
12
- lib: ~/jdbc/postgresql/postgresql.jar
13
- - jmx:
14
- :password: jbb
15
- - default_ds:
16
- :type: postgres
17
- :attributes:
18
- :user_name: postgres
19
- :password: postgres
20
- :connection_url: jdbc:postgresql://localhost:5432/jboss_org_db
21
- :min_pool_size: 5
22
- :max_pool_size: 15
23
- - jboss_web:
24
- :connectors:
25
- ajp:
26
- :max_threads: 600
27
- - run_conf:
28
- :heap_size: 1024m
29
- :perm_size: 512m
30
- :stack_size: 128k
31
- - slimming:
32
- - web_console
@@ -1,7 +0,0 @@
1
- - deploy_folder: deploy/datasources
2
- - deploy_folder: deploy/apps
3
- - jmx
4
- - run_conf:
5
- :heap_size: 1024m
6
- :perm_size: 512m
7
- :debug: :socket