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

Core interfaces and classes
This section describes the VisiBroker for C++ core interfaces and classes.
PortableServer::AdapterActivator
Adapter activators are associated with Portable Object Adapters (POAs). They make it possible for POAs to create child POAs under the following circumstances:
When the find_POA method is called with an activate parameter set to TRUE.
For more information about POAs, see “Using POAs” in the VisiBroker for C++ Developer’s Guide.
IDL Definition
interface AdapterActivator {
boolean unknown_adapter(in POA parent, in string name);
};
PortableServer::AdapterActivator methods
CORBA::Boolean unknown_adapter(
PortableServer::POA_ptr parent, const char* name);
This method is called when the VisiBroker ORB receives a request for an object reference which identifies a target POA that does not exist. The VisiBroker ORB invokes this method once for each POA that must be created in order for the POA to exist (starting with the ancestor POA closest to the root POA).
BindOptions
Deprecated interface
This interface is deprecated as of VisiBroker 4.x. It is provided for backward compatibility support only. For support of the current CORBA specification, see "Client basics" in the VisiBroker for C++ Developer's Guide.
struct BindOptions
This structure is used to specify options to the _bind method, described in “Object” on page 17. Each process has a global BindOptions structure that is used for all _bind invocations that do not specify bind options. You can modify the default bind options using the Object::_default_bind_options method.
Bind options may also be set for a particular object and will remain in effect for the lifetime of the connection to that object.
Include file
The corba.h file should be included when you use this structure.
BindOptions members
CORBA::Boolean defer_bind;
If set to TRUE, the establishment of the connection between client and the object implementation is delayed until the first client operation is issued.
If set to FALSE, the _bind method should establishes the connection immediately.
CORBA::Boolean enable_rebind;
If set to TRUE and the connection is lost, due to a network failure or some other error, the VisiBroker ORB attempts to re-establish a connection to a suitable object implementation.
If set to FALSE, no attempt is made to reconnect the client with the object implementation.
Deprecated member
CORBA::Long max_bind_tries;
This member has been deprecated. It is no longer used for manipulating the interactions between the ORB and the OAD. It was used to specify the number of times to retry a bind request when the OAD is busy.
CORBA::ULong send_timeout;
This member specifies the maximum time in seconds that a client is to block waiting to send an operation request. If the request times out, CORBA::NO_RESPONSE exception is raised and the connection to the server is destroyed.
The default value of 0 (zero) indicates that the client is to block indefinitely.
CORBA::ULong receive_timeout;
This member specifies the maximum time in seconds that a client is to block waiting for a response to an operation request. If the request times out, a CORBA::NO_RESPONSE exception is raised and the connection to the server is destroyed.
The default value of 0 (zero) indicates that the client is to block indefinitely.
CORBA::ULong connection_timeout;
This member specifies the maximum time in seconds that a client is to wait for a connection. If the time specified is exceeded, a CORBA::NO_IMPLEMENT exception is raised.
The default value of 0 indicates that the default system time-out for connections is to be used.
BOA
Deprecated interface
This class is deprecated as of VisiBroker 4.x. It is provided for backward compatibility support only. For more information, see "Using the BOA with VisiBroker" in the VisiBroker for C++ Developer's Guide. For support of the current CORBA specification Micro Focus recommends using POAs; see "Using POAs" in the VisiBroker for C++ Developer's Guide.
class BOA
The BOA class represents the Basic Object Adaptor and provides methods for creating and manipulating objects and object references. Object servers use the BOA to activate and deactivate object implementations and to specify the thread policy they wish to use.
You do not instantiate a BOA object. Instead, you obtain a reference to a BOA object by invoking the ORB::BOA_init method.
VisiBroker provides extensions to the CORBA BOA specification which are covered in “VisiBroker extensions to CORBA::BOA”. These methods provide for the management of connections, threads, and the activation of services.
Include file
Include the file corba.h when you use this class.
CORBA::BOA methods
CORBA::Object_ptr create(const CORBA::ReferenceData& refData, extension::CreationImplDef& creationImplDef)
This method registers the specified implementation with the OAD.
This pointer's true type is CreationImplDef. It provides the interface name, object name, path name of the executable and the activation policy and other parameters. See “Activation interfaces and classes” for a complete discussion of the CreationImplDef class.
void deactivate_impl(extension::ImplementationDef_ptr implDefPtr)
This method causes requests to the implementation to be discarded.
The method deactivates the implementation specified by implDefPtr. Once this method is called, no further client requests are delivered to the object within this implementation until the objects and implementation are re-activated. To cause the implementation to again accept requests, call impl_is_ready or obj_is_ready.
This pointer's true type is CreationImplDef. It provides the interface name, object name, path name of the executable and activation policy, along with other parameters.
void deactivate_obj(CORBA::Object_ptr objPtr)
This method requests that the BOA deactivate the specified object. Once this method is invoked, the BOA does not deliver any requests to the object until obj_is_ready or impl_is_ready is invoked.
static CORBA::BOA_ptr _duplicate(CORBA::BOA_ptr ptr)
This static method duplicates the BOA pointer that is passed in as a parameter.
A BOA pointer.
void exit_impl_ready()
This method provides backward compatibility with earlier releases of VisiBroker for C++. It invokes BOA::shutdown, described in “void shutdown()” on page 12 which causes a previous invocation of the impl_is_ready method to return. This method cannot be invoked in the context of an active request.
CORBA::ReferenceData_ptr get_id(CORBA::Object_ptr objPtr)
This method returns the reference data for the specified object. The reference data is set by the object implementation at activation time and is guaranteed to remain constant throughout the life of the object.
CORBA::Principal_ptr get_principal(CORBA::Object_ptr objPtr, CORBA::Environment_ptr env=NULL)
This method returns the Principal object associated with the specified object. This method may only be called by an object implementation during the processing of a client operation request.
void impl_is_ready(const char *service_name,
extension::Activator_ptr activator,
CORBA::Boolean block = 1)
This method instructs the BOA to delay activation of the object implementation associated with the specified service_name until a client requests the service. Once a client requests the service, the specified Activator object is used to activate the object implementation. If block is set to 0, this method blocks the caller until the exit_impl_ready method is invoked.
void impl_is_ready(extension::ImplementationDef_ptr impl=NULL)
This method notifies the BOA that one or more objects in the server are ready to receive service requests. This method blocks the caller until the exit_impl_ready method is invoked. If all objects that the implementation offers were created through C++ instantiation and activated using the obj_is_ready method, do not specify the ImplementationDef_ptr.
An object implementation may offer only one object and may want to defer the activation of that object until a client request is received. In these cases, the object implementation does not need to first invoke the obj_is_ready method. Instead, it may simply invoke this method, passing the ActivationImplDef pointer as its single object.
This pointer's true type is ActivationImplDef and provides the interface name, object name, path name of the executable and activation policy, along with other parameters.
static CORBA::BOA_ptr _nil()
This static method returns a NULL BOA pointer that can be used for initialization purposes.
void obj_is_ready(CORBA::Object_ptr obj,
extension::ImplementationDef_ptr impl_ptr = NULL)
This method notifies the BOA that the specified object is ready for use by clients. There are two different ways to use this method:
Objects whose creation is to be deferred until the first client request is received should specify a NULL Object_ptr and provide a pointer to an ActivationImplDef object that has been initialized.
A optional pointer to an ActivationImplDef object.
static void CORBA::release(CORBA::BOA_ptr boa)
This static method releases the specified BOA pointer. Once the object's reference count reaches zero, the object is automatically deleted.
A valid BOA pointer.
static RegistrationScope scope()
This static method returns the registration scope of the BOA. The registration scope of an object can be SCOPE_GLOBAL or SCOPE_LOCAL. Only objects with a global scope are registered with the osagent.
static void scope(RegistrationScope val)
This static method changes the registration scope of the BOA to the specified value.
The scope for this BOA. Must be one of the following values: LOCAL_SCOPE for transient objects. GLOBAL_SCOPE for objects registered with the Smart Agent.
void shutdown()
This method causes a previous invocation of the impl_is_ready method to return. This method cannot be invoked in the context of an active request.
CORBA::Object_ptr string_to_object(const char * str)
This method converts a stringified object reference, created with the object_to_string method described in “char *object_to_string(CORBA::Object_ptr obj);” on page 25, back into an object reference that may be used to invoke methods on the object.
Deprecated methods
void dispose(CORBA::Object_ptr objPtr)
This method unregisters the implementation of the specified object from the Object Activation Daemon. Once this method is invoked, all references to the specified object are invalid and any connections to this object implementation are broken. If the object has been allocated, it is the application’s responsibility to delete the object. This method is deprecated since VisiBroker 4.x. We recommend that you use the OAD interface instead.
VisiBroker extensions to CORBA::BOA
CORBA::ULong connection_max()
This method returns the maximum number of connections allowed.
void connection_max(CORBA::ULong max_conn)
This method is used by servers to set the maximum number of connections allowed.
CORBA::ULong thread_max()
This method returns the maximum number of threads allowed if the TPool thread policy has been selected.
void thread_max(CORBA::ULong max)
This method sets the maximum number of threads allowed when the TPool thread policy has been selected. If the current number of threads exceeds this number, the extra threads are destroyed one at a time as soon as they are no longer in use until the number of threads is down to max.
CORBA::ULong thread_stack_size()
Returns the maximum thread stack size (in bytes) when TPool or TSession thread policy is selected.
void thread_stack_size(CORBA::ULong size)
Sets the maximum thread stack size (in bytes) when TPool or TSession thread policy is selected.
CompletionStatus
enum CompletionStatus
This enumeration represents how an operation request completed.
IDL Definition
enum CompletionStatus {
COMPLETED_YES;
COMPLETED_NO;
COMPLETED_MAYBE;};
CompletionStatus members
 
Context
class CORBA::Context
The Context class contains information about a client application's environment that is passed to a server as an implicit parameter during static or dynamic method invocations. It can be used to communicate special information that needs to be associated with a request, but is not part of the method's argument list.
The Context class consists of a list of properties, stored as name-value pairs, and provides methods for setting and manipulating those properties. A Context contains an NVList object and chains the name-value pairs together.
A Context_var class is also available and provides simpler memory management semantics.
Include file
Include the corba.h file when you use this class.
Context methods
const char *context_name() const;
This method returns the name used to identify this context. If no name was provided when this object was created, it returns a NULL value.
void create_child(const char * name, CORBA::Context_out context_ptr);
This method creates a child Context for this object.
The name of the new Context object.
void delete_values(const char *name);
This method deletes one or more properties from this object.
static CORBA::Context_ptr _duplicate(CORBA::Context_ptr ctx);
This method duplicates the specified object.
void get_values(const char *start_scope, CORBA::Flags flag, const char *name, CORBA::NVList_out NVList_ptr);
This method searches the Context object hierarchy and retrieves one or more of the name/value pairs specified by the name parameter. If the name parameter has a trailing wildcard character (*), then all matching properties and their values are returned. It then creates an NVList object and places the name/value pairs in the NVList. If the name parameter is an empty string or a NULL string, the BAD_PARAM standard system exception is raised. If the name parameter is not found, the BAD_CONTEXT standard system exception is raised and no property list is returned.
The start_scope parameter specifies the name of the context where the search begins. If the property is not found, the search continues up the Context object hierarchy until a match is found, or until there are no more Context objects to search. If the start_scope parameter is omitted, the search begins with the specified context object.
The name of the Context object at which to start the search. If set to CORBA::Context::_nil(), the search begins with the current Context. To restrict the search scope can to just the current Context, specify CORBA::CTX_RESTRICT_SCOPE.
static CORBA::Context_ptr _nil();
This method returns a NULL Context_ptr suitable for initialization purposes.
CORBA::Context_ptr parent();
This method returns a pointer to the parent Context. If there is no parent Context, a NULL value is returned.
static void _release(CORBA::Context_ptr ctx);
This static method releases the specified Context object. Once the object's reference count reaches zero, the object is automatically deleted.
void set_one_value(const char *name, const CORBA::Any& anAny);
This method adds a property to this object using the specified name and value.
void set_values(CORBA::NVList_ptr _list);
This method adds one or more properties to this object, using the name/value pairs specified in the NVList. When you create the NVList object to be used as an input parameter to this method, you must set the Flags field to zero and each Any object added to the NVList must have its TypeCode set to TC_string. For more information on the NVList class, see “Dynamic interfaces and classes”.
PortableServer::Current
class PortableServer::Current : public CORBA::Current
This class provides methods with access to the identity of the object on which the method was called. The Current class provides support for servants which implement multiple objects but can be used within the context of POA-dispatched method invocations on any servant.
IDL Definition
interface Current : CORBA::Current {
exception NoContext {};
POA get_POA() raises (NoContext);
};
PortableServer::Current methods
PortableServer::POA *get_POA();
This method returns a reference to the POA which implements the object in whose context it is called. If this method is called from outside the context of a POA-dispatched method, a NoContext exception is raised.
PortableServer::ObjectId get_object_id();
This method returns the ObjectId which identifies the object in whose context it was called. If this method is called from outside the context of a POA-dispatched method, a NoContext exception is raised.
Exception
class CORBA::Exception
The Exception class is the base class of the system exception and user exception classes. For more information, see “SystemException” on page 45.
Include file
You should include the corba.h file when using this class.
Object
class CORBA::Object
All ORB objects are derived from the Object class, which provides methods for binding clients to objects and manipulating object references as well as querying and setting an object's state. Object class methods are implemented by the ORB.
VisiBroker for C++ provides extensions to the CORBA Object specification. These are covered in “VisiBroker extensions to CORBA::Object” on page 19.
Include file
You should include the file corba.h when using this class.
CORBA::Object methods
void _create_request(CORBA::Context_ptr ctx, const char *operation, CORBA::NVList_ptr arg_list, CORBA::NamedValue_ptr result, CORBA::Request_out request, CORBA::Flags req_flags);
This method creates a Request for an object implementation that is suitable for invocation with the Dynamic Invocation Interface.
A pointer to the Request that is created. For more information, see “Dynamic interfaces and classes”.
This flag must be set to OUT_LIST_MEMORY if one or more of the NamedValue items in arg_list are output arguments.
void _create_request(
CORBA::Context_ptr ctx,
const char *operation,
CORBA::NVList_ptr arg_list,
CORBA::NamedValue_ptr result,
CORBA::ExceptionList_ptr eList,
CORBA::ContextList_ptr ctxList,
CORBA::Request_out request,
CORBA::Flags req_flags);
This method creates a Request for an object implementation that is suitable for invocation with the Dynamic Invocation Interface.
A list of Context objects for this request.
A pointer to the Request that is created. See “Dynamic interfaces and classes” for more information.
This flag must be set to OUT_LIST_MEMORY if one or more of the NamedValue items in arg_list are output arguments.
static CORBA::Object_ptr _duplicate(CORBA::Object_ptr obj);
This static method duplicates the specified Object_ptr and returns a pointer to the object. The object's reference count is increased by one.
CORBA::InterfaceDef_ptr _get_interface();
This method returns a pointer to this object's interface definition. See “Interface repository interfaces and classes (C++)” for more information.
CORBA::ULong _hash(CORBA::ULong maximum);
This method returns a hash value for this object. This value does change for the lifetime of this object, however the value is not necessarily unique. If two objects return different hash values, then they are not identical. The upper bound of the hash value may be specified. The lower bound is 0 (zero).
CORBA::Boolean _is_a(const char *logical_type_id);
This method returns TRUE if this object implements the interface associated with the repository id. Otherwise, it returns FALSE.
CORBA::Boolean _is_equivalent(CORBA::Object_ptr other_object);
This method returns TRUE if the specified object pointer and this object point to the same object implementation. Otherwise, it returns FALSE.
static CORBA::Object_ptr _nil();
This static method returns a NULL pointer suitable for initialization purposes.
CORBA::Boolean _non_existent();
This method returns TRUE if the object represented by this object reference no longer exists.
CORBA::Request_ptr _request(const char* operation);
This method creates a Request suitable for invoking methods on this object. A pointer to the Request object is returned. See “Dynamic interfaces and classes” for more information.
CORBA::Object_ptr _resolve_reference(const char* id);
Your client application can invoke this method on an object reference to resolve the server-side interface with the specified service identifier. This method causes the ORB::_resolve_initial_references method to be invoked on the server-side to resolve the specified service. This method returns an object reference which your client can narrow to the appropriate server type.
This method is typically used by client applications that wish to manage a server's attributes.
VisiBroker extensions to CORBA::Object
CORBA::BindOptions* _bind_options();
This method returns a pointer to the bind options that used for this object only. For more information, see “BindOptions” on page 7.
void _bind_options(const CORBA::BindOptions& opt);
This method sets the bind options for this object only. The options that are set remain in effect for the lifetime of the proxy object. Any changes to time-out values will apply to all subsequent send and receive operations as well as any re-bind operations. For more information, see “BindOptions” on page 7.
static CORBA::Object_ptr _bind_to_object(
const char *rep_id,
const char *object_name=NULL,
const char *host_name=NULL,
const CORBA::BindOptions *options=NULL,
CORBA::ORB_ptr orb=NULL);
This method attempts to bind to the object with the specified repository_id and object_name on the specified host using the specified BindOptions and ORB.
Deprecated method
CORBA::BOA _boa() const;
This method is deprecated as of VisiBroker 4.x. It is provided for backward compatibility support only. For more information, see "Using the BOA with VisiBroker" in the VisiBroker for C++ Developer's Guide. For current CORBA specification support, Micro Focus recommends using POAs rather than BOAs. See "Using POAs" in the VisiBroker for C++ Developer's Guide.
The method returns a pointer to the Basic Object Adaptor with which this object is registered.
static CORBA::Object_ptr _clone(
CORBA::Object_ptr obj,
CORBA::Boolean reset_connection = 1UL);
This method clones the specified object reference.
static const CORBA::BindOptions
*
_default_bind_options();
This method returns a pointer to the global, per client process BindOptions. For more information, see “BindOptions” on page 7.
static void _default_bind_options(
const CORBA::BindOptions& bindOptions);
This method sets the bind options to be used by default for all _bind invocations that do not specify their own bind options. For more information, see “BindOptions” on page 7.
static const CORBA::TypeInfo *_desc();
Returns type information for this object.
const char *_interface_name() const;
This method returns this object's interface name.
CORBA::Boolean _is_bound() const;
This method returns FALSE if the client process has established a connection to an object implementation.
CORBA::Boolean _is_local() const;
This method returns TRUE if the object implementation resides within the same process or address space as the client application.
CORBA::Boolean _is_persistent() const;
This method returns TRUE if this object is a persistent object. A FALSE value returned is not an authoritative answer that the object is not persistent.
CORBA::Boolean _is_remote() const;
This method returns TRUE if the object implementation resides in a different process or address space than the client application. The client and object implementation may or may not reside on the same host.
const char *_object_name() const;
This method returns the object name associated with this object.
CORBA::Long _ref_count() const;
Returns the reference count for this object.
void _release();
Decrements this object's reference count and releases the object if the reference count has reached 0.
const char *_repository_id() const;
This method returns this object's repository identifier.
ORB
class CORBA::ORB
The ORB class provides an interface to the Object Request Broker. It provides methods to the client object, independent of the particular Object or Object Adaptor.
VisiBroker provides extensions to the CORBA ORB that are discussed in “VisiBroker extensions to CORBA::ORB” on page 28. These methods are provided for the management of connections, threads, and the activation of services.
Include file
You should include the file corba.h when using this class.
CORBA::ORB methods
CORBA::Boolean work_pending();
This method returns true if the ORB has any work waiting to be processed.
static CORBA::TypeCode_ptr create_alias_tc(
const char *repository_id,
const char *type_name,
CORBA::TypeCode_ptr original_type);
This static method dynamically creates a TypeCode for the alias with the specified type and name.
static CORBA::TypeCode_ptr create_array_tc(CORBA::Ulong length, TypeCode_ptr element_type);
This static method dynamically creates a TypeCode for an array.
static CORBA::TypeCode_ptr create_enum_tc(const char *repository_id, const char *type_name, const CORBA::EnummemberSeq& members);
This static method dynamically creates a TypeCode for an enumeration with the specified type and members.
void create_environment(CORBA::Environment_out env);
This method creates an Environment object.
static CORBA::TypeCode_ptr create_exception_tc(
const char *repository_id,
const char *type_name,
const CORBA::StructMemberSeq& members);
This static method dynamically creates a TypeCode for an exception with the specified type and members.
static CORBA::TypeCode_ptr create_interface_tc(
const char *repository_id, const char *type_name);
This static method dynamically creates a TypeCode for the interface with the specified type.
void create_list(
CORBA::Long num, CORBA::NVList_out nvList);
This method creates an NVList with the specified number of elements and returns a reference to the list.
void create_named_value(CORBA::NamedValue_out value);
This method creates a NamedValue object.
void create_operation_list(CORBA::OperationDef_ptr opDefPtr, CORBA::NVList_out nvList);
This method creates an argument list for the specified OperationDef object.
static CORBA::TypeCode_ptr create_recursive_sequence_tc(CORBA::Ulong bound, CORBA::Ulong offset);
This static method dynamically creates a TypeCode for a recursive sequence. The result of this method can be used to create other types. The offset parameter determines which enclosing TypeCode describes the elements of this sequence.
static CORBA::TypeCode_ptr create_sequence_tc(CORBA::Ulong bound, CORBA::TypeCode_ptr element_type);
This static method dynamically creates a TypeCode for a sequence.
static CORBA::TypeCode_ptr create_string_tc(CORBA::Ulong bound);
This static method dynamically creates a TypeCode for a string.
static CORBA::TypeCode_ptr create_struct_tc(
const char *repository_id, const char *type_name,
const CORBA::StructMemberSeq& members);
This static method dynamically creates a TypeCode for the structure with the specified type and members.
static CORBA::TypeCode_ptr create_union_tc(
const char *repository_id,
const char *type_name,
CORBA::TypeCode_ptr discriminator_type,
const CORBA::UnionMemberSeq& members);
This static method dynamically creates a TypeCode for a union with the specified type, discriminator and members.
CORBA::Status get_default_context(
CORBA::Context_ptr& contextPtr);
This method returns the default per-process Context maintained by VisiBroker. The default Context is often used in constructing DII requests. For more information, go to “Context” on page 14.
CORBA::Status get_next_response(CORBA::Request_out*& req);
This method blocks waiting for the response associated with a deferred request. You can use the ORB::poll_next_response method to determine if there is a response waiting to be received before you call this method.
ObjectIdList *list_initial_services();
This method returns a list of the names of any object services that are available to your application. These services may include the Location Service, Interface Repository, Name Service, or Event Service. You can use any of the returned names with the ORB::resolve_initial_references method to obtain the top-level object for that service.
char *object_to_string(CORBA::Object_ptr obj);
This method converts the specified object reference to a string, a process referred to as "stringification" in the CORBA specification. Object references that have been converted to strings can be stored in files, for example. This is an ORB method because different ORB implementations may have different conventions for representing object references as strings.
Deprecated method
CORBA::BOA_ptr ORB::BOA_init(
int& argc, char *const *argv,
const char *boa_identifier = (char *)NULL);
This method is deprecated as of VisiBroker 4.x. It is provided for backward compatibility support only. For more information, see "Using the BOA with VisiBroker" in the VisiBroker for C++ Developer's Guide. For current CORBA specification support, Micro Focus recommend using POAs. See "Using POAs" in the VisiBroker for C++ Developer's Guide.
This ORB method returns a handle to the BOA and specifies optional networking parameters. The argc and argv parameters are the same parameters passed to the object implementation process when it is started.
Identifies the type of BOA to be used. Use TPool if multiple thread support is desired. Use TSingle if the implementation does not use threads.
static CORBA::ORB_ptr ORB_init(int& argc, char *const *argv, const char *orb_id = NULL);
This method initializes the ORB and is used by both clients and object implementations. It returns a pointer to the ORB that can be used to invoke ORB methods. The argc and argv parameters passed to the application's main function can be passed directly to this method. Arguments accepted by this method take the form of name-value pairs so that they can be distinguished from other command line arguments.
void perform_work();
This method instructs the ORB to perform some work.
CORBA::Boolean poll_next_response();
This method returns TRUE if a response to a deferred request was received, otherwise FALSE is returned. This call does not block.
CORBA::Object_ptr resolve_initial_references(const char * identifier);
This method resolves one of the names returned by the ORB::list_initial_services method, described in “ObjectIdList *list_initial_services();” on page 25, to its corresponding implementation object. The resolved object which is returned can then be narrowed to the appropriate server type. If the specified service cannot be found, an InvalidName exception is raised.
void register_initial_reference (const char * identifier, CORBA::Object_ptr obj);
This method registers the name to its corresponding implementation object. The corresponding object id could now be resolved using an object URL format such as corbaloc. An InvalidName exception is raised if the identifier is empty or is already registered.
void send_multiple_requests_deferred(const CORBA::RequestSeq& req);
This method sends all the client requests in the specified sequence as deferred requests. The ORB will not wait for any responses from the object implementation. The client application is responsible for retrieving the responses to each request using the ORB::get_next_response method.
void send_multiple_requests_oneway(const CORBA::RequestSeq& req);
This method sends all the client requests in the specified sequence as one-way requests. The ORB does not wait for a response from any of the requests because one-way requests do not generate responses from the object implementation.
CORBA::Object_ptr string_to_object(const char *str);
This method converts a string representing an object into an object pointer. The string must have been created using the ORB::object_to_string method.
static CORBA::ORB_ptr _duplicate(CORBA::ORB_ptr ptr);
This static method duplicates the specified ORB pointer and returns a pointer to the duplicated ORB.
static CORBA::ORB_ptr _nil();
This static method returns a NULL ORB pointer suitable for initialization purposes.
void run();
This method causes the ORB to start processing work. This ORB receives requests and dispatches them. This call blocks this process until the ORB is shut down.
static void shutdown(CORBA::Boolean wait_for_completion=0);
This method causes a previous invocation of the impl_is_ready method to return. All object adapters are shut down and associated memory is freed. If the wait_for_completion parameter is TRUE, this operation blocks until the shutdown is complete. If an application does this in a thread that is currently servicing an invocation, the BAD_INV_ORDER system exception is raised. If the wait_for_completion parameter is FALSE, then shutdown may not have completed upon return.
static void destroy();
This operation destroys the ORB so that its resources can be reclaimed by the application. If destroy is called on an ORB that has not been shut down, it will start the shut down process and block until the ORB has shut down before it destroys the ORB. The behavior is similar to that achieved by calling shutdown with the wait_for_completion parameter set to TRUE. If an application calls destroy in a thread that is currently servicing an invocation, the BAD_INV_ORDER system exception is raised.
VisiBroker extensions to CORBA::ORB
CORBA::Object_ptr bind(
const char *rep_id,
const char *object_name =
(const char*)NULL, const char *host_name =
(const char*)NULL, CORBA::BindOptions *opt =
(CORBA::BindOptions*)NULL);
This method allows you obtain a generic object reference to an object by specifying the repository id of the object and optionally, its object name and host name where it is implemented.
CORBA::ULong connection_count()
This method is used by client applications to return the current number of active connections.
void connection_max(CORBA::ULong max_conn)
Client applications use this method to set the maximum number of connections allowed.
CORBA::ULong connection_max()
Client applications use this method to obtain the maximum number of connections allowed.
static CORBA::TypeCode_ptr create_wstring_tc(
CORBA::Ulong bound);
This static method dynamically creates a TypeCode for a Unicode string.
PortableServer::POA
class PortableServer::POA
Objects of the POA class manage the implementations of a collection of objects. The POA supports a namespace for these objects which are identified by Object Ids. A POA also provides a namespace for other POAs in that a POA must be created as a child of an existing POA, which then forms a hierarchy starting with the root POA.
A POA object must not be exported to other processes or be stringified. A MARSHAL exception is raised if this is attempted.
PortableServer::POA methods
PortableServer::ObjectId* activate_object(
PortableServer::Servant _p_servant);
This method generates an object id and returns it. The object id and the specified _p_servant are entered into the Active Object Map. If the UNIQUE_ID policy is present with the POA and the specified _p_servant is already in the Active Object Map, then a ServantAlreadyActive exception is raised.
This method requires that the SYSTEM_ID and RETAIN policies be present with the POA; otherwise, a WrongPolicy exception is raised.
The Servant to be entered into the Active Object Map.
void activate_object_with_id(
const PortableServer::ObjectId& _oid,
PortableServer::Servant _p_servant);
This method attempts to activate the specified _oid and to associate it with the specified _p_servant in the Active Object Map. If the _oid already has a servant bound to it in the Active Object Map, then an ObjectAlreadyActive exception is raised. If the POA has the UNIQUE_ID policy present and the _p_servant is already in the Active Object map, then a ServantAlreadyActive exception is raised.
If the POA has the SYSTEM_ID policy present and it detects that the _oid was not generated by the system or for the POA, then this method raises a BAD_PARAM system exception.
This method requires that the RETAIN policy be present with the POA; otherwise, a WrongPolicy exception is raised.
The Servant to be entered into the Active Object Map.
PortableServer::ImplicitActivationPolicy_ptr
create_implicit_activation_policy(
PortableServer::ImplicitActivationPolicyValue
_value);
This method returns a pointer to an ImplicitActivationPolicy object with the specified _value. The application is responsible for calling the inherited destroy method on the Policy object after the Policy object is no longer needed.
If no ImplicitActivationPolicy is specified at POA creation, then the default is NO_IMPLICIT_ACTIVATION.
If set to IMPLICIT_ACTIVATION, the POA implicitly activates servants: also requires SYSTEM_ID and RETAIN policies. If set to NO_IMPLICIT_ACTIVATION, the POA will not implicitly activate servants.
CORBA::Object_ptr create_reference(const char* _intf);
This method creates and returns an object reference that encapsulates a POA-generated ObjectId and the specified _intf values. The _intf, which may be null, becomes the type_id of the generated object reference. This method does not cause an activation to take place. Undefined behavior results if the _intf value does not identify the most derived interface of the object or one of its base interfaces. The ObjectId may be obtained by invoking the POA::reference_to_id method on the returned Object.
This method requires that the RETAIN policy be present with the POA; otherwise, a WrongPolicy exception is raised.
CORBA::Object_ptr create_reference_with_id (
const PortableServer::ObjectId&
_oid,const char* _intf);
This method creates and returns an object reference that encapsulates the specified _oid and _intf values. The _intf, which may be a null string, becomes the type_id of the generated object reference. An _intf value that does not identify the most derived interface of the object or one of its base interfaces will result in undefined behavior. This method does not cause an activation to take place. The returned object reference may be passed to clients, so that subsequent requests on those references will cause the object to be activated if necessary, or the default servant used, depending on the applicable policies.
If the POA has the SYSTEM_ID policy present and it detects the ObjectId value was not generated by the system or for the POA, this method may raise a BAD_PARAM system exception.
PortableServer::IdAssignmentPolicy_ptr create_id_assignment_policy (
PortableServer::IdAssignmentPolicyValue _value);
This method returns a pointer to an IdAssignmentPolicy object with the specified _value. The application is responsible for calling the inherited destroy method on the Policy object after it is no longer needed.
If no IdAssignmentPolicy is specified at POA creation, then the default is SYSTEM_ID.
If set to USER_ID, then objects created by the POA are assigned object ids only by the application. If set to SYSTEM_ID, then objects created by the POA are assigned object ids only by the POA.
PortableServer::IdUniquenessPolicy_ptr create_id_uniqueness_policy (
PortableServer::IdUniquenessPolicyValue _value);
This method returns a pointer to an IdUniquenessPolicy object with the specified _value. The application is responsible for calling the inherited destroy method on the Policy object after it is no longer needed.
If no IdUniquenessPolicy is specified at POA creation, then the default is UNIQUE_ID.
If set to UNIQUE_ID, then servants which are activated with the POA support exactly one object id. If set to MULTIPLE_ID, then a servant which is activated with the POA may support one or more object ids.
PortableServer::LifespanPolicy_ptr create_lifespan_policy (
PortableServer::LifespanPolicyValue _value);
This method returns a pointer to a LifespanPolicy object with the specified _value. The application is responsible for calling the inherited destroy method on the Policy object after it is no longer needed.
If no LifespanPolicy is specified at POA creation, then the default is TRANSIENT.
If set to TRANSIENT, then objects implemented in the POA cannot outlive the POA instance in which they were first created. Once a transient POA is deactivated, the use of any object references generated from it results in an OBJECT_NOT_EXIST exception being raised. If set to PERSISTENT, then the objects implemented in the POA can outlive any process in which they are first created.
PortableServer::POA_ptr create_POA(
const char* _adapter_name,
PortableServer::POAManager_ptr _a_POAManager,
const CORBA::PolicyList& _policies);
This method creates a new POA with the specified _adapter_name. The new POA is a child of the specified _a_POAManager. If a child POA with the same name already exists for the parent POA, a PortableServer::AdapterAlreadyExists exception is raised.
The specified _policies are associated with the new POA and are used to control its behavior.
PortableServer::RequestProcessingPolicy_ptr
create_request_processing_policy (
PortableServer::RequestProcessingPolicyValue _value);
This method returns a pointer to a RequestProcessingPolicy object with the specified _value. The application is responsible for calling the inherited destroy method on the Policy object after it is no longer needed.
If no RequestProcessingPolicy is specified at POA creation, then the default is USE_ACTIVE_OBJECT_MAP_ONLY.
If set to USE_ACTIVE_OBJECT_MAP_ONLY and the object id is not found in the Active Object Map, then an OBJECT_NOT_EXIST exception is returned to the client. (The RETAIN policy is also required.)If set to USE_DEFAULT_SERVANT and the object id is not found in the Active Object Map or the NON_RETAIN policy is present, and a default servant has been registered with the POA using the set_servant method, then the request is dispatched to the default servant. If no default servant has been registered, then an OBJ_ADAPTER exception is returned to the client. (The MULTIPLE_ID policy is also required.)If set to USE_SERVANT_MANAGER and the object id is not found in the Active Object Map or the NON_RETAIN policy is present, and a servant manager has been registered with the POA using the set_servant_manager method, then the servant manager is given the opportunity to locate a servant or raise an exception. If no servant manager has been registered, then an OBJ_ADAPTER is returned to the client.
PortableServer::ServantRetentionPolicy_ptr
create_servant_retention_policy (
PortableServer::ServantRetentionPolicyValue _value);
This method returns a pointer to a ServantRetentionPolicy object with the specified _value. The application is responsible for calling the inherited destroy method on the Policy object after it is no longer needed.
If no ServantRetentionPolicy is specified at POA creation, then the default is RETAIN.
If set to RETAIN, then the POA will retain active servants in its Active Object Map. If set to NON_RETAIN, then servants are not retained by the POA.
PortableServer::ThreadPolicy_ptr create_thread_policy(
PortableServer::ThreadPolicyValue _value);
This method returns a pointer to a ThreadPolicy object with the specified _value. The application is responsible for calling the inherited destroy method on the Policy object after it is no longer needed.
If no ThreadPolicy is specified at POA creation, then the default is ORB_CTRL_MODEL.
If set to ORB_CTRL_MODEL, the ORB is responsible for assigning requests for an ORB-controlled POA to threads. In a multi-threaded environment, concurrent requests may be delivered using multiple threads. If set to SINGLE_THREAD_MODEL, then requests to the POA are processed sequentially. In a multi-threaded environment, all upcalls made by the POA to servants and servant managers are made in a manner that is safe for code that is multi-thread unaware.
void deactivate_object(const PortableServer::ObjectId& _oid);
This method causes the specified _oid to be deactivated. An ObjectId which has been deactivated continues to process requests until there are no more active requests for that ObjectId. An ObjectId is removed from the Active Object Map when all requests executing for that ObjectId have completed.
If a ServantManager is associated with the POA, then the ServantActivator::etherealize method is invoked with the ObjectId and the associated servant after the ObjectId has been removed from the Active Object map. Reactivization for the ObjectId blocks until etherealization, if necessary, has completed. However, the method does not wait for requests or etherealization to complete and always returns immediately after deactivating the specified _oid.
This method requires that the RETAIN policy be present with the POA; otherwise, a WrongPolicy exception is raised.
void destroy(
CORBA::Boolean _etherealize_objects,
CORBA::Boolean _wait_for_completion);
This method destroys this POA object and all of its descendant POAs. First the children are destroyed and finally the current container POA. If desired, later, a POA with that same name in the same process can be created.
If TRUE, the POA has the RETAIN policy, and a servant manager has registered with the POA, then the etherealize method is called on each active object in the Active Object Map. The apparent destruction of the POA occurs before the etherealize method is called, and thus any etherealize method which attempts to invoke methods on the POA raises an OBJECT_NOT_EXIST exception.
If TRUE and the current thread is not in an invocation context dispatched from some POA belonging to the same ORB as this POA, the destroy method only returns after all active requests and all invocations of etherealize have completed. IfFALSE and the current thread is in an invocation context dispatched from some POA belonging to the same ORB as this POA, the BAD_INV_ORDER exception is raised and POA destruction does not occur.
PortableServer::POA_ptr find_POA(
const char* _adapter_name,CORBA::Boolean _activate_it);
If the POA object on which this method is called is the parent of the POA with the specified _adapter_name, the child POA is returned.
If set to TRUE and no child POA of the POA specified by _adapter_name exists, then the POA's AdapterActivator, if not null, is invoked. If it successfully activates the child POA, then that POA is returned. Otherwise an AdapterNonExistent exception is raised.
PortableServer::Servant get_servant();
This method returns the default Servant associated with the POA. If no Servant has been associated with the POA, then a NoServant exception is raised.
This method requires that the USE_DEFAULT_SERVANT policy be present with the POA; otherwise, a WrongPolicy exception is raised.
PortableServer::ServantManager_ptr get_servant_manager();
This method returns a pointer to the ServantManager object associated with the POA. The result is null if no ServantManager is associated with the POA.
This method requires that the USE_SERVANT_MANAGER policy be present with the POA; otherwise, a WrongPolicy exception is raised.
CORBA::Object_ptr id_to_reference(PortableServer::ObjectId& _oid);
This method returns an object reference if the specified _oid value is currently active. If the _oid is not active, then an ObjectNotActive exception is raised.
This method requires that the RETAIN policy be present with the POA; otherwise, a WrongPolicy exception is raised.
PortableServer::Servant id_to_servant(PortableServer::ObjectId& _oid);
This method has three behaviors:
If the POA has the RETAIN policy present and the specified _oid is in the Active Object Map, then it returns the servant associated with that object in the Active Object Map.
If the POA has the USE_DEFAULT_SERVANT policy present and a default servant has been registered with the POA, it returns the default servant.
Otherwise, an ObjectNotActive exception is raised.
This method requires that the USE_DEFAULT_SERVANT policy be present with the POA; if neither policy is present, a WrongPolicy exception is raised.
PortableServer::Servant reference_to_servant(CORBA::Object_ptr _reference);
This method has three behaviors:
If the POA has the RETAIN policy and the specified _reference is present in the Active Object Map, then it returns the servant associated with that object in the Active Object Map.
If the POA has the USE_DEFAULT_SERVANT policy present and a default servant has been registered with the POA, then it returns the default servant.
Otherwise, it raises an ObjectNotActive exception.
This method requires that the RETAIN or USE_DEFAULT_SERVANT policies be present; otherwise, a WrongPolicy exception is raised.
PortableServer::ObjectId* reference_to_id(CORBA::Object_ptr _reference);
This method returns theObjectId value encapsulated by the specified _reference. The invocation is valid only if the _reference was created by the POA on which the method is called. If the _reference was not created by the POA, a WrongAdapter exception is raised. The object denoted by the _reference parameter does not have to be active for this method to succeed.
Though the IDL specifies that a WrongPolicy exception may be raised by this method, it is simply declared for possible future extension.
PortableServer::ObjectId* servant_to_id(
PortableServer::Servant _p_servant);
This method has four possible behaviors:
If the POA has the UNIQUE_ID policy present and the specified _p_servant is active, then the ObjectId associated with the _p_servant is returned.
If the POA has the IMPLICIT_ACTIVATION policy present and either the POA has the MULTIPLE_ID policy present or the specified _p_servant is not active, then the _p_servant is activated using the POA-generated ObjectId and the repository interface id associated with the _p_servant, and that ObjectId is returned.
If the POA has the USE_DEFAULT_SERVANT policy present, the specified _p_servant is the default servant, then the ObjectId associated with the current invocation is returned.
Otherwise, a ServantNotActive exception is raised.
This method requires that the USE_DEFAULT_SERVANT policy or a combination of the RETAIN policy and either the UNIQUE_ID or IMPLICIT_ACTIVATION policies be present; otherwise, a WrongPolicy exception is raised.
CORBA::Object_ptr servant_to_reference(PortableServer::Servant _p_servant);
This method has the following possible behaviors:
If the POA has both the RETAIN and the UNIQUE_ID policies present and the specified _p_servant is active, then an object reference encapsulating the information used to activate the servant is returned.
If the POA has both the RETAIN and the IMPLICIT_ACTIVATION policies present and either the POA has the MULTIPLE_ID policy or the specified _p_servant is not active, then the _p_servant is activated using a POA-generated ObjectId and repository interface id associated with the _p_servant, and a corresponding object reference is returned.
If this method was invoked in the context of executing a request on the specified _p_servant, the reference associated with the current invocation is returned.
Otherwise, a ServantNotActive exception is raised.
This method requires the presence of the RETAIN policy and either the UNIQUE_ID or IMPLICIT_ACTIVATION policies if invoked outside the context of a method dispatched by the POA. If this method is not invoked in the context of executing a request on the specified _p_servant and one of these policies is not present, then a WrongPolicy exception is raised.
The Servant for which a reference is to be returned.
void set_servant(PortableServer::Servant _p_servant);
This method sets the default Servant associated with the POA. The specified Servant will be used for all requests for which no servant is found in the Active Object Map.
This method requires that the USE_DEFAULT_SERVANT policy be present with the POA; otherwise, a WrongPolicy exception is raised.
The Servant to be used as the default associated with the POA.
void set_servant_manager
(PortableServer::ServantManager_ptr _imagr);
This method sets the default ServantManager associated with the POA. This method may only be invoked after a POA has been created. Attempting to set the ServantManager after one has already been set raises a BAD_INV_ORDER exception.
This method requires that the USE_SERVANT_MANAGER policy be present with the POA; otherwise, a WrongPolicy exception is raised.
The ServantManager to be used as the default used with the POA.
PortableServer::AdapterActivator_ptr the_activator();
This method returns the AdapterActivator associated with the POA. When a POA is created, it does not have an AdapterActivator (i.e., the attribute is null). It is system dependent whether a root POA has an activator and the application can assign one as it wishes.
void the_activator(PortableServer::AdapterActivator_ptr _val);
This method sets the AdapterActivator object associated with the POA to the one specified.
The ActivatorAdapter to be associated with the POA.
char* the_name();
This method returns the read-only attribute which identifies the POA relative to its parent. This parent is assigned at POA creation. The name of the root POA is system dependent and should not be relied upon by the application.
PortableServer::POA_ptr the_parent();
This method returns a pointer to the POA's parent POA. The parent of the root POA is null.
Portableserver::POAManager_ptr the_POAManager();
This method returns the read-only attribute which is a pointer to the POAManager associated with the POA.
PortableServer::POAManager
Each POA has an associated POA manager which in turn may be associated with one or more POA objects. A POA manager encapsulates the processing state of the POAs with which it is associated.
There are four possible states which a POA manager can be in:
A POA manager is created in the holding state. The figure below illustrates the states which a POA manager transitions to based on the method called.
Include file
You should include the file poa_c.hh when using this class.
PortableServer::POAManager methods
void activate();
This method changes the state of the POA manager to active, which enables the associated POAs to process requests. If invoked while the POA manager is in the inactive state, the AdapterInactive exception is raised.
void deactivate(CORBA::Boolean _etherealize_objects, CORBA::Boolean _wait_for_completion);
This method changes the state of the POA manager to inactive, which causes the associated POAs to reject requests that have not begun execution, as well as any new requests. If invoked while the POA manager is in the inactive state, the AdapterInactive exception is raised.
After the state changes, if the etherealize_objects parameter is
TRUE- the POA manager causes all associated POAs that have the RETAIN and USE_SERVANT_MANAGER policies to perform the etherealize operation on the associated servant manager for all active objects.
FALSE - the etherealize operation is not called. The purpose is to provide developers with a means to shut down POAs in a crisis (for example, unrecoverable error) situation.
If the wait_for_completion parameter is FALSE, this operation returns immediately after changing the state. If the parameter is TRUE and the current thread is not in an invocation context dispatched by some POA belonging to the same VisiBroker ORB as this POA, this operation does not return until there are no actively executing requests in any of the POAs associated with this POA manager (that is, all requests that were started prior to the state change have completed) and, in the case of a TRUE etherealize_objects parameter, all invocations of etherealize have completed for POAs having the RETAIN and USE_SERVANT_MANAGER policies. If the parameter is TRUE and the current thread is in an invocation context dispatched by some POA belonging to the same VisiBroker ORB as this POA, the BAD_INV_ORDER exception is raised and the state is not changed.
void discard_requests(CORBA::Boolean _wait_for_completion);
This method changes the state of the POA manager to discarding, which causes the associated POAs to discard incoming requests. In addition, any requests that have been queued but have not started executing are discarded. When a request is discarded, a TRANSIENT system exception is returned to the client. If invoked while the POA manager is in the inactive state, the AdapterInactive exception is raised.
If the wait_for_completion parameter is FALSE, this operation returns immediately after changing the state. If the parameter is TRUE and the current thread is not in an invocation context dispatched by some POA belonging to the same VisiBroker ORB as this POA, this operation does not return until either there are no actively executing requests in any of the POAs associated with this POA manager (that is, all requests that were started prior to the state change have completed) or the state of the POA manager is changed to a state other than discarding. If the parameter is TRUE and the current thread is in an invocation context dispatched by some POA belonging to the same VisiBroker ORB as this POA, the BAD_INV_ORDER exception is raised and the state is not changed.
void hold_requests(CORBA::Boolean _wait_for_completion);
This method changes the state of the POA manager to holding, which causes the associated POAs to queue incoming requests. Any requests that have been queued but are not executing will continue to be queued while in the holding state. If invoked while the POA manager is in the inactive state, the AdapterInactive exception is raised.
If the wait_for_completion parameter is FALSE, this operation returns immediately after changing the state. If the parameter is TRUE and the current thread is not in an invocation context dispatched by some POA belonging to the same VisiBroker ORB as this POA, this operation does not return until there are no actively executing requests in any of the POAs associated with this POA manager (that is, all requests that were started prior to the state change have completed) and, in the case of a TRUE etherealize_objects parameter, all invocations of etherealize have completed for POAs having the RETAIN and USE_SERVANT_MANAGER policies. If the parameter is TRUE and the current thread is in an invocation context dispatched by some POA belonging to the same VisiBroker ORB as this POA the BAD_INV_ORDER exception is raised and the state is not changed.
Principal
Deprecated feature
typedef OctetSequence Principal
This feature is deprecated as of VisiBroker 4.0. It is provided for backward compatibility support only. For more information, see "Using the BOA with VisiBroker" in the VisiBroker for C++ Developer's Guide. For support of the current CORBA specification support, Micro Focus recommends using POAs. See "Using POAs" in the VisiBroker for C++ Developer's Guide.
The Principal is used to represent the client application on whose behalf a request is being made. An object implementation can accept or reject a bind request, based on the contents of the client's Principal.
Include file
You should include the file corba.h when using this typedef.
Principal methods
The BOA class provides the get_principal method, which returns a pointer to the Principal associated with an object. The Object class also provides methods for getting and setting the Principal.
PortableServer::RefCountServantBase
class RefCountServantBase : public ServantBase
This class can be used as a standard servant reference counting mix-in class, rather than the PortableServer::ServantBase class which is to be used with inheritance class. (Also see “PortableServer::ServantBase” on page 43.)
Include file
You should include the file poa_c.hh when using this class.
PortableServer::RefCountServantBase methods
void _add_ref();
This method increments the reference count by one. You can use this method from the base class to provide true reference counting.
void _remove_ref();
This method decrements the reference count by one. You can override this method from the base class to provide true reference counting.
PortableServer::ServantActivator
class PortableServer::ServantActivator : public
PortableServer::ServantManager
If the POA has the RETAIN policy present, then it uses servant managers that are PortableServer::ServantActivator objects.
Include file
You should include the file poa_c.hh when using this class.
PortableServer::ServantActivator methods
void etherealize(PortableServer::ObjectId& oid,
PortableServer::POA_ptr adapter,
PortableServer::Servant serv,
CORBA::Boolean cleanup_in_progress,
CORBA::Boolean remaining_activations);
This method is called by the specified adapter whenever a servant for an object (the specified oid) is deactivated, assuming that the RETAIN and USE_SERVANT_MANAGER policies are present.
If set to TRUE, the reason for the invocation of the method is either that the deactivate or destroy method was called with the etherealize_objects parameter set to TRUE; otherwise, the method was called for other reasons.
If the specified serv is associated with other objects in the specified adapter it is set to TRUE; otherwise it is FALSE.
PortableServer::Servant incarnate(const PortableServer::ObjectId& oid, PortableServer::POA_ptr adapter);
This method is called by the POA whenever the POA receives a request for an inactive object (the specified oid) assuming that the RETAIN and USE_SERVANT_MANAGER policies are present.
The user supplies a servant manager implementation which is responsible for locating and creating an appropriate servant that corresponds to the specified oid value. The method returns a servant, which is also entered into the Active Object map. Any further requests for the active object are passed directly to the servant associated with it without invoking the servant manager.
If this method returns a servant that is already active for a different object id and if the POA also has the UNIQUE_ID policy present, then it raises the OBJ_ADAPTER exception.
PortableServer::ServantBase
class PortableServer::ServantBase
The Portable::ServantBase class is the base class for your server application.
Include file
You should include the file poa_c.hh when using this class.
PortableServer::ServantBase methods
void _add_ref();
This method adds a reference count for this servant. It should be overridden to provide reference counting functionality for classes derived from this class as the default implementation does nothing.
PortableServer::POA_ptr _default_POA();
This method returns an Object reference to the root POA of the default VisiBroker ORB in the current process, (i.e., the same return value as an invocation of ORB::resolve_initial_references("RootPOA") on the default VisiBroker ORB. Classes derived from the PortableServer::ServantBase class may override this method to return the POA of their choice, if desired.
CORBA::InterfaceDef_ptr _get_interface();
This method returns a pointer to this object's interface definition. See “Interface repository interfaces and classes (C++)” for more information.
CORBA::Boolean _is_a(const char *rep_id);
This method returns TRUE if this servant implements the interface associated with the repository id. Otherwise, it returns FALSE.
void _remove_ref();
This method removes a reference count for this servant. It should be overridden to provide reference counting functionality for classes derived from this class as the default implementation does nothing.
PortableServer::ServantLocator
class PortableServer::ServantLocator : public
PortableServer::ServantManager
When the POA has the NON_RETAIN policy present, it uses servant managers which are PortableServer::ServantLocator objects. The servant returned by the servant manager will be used only for a single request.
Because the POA knows that the servant returned by the servant manager will be used only for a single request, it can supply extra information for the servant manager's methods and the servant manager's pair of methods may do something different than a PortableServer::ServantLocator servant manager.
Include file
You should include the file poa_c.hh when using this class.
PortableServer::ServantLocator methods
PortableServer::Servant preinvoke(const PortableServer::ObjectId& oid, PortableServer::POA_ptr adapter,const char* operation, Cookie& the_cookie);
This method is called by the POA whenever the POA receives a request for an object that is not currently active, assuming that the NON_RETAIN and USE_SERVANT_MANAGER policies are present.
The user-supplied implementation of the servant manager is responsible for locating or creating an appropriate servant that corresponds to the specified oid value if possible.
The ObjectId value that is associated with the incoming request.
void postinvoke(const PortableServer::ObjectId& oid,PortableServer::POA_ptr adapter, const char* operation, Cookie the_cookie, PortableServer::Servant the_servant)
If the POA has the NON_RETAIN and USE_SERVANT_MANAGER policies present, this method is called whenever a servant completes a request. This method is considered to be part of the request on an object, (i.e., if the method finishes normally, but postinvoke raises a system exception, then the method's normal return is overridden; and the request completes with the exception).
Destroying a servant that is known to a POA can lead to undefined results.
The ObjectId value that is associated with the incoming request.
PortableServer::ServantManager
class PortableServer::ServantManager
Servant managers are associated with Portable Object Adapters (POAs). A servant manager allows a POA to activate objects on demand when the POA receives a request targeted for an inactive object.
The PortableServer::ServantManager class has no methods; rather it is the base class for two other classes: the PortableServer::ServantActivator and the Portableserver::ServantLocator classes. For more details, see “PortableServer::ServantActivator” on page 42 and “PortableServer::ServantLocator” on page 44. The use of these two classes depends on the POA's policies: RETAIN for the PortableServer::ServantActivator and NON_RETAIN for the Portableserver::ServantLocator.
Include file
You should include the file poa_c.hh when using this class.
SystemException
class CORBA::SystemException : public CORBA::Exception
The SystemException class is used to report standard system errors encountered by the VisiBroker ORB or by the object implementation. This class is derived from the Exception class, described in “Exception” on page 17, which provides methods for printing the name and details of the exception to an output stream.
SystemException objects include a completion status which indicates if the operation that caused the exception was completed. SystemException objects also have a minor code that can be set and retrieved.
Include file
The corba.h file should be included when you use this class.
SystemException methods
CORBA::SystemException(CORBA::ULong minor = 0, CORBA::CompletionStatus status = CORBA::COMPLETED_NO);
This method creates a SystemException object with the specified properties.
The completion status, one of CORBA::COMPLETED_YES, CORBA::COMPLETED_NO, or CORBA::COMPLETED_MAYBE.
CORBA::CompletionStatus completed() const;
This method returns TRUE if this object's completion status is set to COMPLETED_YES.
void completed(CORBA::CompletionStatus status);
This method sets the completion status for this object.
The completion status, one of COMPLETED_YES, COMPLETED_NO, or COMPLETED_MAYBE.
CORBA::ULong minor() const;
This method returns this object's minor code.
void minor(CORBA::ULong val);
This method sets the minor code for this object.
static CORBA::SystemException *_downcast
(CORBA::Exception *exc);
This method attempts to downcast the specified Exception pointer to a SystemException pointer. If the supplied pointer points to a SystemException object or an object derived from SystemException, a pointer to the object is returned. If the supplied pointer does not point to a SystemException object, a NULL pointer is returned.
Note
The reference count for the Exception object is not incremented by this method.
UserException
class CORBA::UserException : public CORBA::Exception
The UserException base class is used to derive the user exceptions that your object implementations may want to raise. This class is derived from the Exception class, described in “Exception”, which provides methods for printing the name and details of the exception to an output stream.
UserException objects include a completion status which indicates if the operation that caused the exception was completed. UserException objects also have a minor code that can be set and retrieved.
Include file
The corba.h file should be included when you use this class.
UserException methods
This method creates a UserException object with the specified properties.
The completion status, one of CORBA::COMPLETED_YES, CORBA::COMPLETED_NO, or CORBA::COMPLETED_MAYBE.
UserException derived classes
class AdapterAlreadyExists : public CORBA::UserException
class AdapterInactive : public CORBA::UserException
class AdapterNonExistent : public CORBA::UserException
class InvalidPolicy : public CORBA::UserException
class NoServant : public CORBA::UserException
class ObjectAlreadyActive : public CORBA::UserException
class ObjectNotActive : public CORBA::UserException
class ServantAlreadyActive : public CORBA::UserException
class ServantNotActive : public CORBA::UserException
class WrongAdapter : public CORBA::UserException
class WrongPolicy : public CORBA::UserException
class ManagerAlreadyExists : public CORBA::UserException