GDS Cache Class


GDSCache is used to store the character delimiter and lists of MDRs. They are three different sets of delimiters which can be

set by application dynamically. Any MDR has to be added to GDSCache before using it to decode or encode gds message.

GDSCache maintains MDR lists: Permanent MDR List and Non-permanent MDR List. MDRs in the permanent list can only

be overwriten by the same version of MDRs. MDRs in the non-permanet list will be automatically deleted for available

spaces to accommodate new added MDRs. The maximum number of MDRs in the non-permanet list should be set by

application. Otherwise default number 10 will be used. Application can also preload MDRs permanently into Cache from





     public static synchronized int addMDR(String mdrId, String mdrVer, String mdrBuf, boolean permanent, boolean overWrite)

     public static synchronized int addNonPermanentMDR(String mdrId, String mdrVer, String mdrBuf, boolean overWrite)

     public static synchronized int addPermanentMDR(String mdrId, String mdrVer, String mdrBuf, boolean overWrite)

     public synchronized static int loadMDRFromFile(String filePath, String mdrList)

     public synchronized static int loadMDRFromURL(URL fileUrl, String mdrList)

     public static synchronized int setMaxNumOfMDRs(int num)

     public synchronized static void setSystem(String sysName)



GDS Decode Class



GDSDecoder is responsible for parsing incoming GDS message and returning parsed segments and elements to calling application.


Application can passes a GDS message in two ways:


     allocMsg() - passes the whole complete message into the decoder. It is recommended for small size message which is less than or equal to 5K.

     resetPacket() and putPacket() - passes a packet of the packetized message into the once a time until the last packet.It is recommended for large size message which is more than 5K.


Application can get segments and elements in two ways:


     getNextSeg() and getNextElem() - gets segments and elements in the sequencial order which they are in the message.

     These method can be called even during the process of putPacket When

     GDSError.GDS_MESSAGE_PREMATURE_END error returned, application should continue to put packet before

     call getNextSeg() or getNextElem() again.

     getSegList() - This method is used to get the segment list with the id and the nesting level is 0.This method should be called after the whole message has been put into the decoder otherwise the segment list may be not complete.




     public synchronized int allocMsg(String gdsString)

     public synchronized String getMsgId()

     public synchronized String getMsgVer()

     public synchronized GDSSegValue getNextSeg()

     public synchronized GDSElemValue getNextElem()

     public synchronized GDSSegList getSegList(String segId)

     public synchronized int resetPacket()

     public synchronized int putPacket(String packet)



GDS Encode Class


GDSEncoder is responsible for taking segments and elements to build outgoing GDS message. Application calls a seris of put

functions to put message id, version segments and elements for building a message.


Application can get the built message in two ways:


     getMsg() - gets the whole message.

     initPacket() and getPacket() - has the encoder to packetize the message into packets with specified size ( Last packet

     size may be less than the packet size.) and return one packet a time.




     public synchronized int putMsgIdVer(String id, String ver)

     public synchronized int putAction(String action)

     public synchronized int putSeg(String segId, char segNestLevel)

     public synchronized int putElem(String elemId, String value)

     public synchronized int putCompElem(String compId, char nestLevel)

     public synchronized int putCompEnd()

     public synchronized String getMsg()

     public synchronized int initPacket(int packetSize)

     public synchronized String getPacket()