Run Business Modeler as a Business Administrator and place the following code into a new Program Object named "Hello World". Mark the Program Object as type "Java." import matrix.db.*; import java.io.*; public class ${CLASSNAME} { public ${CLASSNAME} () { } public ${CLASSNAME} (Context context, String[] args) throws Exception { } public int mxMain(Context context, String []args) throws Exception { BufferedWriter writer = new BufferedWriter(new MatrixWriter(context)); writer.write("Hello World!\n"); writer.flush(); return 0; } } There are several ways to invoke this new JPO. In this example, an instance of the class "Hello World" is instantiated using the constructor (Context, string[]). Actually, the resulting class name will be modified to adhere to the Java language rules for naming classes. This process is referred to as name mangling. The Context object is constructed by the kernel to allow the program to share the transactional context of the launching thread. The constructor can be implemented to connect to a Live Collaboration kernel elsewhere on the network. In this case, however, the program will run on a different thread, and inside its own transaction boundary. |