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
SupplierNode
implementation.- 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 void
addProperty(java.lang.String name, java.lang.String value)
Adds aProperty
to configure the item.void
autoWireObjects(AutoWirer<LinkObjectNode> autoWirer, OfficeNode office, CompileContext compileContext)
Auto-wires theSupplierThreadLocalNode
instances that are unlinked.void
buildSupplier(OfficeBuilder officeBuilder, CompileContext compileContext)
Builds theSupplierThreadLocal
instances for theSupplierSource
.boolean
ensureNoThreadLocals(CompileContext compileContext)
Ensures there are noSupplierThreadLocalNode
andThreadSynchroniserFactory
instances.Node[]
getChildNodes()
Obtains the childNode
instances.InternalSupplier[]
getInternalSuppliers()
Obtains theInternalSupplier
instances.java.lang.String
getLocation()
Obtains the location of theNode
.<S> S
getManagedObjectSource(java.lang.String qualifier, java.lang.String type, java.util.function.Function<SuppliedManagedObjectSourceNode,S> factory)
Obtains theOfficeFloorManagedObjectSource
/OfficeManagedObjectSource
.java.lang.String
getNodeName()
Obtains the name of theNode
.java.lang.String
getNodeType()
Obtains theNode
type.OfficeFloorManagedObjectSource
getOfficeFloorManagedObjectSource(java.lang.String managedObjectSourceName, java.lang.String qualifier, java.lang.String type)
Obtains theOfficeFloorManagedObjectSource
.OfficeFloorNode
getOfficeFloorNode()
Obtains the parentOfficeFloorNode
.java.lang.String
getOfficeFloorSupplierName()
Obtains the name of thisOfficeFloorSupplier
.OfficeFloorSupplierThreadLocal
getOfficeFloorSupplierThreadLocal(java.lang.String qualifier, java.lang.String type)
Obtains theOfficeFloorSupplierThreadLocal
.OfficeManagedObjectSource
getOfficeManagedObjectSource(java.lang.String managedObjectSourceName, java.lang.String qualifier, java.lang.String type)
Obtains theOfficeManagedObjectSource
.OfficeNode
getOfficeNode()
Obtains the parentOfficeNode
.java.lang.String
getOfficeSupplierName()
Obtains the name of thisOfficeSupplier
.OfficeSupplierThreadLocal
getOfficeSupplierThreadLocal(java.lang.String qualifier, java.lang.String type)
Obtains theOfficeSupplierThreadLocal
.Node
getParentNode()
void
initialise(java.lang.String supplierSourceClassName, SupplierSource supplierSource)
Initialises theSupplierNode
.boolean
isInitialised()
Indicates if theNode
has been initialised.void
loadAutoWireExtensions(AutoWirer<ManagedObjectExtensionNode> autoWirer, ManagedObjectSourceVisitor managedObjectSourceVisitor, CompileContext compileContext)
Loads theSuppliedManagedObjectSourceNode
instances asManagedObjectExtensionNode
instances to theAutoWirer
.void
loadAutoWireObjects(AutoWirer<LinkObjectNode> autoWirer, ManagedObjectSourceVisitor managedObjectSourceVisitor, CompileContext compileContext)
Loads theSuppliedManagedObjectSourceNode
instances asManagedObjectNode
instances to theAutoWirer
.InitialSupplierType
loadInitialSupplierType(boolean isLoadingType)
Loads theInitialSupplierType
.SupplierType
loadSupplierType(CompileContext compileContext, boolean isLoadingType, AvailableType[] availableTypes)
Loads theSupplierType
.void
registerAsPossibleMBean(CompileContext compileContext)
Registers as a possible MBean.boolean
sourceComplete(CompileContext compileContext)
Flags sourcing functionality complete.boolean
sourceSupplier(CompileContext compileContext)
Sources theSupplierThreadLocal
instances.-
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
/OfficeManagedObjectSource
type.- 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:Node
Obtains the name of theNode
.- Specified by:
getNodeName
in interfaceNode
- Returns:
- Name of the
Node
.
-
getNodeType
public java.lang.String getNodeType()
Description copied from interface:Node
Obtains theNode
type.- Specified by:
getNodeType
in interfaceNode
- Returns:
Node
type.
-
getLocation
public java.lang.String getLocation()
Description copied from interface:Node
Obtains the location of theNode
.- Specified by:
getLocation
in interfaceNode
- Returns:
- Location of the
Node
. May benull
ifNode
does not support a location.
-
getParentNode
public Node getParentNode()
Description copied from interface:Node
- Specified by:
getParentNode
in interfaceNode
- Returns:
Node
containing thisNode
.
-
getChildNodes
public Node[] getChildNodes()
Description copied from interface:Node
Obtains the childNode
instances.- Specified by:
getChildNodes
in interfaceNode
- Returns:
- Child
Node
instances.
-
isInitialised
public boolean isInitialised()
Description copied from interface:Node
Indicates if theNode
has been initialised.Node
instances should only be initialised once. Initialising theNode
twice is an issue.- Specified by:
isInitialised
in interfaceNode
- Returns:
true
if initialised.
-
initialise
public void initialise(java.lang.String supplierSourceClassName, SupplierSource supplierSource)
Description copied from interface:SupplierNode
Initialises theSupplierNode
.- Specified by:
initialise
in interfaceSupplierNode
- Parameters:
supplierSourceClassName
-Class
name of theSupplierSource
.supplierSource
- Optional instantiatedSupplierSource
. May benull
.
-
getOfficeFloorSupplierName
public java.lang.String getOfficeFloorSupplierName()
Description copied from interface:OfficeFloorSupplier
Obtains the name of thisOfficeFloorSupplier
.- Specified by:
getOfficeFloorSupplierName
in interfaceOfficeFloorSupplier
- Returns:
- Name of this
OfficeFloorSupplier
.
-
addProperty
public void addProperty(java.lang.String name, java.lang.String value)
Description copied from interface:PropertyConfigurable
Adds aProperty
to configure the item.- Specified by:
addProperty
in interfacePropertyConfigurable
- Parameters:
name
- Name ofProperty
.value
- Value ofProperty
.
-
getOfficeFloorSupplierThreadLocal
public OfficeFloorSupplierThreadLocal getOfficeFloorSupplierThreadLocal(java.lang.String qualifier, java.lang.String type)
Description copied from interface:OfficeFloorSupplier
Obtains theOfficeFloorSupplierThreadLocal
.- Specified by:
getOfficeFloorSupplierThreadLocal
in interfaceOfficeFloorSupplier
- Parameters:
qualifier
- Qualifier of the requiredManagedObject
. May benull
to 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:OfficeFloorSupplier
Obtains theOfficeFloorManagedObjectSource
.- Specified by:
getOfficeFloorManagedObjectSource
in interfaceOfficeFloorSupplier
- Parameters:
managedObjectSourceName
- Name of theOfficeFloorManagedObjectSource
.qualifier
- Qualifier on the object type. May benull
to match only on type.type
- Type of object required from theOfficeFloorSupplier
.- Returns:
OfficeFloorManagedObjectSource
.
-
getOfficeSupplierName
public java.lang.String getOfficeSupplierName()
Description copied from interface:OfficeSupplier
Obtains the name of thisOfficeSupplier
.- Specified by:
getOfficeSupplierName
in interfaceOfficeSupplier
- Returns:
- Name of this
OfficeSupplier
.
-
getOfficeSupplierThreadLocal
public OfficeSupplierThreadLocal getOfficeSupplierThreadLocal(java.lang.String qualifier, java.lang.String type)
Description copied from interface:OfficeSupplier
Obtains theOfficeSupplierThreadLocal
.- Specified by:
getOfficeSupplierThreadLocal
in interfaceOfficeSupplier
- Parameters:
qualifier
- Qualifier of the requiredManagedObject
. May benull
to 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:OfficeSupplier
Obtains theOfficeManagedObjectSource
.- Specified by:
getOfficeManagedObjectSource
in interfaceOfficeSupplier
- Parameters:
managedObjectSourceName
- Name of theOfficeManagedObjectSource
.qualifier
- Qualifier on the object type. May benull
to match only on type.type
- Type of object required from theOfficeSupplier
.- Returns:
OfficeManagedObjectSource
.
-
getOfficeNode
public OfficeNode getOfficeNode()
Description copied from interface:SupplierNode
Obtains the parentOfficeNode
.- Specified by:
getOfficeNode
in interfaceSupplierNode
- Returns:
- Parent
OfficeNode
ornull
if configured at theOfficeFloor
level.
-
getOfficeFloorNode
public OfficeFloorNode getOfficeFloorNode()
Description copied from interface:SupplierNode
Obtains the parentOfficeFloorNode
.- Specified by:
getOfficeFloorNode
in interfaceSupplierNode
- Returns:
- Parent
OfficeFloorNode
.
-
loadInitialSupplierType
public InitialSupplierType loadInitialSupplierType(boolean isLoadingType)
Description copied from interface:SupplierNode
Loads theInitialSupplierType
.- Specified by:
loadInitialSupplierType
in 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:SupplierNode
Loads theSupplierType
.- Specified by:
loadSupplierType
in interfaceSupplierNode
- Parameters:
compileContext
-CompileContext
.isLoadingType
- Indicates if using to load type.availableTypes
-AvailableType
instances.- Returns:
SupplierType
.
-
registerAsPossibleMBean
public void registerAsPossibleMBean(CompileContext compileContext)
Description copied from interface:SupplierNode
Registers as a possible MBean.- Specified by:
registerAsPossibleMBean
in interfaceSupplierNode
- Parameters:
compileContext
-CompileContext
.
-
loadAutoWireObjects
public void loadAutoWireObjects(AutoWirer<LinkObjectNode> autoWirer, ManagedObjectSourceVisitor managedObjectSourceVisitor, CompileContext compileContext)
Description copied from interface:SupplierNode
Loads theSuppliedManagedObjectSourceNode
instances asManagedObjectNode
instances to theAutoWirer
.- Specified by:
loadAutoWireObjects
in interfaceSupplierNode
- Parameters:
autoWirer
-AutoWirer
.managedObjectSourceVisitor
-ManagedObjectSourceVisitor
.compileContext
-CompileContext
.
-
loadAutoWireExtensions
public void loadAutoWireExtensions(AutoWirer<ManagedObjectExtensionNode> autoWirer, ManagedObjectSourceVisitor managedObjectSourceVisitor, CompileContext compileContext)
Description copied from interface:SupplierNode
Loads theSuppliedManagedObjectSourceNode
instances asManagedObjectExtensionNode
instances to theAutoWirer
.- Specified by:
loadAutoWireExtensions
in interfaceSupplierNode
- Parameters:
autoWirer
-AutoWirer
.managedObjectSourceVisitor
-ManagedObjectSourceVisitor
.compileContext
-CompileContext
.
-
sourceSupplier
public boolean sourceSupplier(CompileContext compileContext)
Description copied from interface:SupplierNode
Sources theSupplierThreadLocal
instances.- Specified by:
sourceSupplier
in interfaceSupplierNode
- Parameters:
compileContext
-CompileContext
.- Returns:
true
if successfully sourced theSupplierSource
.false
if failed to source, with issues reported to theCompilerIssues
.
-
sourceComplete
public boolean sourceComplete(CompileContext compileContext)
Description copied from interface:SupplierNode
Flags sourcing functionality complete.- Specified by:
sourceComplete
in interfaceSupplierNode
- Parameters:
compileContext
-CompileContext
.- Returns:
true
if successfully handle completing sourcing.false
if failed to source, with issues reported to theCompilerIssues
.
-
ensureNoThreadLocals
public boolean ensureNoThreadLocals(CompileContext compileContext)
Description copied from interface:SupplierNode
Ensures there are no
SupplierThreadLocalNode
andThreadSynchroniserFactory
instances.SupplierThreadLocal
andThreadSynchroniserFactory
instances are only applicable within theOffice
(application). IfSupplierSource
is used at theOfficeFloor
, then it can only supplyManagedObjectSource
instances and not depend onSupplierThreadLocal
norThreadSynchroniserFactory
instances.If
SupplierThreadLocal
orThreadSynchroniserFactory
instances then they are raised viaCompilerIssues
.- Specified by:
ensureNoThreadLocals
in interfaceSupplierNode
- Parameters:
compileContext
-CompileContext
.- Returns:
true
if noSupplierThreadLocal
norThreadSynchroniserFactory
instances.
-
autoWireObjects
public void autoWireObjects(AutoWirer<LinkObjectNode> autoWirer, OfficeNode office, CompileContext compileContext)
Description copied from interface:SupplierNode
Auto-wires theSupplierThreadLocalNode
instances that are unlinked.- Specified by:
autoWireObjects
in interfaceSupplierNode
- Parameters:
autoWirer
-AutoWirer
.office
-OfficeNode
requiring the auto-wiring.compileContext
-CompileContext
.
-
buildSupplier
public void buildSupplier(OfficeBuilder officeBuilder, CompileContext compileContext)
Description copied from interface:SupplierNode
Builds theSupplierThreadLocal
instances for theSupplierSource
.- Specified by:
buildSupplier
in interfaceSupplierNode
- Parameters:
officeBuilder
-OfficeBuilder
to build the required thread handling.compileContext
-CompileContext
.
-
getInternalSuppliers
public InternalSupplier[] getInternalSuppliers()
Description copied from interface:SupplierNode
Obtains theInternalSupplier
instances.- Specified by:
getInternalSuppliers
in interfaceSupplierNode
- Returns:
InternalSupplier
instances.
-
-