quarks.oplet

Interface OpletContext<I,O>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      java.lang.String getId()
      Get the unique identifier (within the running job) for this oplet.
      int getInputCount()
      Get the number of connected inputs to this oplet.
      JobContext getJobContext()
      Get the job hosting this oplet.
      int getOutputCount()
      Get the number of connected outputs to this oplet.
      java.util.List<? extends Consumer<O>> getOutputs()
      Get the mechanism to submit tuples on an output port.
      <T> T getService(java.lang.Class<T> serviceClass)
      Get a service for this invocation.
      java.lang.String uniquify(java.lang.String name)
      Creates a unique name within the context of the current runtime.
    • Method Detail

      • getId

        java.lang.String getId()
        Get the unique identifier (within the running job) for this oplet.
        Returns:
        unique identifier for this oplet
      • getService

        <T> T getService(java.lang.Class<T> serviceClass)
        Get a service for this invocation.

        These services must be provided by all implementations:

        • java.util.concurrent.ThreadFactory - Thread factory, runtime code should create new threads using this factory.
        • java.util.concurrent.ScheduledExecutorService - Scheduler, runtime code should execute asynchronous and repeating tasks using this scheduler.

        Get a service for this oplet invocation. An invocation of an oplet may get access to services, which provide specific functionality, such as metrics.

        Specified by:
        getService in interface RuntimeServices
        Parameters:
        serviceClass - Type of the service required.
        Returns:
        Service of type implementing serviceClass if the container this invocation runs in supports that service, otherwise null.
      • getInputCount

        int getInputCount()
        Get the number of connected inputs to this oplet.
        Returns:
        number of connected inputs to this oplet.
      • getOutputCount

        int getOutputCount()
        Get the number of connected outputs to this oplet.
        Returns:
        number of connected outputs to this oplet.
      • getOutputs

        java.util.List<? extends Consumer<O>> getOutputs()
        Get the mechanism to submit tuples on an output port.
        Returns:
        list of consumers
      • getJobContext

        JobContext getJobContext()
        Get the job hosting this oplet.
        Returns:
        JobContext hosting this oplet invocation.
      • uniquify

        java.lang.String uniquify(java.lang.String name)
        Creates a unique name within the context of the current runtime.

        The default implementation adds a suffix composed of the package name of this interface, the current job and oplet identifiers, all separated by periods ('.'). Developers should use this method to avoid name clashes when they store or register the name in an external container or registry.

        Parameters:
        name - name (possibly non-unique)
        Returns:
        unique name within the context of the current runtime.

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