Skip navigation.

CORBA Programming Reference

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

 


Tobj_ServantBase:: activate_object()

Synopsis

Associates an object ID with a servant. This method gives the application an opportunity to restore the object's state when the object is activated. The state may be restored from shared memory, from an ordinary flat file, or from a database file.

C++ Binding

class Tobj_ServantBase : public PortableServer::ServantBase {
public:
virtual void activate_object(const char * stroid) {}
};

Argument

stroid

Specifies the object ID in string format. The object ID uniquely identifies this instance of the class. This is the same object ID that was specified when the object reference was created (using TP:create_object_reference()) or in the TP::create_active_object_reference() for the object reference used for this invocation.

Note: The restriction on the length of the object ID has been removed in this release.

Description

Object activation is triggered by a client invoking a method on an inactive CORBA object. This causes the Portable Object Adapter (POA) to assign a servant to the CORBA object. The activate_object() method is invoked before the method invoked by the client is invoked. If activate_object() returns successfully, that is, without raising an exception, the requested method is executed on the servant.

The activate_object() and deactivate_object() methods and the method invoked by the client can be used by the programmer to manage object state. The particular way these methods are used to manage object state may vary according to the needs of the application. For a discussion of how these methods might be used, see Creating CORBA Server Applications.

If the object is currently infected with a global transaction, activate_object() executes within the scope of that same global transaction.

It is the responsibility of the programmer of the object to check that the stored state of the object is consistent. In other words, it is up to the application code to save a persistent flag that indicates whether or not deactivate_object() successfully saved the state of the object. That flag should be checked in activate_object().

Return Value

None.

Exceptions

If an error occurs while executing activate_object(), the application code should raise either a CORBA standard exception or a TobjS::ActivateObjectFailed exception. When an exception is raised, the TP Framework catches the exception, and the following events occur:

Note: For each CORBA interface, set AUTOTRAN to Yes if you want a transaction to start automatically when an operation invocation is received. Setting AUTOTRAN to Yes has no effect if the interface is already in transaction mode. For more information about AUTOTRAN, see Using CORBA Transactions.

TobjS::ActivateObjectFailed

"TPFW_CAT:24: ERROR: Activating object - application raised TobjS::ActivateObjectFailed. Reason = reason. Interface = interfaceName, OID = oid"

Where reason is a user-supplied reason, and interfaceName and oid are the interface ID and object ID, respectively, of the invoked CORBA object.

TobjS::OutOfMemory

"TPFW_CAT:22: ERROR: Activating object - application raised TobjS::OutOfMemory. Reason = reason. Interface = interfaceName, OID = oid"

Where reason is a user-supplied reason, and interfaceName and oid are the interface ID and object ID, respectively, of the invoked CORBA object.

CORBA::Exception

"TPFW_CAT:25: ERROR: Activating object - CORBA Exception not handled by application. Exception ID = exceptionID. Interface = interfaceName, OID = oid"

Where exceptionID is the interface ID of the exception, and interfaceName and oid are the interface ID and object ID, respectively, of the invoked CORBA object.

Other exception

"TPFW_CAT:26: ERROR: Activating object - Unknown Exception not handled by application. Exception ID = exceptionID. Interface = interfaceName, OID = oid"

Where exceptionID is the interface ID of the exception, and interfaceName and oid are the interface ID and object ID, respectively, of the invoked CORBA object.

 

Skip navigation bar  Back to Top Previous Next