VisiBroker for C++ Activation Interfaces and Classes

This document describes the interfaces and classes used in the activation of object implementations.

ImplementationStatus

struct ImplementationStatus

ImplementationStatus is used to track the activation state for a server that is registered with the OAD.

module Activation

{

   . . .

   struct ImplementationStatus {

      extension::CreationImplDef   impl;

      ObjectStatusList      status;

   };

   . . .

};

Include file

Include the oad_c.hh file when you use this class.

ImplementationStatus members

CreationImplDef impl;

The CreationImplDef for the object implementation.

ObjectStatusList status;

Represents a list of status information for each object offered by the server. See "ObjectStatusList" for information on the ObjectStatusList class.

OAD

The OAD interface provides access to the OAD (Object Activation Daemon). It is used by the administration tools for listing, registering, and unregistered objects. It can also be used by client code for programmatic administration of the OAD.

This code sample shows the OAD IDL.

interface OAD {

   extension::CreationImplDef create_CreationImplDef();



   Object reg_implementation(in extension::CreationImplDef impl)

         raises(DuplicateEntry, InvalidPath);



   extension::CreationImplDef get_implementation( 

               in CORBA::RepositoryId repId,

               in COBRA::RepositoryId repId,

               in string object_name)

            raises(NotRegistered);



   void change_implementation(

               in extension::CreationImplDef old_info,

               in extension::CreationImplDef new_info)

            raises(NotRegistered, InvalidPath, IsActive);



   attribute boolean destroy_on_unregister;



   void unreg_implementation( 

               in CORBA::RepositoryId repId,

               in string object_name)

            raises(NotRegistered);



   void unreg_interface(in CORBA::RepositoryId repId) 

         raises(NotRegistered);



   void unregister_all();



   ImplementationStatus get_status( 

            in CORBA::RepositoryId repId,

            in string object_name)

         raises(NotRegistered);



   ImplStatusList get_status_interface( 

            in CORBA::RepositoryId repId)

         raises(NotRegistered);



   ImplStatusList get_status_all(); 



   Object lookup_interface(in CORBA::RepositoryId repId, in long timeout)

        raises(NotRegistered, FailedToExecute, 

            NotResponding, Busy);

   Object lookup_implementation(in CORBA::RepositoryId repId, in string object_name, in long timeout)

        raises(NotRegistered, FailedToExecute,

            NotResponding, Busy);



   extension::CreationImplDef boa_activate_obj(

               in Object obj, 

               in string repository_id,

               in long unique_id)

            raises(NotRegistered);



void boa_deactivate_obj(in Object obj, 

         in string repository_id,

         in long unique_id)

             raises(NotRegistered);



string generated_command(in extension::CreationImplDef impl);



string generated_environment(in extension::CreationImplDef impl);



};

For a complete description of the IDL source codes, refer to the oad.idl file located in the VisiBroker Edition subdirectory.

Include file

Include the oad_c.hh file when you use this class.

OAD methods

void change_implementation(const extension::CreationImplDef&_old_info, const extension::CreationImplDef& _new_info);

This method changes an object's implementation dynamically. You can use this method to change the registration's activation policy, path name, argument settings, and environment settings.

Parameter Description
old_info The information you want to change.
new_info The information to replace the old info.


Exception Description
NotRegistered The object you specify is not registered. You must specify a registered object.
IsActive The object implementation is currently running. Deactivate the object and then try to change its information.

Caution: You cannot change information for a currently active implementation. Be sure to exercise caution when changing an object's implementation name and object name with this method. Doing so will prevent client applications from locating the object using the old name.

CreationImplDef_ptr create_CreationImplDef();

Returns an instance of a extension::CreationImplDef_ptr object. You can then set its attributes as explained in "CreationImplDef_ptr create_CreationImplDef();."

void destroy_on_unregister(CORBA::Boolean val);

Sets the destroy_on_unregister attribute for the OAD.

Parameter Description
val If set to TRUE, any active implementations are shut down when they are unregistered. Otherwise, they will not be shut down when unregistered.

Note: Currently, this attribute cannot be set programatically.

CORBA::Boolean destroy_on_unregister();

Returns the setting for the destroy_on_unregister attribute for an implementation. If the attribute is set to TRUE, any active implementations are shut down when unregistered.

Note: Currently, this attribute cannot be set programatically.

CORBA::CreationImplDef_ptr get_implementation(const char *repId, const char *object_name);

This method retrieves information about implementations registered for the specified repository identifier and object name. It returns a extension::CreationImplDef_ptr object.

Parameter Description
repId The repository identifier.
object_name The object name.


Exception Description
NotRegistered The object you specify is not registered. You must specify a registered object.

ImplementationStatus *get_status(const char *repId, const char *object_name);

This method retrieves the status information about implementations registered for the specified repository identifier and object name.

Parameter Description
repId The repository identifier.
object_name The object name.

ImplStatusList *get_status_all();

Returns an ImplStatusList containing the status information for all implementations.

ImplStatusList *get_status_interface(cost char *repId);

This method gets the status information about implementations registered for the specified repository identifier.

Parameter Description
repId The repository identifier.


Exception Description
NotRegistered The object you specify is not registered. You must specify a registered object.

::CORBA::Object_ptr reg_implementation(const extension::CreationImplDef& _impl);

This method registers an implementation with the OAD and the VisiBroker Edition directory service.

Parameter Description
impl The instance of CreationImplDef.


Exception Description
DuplicateEntry The object you specify is a duplicate entry. You must specify an unregistered object.

void unreg_implementation(const char *repId, const char *object_name);

This method unregisters implementations by repository identifier and object name. If the destroy_on_unregister attribute is set to true, this method terminates all processes currently implementing the repository identifier and object name that is specified.

Parameter Description
repId The repository identifier.
object_name The object name.


Exception Description
NotRegistered The object you specify is not registered. You must specify a registered object.

void unreg_interface(const char *repId);

This method unregisters all implementations for a repository identifier. If the destroy_on_unregister attribute is set to true, this method terminates all processes currently implementing the repository identifier specified.

Parameter Description
repId The repository identifier.
Exception Description
NotRegistered The object you specify is not registered. You must specify a registered object.

void unregister_all();

This method unregisters all implementations. Unless the attribute destroy_on_unregister is set to true, all active implementations continue to execute.

ObjectStatus

struct ObjectStatus

This structure is used to store information about a particular object offered by an object implementation that is registered with the OAD. This structure is returned by the ObjectStatusList class, described in "ObjectStatusList."

module Activation

{

   . . .

   struct ObjectStatus {

      long         unique_id;

      State         activation_state;

      Object            objRef;

   };

   . . .

};

Include file

Include the oad_c.hh file when you use this class.

ObjectStatus members

CORBA::Long unique_id;

A unique identifier for the object.

State activation_state;

The object's current activation state; one of these values:

CORBA::Object objRef;

The object whose state is represented in the structure.

ObjectStatusList

class ObjectStatusList

This class implements a list of ObjectStatus structures and is used to represent information about the objects offered by a server.

See also

Include file

Include the oad_c.hh file when you use this class.

ObjectStatusList methods

void length(CORBA::ULong len);

Sets the length of the list.

Parameter Description
len The length of the list.

CORBA::ULong length() const;

Returns the length of the list.

CORBA::ULong maximum() const;

Returns the maximum length of the list.

ObjectStatus& operator[](CORBA::ULong index);

Returns the ObjectStatus structure with the specified index in the list.

Parameter Description
index The zero-based index of the item in the list.