External Methods - Connect_CDC - connect_cdc_mimix_share - 5.8

Connect CDC System Reference Guide

Product type
Software
Portfolio
Integrate
Product family
Connect
Product
Connect > Connect CDC (MIMIX Share)
Version
5.8
Language
English
Product name
Connect CDC
Title
Connect CDC System Reference Guide
Copyright
2024
First publish date
2003
ft:lastEdition
2024-02-12
ft:lastPublication
2024-02-12T15:11:59.486869

An external method is a static public Java method that is contained in a public class in a Java package that is separate from the set of built-in methods that is delivered with Connect CDC. The external method might be a member of a class in the Java JRE or in a class written by the customer or provided by a third party.

An external method can be referenced in an Connect CDC expression if the following conditions are met:

  1. The method contained in the Java package must be defined as public and static. The method will be delivered or will reside in either a class file or it will be packaged with other class files in a Java jar file or zip file.

  2. The class containing the method must be defined as public.

  3. The datatypes of method's input parameters and its return value must be compatible with the types supported by the Expression Handler.

  4. The Java package that contains the external method must be appropriately specified in the CLASSPATH for Connect CDC Listener and Connect CDC Director.

  5. When the method is used in an expression, its fully qualified name, including its class and package name, must be specified when referenced in an expression.

By default, any unqualified method name, for example, “substring”, is assumed to be part of the set of built-in methods that are delivered with Connect CDC. The Expression Handler can recognize an external method and distinguish it from a built-in method if it is fully qualified and is available in the Java CLASSPATH. For example, the Java method “sqrt”, exists in the Math class of the java.lang package.

Note: For any of the classes in the set of Java classes, for example, java.lang, no special action is needed to install them as discussed in Installing an External Method. They are automatically available in the CLASSPATH.

The following is an example of an expression that calculates the square root of a value contained in the column SQUARE_AREA:

java.lang.Math.sqrt(SQUARE_AREA);

The following is an example of an expression that calculates the length of the hypotenuse of a right triangle given the lengths of the other 2 sides, using the Pythagorean theorem:

java.lang.Math.sqrt(
                java.lang.Math.pow(side1,2) +
                java.lang.Math.pow(side2,2) );

The value for each side, side1 and side2, is first squared using the pow method and then the method sqrt is used to take the square root of the sums of the squares.

Both the external methods used, sqrt and pow, are defined in the Math class as public and static.

  1. To create a .zip file, use Winzip®.
  2. To create a .jar file, use the command:
    java cvf <name of jar file to be created> <list of input class files>
  3. To view the classes in a jar file, use the command:
     jar tf <name of the jar file>