Commit a7aff4f5 authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
9781565926769
\ No newline at end of file
package myGenFac;
import com.ibm.cics.server.ts.iiop.*;
/**
* This type was created in VisualAge.
*/
public class DoIt {
/**
* Constructor
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
public DoIt() {
super();
}
/**
* Starts the application.
* @param args an array of command-line arguments
*/
public static void main(java.lang.String[] args) {
String[] myArray=new String[6];
myArray[0]="-host";
myArray[1]="winmvs26.hursley.ibm.com";
myArray[2]="-port";
myArray[3]="32661";
myArray[4]="-d";
myArray[5]="c:\\IORFiles";
com.ibm.cics.server.ts.iiop.GenFacIOR.main(myArray);
}
}
\ No newline at end of file
module accountObject {
struct AccountData {
string respcode;
string reascode;
string cicsfunc;
string acctid;
string lastname;
string firstname;
string midinit;
string title;
string telnum;
string addr1;
string addr2;
string addr3;
string auth1;
string auth2;
string auth3;
string auth4;
string cards;
string issuemonth;
string issueday;
string issueyear;
string reason;
string code;
string approver;
string scode1;
string scode2;
string scode3;
string status;
string limit;
};
interface AccountInterface {
//getter methods
accountObject::AccountData getAccount(in string acctno);
};
};
package testIIOPClient;
import accountObject.*;
import java.io.*;
import org.omg.CORBA.*;
import org.omg.CosLifeCycle.*;
import org.omg.CosNaming.*;
/**
* This type was created in VisualAge.
*/
public class ClientStub {
/**
* ClientStub constructor comment.
*/
public ClientStub(String acctID) {
String factoryIOR;
AccountInterface ai = null;
try
{
// create and initialize the ORB
System.out.println("Client: creating and initializing the ORB");
ORB orb = ORB.init();
// create the generic factory
System.out.println("Client: creating the generic factory");
factoryIOR = getFactoryIOR();
org.omg.CORBA.Object genFacRef = orb.string_to_object(factoryIOR);
System.out.println("Client: narrowing the generic factory");
GenericFactory fact = GenericFactoryHelper.narrow(genFacRef);
// use generic factory to make accountObject object
System.out.println("Client: using generic factory to make testObject object");
NameComponent nc = new NameComponent("accountObject::AccountInterface", "object interface");
NameComponent key[] = {nc};
NVP mycriteria[] = {};
System.out.println("about to create object reference");
org.omg.CORBA.Object objRef = fact.create_object(key, mycriteria);
System.out.println("about to narrow");
ai = AccountInterfaceHelper.narrow(objRef);
getDetails(ai, acctID);
}
// Catch NoFactory
catch (org.omg.CosLifeCycle.NoFactory nf)
{
System.out.println("Client: NoFactory thrown by create_object for accountObject::AccountInterface");
System.out.println(" - check server program with alias accountObject.jll is available on the CICS server");
}
// Catch any unexpected exceptions
catch (Exception e)
{
System.out.println("Client: Unexpected exception : " + e);
e.printStackTrace(System.out);
}
}
/**
* This method was created in VisualAge.
* @param ai accountObject.AccountInterface
*/
public void getDetails(accountObject.AccountInterface ai, String acctID) {
// Invoke the getAccount method
System.out.println("Client: invoking getAccount method on accountObject object");
AccountData acctData = ai.getAccount(acctID);
if (acctData.respcode.equals("0000") && acctData.reascode.equals("0000")) {
System.out.println("Account ID: " + acctData.acctid);
System.out.println("First name: " + acctData.firstname);
System.out.println("Last name: " + acctData.lastname);
System.out.println("Mid init: " + acctData.midinit);
System.out.println("Title: " + acctData.title);
System.out.println("Tel Number: " + acctData.telnum);
System.out.println("Address 1: " + acctData.addr1);
System.out.println("Address 2: " + acctData.addr2);
System.out.println("Address 3: " + acctData.addr3);
System.out.println("Auth 1: " + acctData.auth1);
System.out.println("Auth 2: " + acctData.auth2);
System.out.println("Auth 3: " + acctData.auth3);
System.out.println("Auth 4: " + acctData.auth4);
System.out.println("Cards: " + acctData.cards);
System.out.println("Issue Date: " + acctData.issueday + "/" + acctData.issuemonth + "/" + acctData.issueyear);
System.out.println("Reason: " + acctData.reason);
System.out.println("Code: " + acctData.code);
System.out.println("Approver: " + acctData.approver);
System.out.println("Scode 1: " + acctData.scode1);
System.out.println("Scode 2: " + acctData.scode2);
System.out.println("Scode 3: " + acctData.scode3);
System.out.println("Status: " + acctData.status);
System.out.println("Limit: " + acctData.limit);
}
else // non-zero return code
{
System.out.println("An error occurred: ");
System.out.println("Response Code: " + acctData.respcode);
System.out.println("Reason Code: " + acctData.reascode);
System.out.println("Account ID: " + acctData.acctid);
System.out.println("CICS Function: " + acctData.cicsfunc);
}
}
/**
* This method was created in VisualAge.
* @return java.lang.String
* @exception java.io.IOException The exception description.
*/
public String getFactoryIOR() throws IOException {
String line;
final String filename = "C://IORFiles/genfac.ior";
FileInputStream in = null;
InputStreamReader isr = null;
BufferedReader br = null;
try
{
in = new FileInputStream(filename);
isr = new InputStreamReader(in);
br = new BufferedReader(isr);
}
catch(IOException e)
{
System.out.println("Client: Error opening file " + filename);
throw e;
}
try
{
line = br.readLine();
System.out.println("IOR:" + line); // for diagnostics
}
catch(IOException e)
{
System.out.println("Client: Error reading file " + filename);
throw e;
}
return line;
}
}
\ No newline at end of file
package testIIOPClient;
/**
* This type was created in VisualAge.
*/
public class RunClient {
/**
* RunClient constructor comment.
*/
public RunClient() {
super();
}
/**
* Starts the application.
* @param args an array of command-line arguments
*/
public static void main(java.lang.String[] args) {
new ClientStub("11111"); // 5-digit account number used for testing
}
}
\ No newline at end of file
package accountObject;
/**
* accountObject/AccountData.java
* Generated by the IBM IDL-to-Java compiler, version 1.0
* from accountObject.idl
* 22 December 1999 17:39:18 o'clock GMT+00:00
*/
public final class AccountData
{
public String respcode = null;
public String reascode = null;
public String cicsfunc = null;
public String acctid = null;
public String lastname = null;
public String firstname = null;
public String midinit = null;
public String title = null;
public String telnum = null;
public String addr1 = null;
public String addr2 = null;
public String addr3 = null;
public String auth1 = null;
public String auth2 = null;
public String auth3 = null;
public String auth4 = null;
public String cards = null;
public String issuemonth = null;
public String issueday = null;
public String issueyear = null;
public String reason = null;
public String code = null;
public String approver = null;
public String scode1 = null;
public String scode2 = null;
public String scode3 = null;
public String status = null;
public String limit = null;
public AccountData ()
{
} // ctor
public AccountData (String _respcode, String _reascode, String _cicsfunc, String _acctid, String _lastname, String _firstname, String _midinit, String _title, String _telnum, String _addr1, String _addr2, String _addr3, String _auth1, String _auth2, String _auth3, String _auth4, String _cards, String _issuemonth, String _issueday, String _issueyear, String _reason, String _code, String _approver, String _scode1, String _scode2, String _scode3, String _status, String _limit)
{
respcode = _respcode;
reascode = _reascode;
cicsfunc = _cicsfunc;
acctid = _acctid;
lastname = _lastname;
firstname = _firstname;
midinit = _midinit;
title = _title;
telnum = _telnum;
addr1 = _addr1;
addr2 = _addr2;
addr3 = _addr3;
auth1 = _auth1;
auth2 = _auth2;
auth3 = _auth3;
auth4 = _auth4;
cards = _cards;
issuemonth = _issuemonth;
issueday = _issueday;
issueyear = _issueyear;
reason = _reason;
code = _code;
approver = _approver;
scode1 = _scode1;
scode2 = _scode2;
scode3 = _scode3;
status = _status;
limit = _limit;
} // ctor
} // class AccountData
\ No newline at end of file
package accountObject;
/**
* accountObject/AccountDataHelper.java
* Generated by the IBM IDL-to-Java compiler, version 1.0
* from accountObject.idl
* 22 December 1999 17:39:18 o'clock GMT+00:00
*/
public final class AccountDataHelper
{
private static org.omg.CORBA.TypeCode __typeCode = null;
private AccountDataHelper()
{
}
public static accountObject.AccountData extract (org.omg.CORBA.Any a)
{
return read (a.create_input_stream ());
}
public static String id ()
{
return "IDL:accountObject/AccountData:1.0";
}
public static void insert (org.omg.CORBA.Any a, accountObject.AccountData that)
{
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
a.type (type ());
write (out, that);
a.read_value (out.create_input_stream (), type ());
}
public static accountObject.AccountData read (org.omg.CORBA.portable.InputStream istream)
{
accountObject.AccountData value = new accountObject.AccountData ();
value.respcode = istream.read_string ();
value.reascode = istream.read_string ();
value.cicsfunc = istream.read_string ();
value.acctid = istream.read_string ();
value.lastname = istream.read_string ();
value.firstname = istream.read_string ();
value.midinit = istream.read_string ();
value.title = istream.read_string ();
value.telnum = istream.read_string ();
value.addr1 = istream.read_string ();
value.addr2 = istream.read_string ();
value.addr3 = istream.read_string ();
value.auth1 = istream.read_string ();
value.auth2 = istream.read_string ();
value.auth3 = istream.read_string ();
value.auth4 = istream.read_string ();
value.cards = istream.read_string ();
value.issuemonth = istream.read_string ();
value.issueday = istream.read_string ();
value.issueyear = istream.read_string ();
value.reason = istream.read_string ();
value.code = istream.read_string ();
value.approver = istream.read_string ();
value.scode1 = istream.read_string ();
value.scode2 = istream.read_string ();
value.scode3 = istream.read_string ();
value.status = istream.read_string ();
value.limit = istream.read_string ();
return value;
}
synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [28];
org.omg.CORBA.TypeCode _tcOf_members0;
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[0] = new org.omg.CORBA.StructMember (
"respcode",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[1] = new org.omg.CORBA.StructMember (
"reascode",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[2] = new org.omg.CORBA.StructMember (
"cicsfunc",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[3] = new org.omg.CORBA.StructMember (
"acctid",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[4] = new org.omg.CORBA.StructMember (
"lastname",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[5] = new org.omg.CORBA.StructMember (
"firstname",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[6] = new org.omg.CORBA.StructMember (
"midinit",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[7] = new org.omg.CORBA.StructMember (
"title",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[8] = new org.omg.CORBA.StructMember (
"telnum",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[9] = new org.omg.CORBA.StructMember (
"addr1",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[10] = new org.omg.CORBA.StructMember (
"addr2",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[11] = new org.omg.CORBA.StructMember (
"addr3",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[12] = new org.omg.CORBA.StructMember (
"auth1",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[13] = new org.omg.CORBA.StructMember (
"auth2",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[14] = new org.omg.CORBA.StructMember (
"auth3",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[15] = new org.omg.CORBA.StructMember (
"auth4",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[16] = new org.omg.CORBA.StructMember (
"cards",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[17] = new org.omg.CORBA.StructMember (
"issuemonth",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[18] = new org.omg.CORBA.StructMember (
"issueday",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[19] = new org.omg.CORBA.StructMember (
"issueyear",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[20] = new org.omg.CORBA.StructMember (
"reason",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[21] = new org.omg.CORBA.StructMember (
"code",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[22] = new org.omg.CORBA.StructMember (
"approver",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[23] = new org.omg.CORBA.StructMember (
"scode1",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[24] = new org.omg.CORBA.StructMember (
"scode2",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[25] = new org.omg.CORBA.StructMember (
"scode3",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[26] = new org.omg.CORBA.StructMember (
"status",
_tcOf_members0,
null);
_tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
_members0[27] = new org.omg.CORBA.StructMember (
"limit",
_tcOf_members0,
null);
__typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (id (), "AccountData", _members0);
}
return __typeCode;
}
public static void write (org.omg.CORBA.portable.OutputStream ostream, accountObject.AccountData value)
{
ostream.write_string (value.respcode);
ostream.write_string (value.reascode);
ostream.write_string (value.cicsfunc);
ostream.write_string (value.acctid);
ostream.write_string (value.lastname);
ostream.write_string (value.firstname);
ostream.write_string (value.midinit);
ostream.write_string (value.title);
ostream.write_string (value.telnum);
ostream.write_string (value.addr1);
ostream.write_string (value.addr2);
ostream.write_string (value.addr3);