com.ibm.streams.operator.model

Annotation Type Libraries



  • @Target(value=TYPE)
    @Retention(value=RUNTIME)
    @Documented
    @Inherited
    public @interface Libraries
    Declare a set of Java class libraries to be added to the operator's class loader at execution time. A path may be one of:

    A path may contain an environment variable delimited by @ characters, e.g. @DERBY_INSTALL@/lib/derby.jar. The environment variable is evaluated during SPL compilation when the SPL application invokes a PrimitiveOperator with this annotation. This means that the resultant path must be available on any resource (host) where the operator will execute.

    If a file path ends with /* then all the files in the specified directory with the extension .jar or .JAR will added to the operator's class loader. The expansion occurs at execution time.
    Otherwise the file path is assumed to refer to a jar file or a directory.

    Example of including all the jar files in $DERBY_INSTALL/lib .

     
     @PrimitiveOperator
     @Libraries({"@DERBY_INSTALL@/lib/*"})
     public class DerbyOp extends AbstractOperator
     
     
    Note that this annotation can be inherited i.e. if specified on a class, this annotation will be inherited by any subclasses unless the subclass provides its own version of the annotation.

    The search order for classes for a Java primitive operator is:

    1. The classes provided by the virtual machine's Java runtime (Java 6 or Java 7).
    2. The classes provided by the SPL Java runtime, including:
      • Java Operator samples and patterns - com.ibm.streams.operator.samples.jar
      • Java Operator API - com.ibm.streams.operator.jar
      • Apache Common Math 2.2
      • Apache Logging 1.2
      • IBM JSON for Java
    3. The jar or directory containing the operator class annotated with PrimitiveOperator, including any dependent classes from the jar's manifest Class-Path entry.
    4. The classes specified by the operator class's Libraries annotation. Order within value() is preserved, with the path listed first being earliest in the search order.
    5. Any classes added by OperatorContext.addClassLibraries(String[])
    When a path defined by @Libraries or addClassLibraries ends with '/*' then all jar files in that directory are included in the search order. The order within the set of jars loaded though this mechanism is not defined, but they remain ordered with respect to the path that included them. For example: @Libraries({"opt/a/*", "opt/b/*"}) will include all the jars in opt/a and opt/b, and all jars in opt/a are earlier in the search path than those in opt/b.

    Since:
    InfoSphere® Streams Version 3.2
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element and Description
      java.lang.String[] value 
    • Element Detail

      • value

        public abstract java.lang.String[] value