Title: NonStop Java Series
1NonStop Java Series
- Using NonStop Java and JToolkit
- to Web-enable Enscribe Databases
- Sam Ayers, Paymentech
2Why Java on Tandem?
- NonStop Architecture
- Legacy Data and Business Rules
- No Web Integration Tier
- Web Pages direct from Tandem
- Web Services direct from Tandem
- HPs Technology Plan
- From Cobol to Java, C
- Future Workforce
3Traditional NonStop Architecture
3) Servers query database, execute business
logic, return messages to Requesters
Enscribe
Pathway
2) Servers listen for messages on RECEIVE
mailbox
Pathsend
1) Requesters send messages to servers using
Pathsend
4Tandem Java Components
- iTP Web Server
- Web Container - HTTP, CGI, J2EE
- NonStop Java Server 4.0
- JDK 1.4 - with NonStop capability
- NonStop Java Servlets for JSP
- Apache Tomcat 4.x with NonStop
- JToolkit
- Tandem-specific APIs
5iTP Web Server and NonStop JSP
6JToolkit for NonStop Servers
- Pathway API
- Server Class
- Includes NonStop and Threads support
- RECEIVE (mailbox)
- System messages
- Pathsend API
- Requests Replies
- Data Conversion
- Enscribe API
- Create, Read, Update, Delete, Search
- NonStop, Transactional with Record Locking
- ddl2java Tool
- Generates Java Classes from DDL for all of above
7Java Servlets, using Pathsend API
Legacy Enscribe Database
Legacy COBOL Server
JToolkit Pathsend API
New J2EE Servlet
Tandem iTP Web Server
8Java Servlets, using Enscribe API
Legacy Enscribe Database
JToolkit Enscribe API
New J2EE Servlet
Tandem iTP Web Server
9Java Servlets, using Pathway API
Legacy Enscribe Database
JToolkit Enscribe API
JToolkit Pathway API
New Java Server - new Business Logic
JToolkit Pathsend API
New J2EE Servlet
Tandem iTP Web Server
10Web Enabling Enscribe
- Generate data dictionary from the DDL
- Generate Java classes using ddl2java
- Write Java Servlet that uses the generated Java
classes and Enscribe API
11Create Data Dictionary
- Edit DDL to point to data dictionary
- ?dict data6.develdat
- ?SECTION PTIC-TID-XREF-RECORD
- RECORD PTIC-TID-XREF-RECORD.
- FILE IS "TIDXFILE"
KEY-SEQUENCED. - ?TALBOUND 0
- Generate the Data Dictionary
- gtacl p ddl lt ddlfile
12Generate Java Classes
- Create an Item File
- Item File itemPticTidXref contains these records
- REC PTIC-TID-XREF-RECORD,INPUT,COBOL,nt
- REC PTIC-TID-XREF-RECORD,OUTPUT,COBOL,nt
- Generate the Java classes
- !/bin/ksh
- Export CLASSPATH./usr/tandem/javaextv20/lib/tdme
xt.jarCLASSPATH - /usr/tandem/javaextv20/bin/ddl2java -i
itemPticTidXref -dpath /G/data6/develdat -d
pticTidXref -p pticTidXref -c
13Create/Insert JToolkit Enscribe API
public void insertTid(String insertCanadaTid,
I_Ptic_tid_xref_record recordToCopy)
//Declare an output record O_Ptic_tid_xref_
record translationOutputRecord Current
tx try //Instantiate the translation
file object EnscribeFile translationFile new
EnscribeFile(translationFileName) //Open the
translation file translationFile.open(EnscribeO
penOptions.READ_WRITE,EnscribeOpenOptions.SHARED)
tx new Current() //Begin
transaction tx.begin() //Replicate
the input record to the output record translati
onOutputRecord copyInToOut(recordToCopy)
//Update the fields that are to be
changed translationOutputRecord.setTidx_tid_no(
insertCanadaTid) //Write the updated
record translationFile.write(translationOutputR
ecord) //Commit the transaction tx.comm
it(true) //Close the
file translationFile.close() catch
(com.tandem.ext.util.DataConversionException de)
de.printStackTrace() catch
(com.tandem.util.FSException fse)
fse.printStackTrace() catch
(EnscribeFileException ee) ee.printStackTrace
() //System.out.println(ee.getMessage())
14Read/Search JToolkit Enscribe API
public I_Ptic_tid_xref_record getTranslationRecor
d (String canadaTid) //Instantiate an input
record I_Ptic_tid_xref_record
translationInputRecord new I_Ptic_tid_xref_recor
d() try //Instantiate the translation
file object EnscribeFile translationFile new
EnscribeFile(translationFileName) //Open the
translation file translationFile.open(EnscribeO
penOptions.READ_WRITE,EnscribeOpenOptions.SHARED)
//Convert the primary key canadaTid to a
numeric string byte array for Enscribe byte
enscribeKey new byte8 DataConversion.JavaS
trToNumStr(enscribeKey, canadaTid, 0, 8, 0,
16) EnscribeKeyPositionOptions kpo new
EnscribeKeyPositionOptions() //Specify this
is the primary key kpo.setKeySpecifier((short)0
) //Put the key value into the key
options kpo.setKeyValue(enscribeKey) //Use
exact positioning in this example (could also
have used approximate) kpo.setPositioningMode
(EnscribeKeyPositionOptions.POSITION_EXACT) //
Specify the length of the key kpo.setKeyLength(
(short)8) //Position within the
file translationFile.keyPosition(kpo) /
/Read the record translationFile.read(translati
onInputRecord) //Close the
file translationFile.close() catch
(com.tandem.ext.util.DataConversionException de)
de.printStackTrace() de.getMessage()
catch (EnscribeFileException ee)
System.out.println(ee.getMessage())
//Return the java class representing the
record return translationInputRecord
15Update JToolkit Enscribe API
//Instantiate the translation file
object EnscribeFile translationFile new
EnscribeFile(translationFileName) //Open the
translation file translationFile.open(EnscribeOp
enOptions.READ_WRITE,EnscribeOpenOptions.SHARED)
//Convert the primary key canadaTid to a
numeric string byte array for Enscribe byte
enscribeKey new byte8 DataConversion.JavaSt
rToNumStr(enscribeKey, canadaTid, 0, 8, 0,
16) EnscribeKeyPositionOptions kpo new
EnscribeKeyPositionOptions() //Specify this is
the primary key kpo.setKeySpecifier((short)0)
//Put the key value into the key
options kpo.setKeyValue(enscribeKey) //Use
exact positioning in this example (could also
have used approximate) kpo.setPositioningMode
(EnscribeKeyPositionOptions.POSITION_EXACT) //S
pecify the length of the key kpo.setKeyLength((s
hort)8) //Position within the
file translationFile.keyPosition(kpo) tx
new Current() //Begin transaction tx.begin(
) //Read the input record translationFile
.readUpdateLock(translationInputRecord) //Re
plicate the input record to the output
record translationOutputRecord
copyInToOut(translationInputRecord) //Up
date the fields that are to be changed translati
onOutputRecord.setTidx_merchant_no(pnsMid) tran
slationOutputRecord.setTidx_terminal_no(pnsTid)
//Write the updated record translationFile.wri
teUpdateUnlock(translationOutputRecord) //Com
mit the transaction tx.commit(true) //C
lose the file translationFile.close()
16Delete JToolkit Enscribe API
public void deleteTid(String canadaTid )
Current tx try //Instantiate the
translation file object EnscribeFile
translationFile new EnscribeFile(translationFile
Name) //Open the translation
file translationFile.open(EnscribeOpenOptions.R
EAD_WRITE,EnscribeOpenOptions.SHARED) //Conver
t the primary key canadaTid to a numeric string
byte array for Enscribe byte enscribeKey
new byte8 DataConversion.JavaStrToNumStr(ens
cribeKey, canadaTid, 0, 8, 0, 16) EnscribeKeyP
ositionOptions kpo new EnscribeKeyPositionOption
s() //Specify this is the primary
key kpo.setKeySpecifier((short)0) //Put
the key value into the key options kpo.setKeyVa
lue(enscribeKey) //Use exact positioning in
this example (could also have used
approximate) kpo.setPositioningMode(EnscribeKe
yPositionOptions.POSITION_EXACT) //Specify
the length of the key kpo.setKeyLength((short)8
) //Position within the file translation
File.keyPosition(kpo) //Create a
transaction tx new Current() //Begin
transaction tx.begin() translationFile.l
ockRecord() //Delete the
record translationFile.deleteRecordUnlock()
//Commit the transaction tx.commit(true)
//Close the file translationFile.close()
catch (com.tandem.ext.util.DataConversionExc
eption de) de.printStackTrace() catch
(com.tandem.util.FSException fse)
fse.printStackTrace() catch
(EnscribeFileException ee) ee.printStackTrace
()
17Compile Java Code
- javac - NonStop Java compiler
- javac -J-Xms32m -J-Xmx48m -classpath
./usr/tandem/javaextv20/lib/tdmext.jar
TidUpdate.java
(Note proprietary user heap allocation, -J
options)
18Summary
- NonStop Java provides ability to
- Directly access Enscribe Databases
- JToolKit Enscribe API
- Create, Read, Update, Delete, Search
- Serve up directly as web pages or web services
- Communicate with Pathway servers
- JToolkit Pathsend API
- Works for COBOL, C and Java servers
- Create pure Java Servers
- JToolkit Pathway API
- All APIs are NonStop-capable with transactional
support