Class SupplierNodeImpl
- java.lang.Object
-
- net.officefloor.compile.impl.structure.SupplierNodeImpl
-
- All Implemented Interfaces:
Node,SupplierNode,PropertyConfigurable,OfficeSupplier,OfficeFloorSupplier
public class SupplierNodeImpl extends java.lang.Object implements SupplierNode
SupplierNodeimplementation.- Author:
- Daniel Sagenschneider
-
-
Field Summary
-
Fields inherited from interface net.officefloor.compile.internal.structure.SupplierNode
TYPE
-
-
Constructor Summary
Constructors Constructor Description SupplierNodeImpl(java.lang.String supplierName, OfficeNode officeNode, OfficeFloorNode officeFloorNode, NodeContext context)Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProperty(java.lang.String name, java.lang.String value)Adds aPropertyto configure the item.voidautoWireObjects(AutoWirer<LinkObjectNode> autoWirer, OfficeNode office, CompileContext compileContext)Auto-wires theSupplierThreadLocalNodeinstances that are unlinked.voidbuildSupplier(OfficeBuilder officeBuilder, CompileContext compileContext)Builds theSupplierThreadLocalinstances for theSupplierSource.booleanensureNoThreadLocals(CompileContext compileContext)Ensures there are noSupplierThreadLocalNodeandThreadSynchroniserFactoryinstances.Node[]getChildNodes()Obtains the childNodeinstances.InternalSupplier[]getInternalSuppliers()Obtains theInternalSupplierinstances.java.lang.StringgetLocation()Obtains the location of theNode.<S> SgetManagedObjectSource(java.lang.String qualifier, java.lang.String type, java.util.function.Function<SuppliedManagedObjectSourceNode,S> factory)Obtains theOfficeFloorManagedObjectSource/OfficeManagedObjectSource.java.lang.StringgetNodeName()Obtains the name of theNode.java.lang.StringgetNodeType()Obtains theNodetype.OfficeFloorManagedObjectSourcegetOfficeFloorManagedObjectSource(java.lang.String managedObjectSourceName, java.lang.String qualifier, java.lang.String type)Obtains theOfficeFloorManagedObjectSource.OfficeFloorNodegetOfficeFloorNode()Obtains the parentOfficeFloorNode.java.lang.StringgetOfficeFloorSupplierName()Obtains the name of thisOfficeFloorSupplier.OfficeFloorSupplierThreadLocalgetOfficeFloorSupplierThreadLocal(java.lang.String qualifier, java.lang.String type)Obtains theOfficeFloorSupplierThreadLocal.OfficeManagedObjectSourcegetOfficeManagedObjectSource(java.lang.String managedObjectSourceName, java.lang.String qualifier, java.lang.String type)Obtains theOfficeManagedObjectSource.OfficeNodegetOfficeNode()Obtains the parentOfficeNode.java.lang.StringgetOfficeSupplierName()Obtains the name of thisOfficeSupplier.OfficeSupplierThreadLocalgetOfficeSupplierThreadLocal(java.lang.String qualifier, java.lang.String type)Obtains theOfficeSupplierThreadLocal.NodegetParentNode()voidinitialise(java.lang.String supplierSourceClassName, SupplierSource supplierSource)Initialises theSupplierNode.booleanisInitialised()Indicates if theNodehas been initialised.voidloadAutoWireExtensions(AutoWirer<ManagedObjectExtensionNode> autoWirer, ManagedObjectSourceVisitor managedObjectSourceVisitor, CompileContext compileContext)Loads theSuppliedManagedObjectSourceNodeinstances asManagedObjectExtensionNodeinstances to theAutoWirer.voidloadAutoWireObjects(AutoWirer<LinkObjectNode> autoWirer, ManagedObjectSourceVisitor managedObjectSourceVisitor, CompileContext compileContext)Loads theSuppliedManagedObjectSourceNodeinstances asManagedObjectNodeinstances to theAutoWirer.InitialSupplierTypeloadInitialSupplierType(boolean isLoadingType)Loads theInitialSupplierType.SupplierTypeloadSupplierType(CompileContext compileContext, boolean isLoadingType, AvailableType[] availableTypes)Loads theSupplierType.voidregisterAsPossibleMBean(CompileContext compileContext)Registers as a possible MBean.booleansourceComplete(CompileContext compileContext)Flags sourcing functionality complete.booleansourceSupplier(CompileContext compileContext)Sources theSupplierThreadLocalinstances.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.officefloor.compile.internal.structure.Node
getQualifiedName, getQualifiedName
-
-
-
-
Constructor Detail
-
SupplierNodeImpl
public SupplierNodeImpl(java.lang.String supplierName, OfficeNode officeNode, OfficeFloorNode officeFloorNode, NodeContext context)Instantiate.- Parameters:
supplierName- Name of theOfficeFloorSupplier.officeNode-OfficeNode.officeFloorNode-OfficeFloorNode.context-NodeContext.
-
-
Method Detail
-
getManagedObjectSource
public <S> S getManagedObjectSource(java.lang.String qualifier, java.lang.String type, java.util.function.Function<SuppliedManagedObjectSourceNode,S> factory)Obtains theOfficeFloorManagedObjectSource/OfficeManagedObjectSource.- Type Parameters:
S-OfficeFloorManagedObjectSource/OfficeManagedObjectSourcetype.- Parameters:
qualifier- Qualifier. May benull.type- Type.factory- Factory to create theOfficeFloorManagedObjectSource/OfficeManagedObjectSource.- Returns:
OfficeFloorManagedObjectSource/OfficeManagedObjectSource.
-
getNodeName
public java.lang.String getNodeName()
Description copied from interface:NodeObtains the name of theNode.- Specified by:
getNodeNamein interfaceNode- Returns:
- Name of the
Node.
-
getNodeType
public java.lang.String getNodeType()
Description copied from interface:NodeObtains theNodetype.- Specified by:
getNodeTypein interfaceNode- Returns:
Nodetype.
-
getLocation
public java.lang.String getLocation()
Description copied from interface:NodeObtains the location of theNode.- Specified by:
getLocationin interfaceNode- Returns:
- Location of the
Node. May benullifNodedoes not support a location.
-
getParentNode
public Node getParentNode()
Description copied from interface:Node- Specified by:
getParentNodein interfaceNode- Returns:
Nodecontaining thisNode.
-
getChildNodes
public Node[] getChildNodes()
Description copied from interface:NodeObtains the childNodeinstances.- Specified by:
getChildNodesin interfaceNode- Returns:
- Child
Nodeinstances.
-
isInitialised
public boolean isInitialised()
Description copied from interface:NodeIndicates if theNodehas been initialised.Nodeinstances should only be initialised once. Initialising theNodetwice is an issue.- Specified by:
isInitialisedin interfaceNode- Returns:
trueif initialised.
-
initialise
public void initialise(java.lang.String supplierSourceClassName, SupplierSource supplierSource)Description copied from interface:SupplierNodeInitialises theSupplierNode.- Specified by:
initialisein interfaceSupplierNode- Parameters:
supplierSourceClassName-Classname of theSupplierSource.supplierSource- Optional instantiatedSupplierSource. May benull.
-
getOfficeFloorSupplierName
public java.lang.String getOfficeFloorSupplierName()
Description copied from interface:OfficeFloorSupplierObtains the name of thisOfficeFloorSupplier.- Specified by:
getOfficeFloorSupplierNamein interfaceOfficeFloorSupplier- Returns:
- Name of this
OfficeFloorSupplier.
-
addProperty
public void addProperty(java.lang.String name, java.lang.String value)Description copied from interface:PropertyConfigurableAdds aPropertyto configure the item.- Specified by:
addPropertyin interfacePropertyConfigurable- Parameters:
name- Name ofProperty.value- Value ofProperty.
-
getOfficeFloorSupplierThreadLocal
public OfficeFloorSupplierThreadLocal getOfficeFloorSupplierThreadLocal(java.lang.String qualifier, java.lang.String type)
Description copied from interface:OfficeFloorSupplierObtains theOfficeFloorSupplierThreadLocal.- Specified by:
getOfficeFloorSupplierThreadLocalin interfaceOfficeFloorSupplier- Parameters:
qualifier- Qualifier of the requiredManagedObject. May benullto match only on type.type- Type of object required for theOfficeFloorSupplierThreadLocal.- Returns:
OfficeFloorSupplierThreadLocal.
-
getOfficeFloorManagedObjectSource
public OfficeFloorManagedObjectSource getOfficeFloorManagedObjectSource(java.lang.String managedObjectSourceName, java.lang.String qualifier, java.lang.String type)
Description copied from interface:OfficeFloorSupplierObtains theOfficeFloorManagedObjectSource.- Specified by:
getOfficeFloorManagedObjectSourcein interfaceOfficeFloorSupplier- Parameters:
managedObjectSourceName- Name of theOfficeFloorManagedObjectSource.qualifier- Qualifier on the object type. May benullto match only on type.type- Type of object required from theOfficeFloorSupplier.- Returns:
OfficeFloorManagedObjectSource.
-
getOfficeSupplierName
public java.lang.String getOfficeSupplierName()
Description copied from interface:OfficeSupplierObtains the name of thisOfficeSupplier.- Specified by:
getOfficeSupplierNamein interfaceOfficeSupplier- Returns:
- Name of this
OfficeSupplier.
-
getOfficeSupplierThreadLocal
public OfficeSupplierThreadLocal getOfficeSupplierThreadLocal(java.lang.String qualifier, java.lang.String type)
Description copied from interface:OfficeSupplierObtains theOfficeSupplierThreadLocal.- Specified by:
getOfficeSupplierThreadLocalin interfaceOfficeSupplier- Parameters:
qualifier- Qualifier of the requiredManagedObject. May benullto match only on type.type- Type of object required for theOfficeSupplierThreadLocal.- Returns:
OfficeSupplierThreadLocal.
-
getOfficeManagedObjectSource
public OfficeManagedObjectSource getOfficeManagedObjectSource(java.lang.String managedObjectSourceName, java.lang.String qualifier, java.lang.String type)
Description copied from interface:OfficeSupplierObtains theOfficeManagedObjectSource.- Specified by:
getOfficeManagedObjectSourcein interfaceOfficeSupplier- Parameters:
managedObjectSourceName- Name of theOfficeManagedObjectSource.qualifier- Qualifier on the object type. May benullto match only on type.type- Type of object required from theOfficeSupplier.- Returns:
OfficeManagedObjectSource.
-
getOfficeNode
public OfficeNode getOfficeNode()
Description copied from interface:SupplierNodeObtains the parentOfficeNode.- Specified by:
getOfficeNodein interfaceSupplierNode- Returns:
- Parent
OfficeNodeornullif configured at theOfficeFloorlevel.
-
getOfficeFloorNode
public OfficeFloorNode getOfficeFloorNode()
Description copied from interface:SupplierNodeObtains the parentOfficeFloorNode.- Specified by:
getOfficeFloorNodein interfaceSupplierNode- Returns:
- Parent
OfficeFloorNode.
-
loadInitialSupplierType
public InitialSupplierType loadInitialSupplierType(boolean isLoadingType)
Description copied from interface:SupplierNodeLoads theInitialSupplierType.- Specified by:
loadInitialSupplierTypein interfaceSupplierNode- Parameters:
isLoadingType- Indicates if using to load type.- Returns:
InitialSupplierType.
-
loadSupplierType
public SupplierType loadSupplierType(CompileContext compileContext, boolean isLoadingType, AvailableType[] availableTypes)
Description copied from interface:SupplierNodeLoads theSupplierType.- Specified by:
loadSupplierTypein interfaceSupplierNode- Parameters:
compileContext-CompileContext.isLoadingType- Indicates if using to load type.availableTypes-AvailableTypeinstances.- Returns:
SupplierType.
-
registerAsPossibleMBean
public void registerAsPossibleMBean(CompileContext compileContext)
Description copied from interface:SupplierNodeRegisters as a possible MBean.- Specified by:
registerAsPossibleMBeanin interfaceSupplierNode- Parameters:
compileContext-CompileContext.
-
loadAutoWireObjects
public void loadAutoWireObjects(AutoWirer<LinkObjectNode> autoWirer, ManagedObjectSourceVisitor managedObjectSourceVisitor, CompileContext compileContext)
Description copied from interface:SupplierNodeLoads theSuppliedManagedObjectSourceNodeinstances asManagedObjectNodeinstances to theAutoWirer.- Specified by:
loadAutoWireObjectsin interfaceSupplierNode- Parameters:
autoWirer-AutoWirer.managedObjectSourceVisitor-ManagedObjectSourceVisitor.compileContext-CompileContext.
-
loadAutoWireExtensions
public void loadAutoWireExtensions(AutoWirer<ManagedObjectExtensionNode> autoWirer, ManagedObjectSourceVisitor managedObjectSourceVisitor, CompileContext compileContext)
Description copied from interface:SupplierNodeLoads theSuppliedManagedObjectSourceNodeinstances asManagedObjectExtensionNodeinstances to theAutoWirer.- Specified by:
loadAutoWireExtensionsin interfaceSupplierNode- Parameters:
autoWirer-AutoWirer.managedObjectSourceVisitor-ManagedObjectSourceVisitor.compileContext-CompileContext.
-
sourceSupplier
public boolean sourceSupplier(CompileContext compileContext)
Description copied from interface:SupplierNodeSources theSupplierThreadLocalinstances.- Specified by:
sourceSupplierin interfaceSupplierNode- Parameters:
compileContext-CompileContext.- Returns:
trueif successfully sourced theSupplierSource.falseif failed to source, with issues reported to theCompilerIssues.
-
sourceComplete
public boolean sourceComplete(CompileContext compileContext)
Description copied from interface:SupplierNodeFlags sourcing functionality complete.- Specified by:
sourceCompletein interfaceSupplierNode- Parameters:
compileContext-CompileContext.- Returns:
trueif successfully handle completing sourcing.falseif failed to source, with issues reported to theCompilerIssues.
-
ensureNoThreadLocals
public boolean ensureNoThreadLocals(CompileContext compileContext)
Description copied from interface:SupplierNodeEnsures there are no
SupplierThreadLocalNodeandThreadSynchroniserFactoryinstances.SupplierThreadLocalandThreadSynchroniserFactoryinstances are only applicable within theOffice(application). IfSupplierSourceis used at theOfficeFloor, then it can only supplyManagedObjectSourceinstances and not depend onSupplierThreadLocalnorThreadSynchroniserFactoryinstances.If
SupplierThreadLocalorThreadSynchroniserFactoryinstances then they are raised viaCompilerIssues.- Specified by:
ensureNoThreadLocalsin interfaceSupplierNode- Parameters:
compileContext-CompileContext.- Returns:
trueif noSupplierThreadLocalnorThreadSynchroniserFactoryinstances.
-
autoWireObjects
public void autoWireObjects(AutoWirer<LinkObjectNode> autoWirer, OfficeNode office, CompileContext compileContext)
Description copied from interface:SupplierNodeAuto-wires theSupplierThreadLocalNodeinstances that are unlinked.- Specified by:
autoWireObjectsin interfaceSupplierNode- Parameters:
autoWirer-AutoWirer.office-OfficeNoderequiring the auto-wiring.compileContext-CompileContext.
-
buildSupplier
public void buildSupplier(OfficeBuilder officeBuilder, CompileContext compileContext)
Description copied from interface:SupplierNodeBuilds theSupplierThreadLocalinstances for theSupplierSource.- Specified by:
buildSupplierin interfaceSupplierNode- Parameters:
officeBuilder-OfficeBuilderto build the required thread handling.compileContext-CompileContext.
-
getInternalSuppliers
public InternalSupplier[] getInternalSuppliers()
Description copied from interface:SupplierNodeObtains theInternalSupplierinstances.- Specified by:
getInternalSuppliersin interfaceSupplierNode- Returns:
InternalSupplierinstances.
-
-