Bionic Buffalo Tech Note #25: Quick Start Guide to Writing CORBA Server Applications
Compile the Interface IDL
Tech Note #20 lists various items generated by the IDL compiler, possibly relevant to a client
application. In addition to those, the IDL compiler generates additional code useful in developing
server applications.
Methods for Each Operation
For each operation and attribute, the IDL compiler generates (as required by the
specifications) prototypes for the methods. Bionic Buffalo's
france compiler, in
addition, will (if asked) generate a sample method for each operation. The operation of
the sample method program is determined by the value of the compile time symbol
(macro)
VUT_METHOD_SELECTOR.
If
VUT_METHOD_SELECTOR is undefined, or if it is set to
VUT_METHOD_NO_IMPLEMENT, then the sample method program will generate a
NO_IMPLEMENT exception when called.
If
VUT_METHOD_SELECTOR is set to VUT_METHOD_STATELESS, then the sample
method will look up the object reference and object id of the target object.
If
VUT_METHOD_SELECTOR is set to VUT_METHOD_MEMORY_STATE, then the
sample method will look up the object reference and object id of the target object, and
will compute a pointer to a state structure in memory. The object id is presumed to
include within its structure a pointer to the object's state structure.
If
VUT_METHOD_SELECTOR is set to VUT_METHOD_INDEXED_STATE, then the
sample method will perform a database lookup of the object's state, then it will perform
a database update of the object's state. Between the lookup and the update, meaningful
work is presumed to be done. Generic database routines are used; non-functioning
versions are provided in the libraries, but a developer may substitute functioning
routines that use file i/o, a database, or some other mechanism. The object id is
presumed to include within its structure the database key. The state structure is
marshaled into an opaque sequence of bytes when written to the database.
In any of these cases, the developer may consider the generated sample method to be an
illustration, or he or she may use the sample method as the starting point for a real
application. These sample methods do not do anything other than housekeeping; a
developer must add code to perform some meaningful work from a client's point of view.
In the two options above which deal with state lookup and update (either in memory, or in
a database), the IDL compiler looks for a structure called
ObjectState defined in the
interface. If found, that structure is used as the state value structure, otherwise the
compiler provides a trivial definition for an
ObjectState structure. If an interface
inherits from another interface, the derived interface's state structure will include the state
structure from the base interface.
Page 9 of 12