VisiBroker for C++ API Reference Guide : Introduction to VisiBroker : Activation interfaces and classes

Activation interfaces and classes
This section 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 OAD registration information for the object implementation.
ObjectStatusList status;
Represents a list of status information for each object offered by the server. See “ObjectStatusList” on page 122 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.
The following 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 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 installation in the following directory:
<install_dir>\idl\
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 objects implementation dynamically. You can use this method to change the registration's activation policy, path name, argument settings, and environment settings.
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.
extension::CreationImplDef_ptr create_CreationImplDef();
Returns an instance of an extension::CreationImplDef_ptr object. You can then set its attributes as explained in “CreationImplDef impl;” on page 117.
void destroy_on_unregister(CORBA::Boolean val);
Sets the destroy_on_unregister attribute for the OAD.
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.
extension::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.
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.
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.
::CORBA::Object_ptr reg_implementation(
const extension::CreationImplDef& _impl);
This method registers an implementation with the OAD and the VisiBroker directory service.
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.
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.
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” on page 122.
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. It can be 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
“ObjectStatus” on page 122.
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.
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.