By including the generated <nameaionapp>.jar file in your Java program, you can access the exposed methods of the Aion BRE exported classes. However, there are programming considerations that must be implemented in the Java program to call an Aion knowledge base.
The essential lesson to know about calling an Aion server from a Java program is that the Java application must obtain a session object of type AionSession in order to bind the Aion BRE objects. Every Aion BRE object has to be created with a reference to an AionSession object.
The aionsession.jar file provides the means by which to create an AionSession under different environments. For standalone testing the Java programmer can create a simple AionSession object. (See the section Aion Deployment on the Web for steps in creating an AionSession under a web.) The following Java code is typical for how an AionSession can be created in a standalone Java application.
ca.aion.j2aion.AionSession myDefinedSession = ca.aion.j2aion.AionSession.getInstance();
Once an AionSession object is obtained, this object is used in the constructor of the proxy class (AionWorld).
ca.aion.hellojavaworld.AionWorld anAionWorldObject = new
ca.aion.hellojavaworld.AionWorld(myDefinedSession);
In the preceding code, AionWorld is an exported class from the Aion BRE application, which is replicated as a proxy class in the hellojavaworld.jar file.
Once an object is created in the Java program, the exposed methods of the Aion BRE class can be called through that instance.
Example:
anAionWorlObject.setMessage("Hello Aion world");
where setMessage() is a public method of anAionWorldObject.
Note: References to non-exported classes in the Java code will cause compile errors.
|
More Information: |
| Copyright © 2009 CA. All rights reserved. | Email CA about this topic |