org.mule.module.guice.config
Class GuiceLookupObjectFactory

java.lang.Object
  extended by org.mule.object.AbstractObjectFactory
      extended by org.mule.module.guice.config.GuiceLookupObjectFactory
All Implemented Interfaces:
MuleContextAware, Disposable, Initialisable, ObjectFactory

public class GuiceLookupObjectFactory
extends AbstractObjectFactory
implements MuleContextAware

A Componet object factory that is configured from Guice


Field Summary
 
Fields inherited from class org.mule.object.AbstractObjectFactory
ATTRIBUTE_OBJECT_CLASS, ATTRIBUTE_OBJECT_CLASS_NAME, initialisationCallbacks, logger, muleContext, objectClass, objectClassName, properties
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
GuiceLookupObjectFactory()
           
 
Method Summary
 void dispose()
          A lifecycle method where implementor should free up any resources.
 Class getClassBinding()
           
 Object getInstance()
          Creates an initialized object instance based on the class and sets any properties.
 Class<?> getObjectClass()
          Returns the class of the object to be instantiated without actually creating an instance.
 void initialise()
          Method used to perform any initialisation work.
 boolean isAutoWireObject()
          Return true if the created object should get its dependencies wired from the registry automatically.
 boolean isExternallyManagedLifecycle()
          Returns true if Mule should not manage the life-cycle the object instance returned from the ObjectFactory.
 boolean isSingleton()
          Returns true if the ObjectFactory implementation always returns the same object instance.
 void setClassBinding(Class classBinding)
           
 void setMuleContext(MuleContext context)
           
 
Methods inherited from class org.mule.object.AbstractObjectFactory
addObjectInitialisationCallback, fireInitialisationCallbacks, getObjectClassName, getProperties, setObjectClass, setObjectClassName, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuiceLookupObjectFactory

public GuiceLookupObjectFactory()
Method Detail

setMuleContext

public void setMuleContext(MuleContext context)
Specified by:
setMuleContext in interface MuleContextAware
Overrides:
setMuleContext in class AbstractObjectFactory

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
Overrides:
initialise in class AbstractObjectFactory
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
Overrides:
dispose in class AbstractObjectFactory

getObjectClass

public Class<?> getObjectClass()
Description copied from interface: ObjectFactory
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
Overrides:
getObjectClass in class AbstractObjectFactory

getInstance

public Object getInstance()
                   throws Exception
Description copied from class: AbstractObjectFactory
Creates an initialized object instance based on the class and sets any properties.

Specified by:
getInstance in interface ObjectFactory
Overrides:
getInstance in class AbstractObjectFactory
Throws:
Exception

getClassBinding

public Class getClassBinding()

setClassBinding

public void setClassBinding(Class classBinding)

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
Overrides:
isSingleton in class AbstractObjectFactory

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
Overrides:
isExternallyManagedLifecycle in class AbstractObjectFactory

isAutoWireObject

public boolean isAutoWireObject()
Description copied from interface: ObjectFactory
Return true if the created object should get its dependencies wired from the registry automatically. Typically Mule object factories would return true for this value, objects managed by DI container such as Spring should set this to false.

Specified by:
isAutoWireObject in interface ObjectFactory
Returns:


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