Java and EJB Functions (Magic xpa 3.x)
Magic xpa can create an instance of a Java class that lets you activate a method, or query and update variables using a pseudo-reference. The pseudo-reference is a BLOB variable that represents the Java class instance. When a method is invoked, the BLOB variable returns values to the Magic xpa program as function return codes.
Class static methods and variables can also be accessed without having an instance of the Java class by using the class name and the method or variable name.
The Magic xpa Java functions are used to simulate the calling methods in Java. Each context of the engine internally maps between the pseudo-reference and the actual reference.
For example, a Magic xpa program can call the JCreate function to create a pseudo-reference as Virtual Variable A. The actual reference to the instance is then internally associated with Virtual Variable A. Any Magic xpa program in the context will be able to access the methods and variables of the object by using JCall(A,...).
The Java functions can be called by a Magic xpa program to:
-
Create a new instance of a Java class
-
Call a method directly from the Java class or from an instance
-
Report and return exceptions
-
Query and update variable values
The EJB functions enable Magic xpa to explore and invoke Enterprise JavaBeans.
For a list and description of the Java and EJB functions, click here.
When an exception is thrown by a method of the Java class, JCreate, JCall, and JCallStatic functions return a Null value. You need to call either the JException or the JExceptionText function to receive a pseudo-reference to the exception or the exception text description.
The JExceptionOccurred function provides an easy way of knowing that an exception occurred.