user manual

Chapter 12: The VisiClient Container 123
Use of Manifest files
descriptors. An IllegalArgumntException exception is thrown if the data provided
is not recognized as a valid deployment descriptor.
Sample code
This example shows usage of this method:
public static void main (String[] args) {
. . .
// load deployment descriptor files
java.io.FileInputStream ddSun = new
java.io.FileInputStream("META-INF/application-client.xml");
java.io.FileInputStream ddBorland = new
java.io.FileInputStream("META-INF/application-client-borland.xml");
// initialize client container
com.borland.appclient.Container.init(ddSun, ddBorland);
// lookup ejb in JNDI using an ejb-ref
javax.naming.Context context = new javax.naming.InitialContext();
Object ref = context.lookup ("java:comp/env/ejb/hello");
. . .
}
Note Only application client descriptors can be loaded using this method. This
means that all ejb-refs must be resolved or located by specifying the jndi-
name in the Borland descriptor. This cannot be done using the ejb-link in the
Sun descriptor since using ejb-link requires complete knowledge of the whole
application including application and EJB JAR deployment descriptors.
Use of Manifest files
VisiClient container relies on the presence of a manifest file to obtain
information about launching an application. The manifest file should be saved
in the META-INF subdirectory of the client archive. The relevant attributes in
the manifest file for the VisiClient container are:
The main class to be launched by the container on startup. This is an
application entry point which must be present in the manifest file.
The classpath of the dependencies of the main class. If the client-jar is self-
contained, or if dependencies are specified using the system CLASSPATH
during application launch, this attribute can be ignored.
Example of a Manifest file
An example of a Manifest file is shown below.
Manifest-Version: 1.0
Main-Class: SortClient
Class-Path:
This example shows the container will execute by loading the main method of
the class specified in the Main-Class attribute of the Manifest file. In this