Interface OfficeBuilder

  • All Known Implementing Classes:
    OfficeBuilderImpl

    public interface OfficeBuilder
    Builder of an Office.
    Author:
    Daniel Sagenschneider
    • 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 the OfficeManager monitors the Office.
        Parameters:
        monitorOfficeInterval - Interval in milli-seconds between each time the OfficeManager monitors the Office.
      • 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 of StackOverflowError occurring in having recursively call into the FunctionState chain. Setting this value high, has more Thread overheads in breaking the recursive chain, slowing performance.

        Parameters:
        maximumFunctionStateChainLength - Maximum FunctionState chain length.
      • setDefaultAsynchronousFlowTimeout

        void setDefaultAsynchronousFlowTimeout​(long timeout)
        Specifies the default timeout for AsynchronousFlow instances.
        Parameters:
        timeout - Default timeout.
      • registerTeam

        void registerTeam​(java.lang.String officeTeamName,
                          java.lang.String officeFloorTeamName)
        Registers a Team which will execute ManagedFunction instances within this Office.
        Parameters:
        officeTeamName - Name of the Team to be referenced locally by this Office.
        officeFloorTeamName - Name of the Team within the OfficeFloor.
      • setDefaultTeam

        void setDefaultTeam​(java.lang.String officeTeamName)
        Allows optionally specifying the default Team for the Office.
        Parameters:
        officeTeamName - Name of the Team within this Office to use as default Team.
      • registerManagedObjectSource

        void registerManagedObjectSource​(java.lang.String officeManagedObjectName,
                                         java.lang.String officeFloorManagedObjectSourceName)
        Registers the ManagedObject within this Office.
        Parameters:
        officeManagedObjectName - Name of the ManagedObject to be referenced locally by this Office.
        officeFloorManagedObjectSourceName - Name of the ManagedObjectSource within the OfficeFloor.
      • setBoundInputManagedObject

        void setBoundInputManagedObject​(java.lang.String inputManagedObjectName,
                                        java.lang.String managedObjectSourceName)
        Specifies the input ManagedObject to be bound to the ProcessState should there be multiple instances and it was not input.
        Parameters:
        inputManagedObjectName - Input ManagedObject name.
        managedObjectSourceName - ManagedObjectSource name.
      • setManuallyManageGovernance

        void setManuallyManageGovernance​(boolean isManuallyManageGovernance)
        Flags whether to manually manage Governance via Administration instances.
        Parameters:
        isManuallyManageGovernance - true to manually manage Governance via Administration 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)
        Adds Governance within the Office.
        Type Parameters:
        E - Extension interface type.
        F - Flow key type.
        Parameters:
        governanceName - Name of the Governance to be referenced locally by this Office.
        extensionInterface - Extension interface.
        governanceFactory - GovernanceFactory class.
        Returns:
        GovernanceBuilder.
      • addEscalation

        void addEscalation​(java.lang.Class<? extends java.lang.Throwable> typeOfCause,
                           java.lang.String functionName)
        Adds an EscalationFlow for issues not handled within the Office.
        Parameters:
        typeOfCause - Type of cause handled by this EscalationFlow.
        functionName - Name of ManagedFunction to handle the EscalationFlow.
      • addStartupFunction

        void addStartupFunction​(java.lang.String functionName,
                                java.lang.Object parameter)
        Adds a ManagedFunction to invoke on start up of the Office.
        Parameters:
        functionName - Name of ManagedFunction.
        parameter - Parameter value to be passed to the ManagedFunction. May be null.
      • setProfiler

        void setProfiler​(Profiler profiler)
        Allows to optionally specify a Profiler that listens in on profiling information of the Office.
        Parameters:
        profiler - Profiler.