Inbound Java

61
BIS-4042: Inbound Java: Getting Started Wednesday, 4 pm

Transcript of Inbound Java

Page 1: Inbound Java

BIS-4042: Inbound Java: Getting Started

Wednesday, 4 pm

Page 2: Inbound Java

2 © 2008 CIBER, Inc. All rights reserved

Agenda

• Tool Installation• About Java• Using Eclipse• Using the BISRA• Comparing Functionality

and Performance• Questions and Answers

© 2008 CIBER, Inc. All rights reserved

Page 3: Inbound Java

3

Tool Installation

The pieces you will need

• Java Development Kit (JDK)

• Unisys BISRA (BIS Resource Adaptor)

• Eclipse or other IDE

Page 4: Inbound Java

4

Installing Java Development Kit

http://java.sun.com/javase/downloads/index.jsp

Standard Edition or Enterprise Edition

• JDK (Java Development Kit) includes JRE (Java Runtime Environment) for Developers

• JRE (Java Runtime Environment) for the BIS server

Page 5: Inbound Java

5

Installing Unisys BISRA

From the BIS release CD

Page 6: Inbound Java

6

Installing Eclipse

http://www.eclipse.org/downloads/

Page 7: Inbound Java

7

Installing Eclipse

Eclipse does not use the Windows Registry

Page 8: Inbound Java

8

• About Java Language

Code

Environment

Page 9: Inbound Java

9

About Java

• Language Java ≠ Javascript (ECMA) Java is compiled; Javascript is interpretive Java on web server; Javascript in browser

Page 10: Inbound Java

10

About Java

• Code Similarities to C, C#, C++ etc. prog.java (source) prog.class (byte code) JVM (Java Virtual Machine) executes prog.class Java is object oriented Java import like BIS :include Java try/catch like BIS error label Java char (Unicode) ≠ byte Everything (except primitives) is abstracted

Page 11: Inbound Java

11

Page 12: Inbound Java

12

Page 13: Inbound Java

13

About Java

Page 14: Inbound Java

14

• “Perspectives”• “Views”• Java Editor / Compiler• Run • Debug

Using Eclipse

Page 15: Inbound Java

15

Eclipse Terminology

Perspective• A grouping of

views (windows)• Java and Debug

provided• You may

customize

Page 16: Inbound Java

16

Eclipse Terminology

The Debug Perspective• Debug view• Variable, Breakpoint• Editor (source code) view• Console view

Page 17: Inbound Java

17

Eclipse Terminology

View• Own tabable windows• Own tool bar / context menu• Own min and max buttons

Page 18: Inbound Java

18

Using Eclipse

Java Editor / Compiler

Jump to an error

Mouse-over to get error message

Also offers“Quick Fix”

options

Page 19: Inbound Java

19

Using Eclipse

Java Editor / Compiler

Mouse-over to display page from javadoc

Page 20: Inbound Java

20

Using Eclipse

Run / DebugRun with the console for output

Execute in the debug perspective

Page 21: Inbound Java

21

Using Eclipse

Using Debug Resume, Pause, Exit

Display the value of data items

Double-click to set

breakpointStep Over

Output for System.out.println()

Page 22: Inbound Java

22

Using Java BISRA

• BISRA Capabilities• Java Code

Connecting Getting rids w/o Scripts Processing Blobs, Clobs

and Datasets Script capabilities Using Scripts

Page 23: Inbound Java

23 23 © 2008 CIBER, Inc. All rights reserved

Java BISRA Capabilities

23 © 2008 CIBER, Inc. All rights reserved

BIS DBB

ISR

A

Scriptdataset

clob

blob

JavaProgram

FileSystem

B I S

JBIS

Page 24: Inbound Java

24

Connecting

• Connecting Non-managed

– From OS 2200 or Windows

Managed– via JBOSS app server

Page 25: Inbound Java

25

Connecting to BIS (non-managed)

import java.util.*; // needed for HashMapimport com.unisys.bis.*; // needed for BISRA. . .Map cp = new HashMap(); cp.put(new Integer(BISResourceAdapter.BIS_SERVER_NAME),"localhost");cp.put(new Integer(BISResourceAdapter.BIS_SITE),"A"); cp.put(new Integer(BISResourceAdapter.BIS_USER_NAME),"JavaKing");cp.put(new Integer(BISResourceAdapter.BIS_DEPARTMENT),"2"); cp.put(new Integer(BISResourceAdapter.BIS_PASSWORD),"LeRoi");

try { BISConnectionFactory bcf = BISResourceAdapter.createConnectionFactory(cp);BISConnection connection = bcf.getConnection();. . . connection.close(); } catch (BISException e) { e.getStackTrace(); } cp - connection parameters (an array of attribute-value pairs)

bcf - BIS connection factory (holds all the BIS connection parameters)

12345678910111213141516171819

Page 26: Inbound Java

26

BISConnectionFactory Parameters

BIS_BLOCK_SIZE [default: 8182, min: 4096, max: 800,000] The maximum number of bytes returned by the BIS Server when accessing a BIS dataset BIS_CHARACTER_SET [default: ISO8859-1] The character set name used for encoding String values. BIS_CONNECTION_TYPE [default: SOCKETS] A string that identifies the connection type. BIS_DEPARTMENT The department number associated with the user name. BIS_LOCALE [default: en_US] Java locale designator. BIS_PASSWORD The password associated with the user name. BIS_PORT_NUMBER [default: 3984] The port number used to connect to the JBIS Server. BIS_SERVER_NAME The name of the system on which BIS Server is running. BIS_SITE The Business Information Server site to access. BIS_USER_NAME The user name for signing on to BIS.

Page 27: Inbound Java

27

Getting Rids w/o a Script

try { BISConnectionFactory bcf = BISResourceAdapter.createConnectionFactory(cp);BISConnection connection = bcf.getConnection();

BISDataset dataset = connection.getDataset("2b0"); BISClob clob = connection.getCLOB("2e0"); BISBlob blob = connection.getBLOB("31e0"); . . . dataset.close(); clob.close();blob.close();

connection.close();}catch (BISException e) {e.getStackTrace();}

Note: The connection object has methods to get hard-numbered, but not named rids.

1234567891011121314151617

Page 28: Inbound Java

28

What is a BLOB?

BLOB: binary large object as seen by Eclipse debug

The rid’s title line

No .DATE lineNo BIS headersNo *= line

Page 29: Inbound Java

29

What is a BLOB?

BLOB: binary large object as seen by Eclipse debug

Debug cannot see it allOnly what is in the buffer

Page 30: Inbound Java

30

BLOB to JPG File

import java.io.*; // needed for file processingimport java.util.*;import com.unisys.bis.*;. . .try { BISBlob blob = connection.getBLOB(“31e0"); InputStream stream = blob.getInputStream(); // streams use buffered io FileOutputStream fileOut = new FileOutputStream("C:\\java\\monalisa.jpg"); byte[] buffer = new byte[8192]; // 8K blocksint bytesRead = 0; while ((bytesRead = stream.read(buffer)) > 0) { fileOut.write(buffer,0, bytesRead); } blob.close();fileOut.close(); connection.close(); }catch (BISException e) {e.getStackTrace();} catch (FileNotFoundException e) {e.getStackTrace();} // needed by filecatch (IOException e) {e.getStackTrace();} // needed by file

1234567891011121314151617181920212223

Page 31: Inbound Java

31

What is a CLOB?

CLOB: character large object as seen by Eclipse debug

The rid’s title line

No .DATE lineNo BIS headersNo *= line

Page 32: Inbound Java

32

CLOB: character large object as seen by Eclipse debug

Debug cannot see it allOnly what is in the buffer

What is a CLOB?

Page 33: Inbound Java

33

import java.io.*; // needed for file processingimport java.util.*;import com.unisys.bis.*;. . . int lf = 0x0A; // line-feed int cr = 0x0D; // carriage-return try { BISClob clob = connection.getCLOB("2e0"); // std RER routine InputStream stream = clob.getInputStream(); FileOutputStream fileOut = new FileOutputStream("C:\\java\\clob.txt"); int byteRead = 0; // one byte at a time while ((byteRead = stream.read()) > 0) { if (byteRead == lf) { fileOut.write(cr);} fileOut.write(byteRead); } clob.close();fileOut.close(); connection.close(); }catch (BISException e) {e.getStackTrace();} catch (FileNotFoundException e) {e.getStackTrace();} // needed by filecatch (IOException e) {e.getStackTrace();} // needed by file

CLOB to TXT File

123456789101112131415161718192021222324

Page 34: Inbound Java

34

What is a Dataset?

Dataset: table formatted rid/result from BIS

Data:

Page 35: Inbound Java

35

Dataset: table formatted rid/result from BIS

Data:

MetaData:

No .DATE lineNo title lineNo *= line

What is a Dataset?

Page 36: Inbound Java

36

Dataset: table formatted rid/result from BIS

Data:

MetaData:

Columns names:

What is a Dataset?

Page 37: Inbound Java

37

Dataset: table formatted rid/result from BIS

Data:

MetaData:

Column names:

Column Sizes:

What is a Dataset?

Page 38: Inbound Java

38

List Dataset Column Info

BISDataset ds = connection.getDataset("2b0"); BISDatasetMetaData md = ds.getMetaData(); int cols = md.getcols(); int pos = 2; // no getColumnPosition method for (int i =1; i <= cols; i++) { String fld = md.getColumnName(i); int siz = md.getColumnSize(i); String colSpec = " (" + pos + "-" + siz + ")"; pos += siz + 1; System.out.println(fld+colSpec); } md.close();ds.close(); connection.close();

StCd (2-2)Status Date (5-6)ByIn (12-2)Product Type (15-9)SerialNumber (25-6)Produc Cost (32-6)OrderNumbr (39-5)CustCode (45-4)Produc Plan (50-6)ProducActual (57-6)Ship Date (64-6)Ship Order (71-5)SpcCod (77-3)

12345678910111213141516

Page 39: Inbound Java

39

Dataset to CSV File

BISDataset ds = connection.getDataset("2b0"); BISDatasetMetaData md = ds.getMetaData(); FileWriter csvFile = new FileWriter("C:\\java\\OrdStat.csv");// ------ get column names ---------------int cols = md.getcols(); String flds = ""; // field names for (int i = 1; i <= columnCount; i++) { flds = flds + md.getColumnName(i)+ ","; } flds = flds + "\n"; csvFile.write(flds); // ------- get each record ---------------while (ds.nextRecord()) { String thisRec = ""; // records for (int i = 1; i <= cols; i++) { String x = ds.getString(i); thisRec = thisRec + x.trim() + ","; } thisRec = thisRec + "\n"; csvFile.write(thisRec); } md.close(); ds.close(); csvFile.close();

1234567891011121314151617181920212223242526

Page 40: Inbound Java

40

Dataset to CSV File

BISDataset ds = connection.getDataset("2b0"); BISDatasetMetaData md = ds.getMetaData(); FileWriter csvFile = new FileWriter("C:\\java\\OrdStat.csv"); int cols = md.getcols(); String flds = ""; // field names for (int i = 1; i <= columnCount; i++) { flds = flds + md.getColumnName(i)+ ","; } flds = flds + "\n"; csvFile.write(flds); while (ds.nextRecord()) { String thisRec = ""; // records for (int i = 1; i <= cols; i++) { String x = ds.getString(i); thisRec = thisRec + x.trim() + ","; } thisRec = thisRec + "\n"; csvFile.write(thisRec); } ds.close(); csvFile.close();

1234567891011121314151617181920212223242526

ØP j ž ¬ )J�� � �� d 3jž Ø 2 jžÙ † D � ˆ Y •�� � � ˜ 6 ��( � � �Æ2j ž. c� � � � � � � � � � � 2j � ÝEö � � � � � h• } Œ �� � � � � � � pØP j ž ¬ )J�� � �� d 3jž Ø 2 jžÙ † D � ˆ Y •�� � � ˜ 6 ��( � � �Æ2j ž. c� � � � � � � � � � � 2jØP j ž ¬ )J�� � �� d 3jž Ø 2 jžÙ † D � ˆ Y •�� � � ˜ 6 ��( � � �Æ2j ž. c� � � � � � � � � � � 2jØP j ž ¬ )J�� � �� d 3jž Ø 2 jžÙ † D � ˆ Y •�� � � ˜ 6 ��( � � �Æ2j ž. c� � � � � � � � � � � 2jØP j ž ¬ )J�� � �� d 3jž Ø 2 jžÙ † D � ˆ Y •�� � � ˜ 6 ��( � � �ÆØP j ž ¬ )J�� � �� d 3jž Ø 2 jžÙ † D � ˆ Y •�� � � ˜ 6 ��( � � �Æ2j ž. c� � � � � � �ØP j ž ¬ )J�� � �� d 3jž Ø 2 jžÙ † D � ˆ Y •�� � � ˜ 6 ��( � � �Æ2j ž. c� � � � � � � � � � � 2jØP j ž ¬ )J�� � �� d 3jž Ø 2 jžÙ † D � ˆ Y •�� � � ˜ 6 ��( � � �Æ2j ž. c� � � � � � � � � � � 2j � ÝEö � �� � � h•ØP j ž ¬ )J�� � �� d 3jž Ø 2 jžÙ † D � ˆ Y •�� � � ˜ 6 ��( � � �Æ2j ž. c� � � � � � � � � � � 2j � ÝEö � �� � � h•ØP j ž ¬ )J�� � �� d 3jž Ø 2 jžÙ † D � ˆ Y •�� � � ˜ 6 ��( � � �Æ2j ž. c� � � � � � � � � � � 2j � ÝEö � �� � � h•ØP j ž ¬ )J�� � �� d 3jž Ø 2 jžÙ † D � ˆ Y •�� � � ˜ 6 ��( � � �Æ2j ž. c� � � � � � � � � � � 2j � ÝEö � �� � � h•ØP j ž ¬ )J�� � �� d 3jž Ø 2 jžÙ † D � ˆ Y •�� � � ˜ 6 ��( � � �Æ2j ž. c� � � � � � � � � � � 2j…

Page 41: Inbound Java

41

• Script capabilities• Using Scripts

Simple validation Fetch BIS data Update BIS data Handling errors

Page 42: Inbound Java

42 © 2008 CIBER, Inc. All rights reserved

Script Capabilities

© 2008 CIBER, Inc. All rights reserved

Scriptdataset

clob

inputparameters

dataset

clob

outputparameters

chg input$gto end,v1,v2

-0

-0

blob

table format

free formprotected

return value

JavaScript only

array ofstrings

BISRAdataset

stream

array ofstrings

BISRAdataset

stream

stream

string Glossarystring - array of charactersstream - buffered interfacedataset - table formatted object

Page 43: Inbound Java

43

Simple Validation

BISScript script = connection.getScript("ValidCust");script.setString(1,"314"); // send cust# script.registerOutputParameter(1); // setup 1st output paramscript.registerOutputParameter(2); // setup 2nd output param script.execute(); // execute the script String sts = script.getString(1); // get statusString cus = script.getString(2); // get cust# after LDV,z System.out.println("Status: " + sts); System.out.println("Customer: " + cus); script.close();

12345678910111213

Java code

.RUN: ValidCust *===========================================@CHG INPUT$ <CUS>a8 LDV,z <CUS> . @LDV <STS>i1=1 . @BFN,514,E,1,6,lin+2 q 'CUSTOMER NUM’ ,<CUS> @LDV <STS>i1=0 . @GTO END,<STS>,<CUS> .

1234567

BIS scriptStatus: 0Customer: 00000314

Output

Page 44: Inbound Java

44

Fetch BIS Data

����������

<p 7<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � � � � �� �• a •• a• . c� � @a• � Ÿ C� � � � ��<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � � � � �� �• a •<p7 � t Ÿ � � pL• @ � ��<p7 �t Ÿ � � p<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � � � � �� �• a •<p7 � t Ÿ � �<p7 � t Ÿ � � pL• @ � �� �<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � � � � �� �• a •<p7 � t Ÿ � � pL• @ � �� � ���À Öˆ• <<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � � � � �� �• a •• a• . c� � @a• � Ÿ C� � � � ��<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � � � � �� �• a •<p7 � t Ÿ � � pL• @ � �� � ���À <p7 �<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � � � � �� �• a •• a• . c� � @a• � Ÿ C� � � � ��<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � � � � �� �• a •• a• . c� � @a• <p7 � t Ÿ � � pL• @<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � � � � �� �• a •• a• . c� � @a• � Ÿ C� � � � �� � ��<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � � � � �� �• a •• a• . c� � @a• � Ÿ C� � � � �� � ��<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � � � � �� �• a •• a• . c� � @a• � Ÿ C� � � � �� � ��<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � � � � �� �• a •• a• . c� � @a• � Ÿ C� � � � �� � �� (<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � �<p7 �t Ÿ �<p7 �t Ÿ � � pL• @ � �� � ���À Öˆ• ˆY•� � � � � �� �• a •• a• . c� � @a• � Ÿ C� � � � �� � �� (<p7 �t Ÿ � � pL

Java code

jp M � gc 0Wgc� � � g • Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� � g• Œ. c� � � gjp M � gc 0Wgc� � � g • Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� � g• Œ. c� � � g• Œ�jp M � gc 0Wgc� � � g • Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� � g• Œ. c� � � g• Œ�

jp M � gc 0jp M � gc 0Wgc� � � g • Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� � g• Œ. c� � � gjp M � gc 0Wgc� � � g • Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� � g• Œ. c�jp M � gc 0Wgc� � � g • Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� � g• Œ. c� �jp M � gc 0Wgc� � � g • Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� � g• Œ. c� �jp M � gc 0Wgc� � � g • Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t�jp M � gc 0Wgc� � � g • Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� � g• Œ. c� � � g• Œ�

jjp M � gc 0Wgc� � � g • Œ�Ãð· �2

jjjjjjjjjjp

BIS script

jpM �gc 0Wgc� � �g • Œ�Ãð· �2 jž¼H ö �è Ãð· � ñ �t� ójpM �gc 0Wgc� � �g • Œ�Ãð· �2 jž¼H ö �è Ãð· � ñ �t� ójpM �gc 0Wgc� � �g • Œ�Ãð· �2 jž¼H ö �è Ãð· � ñ �t� ójpM �gc 0Wgc� � �g • Œ�Ãð· �2 jž¼H ö �è Ãð· � ñ �t� ójpM �gc 0Wgc� � �g • Œ�Ãð· �2 jž¼H ö �è Ãð· � ñ �t� ójpM �gc 0Wgc� � �g • Œ�Ãð· �2 jž¼H ö �è Ãð· � ñ �t� ójpM �gc 0Wgc� � �g • Œ�Ãð· �2 jž¼H ö �è Ãð· � ñ �t� ójpM �gc 0Wgc� � �g • Œ�Ãð· �2 jž¼H ö �è Ãð· � ñ �t� ójpM �gc 0Wgc� � �g • Œ�Ãð· �2 jž¼H ö �è Ãð· � ñ �t� ójpM �gc 0Wgc� � �g • Œ�Ãð· �2 jž¼H ö �è Ãð· � ñ �t� ó

Output

Page 45: Inbound Java

45

Update BIS data

<p 7� � c ��� c � � È Z B Ž� à ð· �2 j ž ¼ H ö � è Ãð· � ñ �t� ó � �ÀZBŽ. c� � ÈZBŽ� � �� � 2j � ÝEö � � Ã ð · ÀZBŽ �T� � $2j žw� � ÈZBŽ� H<p 7� � c ��� c � � È Z B Ž� à ð· �2 j ž ¼ H ö � è Ãð· � ñ �t� ó � �ÀZBŽ. c� � ÈZBŽ� � �� � 2j � ÝEö � � Ã ð · ÀZBŽ �T� � $2j žw� � ÈZBŽ� H<p 7� � c ��� c � � È Z B Ž� à ð· �2 j ž ¼ H ö � è Ãð· � ñ �t� ó � �ÀZBŽ. c� � ÈZBŽ� � �� � 2j � ÝEö � � Ã ð · ÀZBŽ �T� � $2j žw� � ÈZBŽ� H<p 7� � c ��� c � � È Z B Ž � à ð· �2 j ž ¼ H ö � è Ãð· � ñ �t� ó � �ÀZBŽ. c� � ÈZBŽ� � �� � 2j � ÝEö � � Ã ð · ÀZBŽ �T� � $2j žw� � ÈZBŽ�Input File

jp M � gc 0Wg c� � Œ B � —�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� „ B� —. c� � ŒB� —� � �� � 2j � ÝEö �� Ãð · „B�jp M � gc 0Wg c� � Œ B � —�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� „ B� —. c� � ŒB� —� � �� � 2j � ÝEö � � Ã ð · „B� —jp M � gc 0Wg c� � Œ B � —�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� „ B� —. c� � ŒB� —� � �� � 2j � ÝEö � � Ã ð · „B�jp M � gc 0Wg c� � Œ B � —�jp M � gc 0Wg c� � Œ B � —�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� „ B� —. jp Mjp M � gcjp M � gc 0Wg c� � Œ B � —�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� „ B� —. c� � ŒB� —� � �� � 2j � ÝEö � � Ã ð · „B�jp M � gc 0Wg c� � Œ B � —�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� „ B� —. c� � ŒB� —� � �� � 2j � ÝEö � � Ã ð · „jp M � gc 0Wg c� � Œ B � —�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� „ B� —. c� � ŒB� —� � �� � 2j � ÝEö � � Ã ð · „B�jp M � gc 0Wg c� � Œ B � —�Ã

Java code

jp M � gc 0Wgc / i � B w �� à ð ·�2 j�¼Hö�èÃð· � ñ r t� ó � t„ B� —. c� � ŒB� —� � �� � 2j � ÝEö � � Ã ð · „B� — �T� � $2j žw� � ŒB� —� Hjp Mjp M � gc 0Wgc / i � B w �� à ð ·�2 j�¼Hö�èÃð· � ñ r t� ó � t„ B� —. c� � ŒB� —� � �� � 2j � ÝEö � � Ã ð · „B� — �T� � $2j žw� � ŒB� —� Hjp M � gc 0Wgc / i � B w �� à ð ·�2 j�¼Hö�èÃð· � ñ r t� ó � t„ B� —. c� � ŒB� —� � �� � 2j � ÝEö � � Ã ð · „B� — �T� � $2j žw� � ŒB� —� Hjp M � gc 0Wgc / i � B w �� à ð ·�2 j�¼Hö�èÃð· � ñ r t� ó � t„ B� —. c� � ŒB� —� � �� � 2j � ÝEö � � Ã ð · „B� — �T� � $2j žw� � ŒB� —� Hjp M � gc 0Wgc / i � B w �� à ð ·�2 j�¼Hö�èÃð· � ñ r t� ó � t„ B� —. c� � ŒB� —� � �� � 2j � ÝEö � � Ã ð · „B� — �T� � $2j žw� � ŒB� —� Hjp M � gc 0Wgc / i � B w �� à ð ·�2 j�¼Hö�èÃð· � ñ r t� ó � t„ B� —. c� � ŒB� —� � �� � 2j � ÝEö � � Ã ð · „B� — �T� � $2j žw� � ŒB� —� Hjp M � gc 0Wgc / i � B w � � à ð· � 2 j�¼Hö�èÃð· � ñ r t� ó � t„ B� —. c� � ŒB� —� � �� � 2j � ÝEö � � Ã ð · „B� — �T� � $2j žw� � ŒB� —�

Result -0

jp M � gc 0Wgc/ i � B w ��Ãð · �2 j� ¼ H ö� èÃð· � ñ r t� ó � t„ B� —. c� � ŒB� —� �jp M � gc 0Wgc/ i � B w ��Ãð · �2 j� ¼ H ö� èÃð· � ñ r t� ó � t„ B� —. c� � ŒB� —� � ��jp M � gc 0Wgc/ i � B w ��Ãð · �2 j� ¼ H ö� èÃð· � ñ r t� ó � t„ B� —. c� � ŒB� —� �jp M � gc 0Wgc/ i � B w ��Ãð · �2 j� ¼ H ö� èÃð· � ñ r t� ó � t„ B� —. c� � ŒB� —� � ��jp M � gc 0Wgc/ i � B w ��Ãð · �2 j� ¼ H ö� èÃð· � ñ r t� ó � t„ B� —. c� �

BIS ScriptBBBBB

Page 46: Inbound Java

46

Handling Errors

<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð·<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �� � 2j � ÝEö �<p<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �� � 2j � Ý<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � •<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c� � • ‚ } Œ� � �� �<p 7�� c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c�<p 7�<p 7�� c �<p 7� � c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t�<p 7�� c<p 7� � c ��� c� � • ‚ } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �t� ó�� ˆ ‚ } Œ. c

<<<<<<<<<<

<

<

<

<

<

<

<

<

<

<

<

BIS Script

BIS input variablesjp M � gc 0Wg c0 W G ìU ��

Page 47: Inbound Java

47

Handling Errors

jp M � gc 0Wg c0 W � P~Œ�Ãð · �2 jž ¼ H ö� è Ãð· � ñ �( � ó�� „ ) ~Œ. c� � Œ) ~Œ� � �� � 2j � Ýjp M � gc 0Wg c0 W � P~Œ�Ãð · jp Mjp M � gc 0Wg c0 W �jp M � gc 0Wg c0 W � P~Œjp M � gc 0Wgjp M � gc 0Wg c0 W � P~Œ�Ãð · �2 jž ¼ H ö� è Ãð· � ñ �( jp M � gc 0Wjp M � gc 0Wg c0 W � P~Œ�jp M � gc 0Wg c0 W � P~Œ�Ãð · �2 jž ¼ H ö� è Ãð· � ñ �( jp M � gc 0Wg c0 W � P~Œ�Ãð · �2 jž ¼ Hjp M � gc 0Wg c0 W � P~Œ�Ãð · �2 jž ¼ H ö� è Ãð· � ñ �( jp M � gc 0Wg c0 W � P~Œ�Ãð · �2 jž ¼jp M � gc 0Wg c0 W � P~Œ�Ãð · �2 jž ¼ H ö� è Ãð· � ñ �( jp M � gc 0Wg c0 W � P~Œ�Ãð · �jp M �jp M � gc 0Wg c0 W � P~Œ�Ãð · �2 jž ¼ H ö� è Ãð· � ñ �( � ó�� „ ) ~Œ. c� � Œ) ~Œ� � �� � 2j � Ýjp M � gc 0Wg c0 W � P~Œ�Ãð · �2 jž ¼ H ö� è Ãð· � ñ �( � ó�� „ ) ~Œ. c� � jp M � gc 0Wg c0 W �jp M � gc 0Wg c0 W � Pjp M � gc 0Wg c0 W � P~Œ�Ãð · �2 jž ¼ H ö� è Ãð· � ñ �( � ó�� „ ) ~Œ. c�jp M � gc 0Wg c0 W � P~Œ�Ãð · �2 jž ¼ H ö� è Ãð· � ñ �( � ó�� „ ) ~Œ. c� � Œ) ~Œ� � �� � 2j � Ý�jp M� gc 0W�jp M� gc 0Wg c 0 W� P~Œ�Ãð · �2 jž¼ H ö� è Ãð· � ñ� ( � ó �� „ ) ~Œ. c� � Œ) ~Œ� �� � � 2j � ÝEjp M�jp M� gc 0Wg c 0 W� P~Œ�Ãð · �2 jž¼ H ö� è Ãð· � ñ� ( jp M� gc 0Wg c 0 W� P~Œ�Ãð · �2jp M� gjp M� gc 0Wg c 0 W� P~Œ�Ãð · �2 jž¼ Hjp M� gc 0Wg c 0 W� P~Œ�Ãð · �2 jž¼ H ö� è Ãð· � ñ� ( � ó �� „ ) ~Œ. c� � Œ) ~Œ� �� � � 2j � Ýj jp M� gc 0Wg c 0 W� P~Œ�Ãð · �2 jž¼ H ö� è Ãð· � ñ� ( � ó �� „ ) ~Œ. c� � Œ) ~Œ�jp M� gc 0jp M� gc 0Wg c 0 W� P~Œ�Ãð · �2 jž¼ H ö� è Ãð· � ñ� ( � ó �� „ ) ~Œ. c� � Œ) ~Œ� �jp M� gc 0jp M� gc 0Wg c 0 W� P~Œ�Ãð · �2 jž¼ H ö� è Ãð· � ñ� ( � ó �� „ ) ~Œ. c� � Œ) ~Œ� �jp M� gc 0W�jp M� gc 0Wg c 0 W� P~�j�jp M� gc 0Wg c 0 W� P~Œ�Ãð · �2 jž¼ H ö� è Ãð· � ñ� ( � ó �� „ ) ~Œ. c� � Œ) ~Œ�jp M� gc 0Wg�jp M� gc 0Wg c 0 W� P~Œ�Ãð · �2 jž¼ H ö� è Ãð· � ñ� ( � ó �� „ ) jp M� gc 0Wg c 0 W�jp M� gjp M� gc 0Wg c 0 W� P~Œ�Ãð · �2 jž¼ H ö� è Ãð· � ñ� ( � ó �� „ ) ~Œ. c� � Œ) ~Œ� �� � � 2j � Ýjp M� gc 0Wg c 0 W� P~Œ�Ãð · �2 jž¼ H ö� è Ãð· � ñ� ( � ó �� „ ) ~Œ. c� � Œ) ~Œ� �� � � 2j � Ýjp M� gc 0Wg c 0 W� P~Œ�Ãð · �2 jž¼ H ö� è Ãð· � ñ� ( � ó �� „ ) ~Œ. c� � Œ) ~Œ� �� � � 2j � Ý

jjjjjjjjjjpjpjpjpjpjpjpjpjpjpjpjpjpjpjp

Java code

MIME Error: INVALID FIELD NAMEString Error: INVALID FIELD NAME

Output

Page 48: Inbound Java

48

• Connecting Non-managed

– From OS 2200 or Windows

Managed– via JBOSS app server

Page 49: Inbound Java

49

• Conceptual view• Configuring BISRA• On JBOSS startup• Writing an Application:

Web page (jsp) Servlet (java)

• Sequence of Events

Implementedand tested byKeith Sebestaof CIBER

Connecting to BISRA via JBOSS

Page 50: Inbound Java

50

JBOSS

Conceptual View

BIS DB

JBIS

Script

B I S

The Web

JSP

Java BIS

RA

Page 51: Inbound Java

51

Configuring BISRA to JBOSS

1. Edit bisra.xml (a Deployment Descriptor)chg <!--server--> to ServerNamechg <!--user--> to UserNamechg <!--dept--> to Departmentchg <!--password--> to Passwordchg <!--site--> to Site

BISConnectionFactory parameters

chg <!--jndiname--> to BISRANoTx

2. Edit bis-ds.xml (a Deployment Descriptor)

jp M � gc 0Wg c0 W G eF ��Ãð ·�5 j� ¼H ö� è Ãð

3. Build…\JBOSS\deployment\bisra.xml…\JBOSS\config\bis-ds.xml

(Java Directory Naming Interface)

Page 52: Inbound Java

52

On JBOSS Startup

JBOSS

JBIS

B I S

•JBOSS finds Deployment•Uses bisra.xml to:

•Number of pooled connectionsconfigured in bis-ds.xml

•Java can use JNDI to acquire the BISConnectionFactory acquire the BISConnectionor create another BISConnection

BISRA

create BISConnectionFactory create BISConnection

Page 53: Inbound Java

53

Writing an Application

< p 7� � c �� � c��•Š} Œ�Ãð· �2 j ž ¼H< p 7�� c �� � c��•Š} Œ�Ãð· �2 j ž ¼H ö �èÃð· � ñ �� �ó � �ˆ Š} Œ. c� � • Š} Œ� � �� � 2j � ÝEö � �< p 7�� c �� � c��•Š} Œ�Ãð· �2 j ž< p 7�� c �� � c��•Š} Œ�Ãð· �2 j ž ¼H ö �èÃð· � ñ �� �ó � �ˆ Š} Œ. c� � •< p 7� � c �� � c��•Š} Œ�Ãð· �2< p 7�� c �� � c��•Š} Œ�Ãð· �2 j ž ¼H ö �èÃð· � ñ �� �ó � �ˆ Š} Œ. c� � • Š} Œ�< p 7�� c �< p 7�� c �

Web Page (index.jsp)

jp M � gc 0Wg c0� • Š } Œ�Ãð· �2 jž ¼ H ö� è Ãð· � ñ �� � ó�� ˆ Š} Œ.j jp M � gc 0Wg c0� • Š } Œ�ÃjpM�gc0Wg c0�•Š } Œ �à ð· �2 jž¼ H ö�èÃð· � ñjpjpM�gc0Wg c0jpM�gc0Wg c0�•j jpM�gc0Wg c0�•Š } Œ �à ðjpM jpM�gc0Wg c0�•Š } Œj jpM�gc0Wg c0�•Š } Œ �à ð· jpM jpM�gc0Wg c0�•Š } Œ �j jpM�gc0Wg c0�•jpM�gc0Wg c0�•Š } Œ �à ðj jpM�gc0Wg c0�•Š } Œ jpM�gc0Wg c0� jpM�gc0Wg c0�•Š }j jpM�gc0Wg c0�•Š } Œ �jpM jpM�gc0Wg c0�•Š } Œj jpM�gc0Wg c0�•Š } Œ �à ðj jpM�gc0Wg c0

web.xml (placed in …\JBOSS\WEB-INF directory)

Page 54: Inbound Java

54

Writing an Application

<p 7� �<p 7� � c ��� c� � l ƒ ~ Œ�Ãð· �2 jž<p 7<p 7�� c ��� c�// needed for HTTP integration// needed for HTTP integrati// needed for HTTP integrationð· � ñ �///// needed for acquiring bcf// needed for acquiring bcfionð· � ñ ��// ne// needed for acquiring bcfionð· � ñ �� //// needed for acquiring bcfionð· � ñ �� � ó�� dƒ~Œ. c� � l ƒ~Œ� � �� � 2j � ÝEö � � Ã ð · dƒ~Œ �T� � $q// needed f or acquir i n g b c fi o nð· � ñ� � � óq//

// needed f or a cq u i rin g b c fio nð· � ñ� � �ó �� dq// needed f or a cq u i rin g b c fio nð· � ñ� � �ó �� dƒ~Œ// send HTML to out object// send HTML to out objectf i o nð// send HTML to out objectf i o nð· � ñ� � �ó �� dƒ~Œ. c� � l ƒ~Œ� �� � � 2// send HTML to out objectf i o nð·o//

o// seo// /// send HTML to out objectf i o nð· � ñ� � �ó �� d/o// send HTML to out objectf i o nð· � ñ� �o// send HTML to out objectf i o nð· � ñ� // send HTML to out objectf i o ////JNDI nameonameDI HTML to out objectf i o nð· � ñ� � �ó �� dƒ~Œ. c� � l ƒ~onameDI HonnameDI HTML to out objectf i o n

bis.class (placed in …\JBOSS\WEB-INF\classes directory)

Page 55: Inbound Java

55

Sequence of Events

Web User Web Server App Server Java ProgBISRA BIS

Request BCF and Connection ()Init (check deployments )()

B C F<<creates>>

Connection<<creates>>

URL()

Web page w servlet /bis

servlet/bis()

from servlet to JNDI ()from JNDI to class load ()

load bis.class()

acquire BCF()

handle of BCF

acquire Connection ()

handle of ConnectiongetScript(runName)

handle of Script

script.execute()

Run runName

handle to BCF

handle to Connection

Script<<creates>>

result in HTML as CLOB

write CLOB to HTTP response

response in HTML

Page 56: Inbound Java

56

• Comparing Functionality and Performance BIS ODBC Server BIS COM Server Java BISRA

Page 57: Inbound Java

57

Functionality

Functionality ODBCServer

COMServer

JavaBISRA

Get a table DAO ADO BISDataset

Get a string ServiceOutputMIMETYPE,@gto end,var

Get a CLOB BISClob

Get a BLOB BISBlob

Get rids w/o a Run SQL Rid#

Submit updates SQL Run w paramsRun w params,

BISClob

Input a table InputDataset BISDataset*

Input a CLOB BISClob

Page 58: Inbound Java

58

Performance

InterfaceAvg Response

Time (secs) Via

ODBC Server 2.02 VB6 w ADO

ODBC ServerLGN=1.7SQL=.6 MRI

COM Server .0618 VB6 w DAO

Java BISRA .0667 Java from Eclipse

• Performance tests under BIS 10.1• 100 iterations

Connect Search 1124 lines for Cat = ‘TAPE’ returning 59 lines Disconnect Wait ~750 ms

Page 59: Inbound Java

59

Summary and Questions

??• Questions

Tool Installation About Java Using Eclipse Using the BISRA Comparing Functionality and Performance

Page 60: Inbound Java

60

Custom Solutions

14746-B N. 78th WayScottsdale, AZ 85260Phone: (480) 624-4900

www.ciber.com

Page 61: Inbound Java

61

• “BIS Resource Adapter for the Java™ Platform Developer’s Guide”, Unisys Doc# 3839 6529–001

• “Learning Java” by Niemeyer & Knudson; O’Reilly & Associates publisher

• Javadoc.html (in the BISRA install directory)

• “Eclipse in Action: A guide for Java Developers”by Gallardo, Burnette and McGovern; Manning Publications publisher

• “Head First Java” by Sierra & Bates; O’Reilly & Associates publisher

Additional Resources