IO Megamodule, version 1.2/1.3 Created by lm: Aug. 19, 1998. Revised by lm: Sep. 02, 1998: changes in v1.3 The IO megamodule is an "adaptive" megamodule: it takes any object data structure and displays it to the user. To do so, it gets a first object created by the user, scans the data in order to print it as well as to record its structure. Once the data is printed, the user can modify it. The object with the new information is then printed as well. Changes in version 1.3: ----------------------- This version supports ORBACUS 3.0 whereas version 1.2 supports version 2.0.3 of OMNIBROKER (i.e. ex-Orbacus). ORBACUS/OMNIBROKER is OOC Inc's orb implementation. Changes in version 1.2: ------------------------ This version includes real and date basic types. It also directly refers to the common CHAIMS/Code/ASN1 directory for the gentype and asn files and libraries. Input/Output data format: ------------------------- - Integer: usual format (digits as 1234) - String: usual format (caracters sequence as This is a sentence, i.e. without quotes) - Real: decimal notation as 1234.567; Note: reals are rounded when the total number of digits exceeds 6; in the example, the display will be 1234.57 Note: when real type data is expected, it must be entered (otherwise, a null string is taken and creates an error). - Boolean: can be any of: 1, Y, true, TRUE for true or: 0, N, false, FALSE for false. - Date: in the following format: year:month:day::hour:minute:second where, year, month, day, hour, minute, second are integers. As an example: 1998:08:19::02:25:36 (currently, all fields are compulsory even if null) Necessary information about gentypes: Data types transformation chain: ---------------------------------------------------------------------- Option 1 to deal with gentypes: java type <--> java gentype <--> C++ gentype <--> blob (1) (2) (3) or Option2: directly: C++ type <--> C++ gentype <--> blob (1) (3) (1) is done by basic type construction in java (2) is done using ASN1/Java_ASN1/ conversion routines (3) is done using ASN1/asn1cpp-v4.3 library In the case of the IO megamodule: --------------------------------- - Option 1 is used here as the IO interface is developed in Java - step (2) is omitted: conversions between java types and C++ gentypes are done directly (input data from the user is read as java data, is then converted to JNI data; the data is then scanned to get C++ data which is used to fill in the C++ gentype structure) see extractA in asn/asnd.cc. see also below. Directory structure and code explanation: ----------------------------------------- asn --- Gives all encoding/decoding functions to translate data from java to C++ gentypes (then to ASN1) and vice-versa. Uses the asn1 library and the gentypes files from ASN1 directory. Main files contained: - asne.h/cc Fills in Joe's card as C++ gentype; has main function (called by MM_impl.cpp in the math module) which will also encode the data in blobs using the gen_lib library = 1st object created, which is necessary to allow the IO module to know which fields it has to deal with for further extractions. - asnd.h/cc Contains all functions to decode data before displaying it to the user as well as to encode it after retrieving it from the user. * extractA (=EXTRACT primitive): Decodes original ASN1 data to know which types to extract from the user window; Calls extractTextFields to extract the new data and create the corresponding C++ gentype structure; Encodes the data in ASN1 * decodeA (=INVOKE(ask) primitive): Calls Gen_ask which decodes old ASN1 data and then calls Gen_askText; This function sets all the types of the elements of the old data; This will then allow to display the data in the right fields java_io ------- This directory takes care of the display and the management of the windows. It receives the 1st object data to diplay from asne, then each time a user enters new data, it sends it to asnd for encoding, and then retrieves it again to display it in a new window. Main files contained: - Client.java Reflects CHAIMS megaprogram (partially compliant): SETUP to the IO megamodule, [create the 1st object by invoking the TEST method], INVOKE the "write" method to display the object data to the user, TERMINATE the write invocation, INVOKE the "ask" method to get data from the user, EXAMINE if the invocation has been completed till it actually has, EXTRACT the user data, INVOKE again the "write" method to display it, eventually TERMINATE the "ask" invocation. - OutWin.java * write: Displays result window with result data; case of the 1st window with 1st object data - InWin.java Creates second window and: * ask: Calls decodeA in asnd.cc to decode previous ASN1 data and displays it in the proper fields; waits for user input * extract: reversed process: Gets new input and calls extractA in asnd.cc to get new data in ASN1 format - VarVect.java Contains vectors where java data which is retrieved or displayed is contained before being converted. - ioImpl.java Defines CHAIMS primitives mathO ----- Implements the TEST function which calls the mainn function in asne.cc so that the 1st data object is created. Only the Server part is used, i.e MM_impl.cpp More information: ----------------- More information can be found in: - CHAIMS/Code/ASN1/GenericType for C++ gentypes - asn/README for inter-dependencies between directories (where are asn files used?) - java_io/README.doc for more explanations about all the files' functions.