Class OfficeFloorBuilderImpl
- java.lang.Object
-
- net.officefloor.frame.impl.construct.officefloor.OfficeFloorBuilderImpl
-
- All Implemented Interfaces:
OfficeFloorBuilder
,OfficeFloorConfiguration
public class OfficeFloorBuilderImpl extends java.lang.Object implements OfficeFloorBuilder, OfficeFloorConfiguration
Implementation ofOfficeFloorBuilder
.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description OfficeFloorBuilderImpl(java.lang.String officeFloorName)
Initiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <D extends java.lang.Enum<D>,F extends java.lang.Enum<F>,MS extends ManagedObjectSource<D,F>>
ManagedObjectBuilder<F>addManagedObject(java.lang.String managedObjectSourceName, java.lang.Class<MS> managedObjectSourceClass)
Adds aManagedObjectSource
to thisOfficeFloorBuilder
.<D extends java.lang.Enum<D>,F extends java.lang.Enum<F>>
ManagedObjectBuilder<F>addManagedObject(java.lang.String managedObjectSourceName, ManagedObjectSource<D,F> managedObjectSource)
Adds aManagedObjectSource
to thisOfficeFloorBuilder
.OfficeBuilder
addOffice(java.lang.String officeName)
Adds anOffice
on theOfficeFloor
.void
addOfficeFloorListener(OfficeFloorListener listener)
Adds anOfficeFloorListener
.void
addOfficeVisitor(OfficeVisitor visitor)
Adds anOfficeVisitor
.void
addProfile(java.lang.String profile)
Adds an active profile for theOfficeFloor
.void
addResources(ResourceSource resourceSource)
Adds aResourceSource
to locate resources.<TS extends TeamSource>
TeamBuilder<TS>addTeam(java.lang.String teamName, java.lang.Class<TS> teamSourceClass)
<TS extends TeamSource>
TeamBuilder<TS>addTeam(java.lang.String teamName, TS teamSource)
OfficeFloor
buildOfficeFloor()
Builds theOfficeFloor
.OfficeFloor
buildOfficeFloor(OfficeFloorIssues issues)
Builds theOfficeFloor
.EscalationHandler
getEscalationHandler()
Obtains theEscalationHandler
for issues escalating out of theOffice
instances.ExecutiveConfiguration<?>
getExecutiveConfiguration()
Obtains the configuration of theExecutive
for theOfficeFloor
.ManagedObjectSourceConfiguration<?,?>[]
getManagedObjectSourceConfiguration()
Obtains the configuration of theManagedObjectSource
instances.long
getMaxStartupWaitTime()
Obtains the maximum time in milliseconds to wait forOfficeFloor
to start.OfficeConfiguration[]
getOfficeConfiguration()
Obtains the configuration of theOffice
instances on theOfficeFloor
.java.lang.String
getOfficeFloorName()
Obtains the name of theOfficeFloor
.OfficeVisitor[]
getOfficeVisitors()
Obtains theOfficeVisitor
instances.java.lang.String[]
getProfiles()
Obtains the profiles.SourceContext
getSourceContext(java.lang.String sourceName, java.util.function.Supplier<ClockFactory> clockFactoryProvider)
Obtains theSourceContext
.TeamConfiguration<?>[]
getTeamConfiguration()
Obtains the configuration of theTeam
instances on theOfficeFloor
.java.util.function.Consumer<java.lang.Thread>
getThreadDecorator()
Obtains the decorator ofThread
instances created by theTeamSourceContext
.void
setClassLoader(java.lang.ClassLoader classLoader)
Allows overriding theClassLoader
provided to the sources by theSourceContext
.void
setClockFactory(ClockFactory clockFactory)
void
setEscalationHandler(EscalationHandler escalationHandler)
Specifies theEscalationHandler
for issues escalating out of theOffice
instances.<XS extends ExecutiveSource>
ExecutiveBuilder<XS>setExecutive(java.lang.Class<XS> executiveSourceClass)
<XS extends ExecutiveSource>
ExecutiveBuilder<XS>setExecutive(XS executiveSource)
void
setMaxStartupWaitTime(long maxStartupWaitTime)
Specifies the maximum time in milliseconds to wait forOfficeFloor
to start.void
setThreadDecorator(java.util.function.Consumer<java.lang.Thread> decorator)
Decorates all theThread
instances created by theTeamSourceContext
.
-
-
-
Constructor Detail
-
OfficeFloorBuilderImpl
public OfficeFloorBuilderImpl(java.lang.String officeFloorName)
Initiate.- Parameters:
officeFloorName
- Name of theOfficeFloor
.
-
-
Method Detail
-
addProfile
public void addProfile(java.lang.String profile)
Description copied from interface:OfficeFloorBuilder
Adds an active profile for theOfficeFloor
.- Specified by:
addProfile
in interfaceOfficeFloorBuilder
- Parameters:
profile
- Active profile for theOfficeFloor
.
-
setClassLoader
public void setClassLoader(java.lang.ClassLoader classLoader)
Description copied from interface:OfficeFloorBuilder
Allows overriding theClassLoader
provided to the sources by theSourceContext
.- Specified by:
setClassLoader
in interfaceOfficeFloorBuilder
- Parameters:
classLoader
-ClassLoader
.
-
setClockFactory
public void setClockFactory(ClockFactory clockFactory)
Description copied from interface:OfficeFloorBuilder
- Specified by:
setClockFactory
in interfaceOfficeFloorBuilder
- Parameters:
clockFactory
-ClockFactory
.
-
setMaxStartupWaitTime
public void setMaxStartupWaitTime(long maxStartupWaitTime)
Description copied from interface:OfficeFloorBuilder
Specifies the maximum time in milliseconds to wait forOfficeFloor
to start.- Specified by:
setMaxStartupWaitTime
in interfaceOfficeFloorBuilder
- Parameters:
maxStartupWaitTime
- Maximum time in milliseconds to wait forOfficeFloor
to start.
-
setThreadDecorator
public void setThreadDecorator(java.util.function.Consumer<java.lang.Thread> decorator)
Description copied from interface:OfficeFloorBuilder
Decorates all theThread
instances created by theTeamSourceContext
.- Specified by:
setThreadDecorator
in interfaceOfficeFloorBuilder
- Parameters:
decorator
- Decorates all theThread
instances created by theTeamSourceContext
.
-
addResources
public void addResources(ResourceSource resourceSource)
Description copied from interface:OfficeFloorBuilder
Adds aResourceSource
to locate resources.- Specified by:
addResources
in interfaceOfficeFloorBuilder
- Parameters:
resourceSource
-ResourceSource
.
-
addOfficeFloorListener
public void addOfficeFloorListener(OfficeFloorListener listener)
Description copied from interface:OfficeFloorBuilder
Adds anOfficeFloorListener
.- Specified by:
addOfficeFloorListener
in interfaceOfficeFloorBuilder
- Parameters:
listener
-OfficeFloorListener
.
-
addManagedObject
public <D extends java.lang.Enum<D>,F extends java.lang.Enum<F>,MS extends ManagedObjectSource<D,F>> ManagedObjectBuilder<F> addManagedObject(java.lang.String managedObjectSourceName, java.lang.Class<MS> managedObjectSourceClass)
Description copied from interface:OfficeFloorBuilder
Adds aManagedObjectSource
to thisOfficeFloorBuilder
.- Specified by:
addManagedObject
in interfaceOfficeFloorBuilder
- Type Parameters:
D
- Dependency key type.F
- Flow key type.MS
-ManagedObjectSource
type.- Parameters:
managedObjectSourceName
- Name of theManagedObjectSource
.managedObjectSourceClass
- Class of theManagedObjectSource
.- Returns:
ManagedObjectBuilder
.
-
addManagedObject
public <D extends java.lang.Enum<D>,F extends java.lang.Enum<F>> ManagedObjectBuilder<F> addManagedObject(java.lang.String managedObjectSourceName, ManagedObjectSource<D,F> managedObjectSource)
Description copied from interface:OfficeFloorBuilder
Adds aManagedObjectSource
to thisOfficeFloorBuilder
.- Specified by:
addManagedObject
in interfaceOfficeFloorBuilder
- Type Parameters:
D
- Dependency key type.F
- Flow key type.- Parameters:
managedObjectSourceName
- Name of theManagedObjectSource
.managedObjectSource
-ManagedObjectSource
instance to use.- Returns:
ManagedObjectBuilder
.
-
addTeam
public <TS extends TeamSource> TeamBuilder<TS> addTeam(java.lang.String teamName, java.lang.Class<TS> teamSourceClass)
Description copied from interface:OfficeFloorBuilder
- Specified by:
addTeam
in interfaceOfficeFloorBuilder
- Type Parameters:
TS
-TeamSource
type.- Parameters:
teamName
- Name to register theTeam
under.teamSourceClass
-TeamSource
Class
to source theTeam
.- Returns:
TeamBuilder
to build theTeam
.
-
addTeam
public <TS extends TeamSource> TeamBuilder<TS> addTeam(java.lang.String teamName, TS teamSource)
Description copied from interface:OfficeFloorBuilder
- Specified by:
addTeam
in interfaceOfficeFloorBuilder
- Type Parameters:
TS
-TeamSource
type.- Parameters:
teamName
- Name to register theTeam
under.teamSource
-TeamSource
to source theTeam
.- Returns:
TeamBuilder
to build theTeam
.
-
setExecutive
public <XS extends ExecutiveSource> ExecutiveBuilder<XS> setExecutive(java.lang.Class<XS> executiveSourceClass)
Description copied from interface:OfficeFloorBuilder
- Specified by:
setExecutive
in interfaceOfficeFloorBuilder
- Type Parameters:
XS
-ExecutiveSource
type.- Parameters:
executiveSourceClass
-ExecutiveSource
Class
to source theExecutive
.- Returns:
ExecutiveBuilder
to build theExecutive
.
-
setExecutive
public <XS extends ExecutiveSource> ExecutiveBuilder<XS> setExecutive(XS executiveSource)
Description copied from interface:OfficeFloorBuilder
- Specified by:
setExecutive
in interfaceOfficeFloorBuilder
- Type Parameters:
XS
-ExecutiveSource
type.- Parameters:
executiveSource
-ExecutiveSource
to source theExecutive
.- Returns:
ExecutiveBuilder
to build theExecutive
.
-
addOffice
public OfficeBuilder addOffice(java.lang.String officeName)
Description copied from interface:OfficeFloorBuilder
Adds anOffice
on theOfficeFloor
.- Specified by:
addOffice
in interfaceOfficeFloorBuilder
- Parameters:
officeName
- Name of theOffice
.- Returns:
OfficeBuilder
to build theOffice
.
-
addOfficeVisitor
public void addOfficeVisitor(OfficeVisitor visitor)
Description copied from interface:OfficeFloorBuilder
Adds anOfficeVisitor
.- Specified by:
addOfficeVisitor
in interfaceOfficeFloorBuilder
- Parameters:
visitor
-OfficeVisitor
.
-
setEscalationHandler
public void setEscalationHandler(EscalationHandler escalationHandler)
Description copied from interface:OfficeFloorBuilder
Specifies theEscalationHandler
for issues escalating out of theOffice
instances.- Specified by:
setEscalationHandler
in interfaceOfficeFloorBuilder
- Parameters:
escalationHandler
-EscalationHandler
.
-
buildOfficeFloor
public OfficeFloor buildOfficeFloor() throws OfficeFloorBuildException
Description copied from interface:OfficeFloorBuilder
Builds theOfficeFloor
.- Specified by:
buildOfficeFloor
in interfaceOfficeFloorBuilder
- Returns:
- Built
OfficeFloor
. - Throws:
OfficeFloorBuildException
- If fails to build theOfficeFloor
.- See Also:
OfficeFloorBuildException
-
buildOfficeFloor
public OfficeFloor buildOfficeFloor(OfficeFloorIssues issues)
Description copied from interface:OfficeFloorBuilder
Builds theOfficeFloor
.- Specified by:
buildOfficeFloor
in interfaceOfficeFloorBuilder
- Parameters:
issues
-OfficeFloorIssues
to listen for issues in constructing theOfficeFloor
.- Returns:
- Built
OfficeFloor
if successfully built, ornull
if could not constructOfficeFloor
with reasons passed to theOfficeFloorIssues
.
-
getOfficeFloorName
public java.lang.String getOfficeFloorName()
Description copied from interface:OfficeFloorConfiguration
Obtains the name of theOfficeFloor
.- Specified by:
getOfficeFloorName
in interfaceOfficeFloorConfiguration
- Returns:
OfficeFloor
.
-
getMaxStartupWaitTime
public long getMaxStartupWaitTime()
Description copied from interface:OfficeFloorConfiguration
Obtains the maximum time in milliseconds to wait forOfficeFloor
to start.- Specified by:
getMaxStartupWaitTime
in interfaceOfficeFloorConfiguration
- Returns:
- Maximum time in milliseconds to wait for
OfficeFloor
to start.
-
getProfiles
public java.lang.String[] getProfiles()
Description copied from interface:OfficeFloorConfiguration
Obtains the profiles.- Specified by:
getProfiles
in interfaceOfficeFloorConfiguration
- Returns:
- Profiles.
-
getThreadDecorator
public java.util.function.Consumer<java.lang.Thread> getThreadDecorator()
Description copied from interface:OfficeFloorConfiguration
Obtains the decorator ofThread
instances created by theTeamSourceContext
.- Specified by:
getThreadDecorator
in interfaceOfficeFloorConfiguration
- Returns:
- Decorator of
Thread
instances created by theTeamSourceContext
. May benull
.
-
getSourceContext
public SourceContext getSourceContext(java.lang.String sourceName, java.util.function.Supplier<ClockFactory> clockFactoryProvider)
Description copied from interface:OfficeFloorConfiguration
Obtains theSourceContext
.- Specified by:
getSourceContext
in interfaceOfficeFloorConfiguration
- Parameters:
sourceName
- Name of source.clockFactoryProvider
- ProvidesClockFactory
if one not configured.- Returns:
SourceContext
.
-
getManagedObjectSourceConfiguration
public ManagedObjectSourceConfiguration<?,?>[] getManagedObjectSourceConfiguration()
Description copied from interface:OfficeFloorConfiguration
Obtains the configuration of theManagedObjectSource
instances.- Specified by:
getManagedObjectSourceConfiguration
in interfaceOfficeFloorConfiguration
- Returns:
ManagedObjectSource
configuration.
-
getTeamConfiguration
public TeamConfiguration<?>[] getTeamConfiguration()
Description copied from interface:OfficeFloorConfiguration
Obtains the configuration of theTeam
instances on theOfficeFloor
.- Specified by:
getTeamConfiguration
in interfaceOfficeFloorConfiguration
- Returns:
TeamConfiguration
instances.
-
getExecutiveConfiguration
public ExecutiveConfiguration<?> getExecutiveConfiguration()
Description copied from interface:OfficeFloorConfiguration
Obtains the configuration of theExecutive
for theOfficeFloor
.- Specified by:
getExecutiveConfiguration
in interfaceOfficeFloorConfiguration
- Returns:
ExecutiveConfiguration
.
-
getOfficeConfiguration
public OfficeConfiguration[] getOfficeConfiguration()
Description copied from interface:OfficeFloorConfiguration
Obtains the configuration of theOffice
instances on theOfficeFloor
.- Specified by:
getOfficeConfiguration
in interfaceOfficeFloorConfiguration
- Returns:
OfficeConfiguration
instances.
-
getOfficeVisitors
public OfficeVisitor[] getOfficeVisitors()
Description copied from interface:OfficeFloorConfiguration
Obtains theOfficeVisitor
instances.- Specified by:
getOfficeVisitors
in interfaceOfficeFloorConfiguration
- Returns:
OfficeVisitor
instances.
-
getEscalationHandler
public EscalationHandler getEscalationHandler()
Description copied from interface:OfficeFloorConfiguration
Obtains theEscalationHandler
for issues escalating out of theOffice
instances.- Specified by:
getEscalationHandler
in interfaceOfficeFloorConfiguration
- Returns:
EscalationHandler
for issues escalating out of theOffice
instances. May benull
.
-
-