Package org.jboss.as.ee.component
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 Summary
Constructors Constructor Description BasicComponent(BasicComponentCreateService createService)Construct a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcomponentInstanceCreated(BasicComponentInstance basicComponentInstance)Method that can be overridden to perform setup on the instance after it has been createdprotected BasicComponentInstanceconstructComponentInstance(ManagedReference instance, boolean invokePostConstruct)Construct the component instance.protected BasicComponentInstanceconstructComponentInstance(ManagedReference instance, boolean invokePostConstruct, Map<Object,Object> context)Construct the component instance.ComponentInstancecreateInstance()Create a new instance of this component.ComponentInstancecreateInstance(Object instance)Wraps an existing object instance in a ComponentInstance, and run the post construct interceptor chain on it.protected voidcreateInterceptors(org.jboss.invocation.InterceptorFactoryContext context)Class<?>getComponentClass()Get the class of this bean component.StringgetComponentName()Get the name of this bean component.org.jboss.msc.service.ServiceNamegetCreateServiceName()ComponentInstancegetInstance(Object instance)Returns a component instance for a pre-existing instance.NamespaceContextSelectorgetNamespaceContextSelector()voidinit()protected BasicComponentInstanceinstantiateComponentInstance(org.jboss.invocation.Interceptor preDestroyInterceptor, Map<Method,org.jboss.invocation.Interceptor> methodInterceptors, Map<Object,Object> context)Responsible for instantiating theBasicComponentInstance.static org.jboss.msc.service.ServiceNameserviceNameOf(org.jboss.msc.service.ServiceName deploymentUnitServiceName, String componentName)voidstart()Start operation called when the Component is available.voidstop()Stop operation called when the Component is no longer available.StringtoString()voidwaitForComponentStart()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jboss.as.ee.component.Component
isRemotable
-
-
-
-
Constructor Detail
-
BasicComponent
public BasicComponent(BasicComponentCreateService createService)
Construct a new instance.- Parameters:
createService- the create service which created this component
-
-
Method Detail
-
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:
createInstancein interfaceComponent- 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:
createInstancein interfaceComponent- Parameters:
instance- The instance to wrap- Returns:
- The new ComponentInstance
-
getInstance
public ComponentInstance getInstance(Object instance)
Description copied from interface:ComponentReturns a component instance for a pre-existing instance.- Specified by:
getInstancein interfaceComponent- Parameters:
instance- the actual object instance- Returns:
- a component instance
-
waitForComponentStart
public void waitForComponentStart()
- Specified by:
waitForComponentStartin interfaceComponent
-
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 theBasicComponentInstance. This method is *not* responsible for handling the post construct activities like injection and lifecycle invocation. That is handled byconstructComponentInstance(org.jboss.as.naming.ManagedReference, boolean).- Returns:
- the component instance
-
getComponentClass
public Class<?> getComponentClass()
Get the class of this bean component.- Specified by:
getComponentClassin interfaceComponent- 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.
-
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.
-
getNamespaceContextSelector
public NamespaceContextSelector getNamespaceContextSelector()
- Specified by:
getNamespaceContextSelectorin interfaceComponent- 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)
-
-