Package net.officefloor.spring
Class SpringBeanManagedObjectSource
- java.lang.Object
-
- net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource<O,F>
-
- net.officefloor.frame.api.managedobject.source.impl.AbstractManagedObjectSource<Indexed,None>
-
- net.officefloor.spring.SpringBeanManagedObjectSource
-
- All Implemented Interfaces:
CoordinatingManagedObject<Indexed>
,ManagedObject
,ManagedObjectSource<Indexed,None>
public class SpringBeanManagedObjectSource extends AbstractManagedObjectSource<Indexed,None> implements ManagedObject, CoordinatingManagedObject<Indexed>
Spring beanManagedObjectSource
.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource
AbstractAsyncManagedObjectSource.DependencyLabeller<K extends java.lang.Enum<K>>, AbstractAsyncManagedObjectSource.ExecutionLabeller, AbstractAsyncManagedObjectSource.Labeller<K extends java.lang.Enum<K>>, AbstractAsyncManagedObjectSource.MetaDataContext<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>, AbstractAsyncManagedObjectSource.SpecificationContext
-
-
Constructor Summary
Constructors Constructor Description SpringBeanManagedObjectSource(java.lang.String beanName, java.lang.Class<?> objectType, org.springframework.context.ConfigurableApplicationContext springContext, SpringDependency[] springDependencies)
Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ManagedObject
getManagedObject()
Synchronously obtains theManagedObject
.java.lang.Object
getObject()
Obtains the object being managed.protected void
loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<Indexed,None> context)
Overridden to load meta-data.void
loadObjects(ObjectRegistry<Indexed> registry)
Loads the Objects of theManagedObject
instances to be referenced by thisCoordinatingManagedObject
.protected void
loadSpecification(AbstractAsyncManagedObjectSource.SpecificationContext context)
Overridden to load specifications.-
Methods inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractManagedObjectSource
sourceManagedObject
-
Methods inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource
getSpecification, init, start, stop
-
-
-
-
Constructor Detail
-
SpringBeanManagedObjectSource
public SpringBeanManagedObjectSource(java.lang.String beanName, java.lang.Class<?> objectType, org.springframework.context.ConfigurableApplicationContext springContext, SpringDependency[] springDependencies)
Instantiate.- Parameters:
beanName
- Name of the Spring bean.objectType
- Object type expected from Spring.springContext
- SpringConfigurableApplicationContext
.springDependencies
-SpringDependency
instances.
-
-
Method Detail
-
loadSpecification
protected void loadSpecification(AbstractAsyncManagedObjectSource.SpecificationContext context)
Description copied from class:AbstractAsyncManagedObjectSource
Overridden to load specifications.- Specified by:
loadSpecification
in classAbstractAsyncManagedObjectSource<Indexed,None>
- Parameters:
context
- Specifications.
-
loadMetaData
protected void loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<Indexed,None> context) throws java.lang.Exception
Description copied from class:AbstractAsyncManagedObjectSource
Overridden to load meta-data.- Specified by:
loadMetaData
in classAbstractAsyncManagedObjectSource<Indexed,None>
- Parameters:
context
- Meta-data.- Throws:
java.lang.Exception
- If fails to load the meta-data.
-
getManagedObject
protected ManagedObject getManagedObject() throws java.lang.Throwable
Description copied from class:AbstractManagedObjectSource
Synchronously obtains theManagedObject
.- Specified by:
getManagedObject
in classAbstractManagedObjectSource<Indexed,None>
- Returns:
ManagedObject
.- Throws:
java.lang.Throwable
- If fails to obtain theManagedObject
.
-
loadObjects
public void loadObjects(ObjectRegistry<Indexed> registry) throws java.lang.Throwable
Description copied from interface:CoordinatingManagedObject
Loads the Objects of the
ManagedObject
instances to be referenced by thisCoordinatingManagedObject
.References to the loaded Objects must be released on recycling the
ManagedObject
.- Specified by:
loadObjects
in interfaceCoordinatingManagedObject<Indexed>
- Parameters:
registry
- Registry of the Objects for theManagedObject
instances.- Throws:
java.lang.Throwable
- Should thisCoordinatingManagedObject
fail to load theManagedObject
.
-
getObject
public java.lang.Object getObject() throws java.lang.Throwable
Description copied from interface:ManagedObject
Obtains the object being managed.- Specified by:
getObject
in interfaceManagedObject
- Returns:
- Object being managed.
- Throws:
java.lang.Throwable
- Indicating failed to obtain the object for use.
-
-