//ResultImpl.java // Gerard Rodriguez, January 1998, Stanford University // // ResultImpl.java is a very simple example of a Collection acting // as a Result Target, which purpose was just to test the Street Proxy, it // is not intended to be a fully implementation of a Result Collection // For an example of a fully operational Client in Infobus, look for DLITE. // http://dlite.stanford.edu import IDLInterchange.*; import CosPropertyService.*; public class ResultImpl extends CCollectionImpl implements Runnable { Thread result_collection; private USMarc lusmarc = new USMarc(); private boolean started; private static boolean gatekeeper; public static boolean completed; // The objects array stores all the documents send my the proxy. // it contains the names of the properties supported by the proxy // and the values of these properties. static final short MAX_OBJECTS = 100; public static GeneralDoc[] objects = new GeneralDoc[MAX_OBJECTS]; public static short pobjects; // objects[0] contains the names of the properties, it is never used for // something else. public static short current_MessageID; public static int total = -1; private short calls; // pointer to the next two tables // these tables hold the information sent by the proxy // we need tables just in case the proxy sends the docs in more than // one connection (several calls to AddItems) static final short MAX_CALLS = 50; private IDLInterchange.TItemsACState[] resultdata = new IDLInterchange.TItemsACState[MAX_CALLS]; private IDLInterchange.TAccessOption[][] moredata = new IDLInterchange.TAccessOption[MAX_CALLS][1]; private static String nameRC; // Here the implementation of the Result Collection begins // Constructor for the Class public ResultImpl () { started = false; nameRC = "ResultTarget"; gatekeeper = false; // Creating the thread for the Result Collection System.out.println("Creating the thread...."); result_collection = new Thread(this); result_collection.start(); System.out.println("Thread created"); } // Class Constructor if we use the Visigenic Gatekeeper public ResultImpl (int usegatekeeper, String pnameRC) { started = false; nameRC = pnameRC; if ( usegatekeeper == 1 ) { gatekeeper = true; } else { gatekeeper = false; } // Creating the thread System.out.println("Creating the thread...."); result_collection = new Thread(this); result_collection.start(); System.out.println("Thread created"); } // Constructor for the class once the thread has started public ResultImpl (String name) { super(name); Init(); } //SetItemsProperties() // // Set properties of existing Items in this collection. If a item does not // exist in this collection, raise an exception. // o pMessageID is the client-side data that matches the // pMessageID of the initial request (a RequestItemsProperties call) // o pItems contains the state information requested. public void SetItemsProperties( CosPropertyService.Any pMessageID, IDLInterchange.TItemsCookieState pItems) { System.out.println("Result Target: SetItemsProperties\n"); if ( current_MessageID != (pMessageID.a_short())) { System.out.println("Error: Different message IDs"); return; } try { for(int i =0;i