Renamed m_*Endpoint to m_Endpoint.

This commit is contained in:
Gunnar Beutner 2012-07-02 11:07:54 +02:00
parent 9b1de189be
commit 5649f3efb2
10 changed files with 53 additions and 53 deletions

View File

@ -28,13 +28,13 @@ string CheckerComponent::GetName(void) const
void CheckerComponent::Start(void) void CheckerComponent::Start(void)
{ {
m_CheckerEndpoint = boost::make_shared<VirtualEndpoint>(); m_Endpoint = boost::make_shared<VirtualEndpoint>();
m_CheckerEndpoint->RegisterTopicHandler("checker::AssignService", m_Endpoint->RegisterTopicHandler("checker::AssignService",
boost::bind(&CheckerComponent::AssignServiceRequestHandler, this, _2, _3)); boost::bind(&CheckerComponent::AssignServiceRequestHandler, this, _2, _3));
m_CheckerEndpoint->RegisterTopicHandler("checker::ClearServices", m_Endpoint->RegisterTopicHandler("checker::ClearServices",
boost::bind(&CheckerComponent::ClearServicesRequestHandler, this, _2, _3)); boost::bind(&CheckerComponent::ClearServicesRequestHandler, this, _2, _3));
m_CheckerEndpoint->RegisterPublication("checker::CheckResult"); m_Endpoint->RegisterPublication("checker::CheckResult");
EndpointManager::GetInstance()->RegisterEndpoint(m_CheckerEndpoint); EndpointManager::GetInstance()->RegisterEndpoint(m_Endpoint);
m_CheckTimer = boost::make_shared<Timer>(); m_CheckTimer = boost::make_shared<Timer>();
m_CheckTimer->SetInterval(5); m_CheckTimer->SetInterval(5);
@ -54,7 +54,7 @@ void CheckerComponent::Stop(void)
EndpointManager::Ptr mgr = EndpointManager::GetInstance(); EndpointManager::Ptr mgr = EndpointManager::GetInstance();
if (mgr) if (mgr)
mgr->UnregisterEndpoint(m_CheckerEndpoint); mgr->UnregisterEndpoint(m_Endpoint);
} }
void CheckerComponent::CheckTimerHandler(void) void CheckerComponent::CheckTimerHandler(void)
@ -155,7 +155,7 @@ void CheckerComponent::ResultTimerHandler(void)
rm.SetParams(params); rm.SetParams(params);
EndpointManager::GetInstance()->SendMulticastMessage(m_CheckerEndpoint, rm); EndpointManager::GetInstance()->SendMulticastMessage(m_Endpoint, rm);
} }
if (min_latency > 5) { if (min_latency > 5) {
@ -200,7 +200,7 @@ void CheckerComponent::AssignServiceRequestHandler(const Endpoint::Ptr& sender,
MessagePart result; MessagePart result;
rm.SetResult(result); rm.SetResult(result);
EndpointManager::GetInstance()->SendUnicastMessage(m_CheckerEndpoint, sender, rm); EndpointManager::GetInstance()->SendUnicastMessage(m_Endpoint, sender, rm);
} }
} }

View File

@ -48,7 +48,7 @@ public:
virtual void Stop(void); virtual void Stop(void);
private: private:
VirtualEndpoint::Ptr m_CheckerEndpoint; VirtualEndpoint::Ptr m_Endpoint;
ServiceQueue m_Services; ServiceQueue m_Services;
set<ConfigObject::Ptr> m_PendingServices; set<ConfigObject::Ptr> m_PendingServices;

View File

@ -30,30 +30,30 @@ void ConfigRpcComponent::Start(void)
{ {
EndpointManager::Ptr endpointManager = EndpointManager::GetInstance(); EndpointManager::Ptr endpointManager = EndpointManager::GetInstance();
m_ConfigRpcEndpoint = boost::make_shared<VirtualEndpoint>(); m_Endpoint = boost::make_shared<VirtualEndpoint>();
long configSource; long configSource;
if (GetConfig()->GetProperty("configSource", &configSource) && configSource != 0) { if (GetConfig()->GetProperty("configSource", &configSource) && configSource != 0) {
m_ConfigRpcEndpoint->RegisterTopicHandler("config::FetchObjects", m_Endpoint->RegisterTopicHandler("config::FetchObjects",
boost::bind(&ConfigRpcComponent::FetchObjectsHandler, this, _2)); boost::bind(&ConfigRpcComponent::FetchObjectsHandler, this, _2));
ConfigObject::GetAllObjects()->OnObjectAdded.connect(boost::bind(&ConfigRpcComponent::LocalObjectCommittedHandler, this, _2)); ConfigObject::GetAllObjects()->OnObjectAdded.connect(boost::bind(&ConfigRpcComponent::LocalObjectCommittedHandler, this, _2));
ConfigObject::GetAllObjects()->OnObjectCommitted.connect(boost::bind(&ConfigRpcComponent::LocalObjectCommittedHandler, this, _2)); ConfigObject::GetAllObjects()->OnObjectCommitted.connect(boost::bind(&ConfigRpcComponent::LocalObjectCommittedHandler, this, _2));
ConfigObject::GetAllObjects()->OnObjectRemoved.connect(boost::bind(&ConfigRpcComponent::LocalObjectRemovedHandler, this, _2)); ConfigObject::GetAllObjects()->OnObjectRemoved.connect(boost::bind(&ConfigRpcComponent::LocalObjectRemovedHandler, this, _2));
m_ConfigRpcEndpoint->RegisterPublication("config::ObjectCommitted"); m_Endpoint->RegisterPublication("config::ObjectCommitted");
m_ConfigRpcEndpoint->RegisterPublication("config::ObjectRemoved"); m_Endpoint->RegisterPublication("config::ObjectRemoved");
} }
endpointManager->OnNewEndpoint.connect(boost::bind(&ConfigRpcComponent::NewEndpointHandler, this, _2)); endpointManager->OnNewEndpoint.connect(boost::bind(&ConfigRpcComponent::NewEndpointHandler, this, _2));
m_ConfigRpcEndpoint->RegisterPublication("config::FetchObjects"); m_Endpoint->RegisterPublication("config::FetchObjects");
m_ConfigRpcEndpoint->RegisterTopicHandler("config::ObjectCommitted", m_Endpoint->RegisterTopicHandler("config::ObjectCommitted",
boost::bind(&ConfigRpcComponent::RemoteObjectCommittedHandler, this, _3)); boost::bind(&ConfigRpcComponent::RemoteObjectCommittedHandler, this, _3));
m_ConfigRpcEndpoint->RegisterTopicHandler("config::ObjectRemoved", m_Endpoint->RegisterTopicHandler("config::ObjectRemoved",
boost::bind(&ConfigRpcComponent::RemoteObjectRemovedHandler, this, _3)); boost::bind(&ConfigRpcComponent::RemoteObjectRemovedHandler, this, _3));
endpointManager->RegisterEndpoint(m_ConfigRpcEndpoint); endpointManager->RegisterEndpoint(m_Endpoint);
} }
void ConfigRpcComponent::Stop(void) void ConfigRpcComponent::Stop(void)
@ -61,7 +61,7 @@ void ConfigRpcComponent::Stop(void)
EndpointManager::Ptr mgr = EndpointManager::GetInstance(); EndpointManager::Ptr mgr = EndpointManager::GetInstance();
if (mgr) if (mgr)
mgr->UnregisterEndpoint(m_ConfigRpcEndpoint); mgr->UnregisterEndpoint(m_Endpoint);
} }
void ConfigRpcComponent::NewEndpointHandler(const Endpoint::Ptr& endpoint) void ConfigRpcComponent::NewEndpointHandler(const Endpoint::Ptr& endpoint)
@ -78,7 +78,7 @@ void ConfigRpcComponent::SessionEstablishedHandler(const Endpoint::Ptr& endpoint
RequestMessage request; RequestMessage request;
request.SetMethod("config::FetchObjects"); request.SetMethod("config::FetchObjects");
EndpointManager::GetInstance()->SendUnicastMessage(m_ConfigRpcEndpoint, endpoint, request); EndpointManager::GetInstance()->SendUnicastMessage(m_Endpoint, endpoint, request);
} }
RequestMessage ConfigRpcComponent::MakeObjectMessage(const ConfigObject::Ptr& object, string method, bool includeProperties) RequestMessage ConfigRpcComponent::MakeObjectMessage(const ConfigObject::Ptr& object, string method, bool includeProperties)
@ -115,7 +115,7 @@ void ConfigRpcComponent::FetchObjectsHandler(const Endpoint::Ptr& sender)
RequestMessage request = MakeObjectMessage(object, "config::ObjectCommitted", true); RequestMessage request = MakeObjectMessage(object, "config::ObjectCommitted", true);
EndpointManager::GetInstance()->SendUnicastMessage(m_ConfigRpcEndpoint, sender, request); EndpointManager::GetInstance()->SendUnicastMessage(m_Endpoint, sender, request);
} }
} }
@ -124,7 +124,7 @@ void ConfigRpcComponent::LocalObjectCommittedHandler(const ConfigObject::Ptr& ob
if (!ShouldReplicateObject(object)) if (!ShouldReplicateObject(object))
return; return;
EndpointManager::GetInstance()->SendMulticastMessage(m_ConfigRpcEndpoint, EndpointManager::GetInstance()->SendMulticastMessage(m_Endpoint,
MakeObjectMessage(object, "config::ObjectCommitted", true)); MakeObjectMessage(object, "config::ObjectCommitted", true));
} }
@ -133,7 +133,7 @@ void ConfigRpcComponent::LocalObjectRemovedHandler(const ConfigObject::Ptr& obje
if (!ShouldReplicateObject(object)) if (!ShouldReplicateObject(object))
return; return;
EndpointManager::GetInstance()->SendMulticastMessage(m_ConfigRpcEndpoint, EndpointManager::GetInstance()->SendMulticastMessage(m_Endpoint,
MakeObjectMessage(object, "config::ObjectRemoved", false)); MakeObjectMessage(object, "config::ObjectRemoved", false));
} }

View File

@ -34,7 +34,7 @@ public:
virtual void Stop(void); virtual void Stop(void);
private: private:
VirtualEndpoint::Ptr m_ConfigRpcEndpoint; VirtualEndpoint::Ptr m_Endpoint;
void NewEndpointHandler(const Endpoint::Ptr& endpoint); void NewEndpointHandler(const Endpoint::Ptr& endpoint);
void SessionEstablishedHandler(const Endpoint::Ptr& endpoint); void SessionEstablishedHandler(const Endpoint::Ptr& endpoint);

View File

@ -39,13 +39,13 @@ void DelegationComponent::Start(void)
m_DelegationTimer->Start(); m_DelegationTimer->Start();
m_DelegationTimer->Reschedule(0); m_DelegationTimer->Reschedule(0);
m_DelegationEndpoint = boost::make_shared<VirtualEndpoint>(); m_Endpoint = boost::make_shared<VirtualEndpoint>();
m_DelegationEndpoint->RegisterPublication("checker::AssignService"); m_Endpoint->RegisterPublication("checker::AssignService");
m_DelegationEndpoint->RegisterPublication("checker::ClearServices"); m_Endpoint->RegisterPublication("checker::ClearServices");
m_DelegationEndpoint->RegisterTopicHandler("checker::CheckResult", m_Endpoint->RegisterTopicHandler("checker::CheckResult",
boost::bind(&DelegationComponent::CheckResultRequestHandler, this, _2, _3)); boost::bind(&DelegationComponent::CheckResultRequestHandler, this, _2, _3));
m_DelegationEndpoint->RegisterPublication("delegation::ServiceStatus"); m_Endpoint->RegisterPublication("delegation::ServiceStatus");
EndpointManager::GetInstance()->RegisterEndpoint(m_DelegationEndpoint); EndpointManager::GetInstance()->RegisterEndpoint(m_Endpoint);
EndpointManager::GetInstance()->OnNewEndpoint.connect(bind(&DelegationComponent::NewEndpointHandler, this, _2)); EndpointManager::GetInstance()->OnNewEndpoint.connect(bind(&DelegationComponent::NewEndpointHandler, this, _2));
} }
@ -55,7 +55,7 @@ void DelegationComponent::Stop(void)
EndpointManager::Ptr mgr = EndpointManager::GetInstance(); EndpointManager::Ptr mgr = EndpointManager::GetInstance();
if (mgr) if (mgr)
mgr->UnregisterEndpoint(m_DelegationEndpoint); mgr->UnregisterEndpoint(m_Endpoint);
} }
void DelegationComponent::ObjectCommittedHandler(const ConfigObject::Ptr& object) void DelegationComponent::ObjectCommittedHandler(const ConfigObject::Ptr& object)
@ -77,7 +77,7 @@ void DelegationComponent::AssignService(const Endpoint::Ptr& checker, const Serv
Application::Log(LogDebug, "delegation", "Trying to delegate service '" + service.GetName() + "'"); Application::Log(LogDebug, "delegation", "Trying to delegate service '" + service.GetName() + "'");
EndpointManager::GetInstance()->SendUnicastMessage(m_DelegationEndpoint, checker, request); EndpointManager::GetInstance()->SendUnicastMessage(m_Endpoint, checker, request);
} }
void DelegationComponent::ClearServices(const Endpoint::Ptr& checker) void DelegationComponent::ClearServices(const Endpoint::Ptr& checker)
@ -88,7 +88,7 @@ void DelegationComponent::ClearServices(const Endpoint::Ptr& checker)
MessagePart params; MessagePart params;
request.SetParams(params); request.SetParams(params);
EndpointManager::GetInstance()->SendUnicastMessage(m_DelegationEndpoint, checker, request); EndpointManager::GetInstance()->SendUnicastMessage(m_Endpoint, checker, request);
} }
bool DelegationComponent::IsEndpointChecker(const Endpoint::Ptr& endpoint) bool DelegationComponent::IsEndpointChecker(const Endpoint::Ptr& endpoint)
@ -300,7 +300,7 @@ void DelegationComponent::CheckResultRequestHandler(const Endpoint::Ptr& sender,
RequestMessage rm; RequestMessage rm;
rm.SetMethod("delegation::ServiceStatus"); rm.SetMethod("delegation::ServiceStatus");
rm.SetParams(params); rm.SetParams(params);
EndpointManager::GetInstance()->SendMulticastMessage(m_DelegationEndpoint, rm); EndpointManager::GetInstance()->SendMulticastMessage(m_Endpoint, rm);
} }
EXPORT_COMPONENT(delegation, DelegationComponent); EXPORT_COMPONENT(delegation, DelegationComponent);

View File

@ -34,7 +34,7 @@ public:
virtual void Stop(void); virtual void Stop(void);
private: private:
VirtualEndpoint::Ptr m_DelegationEndpoint; VirtualEndpoint::Ptr m_Endpoint;
ConfigObject::Set::Ptr m_AllServices; ConfigObject::Set::Ptr m_AllServices;
Timer::Ptr m_DelegationTimer; Timer::Ptr m_DelegationTimer;

View File

@ -36,11 +36,11 @@ string DemoComponent::GetName(void) const
*/ */
void DemoComponent::Start(void) void DemoComponent::Start(void)
{ {
m_DemoEndpoint = boost::make_shared<VirtualEndpoint>(); m_Endpoint = boost::make_shared<VirtualEndpoint>();
m_DemoEndpoint->RegisterTopicHandler("demo::HelloWorld", m_Endpoint->RegisterTopicHandler("demo::HelloWorld",
boost::bind(&DemoComponent::HelloWorldRequestHandler, this, _2, _3)); boost::bind(&DemoComponent::HelloWorldRequestHandler, this, _2, _3));
m_DemoEndpoint->RegisterPublication("demo::HelloWorld"); m_Endpoint->RegisterPublication("demo::HelloWorld");
EndpointManager::GetInstance()->RegisterEndpoint(m_DemoEndpoint); EndpointManager::GetInstance()->RegisterEndpoint(m_Endpoint);
m_DemoTimer = boost::make_shared<Timer>(); m_DemoTimer = boost::make_shared<Timer>();
m_DemoTimer->SetInterval(5); m_DemoTimer->SetInterval(5);
@ -56,7 +56,7 @@ void DemoComponent::Stop(void)
EndpointManager::Ptr endpointManager = EndpointManager::GetInstance(); EndpointManager::Ptr endpointManager = EndpointManager::GetInstance();
if (endpointManager) if (endpointManager)
endpointManager->UnregisterEndpoint(m_DemoEndpoint); endpointManager->UnregisterEndpoint(m_Endpoint);
} }
/** /**
@ -71,7 +71,7 @@ void DemoComponent::DemoTimerHandler(void)
RequestMessage request; RequestMessage request;
request.SetMethod("demo::HelloWorld"); request.SetMethod("demo::HelloWorld");
EndpointManager::GetInstance()->SendMulticastMessage(m_DemoEndpoint, request); EndpointManager::GetInstance()->SendMulticastMessage(m_Endpoint, request);
} }
/** /**

View File

@ -35,7 +35,7 @@ public:
private: private:
Timer::Ptr m_DemoTimer; Timer::Ptr m_DemoTimer;
VirtualEndpoint::Ptr m_DemoEndpoint; VirtualEndpoint::Ptr m_Endpoint;
void DemoTimerHandler(void); void DemoTimerHandler(void);
void HelloWorldRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request); void HelloWorldRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request);

View File

@ -36,23 +36,23 @@ string DiscoveryComponent::GetName(void) const
*/ */
void DiscoveryComponent::Start(void) void DiscoveryComponent::Start(void)
{ {
m_DiscoveryEndpoint = boost::make_shared<VirtualEndpoint>(); m_Endpoint = boost::make_shared<VirtualEndpoint>();
m_DiscoveryEndpoint->RegisterPublication("discovery::RegisterComponent"); m_Endpoint->RegisterPublication("discovery::RegisterComponent");
m_DiscoveryEndpoint->RegisterTopicHandler("discovery::RegisterComponent", m_Endpoint->RegisterTopicHandler("discovery::RegisterComponent",
boost::bind(&DiscoveryComponent::RegisterComponentMessageHandler, this, _2, _3)); boost::bind(&DiscoveryComponent::RegisterComponentMessageHandler, this, _2, _3));
m_DiscoveryEndpoint->RegisterPublication("discovery::NewComponent"); m_Endpoint->RegisterPublication("discovery::NewComponent");
m_DiscoveryEndpoint->RegisterTopicHandler("discovery::NewComponent", m_Endpoint->RegisterTopicHandler("discovery::NewComponent",
boost::bind(&DiscoveryComponent::NewComponentMessageHandler, this, _3)); boost::bind(&DiscoveryComponent::NewComponentMessageHandler, this, _3));
m_DiscoveryEndpoint->RegisterTopicHandler("discovery::Welcome", m_Endpoint->RegisterTopicHandler("discovery::Welcome",
boost::bind(&DiscoveryComponent::WelcomeMessageHandler, this, _2, _3)); boost::bind(&DiscoveryComponent::WelcomeMessageHandler, this, _2, _3));
EndpointManager::GetInstance()->ForEachEndpoint(boost::bind(&DiscoveryComponent::NewEndpointHandler, this, _2)); EndpointManager::GetInstance()->ForEachEndpoint(boost::bind(&DiscoveryComponent::NewEndpointHandler, this, _2));
EndpointManager::GetInstance()->OnNewEndpoint.connect(boost::bind(&DiscoveryComponent::NewEndpointHandler, this, _2)); EndpointManager::GetInstance()->OnNewEndpoint.connect(boost::bind(&DiscoveryComponent::NewEndpointHandler, this, _2));
EndpointManager::GetInstance()->RegisterEndpoint(m_DiscoveryEndpoint); EndpointManager::GetInstance()->RegisterEndpoint(m_Endpoint);
/* create the reconnect timer */ /* create the reconnect timer */
m_DiscoveryTimer = boost::make_shared<Timer>(); m_DiscoveryTimer = boost::make_shared<Timer>();
@ -72,7 +72,7 @@ void DiscoveryComponent::Stop(void)
EndpointManager::Ptr mgr = EndpointManager::GetInstance(); EndpointManager::Ptr mgr = EndpointManager::GetInstance();
if (mgr) if (mgr)
mgr->UnregisterEndpoint(m_DiscoveryEndpoint); mgr->UnregisterEndpoint(m_Endpoint);
} }
/** /**
@ -260,7 +260,7 @@ void DiscoveryComponent::FinishDiscoverySetup(const Endpoint::Ptr& endpoint)
endpoint->RegisterSubscription("discovery::Welcome"); endpoint->RegisterSubscription("discovery::Welcome");
RequestMessage request; RequestMessage request;
request.SetMethod("discovery::Welcome"); request.SetMethod("discovery::Welcome");
EndpointManager::GetInstance()->SendUnicastMessage(m_DiscoveryEndpoint, endpoint, request); EndpointManager::GetInstance()->SendUnicastMessage(m_Endpoint, endpoint, request);
endpoint->SetSentWelcome(true); endpoint->SetSentWelcome(true);
@ -310,9 +310,9 @@ void DiscoveryComponent::SendDiscoveryMessage(const string& method, const string
params.SetPublications(publications); params.SetPublications(publications);
if (recipient) if (recipient)
EndpointManager::GetInstance()->SendUnicastMessage(m_DiscoveryEndpoint, recipient, request); EndpointManager::GetInstance()->SendUnicastMessage(m_Endpoint, recipient, request);
else else
EndpointManager::GetInstance()->SendMulticastMessage(m_DiscoveryEndpoint, request); EndpointManager::GetInstance()->SendMulticastMessage(m_Endpoint, request);
} }
bool DiscoveryComponent::HasMessagePermission(const Dictionary::Ptr& roles, const string& messageType, const string& message) bool DiscoveryComponent::HasMessagePermission(const Dictionary::Ptr& roles, const string& messageType, const string& message)

View File

@ -52,7 +52,7 @@ public:
virtual void Stop(void); virtual void Stop(void);
private: private:
VirtualEndpoint::Ptr m_DiscoveryEndpoint; VirtualEndpoint::Ptr m_Endpoint;
map<string, ComponentDiscoveryInfo::Ptr> m_Components; map<string, ComponentDiscoveryInfo::Ptr> m_Components;
Timer::Ptr m_DiscoveryTimer; Timer::Ptr m_DiscoveryTimer;