[hydra-commits] hydra/servicediscovery.git branch "master" updated.

Commits to the Hydra project code repositories hydra-commits at lists.digium.com
Wed Jul 21 08:06:15 CDT 2010


branch "master" has been updated
       via  d2396cb459c8fce950de0db1c912bec3bc257559 (commit)
      from  9ec08565f9196f3153c6e29cd9006d5ef4c07df4 (commit)

Summary of changes:
 src/ServiceLocator.cpp |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)


- Log -----------------------------------------------------------------
commit d2396cb459c8fce950de0db1c912bec3bc257559
Author: Joshua Colp <jcolp at digium.com>
Date:   Wed Jul 21 10:01:11 2010 -0300

    Take care of a todo item I put in. Separate management and discovery on two separate adapters.

diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index f9fd657..a4f3d7c 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -56,6 +56,7 @@ Ice::ObjectProxySeq ServiceDiscoveryImpl::locateAll(const ServiceDiscoveryParams
  */
 int ServiceLocatorApp::run(int argc, char* argv[])
 {
+	/* Talk to the topic manager to either create or get the service discovery topic, configured or default */
 	IceStorm::TopicManagerPrx topicManager = IceStorm::TopicManagerPrx::checkedCast(communicator()->propertyToProxy("TopicManager.Proxy"));
 
 	if (!topicManager) {
@@ -86,19 +87,26 @@ int ServiceLocatorApp::run(int argc, char* argv[])
 
 	EventsPrx service_discovery_topic = EventsPrx::uncheckedCast(topic->getPublisher());
 
-	/* TODO: Place these on separate adapters for security reasons */
-	Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("ServiceLocatorAdapter");
+	/* Management and discovery use separate adapters to provide a level of security, management may want to be protected so arbitrary
+	 * people can't inject bad services into the infrastructure while discovery as a read only function may be allowed to all.
+	 */
+	Ice::ObjectAdapterPtr management_adapter = communicator()->createObjectAdapter("ServiceDiscoveryManagementAdapter");
 
-	ServiceDiscoveryManagementImpl* DiscoveryServiceManagement = new ServiceDiscoveryManagementImpl(adapter, service_discovery_topic);
+	ServiceDiscoveryManagementImpl* DiscoveryServiceManagement = new ServiceDiscoveryManagementImpl(management_adapter, service_discovery_topic);
 
-	adapter->add(DiscoveryServiceManagement, communicator()->stringToIdentity("DiscoveryServiceManagement"));
+	management_adapter->add(DiscoveryServiceManagement, communicator()->stringToIdentity("DiscoveryServiceManagement"));
+
+	management_adapter->activate();
+
+	Ice::ObjectAdapterPtr discovery_adapter = communicator()->createObjectAdapter("ServiceDiscoveryAdapter");
 
 	ServiceDiscoveryPtr DiscoveryService = new ServiceDiscoveryImpl(DiscoveryServiceManagement);
 
-	adapter->add(DiscoveryService, communicator()->stringToIdentity("DiscoveryService"));
+	discovery_adapter->add(DiscoveryService, communicator()->stringToIdentity("DiscoveryService"));
 
-	adapter->activate();
+	discovery_adapter->activate();
 
+	/* Now that management and discovery are active we just sit here waiting until we shutdown */
 	communicator()->waitForShutdown();
 
 	return EXIT_SUCCESS;

-----------------------------------------------------------------------


-- 
hydra/servicediscovery.git




More information about the asterisk-scf-commits mailing list