org.mule.component
Class AbstractJavaComponent

java.lang.Object
  extended by org.mule.component.AbstractComponent
      extended by org.mule.component.AbstractJavaComponent
All Implemented Interfaces:
AnnotatedObject, Component, JavaComponent, FlowConstructAware, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, MessageProcessor
Direct Known Subclasses:
DefaultJavaComponent, JcaComponent, PooledJavaComponent, SimpleCallableJavaComponent

public abstract class AbstractJavaComponent
extends AbstractComponent
implements JavaComponent

Abstract implementation of JavaComponent adds JavaComponent specifics like EntryPointResolverSet and ObjectFactory.


Field Summary
protected  List<InterfaceBinding> bindings
           
protected  EntryPointResolverSet entryPointResolverSet
           
protected  LifecycleAdapterFactory lifecycleAdapterFactory
           
protected  ObjectFactory objectFactory
           
 
Fields inherited from class org.mule.component.AbstractComponent
flowConstruct, interceptorChain, interceptors, lifecycleManager, logger, muleContext, notificationHandler, statistics
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Fields inherited from interface org.mule.api.AnnotatedObject
PROPERTY_NAME
 
Constructor Summary
AbstractJavaComponent()
          For Spring only
AbstractJavaComponent(ObjectFactory objectFactory)
           
AbstractJavaComponent(ObjectFactory objectFactory, EntryPointResolverSet entryPointResolverSet, List<InterfaceBinding> bindings)
           
 
Method Summary
protected abstract  LifecycleAdapter borrowComponentLifecycleAdaptor()
           
protected  LifecycleAdapter createLifecycleAdaptor()
          Creates and initialises a new LifecycleAdaptor instance wrapped the component object instance obtained from the configured object factory.
protected  void doDispose()
           
protected  void doInitialise()
           
protected  Object doInvoke(MuleEvent event)
           
protected  void doStart()
           
 EntryPointResolverSet getEntryPointResolverSet()
          A JavaComponent can have a custom entry-point resolver for its own object.
 List<InterfaceBinding> getInterfaceBindings()
           
 LifecycleAdapterFactory getLifecycleAdapterFactory()
          Returns the factory used create life-cycle adaptors that are used to wrap component instance.
 ObjectFactory getObjectFactory()
           
 Class<?> getObjectType()
           
protected  void injectService()
           
protected  Object invokeComponentInstance(MuleEvent event)
           
protected abstract  void returnComponentLifecycleAdaptor(LifecycleAdapter lifecycleAdapter)
           
 void setEntryPointResolvers(Collection<EntryPointResolver> entryPointResolvers)
          Allow for incremental addition of resolvers by for example the spring-config module
 void setEntryPointResolverSet(EntryPointResolverSet entryPointResolverSet)
          A JavaComponent can have a custom entry-point resolver for its own object.
 void setFlowConstruct(FlowConstruct flowConstruct)
           
 void setInterfaceBindings(List<InterfaceBinding> bindings)
           
 void setLifecycleAdapterFactory(LifecycleAdapterFactory lifecycleAdapterFactory)
          Sets the factory used create life-cycle adaptors that are used to wrap component instance.
 void setObjectFactory(ObjectFactory objectFactory)
          The object factory used to obtain the component object instance.
 
Methods inherited from class org.mule.component.AbstractComponent
createResultEvent, dispose, doStop, fireComponentNotification, getAnnotation, getAnnotations, getFlowConstruct, getInterceptors, getName, getStatistics, initialise, process, release, setAnnotations, setInterceptors, setMuleContext, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mule.api.component.Component
getStatistics
 
Methods inherited from interface org.mule.api.processor.MessageProcessor
process
 

Field Detail

entryPointResolverSet

protected EntryPointResolverSet entryPointResolverSet

bindings

protected List<InterfaceBinding> bindings

objectFactory

protected ObjectFactory objectFactory

lifecycleAdapterFactory

protected LifecycleAdapterFactory lifecycleAdapterFactory
Constructor Detail

AbstractJavaComponent

public AbstractJavaComponent()
For Spring only


AbstractJavaComponent

public AbstractJavaComponent(ObjectFactory objectFactory)

AbstractJavaComponent

public AbstractJavaComponent(ObjectFactory objectFactory,
                             EntryPointResolverSet entryPointResolverSet,
                             List<InterfaceBinding> bindings)
Method Detail

doInvoke

protected Object doInvoke(MuleEvent event)
                   throws Exception
Specified by:
doInvoke in class AbstractComponent
Throws:
Exception

invokeComponentInstance

protected Object invokeComponentInstance(MuleEvent event)
                                  throws Exception
Throws:
Exception

getObjectType

public Class<?> getObjectType()
Specified by:
getObjectType in interface JavaComponent

createLifecycleAdaptor

protected LifecycleAdapter createLifecycleAdaptor()
                                           throws Exception
Creates and initialises a new LifecycleAdaptor instance wrapped the component object instance obtained from the configured object factory.

Throws:
MuleException
Exception

borrowComponentLifecycleAdaptor

protected abstract LifecycleAdapter borrowComponentLifecycleAdaptor()
                                                             throws Exception
Throws:
Exception

returnComponentLifecycleAdaptor

protected abstract void returnComponentLifecycleAdaptor(LifecycleAdapter lifecycleAdapter)
                                                 throws Exception
Throws:
Exception

doInitialise

protected void doInitialise()
                     throws InitialisationException
Overrides:
doInitialise in class AbstractComponent
Throws:
InitialisationException

doStart

protected void doStart()
                throws MuleException
Overrides:
doStart in class AbstractComponent
Throws:
MuleException

doDispose

protected void doDispose()
Overrides:
doDispose in class AbstractComponent

getEntryPointResolverSet

public EntryPointResolverSet getEntryPointResolverSet()
Description copied from interface: JavaComponent
A JavaComponent can have a custom entry-point resolver for its own object. By default this is null. When set this resolver will override the resolver on the model

Specified by:
getEntryPointResolverSet in interface JavaComponent
Returns:
Null is a resolver set has not been set otherwise the resolver to use on this service

getInterfaceBindings

public List<InterfaceBinding> getInterfaceBindings()
Specified by:
getInterfaceBindings in interface JavaComponent

setEntryPointResolverSet

public void setEntryPointResolverSet(EntryPointResolverSet entryPointResolverSet)
Description copied from interface: JavaComponent
A JavaComponent can have a custom entry-point resolver for its own object. By default this is null. When set this resolver will override the resolver on the model

Specified by:
setEntryPointResolverSet in interface JavaComponent

setInterfaceBindings

public void setInterfaceBindings(List<InterfaceBinding> bindings)
Specified by:
setInterfaceBindings in interface JavaComponent

setEntryPointResolvers

public void setEntryPointResolvers(Collection<EntryPointResolver> entryPointResolvers)
Allow for incremental addition of resolvers by for example the spring-config module

Parameters:
entryPointResolvers - Resolvers to add

getObjectFactory

public ObjectFactory getObjectFactory()
Specified by:
getObjectFactory in interface JavaComponent

setObjectFactory

public void setObjectFactory(ObjectFactory objectFactory)
Description copied from interface: JavaComponent
The object factory used to obtain the component object instance. Mule core provides two implementations: SingletonObjectFactory and PrototypeObjectFactory.
The spring-config module provides an ObjectFactory implementation that delegates to spring. There is no PooledObjectFactory, the PooledJavaComponent should be used for pooling.

Specified by:
setObjectFactory in interface JavaComponent

getLifecycleAdapterFactory

public LifecycleAdapterFactory getLifecycleAdapterFactory()
Description copied from interface: JavaComponent
Returns the factory used create life-cycle adaptors that are used to wrap component instance.

Specified by:
getLifecycleAdapterFactory in interface JavaComponent

setLifecycleAdapterFactory

public void setLifecycleAdapterFactory(LifecycleAdapterFactory lifecycleAdapterFactory)
Description copied from interface: JavaComponent
Sets the factory used create life-cycle adaptors that are used to wrap component instance.

Specified by:
setLifecycleAdapterFactory in interface JavaComponent

setFlowConstruct

public void setFlowConstruct(FlowConstruct flowConstruct)
Specified by:
setFlowConstruct in interface FlowConstructAware
Overrides:
setFlowConstruct in class AbstractComponent

injectService

protected void injectService()


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.