/**
 * This service provides a way to register operations that are
 * scheduled for execution at a future time offset.
 *
 * Registered operations can be reset or removed before their
 * execution.
 *
 * Expected Use:
 *
 * This interface represents a self contained component. Server *
 * Framework is expected to provide Lifecycle, Registry and Lookup
 */
public interface ResettableTimeGuardedCommandMap
{
    /** Role exposed by this component */
    String ROLE = ResettableTimeGuardedCommandMap.class.getName();

    /**
     * Schedule a time guarded Operation.
     *
     * @param offset future offset when the command would be executed
     * @param cmd    Command executed in future.
     * @param return Unique Command Identifier.
     */
    int add(long offset, Command cmd);

    /**
     * Remove a sceduled command.
     *
     * @param commandID Unique Command Identifier.
     * @exception NoSuchElementException if no trigger exists with
     * that name
     */
    void remove(int commandID)
        throws NoSuchElementException;

    /**
     * Force a command to be recalculated.
     *
     * @param commandID Unique Command Identifier.
     * @exception NoSuchElementException if no trigger exists with that name
     */
    void reset(int commandID)
        throws NoSuchElementException;
}


/** Command marker. */
public interface Command
{
    /**
     * Execute command
     */
    void execute();
}

