|
|
|
|
|
|
|
|
|
|
|
|
|
|
Creates the TUXCONFIG file, a binary file for the CORBA domain that specifies the configuration of your server application.
|
|
|
|
idl [options] idl-filename [
icf-filename]
|
•
|
options represents one or more command-line options to the IDL compiler. The command-line options are described in the CORBA Programming Reference. If you want to generate implementation files, you need to specify the -i option.
|
|
•
|
idl-filename represents the name of your application’s OMG IDL file.
|
|
•
|
icf-filename is an optional parameter that represents the name of your application’s Implementation Configuration File (ICF file), which you use to specify object activation policies or to limit the number of interfaces for which you want skeleton and implementation files generated. Using the ICF file is described in the section “Step 4: Define the In-memory Behavior of Objects” on page 2-14.
|
For more information about the idl command, see the
CORBA Programming Reference. For more information about generating these files for the Oracle Tuxedo University sample applications, see the
Guide to the CORBA University Sample Applications.
The IDL compiler also provides the -T command-line option, which you can use for generating tie class templates for your interfaces. For more information about implementing tie classes in a CORBA application, see the section “Delegation-based Interface Implementation” on page 2-29.
|
•
|
Optionally, the Tobj_ServantBase::activate_object() and Tobj_ServantBase::deactivate_object() operations.
|
Within the Tobj_ServantBase::activate_object() and
Tobj_ServantBase::deactivate_object()operations, you write code that performs any particular steps related to activating or deactivating an object. This includes reading and writing the object’s durable state from and to disk, respectively. If you implement these operations in your object, you must also edit the implementation header file and add the definitions for these operations in each implementation that uses them.
You typically generate this implementation file only once, using the -i option with the command that invokes the IDL compiler. As you iteratively refine your application’s interfaces, and modify the operations for those interfaces, including operation signatures, you add all the required changes to the implementation file to reflect those changes.
The find_registrar() operation on the
RegistrarFactory object contains the following invocation to the
TP::create_object_reference() operation to create a reference to a
Registrar object:
Any command-line options specified in the CLOPT parameter for your specific server application in the
SERVERS section of the Oracle Tuxedo domain’s
UBBCONFIG file are passed to the
Server::initialize() operation as
argc and
argv. For more information about passing arguments to the server application, see
Administering an Oracle Tuxedo Application at Run Time. For examples of passing arguments to the server application, see the
Guide to the CORBA University Sample Applications.
Within the Server::initialize() operation, you include code that does the following, if applicable:
The TP::register_factory() operation registers the server application’s factories with the FactoryFinder object. This operation requires the following input parameters:
Notice the parameter University::_tc_RegistrarFactory->id(). This is the same parameter specified in the
TP::create_object_reference() operation. This parameter extracts the Interface Repository ID of the object’s OMG IDL interface from its typecode.
The Server::create_servant() operation contains code that instantiates a servant for the object required by the client request. For example, in C++, this code includes a
new statement on the interface class for the object.
The Server::create_servant() operation does not associate the servant with an OID. The association of a servant with an OID takes place when the TP Framework invokes the
Tobj_ServantBase::activate_object() operation on the servant, which completes the instantiation of the object. (You cannot associate an OID with an object in the object’s constructor.) Likewise, the disassociation of a servant with an OID takes place when the TP Framework invokes the
deactivate_object() operation on the servant.
The Server::create_servant() operation requires a single input argument. The argument specifies a character string containing the Interface Repository ID of the OMG IDL interface of the object for which you are creating a servant.
Within the Server::release() operation, you may perform any application-specific cleanup tasks that are specific to the server application, such as:
The invocation of the TP::unregister_factory() operation should be one of the first actions in the
Server::release() implementation. The TP::
unregister_factory() operation unregisters the server application’s factories. This operation requires the following input arguments:
Notice also the parameter UnivB::_tc_RegistrarFactory->id(). This is also the same as the interface name used to register the factory.
|
Note:
|
You must use the buildobjserver command to compile and link CORBA server applications.
|
The buildobjserver command has the following format:
buildobjserver [-o servername] [options]
In the buildobjserver command syntax:
|
•
|
-o servername represents the name of the server application to be generated by this command.
|
|
•
|
options represents the command-line options to the buildobjserver command.
|
|
•
|
TUXCONFIG, which needs to match exactly the TUXCONFIG entry in the UBBCONFIG file. This variable represents the location or path of the application’s UBBCONFIG file.
|
|
•
|
APPDIR, which represents the directory in which the application’s executable file exists.
|
|
4.
|
Set the TUXDIR environment variable on all machines that are running in the Oracle Tuxedo domain or that are connected to the Oracle Tuxedo domain. This environment variable points to the location where the Oracle Tuxedo software is installed.
|
The command-line argument application-ubbconfig-file represents the name of your application’s
UBBCONFIG file. Note that you may need to remove any old
TUXCONFIG files to execute this command.
|
•
|
CORBA UserExceptions defined in the file TobjS_c.h. The OMG IDL for the exceptions defined in this file is the following:
|
|
•
|
In the Server::create_servant, Tobj_ServantBase::activate_object(), and Tobj_ServantBase::deactivate_object() callback methods.
|
|
•
|
The CORBA::OBJECT_NOT_EXIST exception is returned to the client application.
|
|
•
|
If the exception raised is TobjS::CreateServantFailed, then a message is sent to the user log. If a reason string is supplied in the constructor for the exception, then the reason string is also written as part of the message.
|
|
•
|
Neither the Tobj_ServantBase::activate_object() or Tobj_ServantBase::deactivate_object() operations are invoked. The operation requested by the client is not invoked.
|
|
•
|
The CORBA::OBJECT_NOT_EXIST exception is returned to the client application.
|
|
•
|
If the exception raised is TobjS::ActivateObjectFailed, a message is sent to the user log. If a reason string is supplied in the constructor for the exception, the reason string is also written as part of the message.
|
|
•
|
The object has the always transaction policy, and the Oracle Tuxedo system automatically started a transaction when the object was invoked. In this case, the transaction is automatically rolled back by the Oracle Tuxedo system. Because the client application is unaware of the transaction, the Oracle Tuxedo system then raises the CORBA::OBJ_ADAPTER CORBA system exception, and not the CORBA:: TRANSACTION_ROLLEDBACK exception, which would have been the case had the client initiated the transaction.
|
|
•
|
The exception is defined in the file TobjS_c.h. In this case, the exception is converted to the CORBA::BAD_OPERATION exception and is returned to the client application. In addition, the following message is sent to the user log:
|
If the exception is TobjS::IllegalOperation, the following supplementary message is written to warn the developer of a possible coding error in the application:
This can occur if the TP::deactivateEnable() operation is invoked inside an object that has the
transaction activation policy. (Application-controlled deactivation is not supported for transaction-bound objects.)
|
•
|
If the exception raised is TobjS::DectivateObjectFailed, a message is sent to the user log. If a reason string is supplied in the constructor for the exception, the reason string is also written as part of the message.
|
The Server object's implementation of the Server::create_servant() operation instantiates an object based on its interface ID. It is crucial that this interface ID is the same as the one supplied in the factory when the factory invokes the
TP::create_object_reference() operation. If the interface IDs do not match, the
Server::create_servant() operation usually raises an exception or returns a NULL servant. The Oracle Tuxedo system then returns a
CORBA::OBJECT_NOT_EXIST exception to the client application. The Oracle Tuxedo system does not perform any validation of interface IDs in the
TP::create_object_reference() operation.
|
•
|
Immediately before factory invokes the TP::create_object_reference() operation, include code that checks the Interface Repository to see if the required interface exists. Make sure that all the application OMG IDL is up-to-date and loaded into the Interface Repository. Should this check fail to find the interface ID, you can assume that there is a mismatch.
|
|
•
|
Following the invocation of the TP::create_object_reference() operation in your factories, include code that “pings” the object. That is, the code invokes any operation on the object (typically an operation that does not do anything). If this invocation raises the CORBA::OBJECT_NOT_EXIST exception, an interface ID mismatch exists. Note that “pinging” an object causes the object to be activated, with the overhead associated with the activation.
|
The Tobj_ServantBase::deactivate_object() operation is invoked when the activation boundary for an object is reached. You may, optionally, write durable state to disk in the implementation of this operation. It is important to understand that exceptions raised in this operation are not returned to the client application. The client application will be unaware of any error conditions raised in this operation unless the object is participating in a transaction. Therefore, in cases where it is important that the client application know whether the writing of state via this operation is successful, we recommend that transactions be used.
If you decide to use the Tobj_ServantBase::deactivate_object() operation for writing state, and the client application needs to know the outcome of the write operations, we recommend that you do the following:
Normally, during object deactivation (that is, when the TP Framework invokes the Tobj_ServantBase::deactivate_object() operation), the TP Framework deletes the object’s servant; however, when servant pooling is used, the TP Framework does
not delete the servant at object deactivation. Instead, the server application maintains a pointer to the servant in a pool. When a subsequent client request arrives that can be satisfied by a servant in that pool, the server application reuses the servant and assigns a new object ID. When a servant is reused from a pool, the TP Framework does not create a new servant.
|
1.
|
In the Server::initialize() operation on the Server object, write the code that sets up the servant pool. The pool consists of a set of pointers to one or more servants, and the code for the pool specifies how many servants for a given class are to be maintained in the pool.
|
|
2.
|
In the pooled servant’s Tobj_ServantBase::deactive_object() operation, you implement the TP::application_responsibility() operation. In the implementation of the TP::application_responsibility() operation, you provide code that places a pointer to the servant into the servant pool at the time that the TP Framework invokes the Tobj_ServantBase::deactivate_object() operation.
|
|
Note:
|
Support for the TP::application_responsibility() operation has changed in this release. For complete information, see the CORBA Programming Reference.
|
Table 2‑1 shows the inheritance characteristics of the interface
Account, which serves as a wrapper for a legacy object. The legacy object contains the implementation of the operation
op1. The tie class delegates
op1 to the legacy class.
Note that the IDL compiler does not generate the implementation file for the tie class; you need to create this file by hand, as described in the next step.
|
4.
|
In the Server object’s Server::create_servant() operation, write the code that instantiates the legacy object.
|
|
Note:
|
When compiling tie classes with the Compaq C++ Tru64 compiler for UNIX, you must include the -noimplicit_include option in the definition of the CFLAGS or CPPFLAGS environment variables used by the buildobjserver command. This option prevents the C++ compiler from automatically including the server skeleton definition file ( _s.cpp) everywhere the server skeleton header file ( _s.h) is included, which is necessary to avoid multiply-defined symbol errors. See Compaq publications for additional information about using class templates, such as the tie classes, with Tru64 C++.
|