Chapter 2. - bankapp Files

Directory Structure for bankapp

This chapter describes the directory structure under the apps directory, which is subordinate to the root directory for your TUXEDO System software. We will also take a look at the files in the bankapp directory. The directory structure is shown in Figure 1.

Fig 1: Directory structure under apps/

simpapp is described in Chapter 1. hostapp is not distributed except under special arrangements.

Files

Table 1 lists the files of the banking application. The left hand column lists the source files delivered with the TUXEDO System/T software. The center column lists files that are generated when the bankapp.mk is run. The right hand column gives a brief summary of the purpose of the file.

Fig. 2: Banking Application Files

Source Generated Purpose
ACCT.ec ACCT.c, ACCT.o, ACCT Contains OPEN_ACCT and CLOSE_ACCT services to open and close accounts.
ACCTMGR.c ACCTMGR A server that subscribes to events and logs notifications. Contains WATCHDOG and Q_OPENACCT_LOG services.
AUDITC.c AUDITC Contains a conversational server that handles service requests from the client auditcon
BAL.ec BAL.c, BAL.o, BAL Contains ABAL, TBAL, ABAL_BID and TBAL_BID services to allow the audit client to obtain bank--wide or branch-wide account or teller balances.
BALC.ec BALC.c BALC.o BALC Contains ABALC_BID, and TBALC_BID. these services are the same as TBAL_BID and ABAL_BID above, expect that TPSUCCESS is returned when a branch id is not found. This allows auditcon to continue.
BALANCE.m BALANCE.M Mask for balance inquiry data entry.
bankmgr.c bankmgr A client program that subscribes to events of special interest.
BTADD.ec BTADD.c, BTADD.o, BTADD Contains BR_ADD and TLR_ADD services to allow addition of branches or tellers to the database.
CBALANCE.m CBALANCE.M Mask for confirmation of a balance inquiry.
CCLOSE.m CCLOSE.M Mask for confirmation of an account closing.
CDEPOSIT.m CDEPOSIT.M Mask for confirmation of a deposit.
CLOSE.m CLOSE.M Mask for account closing data entry.
COPEN.m COPEN.M Mask for confirmation of an account opening.
cracl.sh -- A shell script that creates Access Control Lists to demonstrate the Access Control security level.
crqueue.sh -- A shell script that creates application queues for use in event notification.
crusers.sh -- A shell script that creates groups and users to demonstrate the authentication security level.
CTRANSFER.m CTRANSFER.M Mask for confirmation of a transfer.
CWITHDRAW.m CWITHDRAW.M Mask for confirmation of a withdrawal.
DEPOSIT.m DEPOSIT.M Mask for deposit data entry.
event.flds -- A field table file used in the event feature.
FILES -- Descriptive list of all the files in bankapp.
HELP.m HELP.M Mask that explains mio keystrokes.
MENU.m MENU.M Mask that offers ring menu to choose deposit, withdrawal, transfer, balance inquiry, open account, or close account data entry screens.
OPEN.m OPEN.M Mask for open account data entry.
README -- Installation and boot procedures.
README.nt -- Installation and boot procedures for the NT platform.
README2 -- Documentation of additions to bankapp that demonstrate new features. The file is located in the apps/bankapp directory.
README2.nt -- Documentation of additions to bankapp that demonstrate new features for the NT platform. The file is located in the apps/bankapp directory.
RUNME.sh -- Interactive script to build, configure, boot, shutdown application
showq.sh -- A shell script that displays the status and contents of a message queue.
TLR.ec TLR.c, TLR.o, TLR Contains WITHDRAWAL, DEPOSIT and INQUIRY services.
TRANSFER.m TRANSFER.M Mask for transfer data entry.
usrevtf.sh -- Creates an ENVFILE for the System/T server TMUSREVT.
WITHDRAW.m WITHDRAW.M Mask for withdrawal data entry.
XFER.c XFER.o, XFER Contains TRANSFER service.
aud.v aud.V, aud.h FML view used to define structure passed between audit client and the BAL server.
appinit.c appinit.o Contains tpsvrinit() and tpsvrdone() for all servers other than TLR.
audit.c audit.o, audit Client that obtains bank--wide or branch-wide account and teller balances via the ABAL, TBAL, ABAL_BID and TBAL_BID services.
auditcon.c auditcon interactive version of audit that uses conversations and services ABAL, TBAL, ABALC_BID, TBALC_BID.
bankapp.mk -- Application makefile.
bankapp.nt -- Application makefile for NT.
bank.flds bank.flds.h Field table file containing bank database fields and auxiliary FML fields used by masks and servers.
bank.h -- Contains data definitions pertinent to more than just one C program within the application.
bankvar -- Contains variable settings, except for those within ENVFILE. Since it sets ENVFILE itself, setting bankvar will in fact set the entire environment.
crbank.sh crbank Creates databases for all banks when using SHM mode. See Chapter 1 for guidelines on use.
crbankdb.sh crbankdb Creates a database for one server group. See Chapter 1 for guidelines on use.
crtlog.sh crtlog, TLOG Creates a UDL and a TLOG on the master site. Creates a UDL on the non-master sites. tmboot creates a TLOG on the non-master sites.
driver.sh driver Drives the application by piping FML buffers with transaction requests through ud(1).
envfile.sh envfile, ENVFILE Creates ENVFILE for use by tmloadcf.
gendata.c gendata Generates ud-readable requests to add ten branches, thirty tellers and two hundred accounts.
gentran.c gentran Generates ud-readable transaction requests from among DEPOSIT, WITHDRAWAL, TRANSFER and INQUIRY.
populate.sh populate Populates the database by piping FML buffers with branch, teller and account add requests through ud(1).
run.sh run Invokes mio with MENU mask.
ubbmp tuxconfig Sample UBBCONFIG file for use in a MP mode configuration.
ubbshm tuxconfig Sample UBBCONFIG file for use in a SHM mode configuration.
util.c util.o Contains a function commonly used among all services, namely getstr().

Of the forty odd files in the directory:

14
are .m files that create data entry masks managed by the system client program, mio(1).

5
are .ec files that are source files for service subroutines using embedded SQL statements.

8
are .c files; audit.c is a client program; auditcon.c is a conversational client that connects to AUDITC.c, which is a conversational server; three others are servers or associated with servers, two are there to generate data or transactions for the application.

The remaining files have various roles; some are files you need in any application, others are makefiles for various add-ons, still others are present simply to facilitate the use of bankapp as an example. In subsequent chapters we will closely examine a number of the files, and give a more complete explanation of their role in the sample application. For now we just want to discuss the bankvar file.

Edit bankvar to Set Environment Variables

bankvar is a file of environment variables needed by bankapp. The bankvar file is approximately 185 lines, due largely to the extensive comments, but there are only a few that you should be concerned about immediately.

The first key line checks to see if TUXDIR is set. If it is not, execution of the file fails with the message:


TUXDIR: parameter null or not set
So, set TUXDIR to the root directory of your TUXEDO System directory structure, and export it.

Another line in bankvar sets APPDIR to the directory ${TUXDIR}/apps/bankapp, which is the directory where bankapp source files are located. APPDIR is a directory where TUXEDO System/T looks for your application-specific files. You might prefer to copy the bankapp files to a different directory to safeguard the original source files. If you do, then the directory you use should be entered here. It does not have to be under TUXDIR.

Another important line sets a value for DIPCKEY. This is an IPCKEY for a TUXEDO System database. There is a discussion of databases in Chapter 6; the use of this key is described there. For now, all you need to know about it is that it must be different from the value of the System/T IPCKEY specified in the UBBCONFIG file (Chapter 7).

The other variables specified in bankvar play various roles in the sample application and you will need to be aware of them when you are developing your own application. They will all be mentioned at appropriate places later in this guide. Grouping them all in bankvar is done to show you an example that you may want to adapt at a later time for use with a real application.

When you have made all the editorial changes to bankvar that you need to, execute bankvar as follows:


. ./bankvar

Fig. 2: Environment Variables for bankapp

#Copyright (c) 1997, 1996 BEA Systems, Inc.
#Copyright (c) 1995, 1994 Novell, Inc.
#Copyright (c) 1993, 1992, 1991, 1990 Unix System Laboratories, Inc.
#All rights reserved
#
# This file sets all the environment variables needed by the TUXEDO software
# to run the bankapp
#
# This directory contains all the TUXEDO software
# System administrator must set this variable
#
if [ -z "${TUXDIR}" ] ; then
	if [ ! -z "${ROOTDIR}" ] ; then
		TUXDIR=$ROOTDIR
		export TUXDIR
	fi
fi
TUXDIR=${TUXDIR:?}
#
# This directory contains all the user written code
#
# Contains the full path name of the directory that the application
# generator should place the files it creates
#
APPDIR=${TUXDIR}/apps/bankapp
#
# This path contains the shared objects that are dynamically linked at
# runtime in certain environments, e.g., SVR4.
#
LD_LIBRARY_PATH=${TUXDIR}/lib:${LD_LIBRARY_PATH}
#
# Logical block size; Database Administrator must set this variable
#
BLKSIZE=512
#
# Set default name of the database to be used by database utilities
# and database creation scripts
#
DBNAME=bankdb
#
# Indicate whether database is to be opened in share or private mode
#
DBPRIVATE=no
#
# Set Ipc Key for the database; this MUST differ from the UBBCONFIG
# *RESOURCES IPCKEY parameter
#
DIPCKEY=80953
#
# Environment file to be used by tmloadcf
#
ENVFILE=${APPDIR}/ENVFILE
#
# List of field table files to be used by mc, viewc, tmloadcf, etc.
#
FIELDTBLS=Usysflds,bank.flds,credit.flds,event.flds
#
FIELDTBLS32=Usysfl32,evt_mib,tpadm
#
# List of directories to search to find field table files
#
FLDTBLDIR=${TUXDIR}/udataobj:${APPDIR}
#
FLDTBLDIR32=${TUXDIR}/udataobj:${APPDIR}
#
# Universal Device List for database
#
FSCONFIG=${APPDIR}/bankdl1
#
# List of directories to search to find mask files for mio
#
MASKPATH=${APPDIR}
#
# Network address, used in MENU script
#
NADDR=
#
# Network device name
#
NDEVICE=
#
# Network listener address, used in MENU script
#
NLSADDR=
#
# List of services permitted to the current invoker of mio
#
OKXACTS=ALL
#
# Make sure TERM is set for mio
#
TERM=${TERM:?}
#
# Set device for the transaction log; this should match the TLOGDEVICE
# parameter under this site's LMID in the *MACHINES section of the
# UBBCONFIG file
#
TLOGDEVICE=${APPDIR}/TLOG
#
# Device for binary file that gives /T all its information
#
TUXCONFIG=${APPDIR}/tuxconfig
#
# Set the prefix of the file which is to contain the central user log;
# this should match the ULOGPFX parameter under this site's LMID in the
# *MACHINES section of the UBBCONFIG file
#
ULOGPFX=${APPDIR}/ULOG
#
# System name, used by RUNME.sh
#
UNAME=
#
# List of view files to be used by viewc, tmloadcf, etc.
#
VIEWFILES=aud.V
#
VIEWFILES32=mib_views,tmib_views
#
# List of directories to search to find view files
#
VIEWDIR=${TUXDIR}/udataobj:${APPDIR}
#
VIEWDIR32=${TUXDIR}/udataobj:${APPDIR}
#
# Specify the Q device (if events included in demo)
#
QMCONFIG=${APPDIR}/qdevice
#
# Export all variables just set
#
export TUXDIR APPDIR BLKSIZE DBNAME DBPRIVATE DIPCKEY ENVFILE
export LD_LIBRARY_PATH
export FIELDTBLS FLDTBLDIR FSCONFIG MASKPATH OKXACTS TERM
export FIELDTBLS32 FLDTBLDIR32
export TLOGDEVICE TUXCONFIG ULOGPFX
export VIEWDIR VIEWFILES
export VIEWDIR32 VIEWFILES32
export QMCONFIG
#
# Add TUXDIR/bin to PATH if not already there
#
a="`echo $PATH | grep ${TUXDIR}/bin`"
if [ x"$a" = x ]
then
	PATH=${TUXDIR}/bin:${PATH}
	export PATH
fi
#
# Add APPDIR to PATH if not already there
#
a="`echo $PATH | grep ${APPDIR}`"
if [ x"$a" = x ]
then
	PATH=${PATH}:${APPDIR}
	export PATH
fi
#
# Check for other machine types bin directories
#
for DIR in /usr/5bin /usr/ccs/bin /opt/SUNWspro/bin
do
	if [ -d ${DIR} ] ; then
		PATH="${DIR}:${PATH}"
	fi
done

Additional PATH Component for SunOS

If your operating system is SunOS, you need to put /usr/5bin at the front of your PATH. The following command can be used:


PATH=/usr/5bin:$PATH;export PATH

Another requirement for SunOS users: use /bin/sh rather than csh for your shell.