29 #include <Ice/CommunicatorF.h>
30 #include <Ice/Current.h>
31 #include <Ice/Identity.h>
32 #include <Ice/ObjectAdapterF.h>
33 #include <Ice/ObjectF.h>
34 #include <Ice/Proxy.h>
35 #include <Ice/ProxyF.h>
36 #include <IceGrid/Admin.h>
37 #include <IceGrid/IceGrid.h>
38 #include <IceGrid/Admin.h>
39 #include <IceGrid/Registry.h>
40 #include <IceUtil/Handle.h>
41 #include <IceUtil/Time.h>
42 #include <IceUtil/Timer.h>
89 virtual public IceUtil::TimerTask,
90 virtual public IceGrid::NodeObserver,
91 virtual public Logging
106 ~IceGridAdmin()
override;
113 IceGrid::AdminSessionPrx adminSession();
120 IceGrid::AdminPrx getAdmin();
127 void addApplication(
const std::string& xmlPath);
141 void setObjectObserver(IceGrid::ObjectObserverPrx objObserverPrx);
146 void removeObservers();
161 Ice::ObjectPrx registerObjectWithNewAdapter(
163 const std::string& objectName,
178 template <
class ObjectType>
179 IceGrid::ObjectInfoSeq getRegisteredObjects(std::string regExp =
"*")
181 IceGrid::AdminPrx admin = getAdmin();
182 IceGrid::ObjectInfoSeq objects = admin->getAllObjectInfos(regExp);
183 IceGrid::ObjectInfoSeq::iterator iter = objects.begin();
184 IceGrid::ObjectInfoSeq result;
186 while (iter != objects.end())
188 Ice::ObjectPrx current = iter->proxy;
195 object = ObjectType::checkedCast(current->ice_timeout(60));
203 result.push_back(*iter);
219 template <
class ObjectType>
220 std::vector<std::string> getRegisteredObjectNames(std::string regExp =
"*")
222 IceGrid::ObjectInfoSeq objects = getRegisteredObjects<ObjectType>(regExp);
224 IceGrid::ObjectInfoSeq::iterator iter = objects.begin();
225 std::vector<std::string> result;
227 while (iter != objects.end())
229 result.push_back(iter->proxy->ice_getIdentity().name);
239 void cleanUpDeadObjects();
244 void nodeInit(
const IceGrid::NodeDynamicInfoSeq& nodes,
const Ice::Current&
c = Ice::emptyCurrent)
override;
245 void nodeUp(
const IceGrid::NodeDynamicInfo& node,
const Ice::Current&
c = Ice::emptyCurrent)
override;
246 void nodeDown(
const std::string& name,
const Ice::Current&
c = Ice::emptyCurrent)
override;
247 void updateServer(
const std::string& node, IceGrid::ServerDynamicInfo updatedInfo,
const Ice::Current&
c = Ice::emptyCurrent);
248 void updateAdapter(
const std::string& node, IceGrid::AdapterDynamicInfo updatedInfo,
const Ice::Current&
c = Ice::emptyCurrent);
249 void updateServer(const ::std::string& node, const ::IceGrid::ServerDynamicInfo& updatedInfo, const ::Ice::Current&
c = Ice::emptyCurrent)
override;
250 void updateAdapter(const ::std::string& node, const ::IceGrid::AdapterDynamicInfo& updatedInfo, const ::Ice::Current&
c = Ice::emptyCurrent)
override;
266 ComponentState getComponentState(std::string
id);
273 void runTimerTask()
override;
275 void printServerInfo(
const IceGrid::ServerDynamicInfo& updatedInfo);
276 void reportRemoteComponentStateChange(
const IceGrid::ServerDynamicInfo& updatedInfo);
278 void notifyComponentChanged(ComponentState state, std::string
id);
283 IceGrid::AdminSessionPrx adminSessionProxy;
286 IceGrid::NodeObserverPrx iceGridAdminProxy;
287 IceGrid::ObjectObserverPrx objObserverPrx;
289 std::map<std::string, std::vector< std::shared_ptr<Component> > > stateChangeNotifications;
290 std::map<std::string, ComponentState> remoteComponentsState;
297 std::mutex mutexComponentStateUpdate;