Java

Accesses the Java API to perform tasks that cannot be accomplished via standard nodes. Runs Java code within a node.

The java code to run must implement the com.lavastorm.brain.node.Node interface, usually by extending the SimplifiedNode abstract class. For information on the Java API, see the "laeJavaApi" Zip file which you will find in the following location: <Data360 Analyze installation directory>/docs/lae.

If you do not have access to the above location, please contact your administrator.

To configure a simple Java node:

  1. In the JavaClass property, type the class name of the node. This must be the same as the class name specified in the JavaCode property, in the following line of code: public class {{^JavaClass^}}.
  2. Modify the default code in the JavaCode property such that the processAll, setup and cleanup methods are completed. For an example, see JavaCode property.
    • setup - Used to read in all properties via their Run Time Property Names. In general, the output metadata is set within the setup method, and any outputs are opened.
    • processAll - Contains all of the record processing, including reading records from input pins and writing records to output pins.
    • cleanup - Cleans up all inputs and outputs, closing down any open channels or streams. If only the node input and output pins are used, and no external files, in general, a simple call to cleanupIo() should be sufficient in this method.

For advanced Java node configuration, see Java node configuration.

Properties

JavaClass

Specify the unqualified (i.e. no package component) class name of the class specified within the JavaCode property. This must be the same as the class name specified in the JavaCode property, in the following line of code: public class {{^JavaClass^}}.

The default value is JavaNode. You must change this value to reflect the name of the node.

JavaCode

Specify the Java code. This will generally specify the Node implementation that is referenced via the NodeClass property. This class must have the fully qualified name {{^JavaPackage^}}.{{^JavaClass^}}

NodeClass

Optionally specify the fully qualified class name of the node class to run. The class specified in this property must implement the com.lavastorm.brain.node.Node interface.

In most implementations, this will simply refer to {{^JavaPackage^}}.{{^JavaClass^}}

Classpaths

Optionally specify entries that are to be added to the classpath used by the node. Any external jars required by the node should be placed in this property. Each entry must be placed on a newline.

NativeLibraryDirectories

List of directories to search for native libraries, such as DLLs and shared libraries. The directories will be used by the JVM search for any native libraries needed by the node, or any of its dependencies. More specifically, the paths will be searched for any call to System.load(...) and System.loadLibrary(...). Additionally, the paths will be used when searching for the pre-load native libraries specified by the NativeLibraryPreloads property.

The directories must be absolute paths, or resolve to absolute paths via substitution. The set of allowable directories is also limited by the server side property ls.brain.node.java.nativeLibraryWhitelistPaths.

Any directory which does not satisfy these conditions will be ignored. Set the LogLevel property to DEBUG to trace library resolution.

NativeLibraryPreloads

A list of names, paths, or patterns of native libraries to pre-load into the JVM, prior to running the node. The specified entries will be searched for in the directories listed in the NativeLibraryDirectories property.

Note that the pre-load will only load the libraries in the JVM memory space, and will not register them for JNI binding. It is assumed that the code itself will make the appropriate calls to System.load(...) and System.loadLibrary(...).

The primary use of this property is to load transitive dependencies for native libraries that would have normally be required to be specified via an environment variable e.g. PATH or LD_LIBRARY_PATH. The values can be of the following forms:

  • A library name which will be matched using the platforms specific naming library naming scheme, for example, for Linux "foo" would match "libfoo.so", while for windows it would match "foo.dll"
  • An absolute path.
  • A glob pattern of the form: glob:
  • A regex pattern of the form: regex:

For both glob and regex patterns the pattern will be matched against the entire absolute path of the library files.

JavaPackage

Optionally specify the package name of the node class. This must be the same as the package specified within the package <packageName>; line within the source code of the class specified by the NodeClass property.

The default value is pkg{{^Handle^}} For all node instances that are to be run within a data flow, this default can be left as is. If you are editing a library node, the package name should be changed to an appropriate value.

BigToString

Optionally specify whether java.lang.BigInteger and java.lang.BigDecimal fields should be converted to Strings and output as such. The internal BRD formats numeric types (double, long) cannot handle numeric values greater than 8 bytes long. If these types are not converted to String, then they must be output as byte array data.

The default value is True.

StringToUnicode

Optionally specify whether or not all java Strings should be output as Unicode in the output records

The default value is False.

ByteArrayToBase64

Optionally specify whether or not byte arrays can be output as Base64 encoded strings. When this is set to False, byte arrays cannot be output by this node.

The default value is False.

JvmMaxHeapSize

Optionally specify the maximum heap size of the JVM instance that runs the node.

If this property is not set, then the value defaults to the value set in the server side property ls.brain.node.java.javaMaxHeapSize.

CompileJavaClass

Optionally specify whether to use the Java code that exists on the server, but disable customizing java code behavior. This will reduce the size of BRXs and reduce time to execute. When this is set to True, the class corresponding to the JavaCode property placed in the node will be compiled. If this is set to False, then the class corresponding to the JavaCode property must exist on the server as it will not be compiled.

The default value is False.

JavaSourceVersion

Optionally specify the version of Java specification that the Java code conforms to. The Java node will validate that the JDK the Data360 Analyze is running under supports the specified version. By default, the Java specification version of generated Java byte code will also be set to this version. See the JavaTargetVersion property for explicitly setting the target java specification.

The default value is 1.8.

JavaTargetVersion

Optionally specify that the Java node should generate byte-code compatible with a particular version of Java specification. The Java node will validate that the JDK the Data360 Analyze is running under supports the specified version.

The default value is 1.8.

JvmProperties

Optionally specify the properties to set on the JVM instance running the node, using the format: <name>=<value>

Specify each new property on a new line.

For example: java.net.useSystemProxies=true

JvmInitialHeapSize

Optionally specify the initial heap size of the JVM instance that runs the node.

If this property is not set, then the value defaults to the value set in the server side property ls.brain.node.java.javaInitialHeapSize.

LogConfig

This optional property is rarely given a value. By default, the JavaNode creates a parsable (XML) log in the temp directory. The logging threshold is set by the LogLevel property.

Customization of JavaNode logging is achieved by specifying an XML text value in the LogConfig property. You can create multiple logs, each of which filters log events by LogLevel and/or ErrorCode or some other user-defined logic supplied as a Java class. A log can also subscribe to events generated by another log.

Inputs and outputs

Inputs: Multiple optional.

Outputs: Multiple optional.