Method: JMX::MBean#initialize
- Defined in:
- lib/jmx4r.rb
#initialize(object_name, connection = nil) ⇒ MBean
Creates a new MBean.
- object_name
-
a string corresponding to a valid ObjectName
- connection
-
a connection to a MBean server. If none is passed, use the global connection created by MBean.establish_connection
82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/jmx4r.rb', line 82 def initialize(object_name, connection=nil) @connection = connection || @@connection @object_name = object_name info = @connection.getMBeanInfo @object_name @attributes = Hash.new info.attributes.each do | mbean_attr | @attributes[mbean_attr.name.snake_case] = mbean_attr.name end @operations = Hash.new info.operations.each do |mbean_op| param_types = mbean_op.signature.map {|param| param.type} @operations[mbean_op.name.snake_case] = [mbean_op.name, param_types] end end |