Class BasicComponent

java.lang.Object
org.jboss.as.ee.component.BasicComponent
All Implemented Interfaces:
Component

public class BasicComponent extends Object implements Component
A basic component implementation.
Author:
John Bailey, David M. Lloyd
  • Constructor Details

    • BasicComponent

      public BasicComponent(BasicComponentCreateService createService)
      Construct a new instance.
      Parameters:
      createService - the create service which created this component
  • Method Details

    • createInstance

      public ComponentInstance createInstance()
      Create a new instance of this component. This may be invoked by a component interceptor, a client interceptor, or in the course of creating a new client, or in the case of an "eager" singleton, at component start. This method will block until the component is available. If the component fails to start then a runtime exception will be thrown.
      Specified by:
      createInstance in interface Component
      Returns:
      the component instance
    • createInstance

      public ComponentInstance createInstance(Object instance)
      Wraps an existing object instance in a ComponentInstance, and run the post construct interceptor chain on it.
      Specified by:
      createInstance in interface Component
      Parameters:
      instance - The instance to wrap
      Returns:
      The new ComponentInstance
    • getInstance

      public ComponentInstance getInstance(Object instance)
      Description copied from interface: Component
      Returns a component instance for a pre-existing instance.
      Specified by:
      getInstance in interface Component
      Parameters:
      instance - the actual object instance
      Returns:
      a component instance
    • waitForComponentStart

      public void waitForComponentStart()
      Specified by:
      waitForComponentStart in interface Component
    • constructComponentInstance

      protected BasicComponentInstance constructComponentInstance(ManagedReference instance, boolean invokePostConstruct)
      Construct the component instance. Upon return, the object instance should have injections and lifecycle invocations completed already.
      Parameters:
      instance - An instance to be wrapped, or null if a new instance should be created
      Returns:
      the component instance
    • constructComponentInstance

      protected BasicComponentInstance constructComponentInstance(ManagedReference instance, boolean invokePostConstruct, Map<Object,Object> context)
      Construct the component instance. Upon return, the object instance should have injections and lifecycle invocations completed already.
      Parameters:
      instance - An instance to be wrapped, or null if a new instance should be created
      Returns:
      the component instance
    • componentInstanceCreated

      protected void componentInstanceCreated(BasicComponentInstance basicComponentInstance)
      Method that can be overridden to perform setup on the instance after it has been created
      Parameters:
      basicComponentInstance - The component instance
    • instantiateComponentInstance

      protected BasicComponentInstance instantiateComponentInstance(org.jboss.invocation.Interceptor preDestroyInterceptor, Map<Method,org.jboss.invocation.Interceptor> methodInterceptors, Map<Object,Object> context)
      Responsible for instantiating the BasicComponentInstance. This method is *not* responsible for handling the post construct activities like injection and lifecycle invocation. That is handled by constructComponentInstance(org.jboss.as.naming.ManagedReference, boolean).

      Returns:
      the component instance
    • getComponentClass

      public Class<?> getComponentClass()
      Get the class of this bean component.
      Specified by:
      getComponentClass in interface Component
      Returns:
      the class
    • getComponentName

      public String getComponentName()
      Get the name of this bean component.
      Returns:
      the component name
    • getCreateServiceName

      public org.jboss.msc.service.ServiceName getCreateServiceName()
    • start

      public void start()
      Start operation called when the Component is available.
      Specified by:
      start in interface Component
    • init

      public void init()
    • createInterceptors

      protected void createInterceptors(org.jboss.invocation.InterceptorFactoryContext context)
    • stop

      public void stop()
      Stop operation called when the Component is no longer available.
      Specified by:
      stop in interface Component
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getNamespaceContextSelector

      public NamespaceContextSelector getNamespaceContextSelector()
      Specified by:
      getNamespaceContextSelector in interface Component
      Returns:
      The components namespace context selector, or null if it does not have one
    • serviceNameOf

      public static org.jboss.msc.service.ServiceName serviceNameOf(org.jboss.msc.service.ServiceName deploymentUnitServiceName, String componentName)