[asterisk-scf-commits] asterisk-scf/release/logger.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Aug 8 03:06:55 CDT 2011
branch "master" has been updated
via a2beb54a44621324d9769a93d190165d4fd3e815 (commit)
from b3083c7ff5e8441eab7de7022e1b77e57ee50983 (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 a2beb54a44621324d9769a93d190165d4fd3e815
Author: Ken Hunt <ken.hunt at digium.com>
Date: Tue Jun 21 11:59:04 2011 -0500
Expanded ServiceLocatorParams.
diff --git a/client/src/IceLogger.cpp b/client/src/IceLogger.cpp
index 2cba8ae..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 02b7169..258a718 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 1cc3ecc..211b3d8 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/release/logger.git
More information about the asterisk-scf-commits
mailing list