Inbound Java

Post on 13-Jul-2015

234 views 0 download

Transcript of Inbound Java

BIS-4042: Inbound Java: Getting Started

Wednesday, 4 pm

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

3

Tool Installation

The pieces you will need

• Java Development Kit (JDK)

• Unisys BISRA (BIS Resource Adaptor)

• Eclipse or other IDE

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

5

Installing Unisys BISRA

From the BIS release CD

6

Installing Eclipse

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

7

Installing Eclipse

Eclipse does not use the Windows Registry

8

• About Java Language

Code

Environment

9

About Java

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

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

11

12

13

About Java

14

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

Using Eclipse

15

Eclipse Terminology

Perspective• A grouping of

views (windows)• Java and Debug

provided• You may

customize

16

Eclipse Terminology

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

17

Eclipse Terminology

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

18

Using Eclipse

Java Editor / Compiler

Jump to an error

Mouse-over to get error message

Also offers“Quick Fix”

options

19

Using Eclipse

Java Editor / Compiler

Mouse-over to display page from javadoc

20

Using Eclipse

Run / DebugRun with the console for output

Execute in the debug perspective

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()

22

Using Java BISRA

• BISRA Capabilities• Java Code

Connecting Getting rids w/o Scripts Processing Blobs, Clobs

and Datasets Script capabilities Using Scripts

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

24

Connecting

• Connecting Non-managed

– From OS 2200 or Windows

Managed– via JBOSS app server

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

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.

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

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

29

What is a BLOB?

BLOB: binary large object as seen by Eclipse debug

Debug cannot see it allOnly what is in the buffer

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

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

32

CLOB: character large object as seen by Eclipse debug

Debug cannot see it allOnly what is in the buffer

What is a CLOB?

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

34

What is a Dataset?

Dataset: table formatted rid/result from BIS

Data:

35

Dataset: table formatted rid/result from BIS

Data:

MetaData:

No .DATE lineNo title lineNo *= line

What is a Dataset?

36

Dataset: table formatted rid/result from BIS

Data:

MetaData:

Columns names:

What is a Dataset?

37

Dataset: table formatted rid/result from BIS

Data:

MetaData:

Column names:

Column Sizes:

What is a Dataset?

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

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

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…

41

• Script capabilities• Using Scripts

Simple validation Fetch BIS data Update BIS data Handling errors

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

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

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

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

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 ��

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

48

• Connecting Non-managed

– From OS 2200 or Windows

Managed– via JBOSS app server

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

50

JBOSS

Conceptual View

BIS DB

JBIS

Script

B I S

The Web

JSP

Java BIS

RA

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)

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

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)

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)

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

56

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

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

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

59

Summary and Questions

??• Questions

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

60

Custom Solutions

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

www.ciber.com

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