[asterisk-scf-commits] asterisk-scf/integration/logger.git branch "locate-with-id" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Jun 28 20:49:45 CDT 2011


branch "locate-with-id" has been updated
       via  3d8703f595df20ee993b13fc1f32b0201f9736ef (commit)
      from  d226b524b9d733c05cb676b344f492c067e060b6 (commit)

Summary of changes:
 client/src/IceLogger.cpp               |   20 ++++++++++++++------
 include/AsteriskSCF/Logger/IceLogger.h |   10 +++++++---
 server/src/main.cpp                    |    8 ++++++--
 3 files changed, 27 insertions(+), 11 deletions(-)


- Log -----------------------------------------------------------------
commit 3d8703f595df20ee993b13fc1f32b0201f9736ef
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Tue Jun 28 20:49:44 2011 -0500

    Mods for changes to ServiceLocatorParams.

diff --git a/client/src/IceLogger.cpp b/client/src/IceLogger.cpp
index c9d898a..a72d48e 100644
--- a/client/src/IceLogger.cpp
+++ b/client/src/IceLogger.cpp
@@ -66,13 +66,14 @@ IceUtil::Handle<ConfiguredIceLogger> ConfiguredIceLogger::create(
     return r;
 }
 
-IceUtil::Handle<ConfiguredIceLogger> ConfiguredIceLogger::create(const ServiceLocatorPrx& locator)
+IceUtil::Handle<ConfiguredIceLogger> ConfiguredIceLogger::create(const ServiceLocatorPrx& locator,
+                                                                 const std::string& serviceName)
 {
     // You cannot call updateLoggerFromServiceLocator directly from the ctor.
     // It implicitly creates a ConfiguredIceLoggerPtr for the AMI call.  If the
     // AMI call completes before the ctor complete, then the object will be
     // deleted before the callee can create their own ConfiguredIceLoggerPtr.
-    ConfiguredIceLoggerPtr r = new ConfiguredIceLogger(locator);
+    ConfiguredIceLoggerPtr r = new ConfiguredIceLogger(locator, serviceName);
     r->updateLoggerFromServiceLocator();
     return r;
 }
@@ -82,8 +83,10 @@ ConfiguredIceLogger::ConfiguredIceLogger(const LoggingServerPrx& server)
     mLogger.setServer(server);
 }
 
-ConfiguredIceLogger::ConfiguredIceLogger(const ServiceLocatorPrx& locator) :
-    mLocator(locator)
+ConfiguredIceLogger::ConfiguredIceLogger(const ServiceLocatorPrx& locator,
+                                         const std::string& serviceName) :
+    mLocator(locator),
+    mLoggingServiceName(serviceName)
 {
     // do not call updateLoggerFromServiceLocator.  see comment in create()
 }
@@ -95,7 +98,9 @@ void ConfiguredIceLogger::updateLoggerFromServiceLocator()
         // we must use AMI to free this thread up for servicing requests
         // if this client is used by the service locator itself, a
         // synchronous call to locate would result in a deadlock
-        ServiceLocatorParamsPtr loggingServerParams = new ServiceLocatorParams(LoggingServerCategory, "");
+        ServiceLocatorParamsPtr loggingServerParams = new ServiceLocatorParams(LoggingServerCategory, 
+                                                                                mLoggingServiceName,                                                                    
+                                                                                "");
 
         Ice::CallbackPtr callback = Ice::newCallback(this, &ConfiguredIceLogger::locateFinished);
 
@@ -185,6 +190,9 @@ ConfiguredIceLoggerPtr AsteriskSCF::System::Logging::createIceLogger(
 {
     Ice::CommunicatorPtr communicator = adapter->getCommunicator();
 
+    std::string serviceName = communicator->getProperties()->getPropertyWithDefault(
+              "LoggerServer.ServiceName", "default");
+
     // If directly specified, use that.
     try
     {
@@ -215,7 +223,7 @@ ConfiguredIceLoggerPtr AsteriskSCF::System::Logging::createIceLogger(
                   << LoggingServerGuid << '\n';
     }
 
-    ConfiguredIceLoggerPtr logger = ConfiguredIceLogger::create(locator);
+    ConfiguredIceLoggerPtr logger = ConfiguredIceLogger::create(locator, serviceName);
 
     IceStorm::TopicManagerPrx topicManager =
         IceStorm::TopicManagerPrx::uncheckedCast(
diff --git a/include/AsteriskSCF/Logger/IceLogger.h b/include/AsteriskSCF/Logger/IceLogger.h
index 3719f99..e2a91cb 100644
--- a/include/AsteriskSCF/Logger/IceLogger.h
+++ b/include/AsteriskSCF/Logger/IceLogger.h
@@ -58,9 +58,11 @@ public:
      * Configure an IceLogger which gets LoggingServer from the ServiceLocator.
      *
      * @param locator Locator to use to get the LoggingServer proxy.
+     * @param serviceName For locating the LoggingServer 
      */
     static IceUtil::Handle<ConfiguredIceLogger> create(
-        const Core::Discovery::V1::ServiceLocatorPrx& locator);
+        const Core::Discovery::V1::ServiceLocatorPrx& locator,
+        const std::string& serviceName);
 
     LogOut& getLogger() { return mLogger; }
 
@@ -84,13 +86,15 @@ protected:
      * Configure an IceLogger which gets LoggingServer from the ServiceLocator.
      *
      * @param locator Locator to use to get the LoggingServer proxy.
+     * @param serviceName Service Name to use in locating LogginServer
      */
-    ConfiguredIceLogger(const Core::Discovery::V1::ServiceLocatorPrx& locator);
+    ConfiguredIceLogger(const Core::Discovery::V1::ServiceLocatorPrx& locator,
+                        const std::string& serviceName);
 
 private:
     IceLogger mLogger;
     Core::Discovery::V1::ServiceLocatorPrx mLocator;
-
+    std::string mLoggingServiceName;
     void locateFinished(const Ice::AsyncResultPtr& r);
 };
 
diff --git a/server/src/main.cpp b/server/src/main.cpp
index 816d906..fcdc734 100644
--- a/server/src/main.cpp
+++ b/server/src/main.cpp
@@ -65,6 +65,8 @@ void LoggingService::registerWithServiceLocator(
         std::string locatorManagementProxyString =
             communicator->getProperties()->getProperty(
                locatorServiceProxyStr);
+        std::string serviceName = communicator->getProperties()->getPropertyWithDefault(
+               "LoggerServer.ServiceName", "default");
         if (!locatorManagementProxyString.empty())
         {
             ServiceLocatorManagementPrx management =
@@ -72,8 +74,10 @@ void LoggingService::registerWithServiceLocator(
                     communicator->stringToProxy(locatorManagementProxyString));
             mServiceManagement = management->addService(serverProxy,
                 LoggingServerGuid);
-            ServiceLocatorParamsPtr params = new ServiceLocatorParams(
-                LoggingServerCategory, "");
+
+            ServiceLocatorParamsPtr params(new ServiceLocatorParams);
+            params->category = LoggingServerCategory;
+            params->service = serviceName;
             mServiceManagement->addLocatorParams(params, "");
         }
         else

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


-- 
asterisk-scf/integration/logger.git



More information about the asterisk-scf-commits mailing list