Class DefaultSchedulableActionFactory

  • All Implemented Interfaces:
    ISchedulableActionFactory

    public class DefaultSchedulableActionFactory
    extends Object
    implements ISchedulableActionFactory
    Default implementation of an ISchedulableActionFactory. This creates IActions using a IActionFactory and then uses those IActions in conjunction with ScheduleParameters to create ScheduableActions.
    Version:
    $Revision: 1.1 $ $Date: 2005/12/21 22:25:34 $
    Author:
    Nick Collier
    See Also:
    ISchedulableAction, IAction, IActionFactory
    • Field Detail

      • actionFactory

        protected IActionFactory actionFactory
        The factory used to create IActions.
      • currentOrderIndex

        protected long currentOrderIndex
        Tracks the order index for adding actions.
    • Constructor Detail

      • DefaultSchedulableActionFactory

        public DefaultSchedulableActionFactory()
        Creates a DefaultSchedulableActionFactory that uses a DefaultActionFactory to create IActions.
      • DefaultSchedulableActionFactory

        public DefaultSchedulableActionFactory​(IActionFactory actionFactory)
        Creates a DefaultSchedulableActionFactory that uses the specified action factory to create IActions.
    • Method Detail

      • createAction

        public ISchedulableAction createAction​(ScheduleParameters scheduleParams,
                                               Object target,
                                               String methodName,
                                               Object... parameters)
        Creates a ISchedulableAction from the specified scheduling parameters that will execute the named method on the target object with the specified parameters.
        Specified by:
        createAction in interface ISchedulableActionFactory
        Parameters:
        scheduleParams - the scheduling data
        target - the object on which to call the named method
        methodName - the name of the method to call
        parameters - the parameters to pass to the method
        Returns:
        the created ISchedulableAction
      • createActionForIterable

        public ISchedulableAction createActionForIterable​(ScheduleParameters scheduleParams,
                                                          Iterable target,
                                                          String methodName,
                                                          boolean shuffle,
                                                          Object... parameters)
        Creates a ISchedulableAction from the specified scheduling parameters that will execute the named method on the objects returned by target object with the specified parameters.
        Specified by:
        createActionForIterable in interface ISchedulableActionFactory
        Parameters:
        scheduleParams - the scheduling data
        target - the Iterable containing the objects on which to call the named method
        methodName - the name of the method to call
        shuffle - whether to shuffle the items in the iterable before calling the method on the objects therein
        parameters - the parameters to pass to the method
        Returns:
        the created ISchedulableAction
      • createAction

        public ISchedulableAction createAction​(Object annotatedObj,
                                               Object... parameters)
        Creates an ISchedulableACtion from ScheduleMethod annotated methods in the specified annotatedObj. The action will execute the method whose parameters best match the specified parameters. The parameters will be passed to the method at execution.
        Specified by:
        createAction in interface ISchedulableActionFactory
        Parameters:
        annotatedObj - the object containing the annotated methods
        parameters - the parameters to pass to the method call and to use to find the method itself
        Returns:
        the created ISchedulableAction
        See Also:
        ScheduledMethod
      • createAction

        public ISchedulableAction createAction​(ScheduleParameters scheduleParams,
                                               Object annotatedObj,
                                               Object... parameters)
        Creates an ISchedulableAction from ScheduleMethod annotated methods in the specified annotatedObj. The action will execute the method whose parameters best match the specified parameters. The parameters will be passed to the method at execution. The method will be executed according to the specified ScheduleParameters. The scheduling parameters derived from the annotation will be ignored.
        Specified by:
        createAction in interface ISchedulableActionFactory
        Parameters:
        scheduleParams - the scheduling parameters describing start time etc.
        annotatedObj - the object containing the annotated methods
        parameters - the parameters to pass to the method call and to use to find the method itself
        Returns:
        the created ISchedulableAction
        See Also:
        ScheduledMethod
      • getActionFactory

        public IActionFactory getActionFactory()
        Gets the IActionFactory used to create the IActions needed by this DefaultSchedulableActionFactory.
        Specified by:
        getActionFactory in interface ISchedulableActionFactory
        Returns:
        the IActionFactory used to create the IActions needed by this DefaultSchedulableActionFactory.