Class SimpleInstanceManager

  • All Implemented Interfaces:
    InstanceManager

    public class SimpleInstanceManager
    extends java.lang.Object
    implements InstanceManager
    SimpleInstanceManager implements the org.apache.tomcat.InstanceManager interface.
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleInstanceManager()
      Creates a new SimpleInstanceManager.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void destroyInstance​(java.lang.Object o)
      Destroy the given instance, performing pre-destroy callbacks.
      java.lang.Object newInstance​(java.lang.Class<?> clazz)
      Create a new instance of the given class.
      void newInstance​(java.lang.Object o)
      Perform dependency injection on the given object.
      java.lang.Object newInstance​(java.lang.String className)
      Create a new instance of the class with the given name.
      java.lang.Object newInstance​(java.lang.String fqcn, java.lang.ClassLoader classLoader)
      Create a new instance of the class with the given name using the specified class loader.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleInstanceManager

        public SimpleInstanceManager()
        Creates a new SimpleInstanceManager.
    • Method Detail

      • newInstance

        public java.lang.Object newInstance​(java.lang.Class<?> clazz)
                                     throws java.lang.IllegalAccessException,
                                            java.lang.reflect.InvocationTargetException,
                                            javax.naming.NamingException,
                                            java.lang.InstantiationException,
                                            java.lang.NoSuchMethodException
        Create a new instance of the given class.
        Specified by:
        newInstance in interface InstanceManager
        Parameters:
        clazz - The class to instantiate
        Returns:
        the new instance
        Throws:
        java.lang.IllegalAccessException - if the class or its nullary constructor is not accessible
        java.lang.reflect.InvocationTargetException - if the nullary constructor throws an exception
        javax.naming.NamingException - if a naming exception is encountered
        java.lang.InstantiationException - if this Class represents an abstract class, an interface, an array class, a primitive type, or void
        java.lang.NoSuchMethodException - if the nullary method cannot be found
      • newInstance

        public java.lang.Object newInstance​(java.lang.String className)
                                     throws java.lang.IllegalAccessException,
                                            java.lang.reflect.InvocationTargetException,
                                            javax.naming.NamingException,
                                            java.lang.InstantiationException,
                                            java.lang.ClassNotFoundException,
                                            java.lang.NoSuchMethodException
        Create a new instance of the class with the given name.
        Specified by:
        newInstance in interface InstanceManager
        Parameters:
        className - The name of the class to instantiate
        Returns:
        the new instance
        Throws:
        java.lang.IllegalAccessException - if the class or its nullary constructor is not accessible
        java.lang.reflect.InvocationTargetException - if the nullary constructor throws an exception
        javax.naming.NamingException - if a naming exception is encountered
        java.lang.InstantiationException - if this Class represents an abstract class, an interface, an array class, a primitive type, or void
        java.lang.ClassNotFoundException - if the class cannot be found
        java.lang.NoSuchMethodException - if the nullary method cannot be found
      • newInstance

        public java.lang.Object newInstance​(java.lang.String fqcn,
                                            java.lang.ClassLoader classLoader)
                                     throws java.lang.IllegalAccessException,
                                            java.lang.reflect.InvocationTargetException,
                                            javax.naming.NamingException,
                                            java.lang.InstantiationException,
                                            java.lang.ClassNotFoundException,
                                            java.lang.NoSuchMethodException
        Create a new instance of the class with the given name using the specified class loader.
        Specified by:
        newInstance in interface InstanceManager
        Parameters:
        fqcn - The fully qualified class name
        classLoader - The class loader to use for loading the class
        Returns:
        the new instance
        Throws:
        java.lang.IllegalAccessException - if the class or its nullary constructor is not accessible
        java.lang.reflect.InvocationTargetException - if the nullary constructor throws an exception
        javax.naming.NamingException - if a naming exception is encountered
        java.lang.InstantiationException - if this Class represents an abstract class, an interface, an array class, a primitive type, or void
        java.lang.ClassNotFoundException - if the class cannot be found
        java.lang.NoSuchMethodException - if the nullary method cannot be found
      • newInstance

        public void newInstance​(java.lang.Object o)
                         throws java.lang.IllegalAccessException,
                                java.lang.reflect.InvocationTargetException,
                                javax.naming.NamingException
        Perform dependency injection on the given object.
        Specified by:
        newInstance in interface InstanceManager
        Parameters:
        o - The object to inject dependencies into
        Throws:
        java.lang.IllegalAccessException - if the class or its nullary constructor is not accessible
        java.lang.reflect.InvocationTargetException - if the nullary constructor throws an exception
        javax.naming.NamingException - if a naming exception is encountered
      • destroyInstance

        public void destroyInstance​(java.lang.Object o)
                             throws java.lang.IllegalAccessException,
                                    java.lang.reflect.InvocationTargetException
        Destroy the given instance, performing pre-destroy callbacks.
        Specified by:
        destroyInstance in interface InstanceManager
        Parameters:
        o - The object to destroy
        Throws:
        java.lang.IllegalAccessException - if the class or its nullary constructor is not accessible
        java.lang.reflect.InvocationTargetException - if the nullary constructor throws an exception