org.ow2.jasmine.monitoring.mbeancmd.commands
Class MLoad

java.lang.Object
  extended by org.ow2.jasmine.monitoring.mbeancmd.AbstractCommand
      extended by org.ow2.jasmine.monitoring.mbeancmd.commands.MLoad
All Implemented Interfaces:
Command

public class MLoad
extends AbstractCommand

Mbean loading facility.


Field Summary
private  org.apache.commons.cli.CommandLine commandLine
          Command line arguments.
private  java.lang.String domain
          Domain name.
private  java.net.URL mbeanUrl
          MBean's URL.
private  javax.management.MBeanServerConnection mbscnx
          JMX connection to server.
private static java.lang.String MLET_OBJECTNAME_RADIX
          Default ObjectName MLet radix.
private  java.lang.String mletName
          Current MLet name.
private  javax.management.ObjectName mleton
          The object name based on the command line arguments.
private  org.apache.commons.cli.Options options
          List of options that should be parsed from the command line.
private  java.lang.String server
          Server name.
 
Fields inherited from class org.ow2.jasmine.monitoring.mbeancmd.AbstractCommand
arguments, name, simpleDateFormat
 
Constructor Summary
MLoad()
          Constructor: calls setOptions().
 
Method Summary
private  void deleteMLet()
          Deletes the MLet given as command argument.
 void exec()
          Implementation of inherited abstract method.
private  java.util.Set findMletON()
           
private  java.lang.String getDomain()
          Sets the J2EE server's domain and server names into domain and server.
private  javax.management.ObjectName getMletON()
           
private  boolean isMletON()
           
private  java.util.Set LoadMBeans()
           
private  void parseCommandLine(java.lang.String[] args)
          Parses the command line arguments into commandLine.
private  void setOptions()
          Sets all options that are parseable from the command line.
 java.lang.String summary()
          Implementation of inherited abstract method.
 
Methods inherited from class org.ow2.jasmine.monitoring.mbeancmd.AbstractCommand
Exit, getHelpDoc, getName, help, setArgs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

options

private org.apache.commons.cli.Options options
List of options that should be parsed from the command line.


commandLine

private org.apache.commons.cli.CommandLine commandLine
Command line arguments.


mleton

private javax.management.ObjectName mleton
The object name based on the command line arguments.


MLET_OBJECTNAME_RADIX

private static final java.lang.String MLET_OBJECTNAME_RADIX
Default ObjectName MLet radix.

See Also:
Constant Field Values

mletName

private java.lang.String mletName
Current MLet name.


mbeanUrl

private java.net.URL mbeanUrl
MBean's URL.


mbscnx

private javax.management.MBeanServerConnection mbscnx
JMX connection to server.


domain

private java.lang.String domain
Domain name.


server

private java.lang.String server
Server name.

Constructor Detail

MLoad

public MLoad()
Constructor: calls setOptions().

Method Detail

setOptions

private void setOptions()
Sets all options that are parseable from the command line.

See Also:
options

exec

public void exec()
Implementation of inherited abstract method.

Specified by:
exec in interface Command
Specified by:
exec in class AbstractCommand
See Also:
AbstractCommand.exec()

LoadMBeans

private java.util.Set LoadMBeans()
                          throws javax.management.InstanceNotFoundException,
                                 javax.management.MBeanException,
                                 javax.management.ReflectionException,
                                 java.io.IOException
Returns:
List of MBeans for the URL given as command line argument.
Throws:
javax.management.InstanceNotFoundException - MBean instance not found.
javax.management.MBeanException - MBean invocation exception.
javax.management.ReflectionException - MBean reflection failed.
java.io.IOException - Connection problem.

deleteMLet

private void deleteMLet()
                 throws javax.management.InstanceNotFoundException,
                        javax.management.MBeanRegistrationException,
                        javax.management.MalformedObjectNameException,
                        java.io.IOException
Deletes the MLet given as command argument.

Throws:
javax.management.InstanceNotFoundException - MBean instance not found.
javax.management.MBeanRegistrationException - MLet registration failed.
javax.management.MalformedObjectNameException - Object name invalid.
java.io.IOException - Connection problem.

getMletON

private javax.management.ObjectName getMletON()
                                       throws javax.management.MalformedObjectNameException,
                                              javax.management.InstanceAlreadyExistsException,
                                              javax.management.MBeanRegistrationException,
                                              javax.management.NotCompliantMBeanException,
                                              javax.management.ReflectionException,
                                              javax.management.MBeanException,
                                              java.io.IOException
Returns:
Newly created MLet instance for the URL given as command line argument.
Throws:
javax.management.MalformedObjectNameException - Object name invalid.
javax.management.InstanceAlreadyExistsException - MLet instance already exists.
javax.management.MBeanRegistrationException - MLet registration failed.
javax.management.NotCompliantMBeanException - MBean not compliant.
javax.management.ReflectionException - MBean reflection failed.
javax.management.MBeanException - MBean invocation exception.
java.io.IOException - Connection problem.

isMletON

private boolean isMletON()
                  throws java.io.IOException,
                         javax.management.MalformedObjectNameException
Returns:
true if the MLet given as command line argument exists.
Throws:
java.io.IOException - Connection problem.
javax.management.MalformedObjectNameException - Object name invalid.

findMletON

private java.util.Set findMletON()
                          throws java.io.IOException,
                                 javax.management.MalformedObjectNameException
Returns:
Existing MLet instance for the URL given as command line argument.
Throws:
java.io.IOException - Connection problem.
javax.management.MalformedObjectNameException - Object name invalid.

getDomain

private java.lang.String getDomain()
                            throws java.io.IOException,
                                   javax.management.MalformedObjectNameException
Sets the J2EE server's domain and server names into domain and server.

Returns:
The J2EE server's domain name, "unknown_domain" on failure.
Throws:
java.io.IOException - Connection problem.
javax.management.MalformedObjectNameException - Object name invalid.

parseCommandLine

private void parseCommandLine(java.lang.String[] args)
                       throws org.apache.commons.cli.ParseException,
                              javax.management.MalformedObjectNameException,
                              java.net.MalformedURLException
Parses the command line arguments into commandLine.

Parameters:
args - Arguments to parse.
Throws:
org.apache.commons.cli.ParseException - If parsing fails.
javax.management.MalformedObjectNameException - Object name given in the command line is invalid.
java.net.MalformedURLException - URL given in the command line is invalid.

summary

public java.lang.String summary()
Implementation of inherited abstract method.

Specified by:
summary in interface Command
Specified by:
summary in class AbstractCommand
Returns:
Command's summary.
See Also:
AbstractCommand.summary()