Chapter 16 Creating CORBA C++ Components
Generating required C++ files
You use Jaguar Manager to generate the C++ files
that you need to compile into a DLL or UNIX shared library as well
as a class implementation template in which to write method logic.
These C++ files include:
- Method
skeletons file - Contains method routines that read the
parameters from the network and call the method. The method skeletons
also send the return status and output parameter
data back to the client.
- Class header file - Contains the method
declarations only. This file is an included file in the method skeletons
file and the class implementation template.
- Class implementation template - Contains
the class, method, and parameter declarations, as well as empty
method definitions. You enter any business logic into the empty
method definitions.
- Stub
interface files - Contain the interface definition for
all components in a package, as well as definitions for user-defined
types and exceptions used in your component's interface.
Jaguar Manager creates these files when you generate C++ stubs
for your component.
- UNIX makefile - You use a makefile to compile
the C++ source files into a UNIX shared library.
- NT makefile and Microsoft Visual C++ module
definition file - You use the makefile and a module definition
file to compile the C++ source files into a DLL.
"Method call to a C++ component
DLL or UNIX shared library" shows the
flow of a client method call to a C++ component
DLL or UNIX shared library.
- The
client invokes a method using the proxy or stub appropriate to the
type of client ("Client stub/proxy support" explains the different client
types). The stub or proxy sends the invocation information over
the network to the Jaguar server.
- The method skeleton in the method skeletons file
unmarshals the call and makes a call to the method implementation
in the class implementation template.
- After the method executes, the method implementation
returns the call to the method skeleton.
- The method skeleton marshals the call and sends
the call to the client.
Method call to a C++ component DLL or UNIX shared library
The following figure shows the flow of a client method call
to a C++ component DLL or UNIX shared library.
Figure 16-1: How C++ component methods are called
Procedure
for generating required C++ files
To generate the required C++ files from
a package or component, start Jaguar Manager and:
- Select the component or, if you want to generate
files for all components in a package, select the package.
- In the Generate Stubs and Skeletons dialog, select
the Generate Skeletons check box.
- Configure the skeleton generation options as follows:
- C/C++ Code
Base
- Directory where the C/C++ skeleton
files are created. When the window displays, the default is the
Jaguar cpplib subdirectory. You can type a
different path or use the Browse button to select one.
The path must be a valid UNIX or Windows NT path. It can include a
drive and as many directories as you want. You can use $JAGUAR or %JAGUAR% to
specify the Jaguar installation directory. Other shell aliases such
as "~" to indicate your home directory are not supported.
If you clear the field, the default is the directory specified
by $HOME for Solaris and %HOMEPATH% for
NT.
If you specify a relative path, such as "myclasses," the
path is interpreted relative to the Jaguar html/classes directory.
- Java Code Base
- Top-level
directory under which the Java skeleton files are created. The skeletons
are created in package subdirectories beneath the code base. Java
skeletons are always created in the same package used by the component's
implementation class.
If you are generating skeletons for a package that contains
both Java and C++ components, specify the location
where generated Java skeletons are to be created. Otherwise, you
can leave this field alone.
- In the Generate Stubs and Skeletons dialog, select
Generate Stubs.
- Select the Generate C++ Stubs
option.
- Enter a value for the C/C++ Code
Base field. This setting specifies the top-level directory path
where generated files should be created.
The rules described for the C/C++ Code
Base field under Generate Skeletons applies to this option as well.
- You can create Java stub files at this time as well. "Generating Java stubs" describes how
to configure the Java stubs options and compile the generated source
files.
- Click Generate. Jaguar Manager generates files that
are appended with .new.
- Rename the generated files, deleting .new.
File naming conventions
The generated component files are named as follows:
File type
|
File name
|
method skeletons file
|
package-name_component-name.cpp
|
class header file
|
class-name.hpp.new
|
class implementation template
|
class-name.cpp.new
|
stub interface file
|
package-name.hpp
|
where:
component-name is the name of the component
that you defined in Jaguar Manager.
class-name is the class name that you
specified when you created the component.
Jaguar Manager creates the directory structure based on the
code base that you specify and the component name, as follows:
code_base/package_name/component_name
where:
code_base is the directory name
in the Code Base field in Jaguar Manager. If the Code Base field
does not contain a full path name, the directory will be located
under the Jaguar installation directory, relative to the html/classes subdirectory.
package-name is the name of the package
that contains the component.
component_name is the component
name as displayed in Jaguar Manager.
Regenerating changed C++ component
methods
When
you add or delete methods or modify component method prototypes,
you must regenerate the method skeletons and class header files.
You must manually add, delete, or modify the methods in the class
implementation template. Before you regenerate the method skeletons
and class header files, make sure that you have moved your modified
class implementation template to another directory or renamed it
so the generated class implementation template does not overwrite
your existing class implementation template.
Copyright © 2000 Sybase, Inc. All rights reserved.
|
|