quarks.runtime.etiao

Class Invocation<T extends Oplet<I,O>,I,O>

  • java.lang.Object
    • quarks.runtime.etiao.Invocation<T,I,O>
  • Type Parameters:
    T - Oplet type.
    I - Data container type for input tuples.
    O - Data container type for output tuples.
    All Implemented Interfaces:
    java.lang.AutoCloseable


    public class Invocation<T extends Oplet<I,O>,I,O>
    extends java.lang.Object
    implements java.lang.AutoCloseable
    An Oplet invocation in the context of the ETIAO runtime.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String ID_PREFIX
      Prefix used by oplet unique identifiers.
    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected Invocation(java.lang.String id, T oplet, int inputCount, int outputCount) 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int addOutput()
      Adds a new output.
      void close() 
      void disconnect(int port)
      Disconnects the specified port by connecting to a no-op Consumer implementation.
      java.lang.String getId()
      Returns the unique identifier associated with this Invocation.
      java.util.List<? extends Consumer<I>> getInputs()
      Returns the list of input stream forwarders for this invocation.
      T getOplet()
      Returns the oplet associated with this Invocation.
      int getOutputCount()
      Returns the number of outputs for this invocation.
      void initialize(JobContext job, RuntimeServices services)
      Initialize the invocation.
      void setTarget(int port, Consumer<O> target)
      Disconnects the specified port and reconnects it to the specified target.
      void start()
      Start the oplet.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ID_PREFIX

        public static final java.lang.String ID_PREFIX
        Prefix used by oplet unique identifiers.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Invocation

        protected Invocation(java.lang.String id,
                             T oplet,
                             int inputCount,
                             int outputCount)
    • Method Detail

      • getId

        public java.lang.String getId()
        Returns the unique identifier associated with this Invocation.
        Returns:
        unique identifier
      • getOplet

        public T getOplet()
        Returns the oplet associated with this Invocation.
        Returns:
        the oplet associated with this invocation
      • getOutputCount

        public int getOutputCount()
        Returns the number of outputs for this invocation.
        Returns:
        the number of outputs
      • addOutput

        public int addOutput()
        Adds a new output. By default, the output is connected to a Consumer that discards all items passed to it.
        Returns:
        the index of the new output
      • disconnect

        public void disconnect(int port)
        Disconnects the specified port by connecting to a no-op Consumer implementation.
        Parameters:
        port - the port index
      • setTarget

        public void setTarget(int port,
                              Consumer<O> target)
        Disconnects the specified port and reconnects it to the specified target.
        Parameters:
        port - index of the port which is reconnected
        target - target the port gets connected to
      • getInputs

        public java.util.List<? extends Consumer<I>> getInputs()
        Returns the list of input stream forwarders for this invocation.
      • initialize

        public void initialize(JobContext job,
                               RuntimeServices services)
        Initialize the invocation.
        Parameters:
        job - the context of the current job
        services - service provider for this invocation
      • start

        public void start()
        Start the oplet. Oplets must not submit any tuples not derived from input tuples until this method is called.
      • close

        public void close()
                   throws java.lang.Exception
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.lang.Exception

Copyright IBM 2015,2016 - 2f6ad0e-20160307-0902