예제 #1
0
  /**
   * Instantiates and registers an MBean in the MBean server. The class loader to be used is
   * identified by its object name. An object name is associated to the MBean. If the object name of
   * the loader is not specified, the ClassLoader that loaded the MBean server will be used. If the
   * MBean object name given is null, the MBean can automatically provide its own name by
   * implementing the {@link javax.management.MBeanRegistration MBeanRegistration} interface. The
   * call returns an <CODE>ObjectInstance</CODE> object representing the newly created MBean.
   *
   * @param className The class name of the MBean to be instantiated.
   * @param name The object name of the MBean. May be null.
   * @param params An array containing the parameters of the constructor to be invoked.
   * @param signature An array containing the signature of the constructor to be invoked.
   * @param loaderName The object name of the class loader to be used.
   * @return An <CODE>ObjectInstance</CODE>, containing the <CODE>ObjectName</CODE> and the Java
   *     class name of the newly instantiated MBean.
   * @exception ReflectionException Wraps a <CODE>{@link java.lang.ClassNotFoundException}</CODE> or
   *     an <CODE>{@link java.lang.Exception}</CODE> that occurred when trying to invoke the MBean's
   *     constructor.
   * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean
   *     server.
   * @exception MBeanRegistrationException The <CODE>preRegister()</CODE> (<CODE>MBeanRegistration
   *     </CODE> interface) method of the MBean has thrown an exception. The MBean will not be
   *     registered.
   * @exception MBeanException The constructor of the MBean has thrown an exception
   * @exception InstanceNotFoundException The specified class loader is not registered in the MBean
   *     server.
   * @exception RuntimeOperationsException Wraps an <CODE>{@link java.lang.IllegalArgumentException}
   *     </CODE>: The className passed in parameter is null, the <CODE>ObjectName</CODE> passed in
   *     parameter contains a pattern or no <CODE>ObjectName</CODE> is specified for the MBean.
   */
  public ObjectInstance createMBean(
      String className, ObjectName name, ObjectName loaderName, Object params[], String signature[])
      throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException,
          MBeanException, NotCompliantMBeanException, InstanceNotFoundException {

    return interceptor.createMBean(className, name, loaderName, params, signature);
  }
예제 #2
0
  /**
   * Instantiates and registers an MBean in the MBean server. The class loader to be used is
   * identified by its object name. An object name is associated to the MBean. If the object name of
   * the loader is null, the ClassLoader that loaded the MBean server will be used. If the MBean's
   * object name given is null, the MBean can automatically provide its own name by implementing the
   * {@link javax.management.MBeanRegistration MBeanRegistration} interface. The call returns an
   * <CODE>ObjectInstance</CODE> object representing the newly created MBean.
   *
   * @param className The class name of the MBean to be instantiated.
   * @param name The object name of the MBean. May be null.
   * @param loaderName The object name of the class loader to be used.
   * @return An <CODE>ObjectInstance</CODE>, containing the <CODE>ObjectName</CODE> and the Java
   *     class name of the newly instantiated MBean.
   * @exception ReflectionException Wraps an <CODE>{@link java.lang.ClassNotFoundException}</CODE>
   *     or an <CODE>{@link java.lang.Exception}</CODE> that occurred when trying to invoke the
   *     MBean's constructor.
   * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean
   *     server.
   * @exception MBeanRegistrationException The <CODE>preRegister()</CODE> (<CODE>MBeanRegistration
   *     </CODE> interface) method of the MBean has thrown an exception. The MBean will not be
   *     registered.
   * @exception MBeanException The constructor of the MBean has thrown an exception
   * @exception NotCompliantMBeanException This class is not a JMX compliant MBean.
   * @exception InstanceNotFoundException The specified class loader is not registered in the MBean
   *     server.
   * @exception RuntimeOperationsException Wraps an <CODE>{@link java.lang.IllegalArgumentException}
   *     </CODE>: The className passed in parameter is null, the <CODE>ObjectName</CODE> passed in
   *     parameter contains a pattern or no <CODE>ObjectName</CODE> is specified for the MBean.
   */
  public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName)
      throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException,
          MBeanException, NotCompliantMBeanException, InstanceNotFoundException {

    return interceptor.createMBean(className, name, loaderName, (Object[]) null, (String[]) null);
  }