All Packages  This Package  Class Hierarchy  Class Search  Index

Interface bmsi.edx.EDXServlet

  Summary

public interface  EDXServlet
{
          // Methods 3
     public abstract short callJava(EDXServletRequest) throws EDXServlet.Errpost;
     public abstract void destroy();
     public abstract void init();

          // Inner Classes 1
     public static class EDXServlet.Errpost
}

Java classes that wish to be called from EDX via the CALL JAVA interface must implement this interface. The EDX program must first obtain an id for the Java class, then use the id to make calls.

MYID	 DATA F'0'
AESSHIP	 TEXT 'bmsi.ox.AESShip'
FILNO	 DATA D'0',CL2' '
	 ...
	 CALL FINDJAVA,MYID,(AESSHIP)	GET THE ID FOR THE AESShip CLASS
	 ...
	 CALL JAVA,MYID,(FILNO),6	GENERATE AN EDI MESSAGE
The FINDJAVA routine creates a new instance of the Java class only if it has not already been assigned an id. The id assigned to a Java class can be removed with
	 CALL UNBIND,MYID
In some cases, multiple instances of a Java class may be desired. To unconditionally load a new instance:
	 CALL LOADJAVA,ID,(CLASS$)
which creates a new instance. Be sure to call UNBIND for ids created with LOADJAVA.

FINDJAVA and LOADJAVA will return a negative id if the Java class is not found or cannot be loaded or does not implement EDXServlet. The JAVA call will post error code 701 if the id passed is negative. This arrangement lets you test whether a class is present. But if you don't check, an EDL exception will be thrown when you try to call it.

You may want to call a Java class only if present, for example, only if Java is available at a customer site. In this case, test whether the FINDJAVA succeded like this:

	IF ID,GE,0
	  CALL JAVA,ID,(PARMS),LEN
	ENDIF

Author:
Stuart D. Gathman


  Cross Reference

Implemented By:
EDXPnuts, Edxspool, Remote4978





  Methods

· init

Summary  |  Top
   public abstract void init() 

Called when the servlet is loaded.



· callJava

Summary  |  Top
   public abstract short callJava(EDXServletRequest req)  throws EDXServlet.Errpost

Called by the EDX program. This method can be called from multiple threads. If an application is not designed to handle parallel execution, use the synchronized keyword when implementing this method to serialize calls.

Returns:
a word to put in $TCBCO2 of the calling EDX task.


· destroy

Summary  |  Top
   public abstract void destroy() 

Called when the servlet is removed. This method will also be called when the Java VM shuts down because the EDX VM has terminated. After destroy returns, any calls to callJava that are still in progress will be terminated abrubtly. If this is not acceptable, synchronizing both callJava and destroy will ensure that callJava will complete before destroy is entered.



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7