org.mule.component
Class AbstractJavaComponent

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

public abstract class AbstractJavaComponent
extends AbstractComponent
implements JavaComponent

Abstract implementation of JavaComponent adds JavaComponent specific's: EntryPointResolverSet, BindingCollection and ObjectFactory. Provides default implementations of doOnCall and doOnEvent and defines abstract template methods provided for obtaining and returning the component object instance.


Field Summary
protected  BindingCollection bindingCollection
           
protected  EntryPointResolverSet entryPointResolverSet
           
protected  LifecycleAdapterFactory lifecycleAdapterFactory
           
protected  ObjectFactory objectFactory
           
 
Fields inherited from class org.mule.component.AbstractComponent
disposed, disposing, initialised, interceptors, logger, muleContext, notificationHandler, service, started, statistics, stopping
 
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
 
Constructor Summary
AbstractJavaComponent()
           
AbstractJavaComponent(ObjectFactory objectFactory)
           
AbstractJavaComponent(ObjectFactory objectFactory, EntryPointResolverSet entryPointResolverSet, BindingCollection bindingCollection)
           
 
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()
           
 BindingCollection getBindingCollection()
           
 EntryPointResolverSet getEntryPointResolverSet()
          A JavaComponent can have a custom entry-point resolver for its own object.
 LifecycleAdapterFactory getLifecycleAdapterFactory()
          Returns the factory used create life-cycle adaptors that are used to wrap component instance.
 ObjectFactory getObjectFactory()
           
 Class getObjectType()
           
protected  Object invokeComponentInstance(MuleEvent event)
           
protected abstract  void returnComponentLifecycleAdaptor(LifecycleAdapter lifecycleAdapter)
           
 void setBindingCollection(BindingCollection bindingCollection)
           
 void setEntryPointResolvers(Collection 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 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
checkDisposed, createResultMessage, dispose, doStop, fireComponentNotification, getInterceptors, getService, getStatistics, initialise, intercept, invoke, release, setInterceptors, setMuleContext, setService, 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
getService, getStatistics, invoke, setService
 
Methods inherited from interface org.mule.api.lifecycle.Initialisable
initialise
 
Methods inherited from interface org.mule.api.lifecycle.Startable
start
 
Methods inherited from interface org.mule.api.lifecycle.Stoppable
stop
 
Methods inherited from interface org.mule.api.lifecycle.Disposable
dispose
 

Field Detail

entryPointResolverSet

protected EntryPointResolverSet entryPointResolverSet

bindingCollection

protected BindingCollection bindingCollection

objectFactory

protected ObjectFactory objectFactory

lifecycleAdapterFactory

protected LifecycleAdapterFactory lifecycleAdapterFactory
Constructor Detail

AbstractJavaComponent

public AbstractJavaComponent()

AbstractJavaComponent

public AbstractJavaComponent(ObjectFactory objectFactory)

AbstractJavaComponent

public AbstractJavaComponent(ObjectFactory objectFactory,
                             EntryPointResolverSet entryPointResolverSet,
                             BindingCollection bindingCollection)
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
Returns:

createLifeCycleAdaptor

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

Returns:
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

getBindingCollection

public BindingCollection getBindingCollection()
Specified by:
getBindingCollection 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

setBindingCollection

public void setBindingCollection(BindingCollection bindingCollection)
Specified by:
setBindingCollection in interface JavaComponent

setEntryPointResolvers

public void setEntryPointResolvers(Collection 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
Returns:

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
Returns:

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


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.