org.mule.object
Class JndiObjectFactory

java.lang.Object
  extended by org.mule.object.JndiObjectFactory
All Implemented Interfaces:
Disposable, Initialisable, ObjectFactory

public class JndiObjectFactory
extends Object
implements ObjectFactory


Field Summary
protected  Log logger
           
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
JndiObjectFactory()
           
JndiObjectFactory(String objectName, String initialFactory, String url)
           
JndiObjectFactory(String objectName, String initialFactory, String url, Map properties)
           
 
Method Summary
 void addObjectInitialisationCallback(InitialisationCallback callback)
          Register a custom initialiser
 void dispose()
          A lifecycle method where implementor should free up any resources.
 Context getContext()
           
 String getInitialFactory()
           
 Object getInstance()
          Retrieve an instance of the object.
 Class getObjectClass()
          Returns the class of the object to be instantiated without actually creating an instance.
 String getObjectName()
           
 Map getProperties()
           
 String getUrl()
           
 void initialise()
          Method used to perform any initialisation work.
 boolean isExternallyManagedLifecycle()
          Returns true if Mule should not manage the life-cycle the object instance returned from the ObjectFactory.
 boolean isLookupOnEachCall()
           
 boolean isSingleton()
          Returns true if the ObjectFactory implementation always returns the same object instance.
protected  void setContext(Context context)
           
 void setInitialFactory(String initialFactory)
           
 void setLookupOnEachCall(boolean lookupOnEachCall)
           
 void setObjectName(String objectName)
           
 void setProperties(Map properties)
           
 void setUrl(String url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final Log logger
Constructor Detail

JndiObjectFactory

public JndiObjectFactory()

JndiObjectFactory

public JndiObjectFactory(String objectName,
                         String initialFactory,
                         String url)

JndiObjectFactory

public JndiObjectFactory(String objectName,
                         String initialFactory,
                         String url,
                         Map properties)
Method Detail

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an InitialisationException should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a RecoverableException should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

Specified by:
initialise in interface Initialisable
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

dispose

public void dispose()
Description copied from interface: Disposable
A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

Specified by:
dispose in interface Disposable

getInstance

public Object getInstance()
                   throws Exception
Description copied from interface: ObjectFactory
Retrieve an instance of the object. This may create a new instance or look up an existing instance depending on the implementation. If a new instance is created it will also be initialized by this method (Initilisable.initialise()).

Specified by:
getInstance in interface ObjectFactory
Throws:
Exception

getObjectClass

public Class getObjectClass()
Returns the class of the object to be instantiated without actually creating an instance. This may not be logical or even possible depending on the implementation.

Specified by:
getObjectClass in interface ObjectFactory

getInitialFactory

public String getInitialFactory()

setInitialFactory

public void setInitialFactory(String initialFactory)

isLookupOnEachCall

public boolean isLookupOnEachCall()

setLookupOnEachCall

public void setLookupOnEachCall(boolean lookupOnEachCall)

getObjectName

public String getObjectName()

setObjectName

public void setObjectName(String objectName)

getProperties

public Map getProperties()

setProperties

public void setProperties(Map properties)

getUrl

public String getUrl()

setUrl

public void setUrl(String url)

getContext

public Context getContext()

setContext

protected void setContext(Context context)

addObjectInitialisationCallback

public void addObjectInitialisationCallback(InitialisationCallback callback)
Description copied from interface: ObjectFactory
Register a custom initialiser

Specified by:
addObjectInitialisationCallback in interface ObjectFactory

isSingleton

public boolean isSingleton()
Description copied from interface: ObjectFactory
Returns true if the ObjectFactory implementation always returns the same object instance.

Specified by:
isSingleton in interface ObjectFactory
Returns:

isExternallyManagedLifecycle

public boolean isExternallyManagedLifecycle()
Description copied from interface: ObjectFactory
Returns true if Mule should not manage the life-cycle the object instance returned from the ObjectFactory. This is normally false except when an ObjectFactory implementation obtains instance from containers (e.g. Spring) that already manages the objects lifecycle. instance.

Specified by:
isExternallyManagedLifecycle in interface ObjectFactory
Returns:


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