This section describes the interfaces you can use to locate object instances on a network of Smart Agents. For more information on the Location Service, see “Using the Location Service” in the VisiBroker for C++ Developer's Guide.class Agent : public CORBA::ObjectYou should include the locate_c.hh file when you use this class.ObjLocation::HostnameSeq_ptr all_agent_locations();
ObjLocation::ObjSeqSeq all_available();
ObjLocation::DescSeqSeq_ptr all_available_descs();
Any of the FailReason values, other than NO_SUCH_TRIGGER, may be presented. For more information on the Fail class, see “Fail”.
Any of the FailReason values, other than NO_SUCH_TRIGGER, may be presented. For more information on the Fail class, see “Fail”.Returns a sequence of object references for objects with the specified repository_id and instance_name.
Any of the FailReason values, other than NO_SUCH_TRIGGER, may be presented. For more information on the Fail class, see “Fail”.Returns a sequence of description information for all object instances with the specified repository_id and instance_name.
Any of the FailReason values, other than NO_SUCH_TRIGGER, may be presented. For more information on the Fail class, see “Fail”.
Registers the trigger handler hdlr for object instances that match the description information specified in desc.A TriggerHandler is invoked every time an object that satisfies the trigger's description becomes available. If you are only interested in learning when the first instance of the object becomes available, you should use the unreg_trigger method to remove the trigger after the first notification is received.
The object instance description information, which can contain combinations of the following information: repository ID, instance name, hostname. You can provide more or less information to narrow or widen the object instances to be monitored.
Any of the FailReason values, other than NO_SUCH_TRIGGER, may be presented. For more information on the Fail class, see “Fail”.Unregisters the trigger handler hdlr for object instances that match the description information specified in desc.
CORBA::Boolean willRefreshOADs();Returns TRUE if the set of Object Activation Daemon is updated each time a method offered by this class is invoked, otherwise returns FALSE. If the cache is not refreshed on each invocation, the following conditions may occur:
• All objects are still reported, but their descriptor's activable flag may be incorrect.
If TRUE, the OAD set will be refreshed whenever a method offered by this class is invoked.struct DescThis structure contains information you use to describe the characteristics of an object. You pass this structure as an argument to several of the Location Service methods described in the chapter. The Desc structure, or a sequence of them, is returned by some of the Location Service methods.module ObjLocation {
struct Desc {
Object ref;
IIOP::ProfileBody iiop_locator;
string repository_id;
string instance_name;
boolean activable;
string agent_hostname;
};
. . .
};Object refIIOP::ProfileBody iiop_locatorCORBA::String_var repository_idCORBA::String_var instance_nameCORBA::Boolean activableSet to TRUE to indicate that this object is registered with the Object Activation Daemon. It is set to FALSE to indicate that the object was started manually and is registered with the osagent.CORBA::String_var agent_hostnameclass Fail : public CORBA::UserExceptionThis exception class may be thrown by the Agent class to indicate various errors. The data member FailReason is used to indicate the nature of the failure.FailReason reasonstruct TriggerDescThis structure contains information you use to describe the characteristics of one or more objects for which you wish to register a TriggerHandler, described in “TriggerHandler” on page 279.The host_name and instance_name members may be set to NULL to monitor the widest possible set of objects. The more information specified, the smaller the set of objects is.ORBA::String_var repository_idThe repository identifiers of the objects to be monitored by the TriggerHandler. May be set to NULL to include all possible repository identifiers.CORBA::String_var instance_nameThe instance name of the object to be monitored by the TriggerHandler. May be set to NULL to include all possible instance names.CORBA::String_var host_name;The host name where the object or objects monitored by the TriggerHandler are located. May be set to NULL to include all hosts in the network.You use this base class to derive your own callback object to be invoked every time an object becomes available or unavailable. You specify the criteria for the object or objects in which you are interested. You register your TriggerHandler object using the Agent::reg_trigger method, described in “TriggerHandler” on page 279.You should include the locate_c.hh file when you use this class.This method is invoked by the Location Service when an object instance matching the criteria specified in desc becomes accessible.
This method is invoked by the Location Service when an object instance matching the criteria specified in desc is no longer accessible.
A sequence of Desc structures. Each class represents a particular sequence of <type>. The Location Service returns lists of information to your client application in the form of sequences which are mapped to one of these classes.The code sample below shows the correct way to index a HostnameSeq returned from the Agent::all_agent_locations method.You must use a CORBA::ULong type for the index. Using an int type may lead to unpredictable results.
CORBA::ULong length() const;
A sequence of DescSeq objects. A sequence of ObjSeq objects.Each class represents a particular sequence of <type>Seq. Some Location Service methods return lists of information to your client application in the form of sequences of sequences which are mapped to one of these classes.Returns a reference to the element in the sequence identified by index. The reference is to a one dimensional sequence, described in “<type>Seq”You must use a CORBA::ULong type for the index. Using an int type may lead to unpredictable results.
CORBA::ULong length() const;