![]() |
![]() |
BEA WebLogic Enterprise 4.2 Developer Center |
![]() HOME | SITE MAP | SEARCH | CONTACT | GLOSSARY | PDF FILES | WHAT'S NEW |
||
![]() GETTING STARTED | TABLE OF CONTENTS | PREVIOUS TOPIC | NEXT TOPIC | INDEX |
The chapter discusses the following topics:
Refer to For an explanation of concepts associated with WLE applications and a description of the development process for WLE applications, see Getting Started.
The Basic sample application allows users to browse for available courses and get details on selected courses. Figure 3-1 illustrates how the Basic sample application works.
The Basic sample application demonstrates the following features:
Readme.txt
in the \basic
directory for troubleshooting information and the latest information about using the Basic sample application.
How the Basic Sample Application Works
Figure 3-1 The Basic Sample Application
The first step in creating client and server applications is to specify all of the CORBA interfaces and their methods using OMG IDL. The Basic sample application implements the following CORBA interfaces:
Listing 3-1 shows the univb.idl
file that defines the CORBA interfaces in the Basic sample application. A copy of this file is included in the directory for the Basic sample application.
Listing 3-1 OMG IDL for the Basic Sample Application
module UniversityB
{
typedef unsigned long CourseNumber;
typedef sequence<CourseNumber> CourseNumberList;
struct CourseSynopsis
{
CourseNumber course_number;
string title;
};
typedef sequence<CourseSynopsis> CourseSynopsisList;
interface CourseSynopsisEnumerator
{
CourseSynopsisList get_next_n(
in unsigned long number_to_get,
out unsigned long number_remaining
);
void destroy();
};
typedef unsigned short Days;
const Days MONDAY = 1;
const Days TUESDAY = 2;
const Days WEDNESDAY = 4;
const Days THURSDAY = 8;
const Days FRIDAY = 16;
struct ClassSchedule
{
Days class_days; // bitmask of days
unsigned short start_hour; // whole hours in military time
unsigned short duration; // minutes
};
struct CourseDetails
{
CourseNumber course_number;
double cost;
unsigned short number_of_credits;
ClassSchedule class_schedule;
unsigned short number_of_seats;
string title;
string professor;
string description;
};
typedef sequence<CourseDetails> CourseDetailsList;
interface Registrar
{
CourseSynopsisList
get_courses_synopsis(
in string search_criteria,
in unsigned long number_to_get, // 0 = all
out unsigned long number_remaining,
out CourseSynopsisEnumerator rest
);
CourseDetailsList get_courses_details(in CourseNumberList
courses);
interface RegistrarFactory
{
Registrar find_registrar(
);
};
};
Note: The CORBA client applications in the University sample applications use static invocation. For an example of using the dynamic invocation interface, see Creating Client Applications. When creating CORBA Java client applications, see your Java ORB's documentation for information about compiling the OMG IDL to get client stubs. ActiveX client applications do not use client stubs.
The interface specification defined in OMG IDL is used by the IDL compiler to generate client stubs for the client application and skeletons for the server application. The client stubs are used by the client application for all operation invocations. You use the skeleton, along with the code you write, to create the server application that implements the CORBA objects. For information about generating and using client stubs and skeletons, see Getting Started.
During the development process, you would use the idl
command to compile the OMG IDL file and produce client stubs and skeletons. This task has been automated in the makefile
for the Basic sample application. For a description of the idl
command, see the C++ Programming Reference.
The WLE software supports three types of client applications:
During the development process, you would write client application code that does the following:
Registrar
object
get_courses_synopsis()
and get_courses_details()
methods on the Registrar
object
C++, Java, and Visual Basic versions of the client application code in the Basic sample application are provided. For information about writing client applications, see Getting Started and Creating Client Applications.
During the development process, you would write the following:
Writing the Server Application
Registrar
object with the WLE domain
C++ code for the Server object and the method implementations in the University server application are provided.
During the development process, you use the For information about writing server applications, see Creating C++ Server Applications.
A key part of any WLE application is the There are two forms of the configuration file:
genicf
command to create an Implementation Configuration File (ICF). You then edit the ICF file to define activation and transaction policies for the Registrar
, RegistrarFactory
, and CourseSynopsisEnumerator
objects. For the Basic sample application, the Registrar
, RegistrarFactory
, and CourseSynopsisEnumerator
objects have an activation policy of process
and a transaction policy of ignore
. An ICF file for the Basic sample application is provided.
Configuring the Basic Sample Application
UBBCONFIG
file. Although creating a UBBCONFIG
file is the task of the administrator, it is important for the client and server programmers to understand that the file exists and how the file is used. When system administrators create a configuration file, they are describing the WLE application using a set of parameters that the WLE software interprets to create a runnable application.
UBBCONFIG
file, an ASCII version of the file, created and modified with any editor. Chapter 2, "Setting Up Your Environment," describes setting the required parameters in the UBBCONFIG
file used by all University sample applications.
For information about the Perform the following steps to build the Basic sample application:
UBBCONFIG
file and the tmloadcf
command, see Administration Guide.
Building the Basic Sample Application
The following sections describe these steps.
Note: Before you can build or run the Basic sample application, you need to perform the steps in Chapter 2, "Setting Up Your Environment."
The files for the Basic sample application are located in the following directories:
Windows NT
drive
:\WLEdir\samples\corba\university
\basic
UNIX
/usr/WLEdir/samples/corba/university
/basic
In addition, you need to copy the utils
directory into your work directory. The utils
directory contains files that set up logging, tracing, and access to the University database.
Table 3-1 lists and describes the files you will use to create the Basic sample application.
During the installation of the WLE software, the sample application files are marked read-only. Before you can edit the files or build the files in the Basic sample application, you need to change the protection of the files you copied into your work directory, as follows:
Windows NT
prompt>attrib -r drive:\
workdirectory
\*.*
UNIX
prompt>chmod u+rw /
workdirectory
/*.*
Use the following command to set the environment variables used to build the client and server applications in the Basic sample application:
Windows NT
prompt>setenvb
UNIX
prompt>/bin/ksh
prompt>. ./setenvb.sh
Use the following command to initialize the University database used with the Basic sample application:
Windows NT
prompt>nmake -f makefileb.nt initdb
UNIX
prompt>make -f makefileb.mk initdb
Use the following command to load the UBBCONFIG
file:
Windows NT
prompt>tmloadcf -y ubb_b.nt
UNIX
prompt>tmloadcf -y ubb_b.mk
During the development process, you would use the buildobjclient
and buildobjserver
commands to build the client and server applications. However, for the Basic sample application, this step has been done for you.
The directory for the Basic sample application contains a makefile
that builds the client and server sample applications.
Use the following commands to build the CORBA C++ client and server applications in the Basic sample application:
Windows NT
prompt>nmake -f makefileb.nt
UNIX
prompt>make -f makefileb.mk
To build the CORBA Java client application:
Windows NT
prompt>nmake -f makefileb.nt javaclient
UNIX
prompt>make -f makefileb.mk javaclient
For information about building and using the ActiveX client application, see "Starting the ActiveX Client Application."
For more information about the buildobjclient
and buildobjserver
commands, see the C++ Programming Reference.
Perform the following steps to run the Basic sample application:
Start the system and sample application server applications in the Basic sample application by entering the following command:
prompt>tmboot -y
This command starts the following server processes:
TMSYSEVT
The BEA TUXEDO system event broker.
TMFFNAME
The transaction management services, including the NameManager and the FactoryFinder services.
TMIFSRVR
The Interface Repository server process. This server process is used only by ActiveX client applications.
univb_server
Before using another sample application, enter the following command to stop the system and sample application server processes:
Start the CORBA C++ client application in the Basic sample application by entering the following command:
Before you can start the CORBA Java client application, you need to change the values of the Start the CORBA Java client application in the Basic sample application by entering the following command:
Note:
For the University sample applications, the task of loading the OMG IDL for the CORBA interfaces into the Interface Repository is automated by the Before you can start the ActiveX client application, you must use the Application Builder to create ActiveX bindings for the CORBA interfaces.
To create an ActiveX binding for a CORBA interface:
prompt>tmshutdown
Starting the CORBA C++ Client Application
prompt>univb_client
Starting the CORBA Java Client Application
Port
and Host
parameters in UnivBApplet.html
to match the host name and port number specified in the ISL
parameter in the UBBCONFIG
file. For example:
<param name=port value=2500>
<param name=host value=BEANIE>prompt>appletviewer UnivBApplet.html
Starting the ActiveX Client Application
makefile
.
The Domain logon window appears.
ISL
parameter in the UBBCONFIG
file. You must match exactly
the capitalization used in the UBBCONFIG
file. For example: //BEANIE:2500
.
The Application Builder logon window appears.
A confirmation window appears.
The Application Builder creates the following:
DI
modulename_interfacename
. For example, the binding for the Registrar
interface is named DIUniversityB_Registrar
.
\
WLEdir\TypeLibraries.
The type library file is named DI
modulename_interfacename
.tlb.
Perform the following steps to open the ActiveX client application:
A logon window appears.
ISL
parameter in the UBBCONFIG
file. You must match exactly the
capitalization used in the UBBCONFIG
file.
The following sections briefly explain how to use the client applications that are included in the Basic sample application.
After starting the CORBA C++ client application, a menu with the following options appears:
<F> Find courses
<A> List all courses
<D> Display course details
<E> Exit
Perform the following steps to find courses the match a particular curriculum subject:
F
.
A list of all the courses that match that search string appears.
Perform the following steps to list all the courses in the database:
A
.
A list of ten courses appears.
y
to continue viewing lists of ten courses or n
to return to the Options
menu.
Perform the following steps to display the details of a particular course:
D
.
-1
at the Course Number
prompt. For
example:
To exit the C++ CORBA client application, enter E
at the Options prompt.
Perform the following steps to find courses that match a particular curriculum subject:
search string?
prompt, enter a text string. You can
enter the title of a course, the name of a professor, or the description of a course.
For example, computer
.
A list of all the courses that match that search string appears.
Perform the following steps to list all the courses in the database:
Perform the following steps to display the details of a particular course:
To exit the CORBA Java client application, choose Quit from the Applet menu.
When you log on to the ActiveX client application, the Course Browser window appears. Use the Course Browser window to find courses available at the university.
Perform the following steps to find courses that match a particular curriculum subject:
computer
.
A list of all the courses that match that search string appears.
Perform the following steps to display the details of a particular course:
A summary of details for the selected course appears.
To exit the ActiveX client application, choose Exit from the File menu.