Java and ACL
To call a Java method from ACL, use one of the following java_type functions.
• java_constructor — Calls a Java constructor.
• java_constructor_modal — Calls a Java constructor in a new thread.
• java_delete — Deletes a Java object created by java_constructor, java_instance, or java_static.
• java_instance — Calls a Java instance method.
• java_instance_modal — Calls a Java instance method in a new thread.
• java_static — Calls a Java static method.
• java_static_modal — Calls a Java static method in a new thread.
• java_init — Tests if the JVM is running and optionally initializes it.
The flow of control in the Java interface usually starts with the execution of a java_type ACL function.Arbortext Editor or the Arbortext PE sub-process starts its embedded Java Virtual Machine (JVM) at startup, making the distributed Java classes and user Java classes available. Java .class files placed in the custom\init directory are automatically executed without the need for the java_type functions.
The Java programming language supports method overloading, so several methods in a class may have the same name with different arguments. When searching for the method to invoke, Arbortext Editor or the Arbortext PE sub-process will use the first method it finds that has the correct name and correct number of arguments.
The java_type functions use Java reflection methods to analyze the called Java class or method before calling it, converting the arguments in the java_type function to the data types used by the called Java code. If you include ACL variables and function calls within your arguments, Arbortext Editor or the Arbortext PE sub-process will perform the necessary variable substitution and pass the result to the called Java code. All arguments passed are considered read-only to the called Java code; the called Java code will not change the value of any of the passed arguments.
Argument values that originate in ACL and are passed to a class or method can only be converted to a void, a Java string, or one of the supported primitive data type. The supported primitive data types are:
• int
• short
• long
• float
• double
• char
• byte
Argument values that originate as returned data from a previous call to a java_type function can be passed back to a Java class or method. For example, a called Java method may return a Java structure. This returned object would be placed within the specified ACL return variable name. While this Java structure could not be used directly within ACL, you could pass it to another Java class or method by calling a java_type function and supplying the return variable name as an input argument.