Пример #1
0
  /**
   * Instantiates an object. The class loader to be used is identified by its object name. If the
   * object name of the loader is null, the ClassLoader that loaded the MBean server will be used.
   * The object's class should have a public constructor. The call returns a reference to the newly
   * created object. The newly created object is not registered in the MBean server.
   *
   * @param className The class name of the object to be instantiated.
   * @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 The newly instantiated object.
   * @exception ReflectionException Wraps the <CODE>{@link java.lang.ClassNotFoundException}</CODE>
   *     or the <CODE>{@link java.lang.Exception}</CODE> that occurred when trying to invoke the
   *     object's constructor.
   * @exception MBeanException The constructor of the object 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.
   */
  public Object instantiate(
      String className, ObjectName loaderName, Object params[], String signature[])
      throws ReflectionException, MBeanException, InstanceNotFoundException {

    return instantiator.instantiate(
        className, loaderName, params, signature, this.getClass().getClassLoader());
  }
Пример #2
0
 /**
  * Instantiates an object using the list of all class loaders registered in the MBean server
  * (using its {@link javax.management.loading.ClassLoaderRepository Default Loader Repository}).
  * The object's class should have a public constructor. It returns a reference to the newly
  * created object. The newly created object is not registered in the MBean server.
  *
  * @param className The class name of the object to be instantiated.
  * @return The newly instantiated object.
  * @exception ReflectionException Wraps the <CODE>{@link java.lang.ClassNotFoundException}</CODE>
  *     or the <CODE>{@link java.lang.Exception}</CODE> that occurred when trying to invoke the
  *     object's constructor.
  * @exception MBeanException The constructor of the object has thrown an exception.
  * @exception RuntimeOperationsException Wraps an <CODE>{@link java.lang.IllegalArgumentException}
  *     </CODE>: The className passed in parameter is null.
  */
 public Object instantiate(String className) throws ReflectionException, MBeanException {
   return instantiator.instantiate(className);
 }