jPOS Programmer's Guide Version: 1.6.1 The book exclusively prepared for Courtesy Edgardo Regodon Jr - 07/2009 (r2966) Copyright © 2008 by Alejandro Revilla ............................................................................................. v Foreword ........................................................................................................................................vi 1. The jPOS Project ........................................................................................................................1 1.1. About jPOS.org .................................................................................................................. 1 1.2. jPOS License .....................................................................................................................1 1.3. Downloading jPOS ............................................................................................................. 1 1.4. Directory Structure ............................................................................................................. 2 1.5. Building jPOS .................................................................................................................... 4 2. An ISO-8583 primer ....................................................................................................................7 2.1. International standard ISO 8583 .......................................................................................... 7 2.2. Message structure ............................................................................................................... 7 2.2.1. ISO-8583 fields ....................................................................................................... 9 2.3. Wire protocol ................................................................................................................... 12 2.4. Message flow ................................................................................................................... 13 3. jPOS approach to ISO-8583 ...................................................................................................... 16 3.1. ISOMsg & Co. ................................................................................................................. 16 3.2. Packing and unpacking ..................................................................................................... 18 3.3. Creating custom packagers ............................................................................................... 20 3.4. Managing the wire protocol with ISOChannel .................................................................... 22 3.4.1. Filtered Channels .................................................................................................. 26 3.5. Accepting connections with ISOServer .............................................................................. 27 3.6. Multiplexing an ISOChannel with a MUX ......................................................................... 30 4. jPOS supporting classes ............................................................................................................ 34 4.1. jPOS' Logger ................................................................................................................... 34 4.2. NameRegistrar ................................................................................................................. 37 4.3. Configuration ................................................................................................................... 39 4.4. SystemMonitor ................................................................................................................ 40 4.5. Profiler ............................................................................................................................ 42 4.6. DirPoll ............................................................................................................................ 43 4.7. ThreadPool ...................................................................................................................... 45 5. Implementing Custom Packagers .............................................................................................. 46 5.1. GenericPackager .............................................................................................................. 47 6. Channel Implementations ......................................................................................................... 51 6.1. TCP/IP Socket-based channels .......................................................................................... 51 6.2. LoopbackChannel ............................................................................................................ 53 6.3. ChannelPool .................................................................................................................... 54 6.4. SSL ................................................................................................................................. 54 7. jPOS Space ............................................................................................................................... 56 7.1. Overview ......................................................................................................................... 56 7.2. SpaceFactory ................................................................................................................... 57 7.3. Using the space ................................................................................................................ 58 7.4. SpaceTap ......................................................................................................................... 60 8. Q2 - second generation QSP ...................................................................................................... 62 8.1. About Q2 ......................................................................................................................... 62 8.2. Building Q2 ..................................................................................................................... 62 8.3. Building Q2 Modules ....................................................................................................... 62 8.4. Q2 Primer ........................................................................................................................ 62 8.5. Q2 Dynamic ClassLoading ............................................................................................... 71 8.6. Q2 Scripts ........................................................................................................................ 72 8.7. Q2 SpaceLet .................................................................................................................... 73 9. Q2Mod jPOS ............................................................................................................................. 75 9.1. ChannelAdaptor ............................................................................................................... 75 1.6.1 ii The book exclusively prepared for Courtesy Edgardo Regodon Jr - 07/2009 (r2966) 9.2. QMUX ............................................................................................................................ 78 9.3. QServer ........................................................................................................................... 79 9.4. DirPoll ............................................................................................................................ 80 9.5. TaskAdaptor .................................................................................................................... 81 9.6. DailyTaskAdaptor ............................................................................................................ 81 9.7. SMAdaptor ...................................................................................................................... 81 9.8. KeyStoreAdaptor ............................................................................................................. 82 9.9. QExec ............................................................................................................................. 82 9.10. Jetty Integration ............................................................................................................. 82 10. TransactionManager ............................................................................................................... 83 10.1. Overview ....................................................................................................................... 83 10.2. Transaction Constants ..................................................................................................... 83 10.3. Transaction Context ....................................................................................................... 84 10.4. Context Recovery interface ............................................................................................. 85 10.5. AbortParticipant ............................................................................................................. 85 10.6. TransactionManager ....................................................................................................... 86 10.7. Integration with ISORequestListener ............................................................................... 87 10.8. GroupSelector ................................................................................................................ 87 10.9. Context implementation .................................................................................................. 89 11. UI Framework ......................................................................................................................... 93 11.1. Overview ....................................................................................................................... 93 11.2. UI configuration ............................................................................................................. 94 11.3. menubar ......................................................................................................................... 95 11.4. UI Factories ................................................................................................................... 97 11.4.1. JLabelFactory .................................................................................................... 100 11.4.2. JButtonFactory .................................................................................................. 101 11.4.3. TextFactory ....................................................................................................... 101 11.4.4. HtmlFactory ...................................................................................................... 102 11.4.5. PanelFactory ..................................................................................................... 103 11.4.6. BorderLayoutFactory ......................................................................................... 103 11.4.7. GridLayoutFactory ............................................................................................ 104 11.4.8. HSplitFactory .................................................................................................... 104 11.4.9. VSplitFactory .................................................................................................... 105 11.4.10. JTabbedPaneFactory ........................................................................................ 105 11.4.11. JTreeFactory ................................................................................................... 106 11.4.12. LogListenerFactory .......................................................................................... 107 11.4.13. ISOMeterFactory ............................................................................................. 109 12. Filter Implementations .......................................................................................................... 112 12.1. MD5Filter .................................................................................................................... 112 12.2. MacroFilter .................................................................................................................. 113 12.3. XSLTFilter .................................................................................................................. 114 13. Legacy components ............................................................................................................... 117 13.1. QSP - jPOS' component assembler ................................................................................ 117 13.1.1. About QSP ........................................................................................................ 117 13.1.2. Installing QSP ................................................................................................... 118 13.1.3. Configuration .................................................................................................... 120 13.1.4.