Interface OfficeBuilder
-
- All Known Implementing Classes:
OfficeBuilderImpl
public interface OfficeBuilder
Builder of anOffice
.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addEscalation(java.lang.Class<? extends java.lang.Throwable> typeOfCause, java.lang.String functionName)
Adds anEscalationFlow
for issues not handled within theOffice
.<E,F extends java.lang.Enum<F>>
GovernanceBuilder<F>addGovernance(java.lang.String governanceName, java.lang.Class<E> extensionInterface, GovernanceFactory<? super E,F> governanceFactory)
AddsGovernance
within theOffice
.<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
ManagedFunctionBuilder<O,F>addManagedFunction(java.lang.String functionName, ManagedFunctionFactory<O,F> mangedFunctionFactory)
Adds aManagedFunction
to be executed within theOffice
.void
addOfficeEnhancer(OfficeEnhancer officeEnhancer)
AddsOfficeEnhancer
for thisOffice
.ThreadDependencyMappingBuilder
addProcessManagedObject(java.lang.String processManagedObjectName, java.lang.String officeManagedObjectName)
void
addStartupFunction(java.lang.String functionName, java.lang.Object parameter)
Adds aManagedFunction
to invoke on start up of theOffice
.ThreadDependencyMappingBuilder
addThreadManagedObject(java.lang.String threadManagedObjectName, java.lang.String officeManagedObjectName)
void
addThreadSynchroniser(ThreadSynchroniserFactory threadSynchroniserFactory)
void
registerManagedObjectSource(java.lang.String officeManagedObjectName, java.lang.String officeFloorManagedObjectSourceName)
Registers theManagedObject
within thisOffice
.void
registerTeam(java.lang.String officeTeamName, java.lang.String officeFloorTeamName)
void
setBoundInputManagedObject(java.lang.String inputManagedObjectName, java.lang.String managedObjectSourceName)
Specifies the inputManagedObject
to be bound to theProcessState
should there be multiple instances and it was not input.void
setDefaultAsynchronousFlowTimeout(long timeout)
Specifies the default timeout forAsynchronousFlow
instances.void
setDefaultTeam(java.lang.String officeTeamName)
void
setManuallyManageGovernance(boolean isManuallyManageGovernance)
Flags whether to manually manageGovernance
viaAdministration
instances.void
setMaximumFunctionStateChainLength(int maximumFunctionStateChainLength)
Specifies the maximumFunctionState
chain length.void
setMonitorClock(MonitorClock clock)
Allows providing anMonitorClock
implementation to obtain the current time.void
setMonitorOfficeInterval(long monitorOfficeInterval)
Specifies the interval in milli-seconds between each time theOfficeManager
monitors theOffice
.void
setProfiler(Profiler profiler)
-
-
-
Method Detail
-
setMonitorClock
void setMonitorClock(MonitorClock clock)
Allows providing an
MonitorClock
implementation to obtain the current time.Should no
MonitorClock
be provided, a default implementation will be used.Typically this is useful in testing to fix to a deterministic time. However, should there be native implementations of keeping time that is efficient, this enables overriding the default implementation.
- Parameters:
clock
-MonitorClock
.
-
setMonitorOfficeInterval
void setMonitorOfficeInterval(long monitorOfficeInterval)
Specifies the interval in milli-seconds between each time theOfficeManager
monitors theOffice
.- Parameters:
monitorOfficeInterval
- Interval in milli-seconds between each time theOfficeManager
monitors theOffice
.
-
setMaximumFunctionStateChainLength
void setMaximumFunctionStateChainLength(int maximumFunctionStateChainLength)
Specifies the maximum
FunctionState
chain length.This value is a trade off between limiting
Thread
stack calls and performance. Setting this value low runs the risk ofStackOverflowError
occurring in having recursively call into theFunctionState
chain. Setting this value high, has moreThread
overheads in breaking the recursive chain, slowing performance.- Parameters:
maximumFunctionStateChainLength
- MaximumFunctionState
chain length.
-
setDefaultAsynchronousFlowTimeout
void setDefaultAsynchronousFlowTimeout(long timeout)
Specifies the default timeout forAsynchronousFlow
instances.- Parameters:
timeout
- Default timeout.
-
registerTeam
void registerTeam(java.lang.String officeTeamName, java.lang.String officeFloorTeamName)
- Parameters:
officeTeamName
- Name of theTeam
to be referenced locally by thisOffice
.officeFloorTeamName
- Name of theTeam
within theOfficeFloor
.
-
setDefaultTeam
void setDefaultTeam(java.lang.String officeTeamName)
-
registerManagedObjectSource
void registerManagedObjectSource(java.lang.String officeManagedObjectName, java.lang.String officeFloorManagedObjectSourceName)
Registers theManagedObject
within thisOffice
.- Parameters:
officeManagedObjectName
- Name of theManagedObject
to be referenced locally by thisOffice
.officeFloorManagedObjectSourceName
- Name of theManagedObjectSource
within theOfficeFloor
.
-
setBoundInputManagedObject
void setBoundInputManagedObject(java.lang.String inputManagedObjectName, java.lang.String managedObjectSourceName)
Specifies the inputManagedObject
to be bound to theProcessState
should there be multiple instances and it was not input.- Parameters:
inputManagedObjectName
- InputManagedObject
name.managedObjectSourceName
-ManagedObjectSource
name.
-
addProcessManagedObject
ThreadDependencyMappingBuilder addProcessManagedObject(java.lang.String processManagedObjectName, java.lang.String officeManagedObjectName)
Adds a
ProcessState
boundManagedObject
to thisOffice
.Dependency scope:
- Other
ManagedObject
instances added via this method.
- Parameters:
processManagedObjectName
- Name to link theManagedObject
forManagedFunction
instances.officeManagedObjectName
- Name of theManagedObject
registered within thisOffice
.- Returns:
ThreadDependencyMappingBuilder
to build any necessary dependencies for theManagedObject
. See scope above.
- Other
-
addThreadManagedObject
ThreadDependencyMappingBuilder addThreadManagedObject(java.lang.String threadManagedObjectName, java.lang.String officeManagedObjectName)
Adds a
ThreadState
boundManagedObject
to thisOffice
.Dependency scope:
- Other
ManagedObject
instances added via this method. ProcessState
boundManagedObject
instances.
- Parameters:
threadManagedObjectName
- Name to link theManagedObject
forManagedFunction
instances.officeManagedObjectName
- Name of theManagedObject
registered within thisOffice
.- Returns:
ThreadDependencyMappingBuilder
to build any necessary dependencies for theManagedObject
. See scope above.
- Other
-
setManuallyManageGovernance
void setManuallyManageGovernance(boolean isManuallyManageGovernance)
Flags whether to manually manageGovernance
viaAdministration
instances.- Parameters:
isManuallyManageGovernance
-true
to manually manageGovernance
viaAdministration
instances.
-
addGovernance
<E,F extends java.lang.Enum<F>> GovernanceBuilder<F> addGovernance(java.lang.String governanceName, java.lang.Class<E> extensionInterface, GovernanceFactory<? super E,F> governanceFactory)
AddsGovernance
within theOffice
.- Type Parameters:
E
- Extension interface type.F
- Flow key type.- Parameters:
governanceName
- Name of theGovernance
to be referenced locally by thisOffice
.extensionInterface
- Extension interface.governanceFactory
-GovernanceFactory
class.- Returns:
GovernanceBuilder
.
-
addManagedFunction
<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>> ManagedFunctionBuilder<O,F> addManagedFunction(java.lang.String functionName, ManagedFunctionFactory<O,F> mangedFunctionFactory)
Adds aManagedFunction
to be executed within theOffice
.- Type Parameters:
O
- Dependency key type.F
- Flow key type.- Parameters:
functionName
- Name of theManagedFunction
.mangedFunctionFactory
-ManagedFunctionFactory
to create theManagedFunction
.- Returns:
ManagedFunctionBuilder
for theManagedFunction
.
-
addEscalation
void addEscalation(java.lang.Class<? extends java.lang.Throwable> typeOfCause, java.lang.String functionName)
Adds anEscalationFlow
for issues not handled within theOffice
.- Parameters:
typeOfCause
- Type of cause handled by thisEscalationFlow
.functionName
- Name ofManagedFunction
to handle theEscalationFlow
.
-
addStartupFunction
void addStartupFunction(java.lang.String functionName, java.lang.Object parameter)
Adds aManagedFunction
to invoke on start up of theOffice
.- Parameters:
functionName
- Name ofManagedFunction
.parameter
- Parameter value to be passed to theManagedFunction
. May benull
.
-
addOfficeEnhancer
void addOfficeEnhancer(OfficeEnhancer officeEnhancer)
Adds
OfficeEnhancer
for thisOffice
.This enables enhancing the
Office
after theManagedObjectSource
instances are registered.- Parameters:
officeEnhancer
-OfficeEnhancer
.
-
addThreadSynchroniser
void addThreadSynchroniser(ThreadSynchroniserFactory threadSynchroniserFactory)
- Parameters:
threadSynchroniserFactory
-ThreadSynchroniserFactory
to create theThreadSynchroniser
.
-
-