Class AbstractJobBusDirectory<CTX,H>

  • Type Parameters:
    CTX - The context type to use, can by any Component, service or POJO.
    H - The handle type used to reference a job.
    All Implemented Interfaces:
    org.refcodes.component.FlushHandle<H>, org.refcodes.component.HandleDirectory<H,org.refcodes.command.Undoable<CTX,?,?>>, org.refcodes.component.HandleLookup<H,org.refcodes.command.Undoable<CTX,?,?>>, org.refcodes.component.ProgressHandle<H>, org.refcodes.component.ResetHandle<H>, JobBus<CTX,H>, JobBusDirectory<CTX,H>
    Direct Known Subclasses:
    JobBusDirectoryImpl

    public abstract class AbstractJobBusDirectory<CTX,H>
    extends AbstractJobBus<CTX,H>
    implements JobBusDirectory<CTX,H>
    The AbstractJobBusDirectory extends the AbstractJobBus with the JobBusDirectory functionality.
    • Constructor Detail

      • AbstractJobBusDirectory

        public AbstractJobBusDirectory​(CTX aContext,
                                       org.refcodes.component.HandleGenerator<H> aHandleGenerator)
        Instantiates the AbstractJobBusDirectory with the provided context and the provided HandleGenerator. It is up to you which context (service, Component, POJO) you want to provide to a job (Undoable) when being executed. Also you can provide any HandleGenerator you thing useful when creating handles. It is up to your HandleGenerator to generate unique handle objects. The JobBusDirectory actually uses a String objects generating HandleGenerator. Make sure your handles implement the Object.hashCode() and Object.equals(Object) methods as of their method contracts as them handles will be used in collections such as HashMap data structures.
        Parameters:
        aContext - The context which is passed to the job (Undoable) instances when being executed.
        aHandleGenerator - The HandleGenerator to be used when generating unique handle objects.
    • Method Detail

      • handleReferences

        public java.util.Collection<org.refcodes.command.Undoable<CTX,?,?>> handleReferences()
        Handle references.
        Specified by:
        handleReferences in interface org.refcodes.component.HandleDirectory<CTX,H>
        Overrides:
        handleReferences in class AbstractJobBus<CTX,H>
        Returns:
        the collection
      • handles

        public java.util.Set<H> handles()
        Returns the set of handles managed by this implementation.
        Specified by:
        handles in interface org.refcodes.component.HandleDirectory<CTX,H>
        Overrides:
        handles in class AbstractJobBus<CTX,H>
        Returns:
        The set containing all currently managed handles.