3 //=============================================================================
7 * @author Jaiganesh Balasubramanian <jai@doc.ece.uci.edu>
8 * @author Ossama Othman <ossama@uci.edu>
10 //=============================================================================
13 #include "orbsvcs/FT_NamingManagerC.h"
14 #include "orbsvcs/PortableGroupC.h"
15 #include "tao/PortableServer/PortableServer.h"
16 #include "ace/Get_Opt.h"
17 #include "orbsvcs/Naming/Naming_Client.h"
19 // Forward Declaration of the kind of servant we would like to handle
26 * @brief Encapsulate the test in class.
28 * TODO: Fix description
29 * This is a class used to retrieve the NamingManager reference and
30 * create the Object Group. Servants add themselves to the object
31 * group and the object group reference is published to the clients.
32 * Clients then invoke the "servant operations" on the NamingManager
33 * itself. At this point the Load Balancing cycle starts.
39 LB_server (int argc
, ACE_TCHAR
**argv
);
41 /// destroys NamingManager, ORB and POA.
45 int start_orb_and_poa ();
47 /// Get the NamingManager Interface.
48 int init (int argc
, ACE_TCHAR
**argv
);
50 /// Create the Object Group using the Load Manager Reference.
51 /// Returns 0 on successful creation. Returns 1 if object
52 /// group already exists. Returns -1 if object group cannot
53 /// be created for some reason.
54 int create_object_group (const char *group_name
);
56 /// register the servants with the object group.
57 int register_servant (Basic
*servant
, const char *loc
);
59 /// remove a servant from the object group.
60 int remove_servant (const char *loc
);
62 /// obtain the name service facade
63 TAO_Naming_Client
& name_svc ();
65 /// for servants to register to the initialised ORB.
66 CORBA::ORB_ptr
orb ();
68 /// for servants to get the reference for object_group.
69 CORBA::Object_ptr
object_group ();
71 /// for servants to get the reference for object_group.
72 FT_Naming::NamingManager_ptr
naming_manager ();
75 int parse_args (int, ACE_TCHAR
**);
79 FT_Naming::NamingManager_var naming_manager_
;
82 CORBA::Object_var object_group_
;
84 /// factory id for the object group.
85 PortableGroup::GenericFactory::FactoryCreationId_var fcid_
;
87 /// Used to force the creation of the object group only once.
88 static int called_once_
;
90 /// write the IOR to a file so that it can be read later.
91 int write_ior_to_file (const ACE_TCHAR
*filename
,
97 PortableServer::POA_var root_poa_
;
98 const ACE_TCHAR
*ior_output_file_
;
99 TAO_Naming_Client name_svc_
;