//Sample2/AclassSI.java // //################################################################# // Class AclassSI : Aclass (S)erver (I)mplementation //################################################################# // // Construction Date : 9/24/98 3:44 PM // Auto-generated by CreateNetAppWrappers (Chris Anderson (C) UCLA 1998) // import java.io.*; import java.net.Socket; import java.util.Vector; import cam.netapp.SetNetworkConnection; import cam.netapp.NetworkConnection; import cam.netapp.SIinterface; import cam.netapp.CIinterface; public class AclassSI implements Runnable, SetNetworkConnection, SIinterface { // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Server Implementation of Source Class Methods //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // public void run() { int methodIndex = -1; boolean comErrorFlag = false; Is = null; try {Is = new ObjectInputStream(InputS);} catch(Exception e){/*System.out.println(e);*/ comErrorFlag = true;}; Os = null; try {Os = new ObjectOutputStream(OutputS);} catch(Exception e){/*System.out.println(e);*/ comErrorFlag = true;}; if(cObj == null) cObj = new Aclass(); while(!comErrorFlag) { Vector methodData = new Vector(); try {methodData = (Vector)Is.readObject();} catch(Exception e){/*System.out.println(e);*/ comErrorFlag = true;} if(!comErrorFlag) { methodIndex = ((Integer)methodData.elementAt(0)).intValue(); Vector methodRet = new Vector(2); switch(methodIndex) { case 0 : // addTwo(...) int Arg_10 = ((Integer)methodData.elementAt(1)).intValue(); int R_0= cObj.addTwo(Arg_10); methodRet.addElement(new Integer(0)); methodRet.addElement(new Integer(R_0)); break; } // switch try{Os.writeObject(methodRet);} catch(Exception e){/*System.out.println(e);*/; comErrorFlag = true;}; } // If !comErrorFlag } // While !comErrorFlag } // run // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Server Implementation Specific Methods //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // public AclassSI() { cObj = null; Os = null; Is = null; } public boolean setNetworkConnection(NetworkConnection N) { InputS = N.getInputStream(); OutputS = N.getOutputStream(); netConnect = N; return true; } public void setSIobject(Object Ob) { cObj = (Aclass)Ob; return; } // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Data Members //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Aclass cObj; ObjectOutputStream Os; ObjectInputStream Is; NetworkConnection netConnect; OutputStream OutputS; InputStream InputS; }