[asterisk-scf-commits] asterisk-scf/integration/servicediscovery.git branch "ice-util-restructure" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Thu Apr 28 10:35:47 CDT 2011
branch "ice-util-restructure" has been created
at b00a3ac902b71f6ba76e1b1a1b3c64dc186cdfd7 (commit)
- Log -----------------------------------------------------------------
commit b00a3ac902b71f6ba76e1b1a1b3c64dc186cdfd7
Author: Brent Eagles <beagles at digium.com>
Date: Thu Apr 28 12:49:36 2011 -0230
Apply changes for ice-util-cpp restructuring
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b1ec31b..29f8732 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,11 +1,9 @@
if(NOT logger_dir)
message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
endif()
-include_directories(${utils_dir}/AmiCollector/include)
-include_directories(${logger_dir}/include)
include_directories(${API_INCLUDE_DIR})
-include_directories(${utils_dir}/StateReplicator/include)
-include_directories(${utils_dir}/SmartProxy/include)
+include_directories(${utils_dir}/include)
+include_directories(${logger_dir}/include)
asterisk_scf_slice_include_directories(${API_SLICE_DIR})
diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index 51b23bb..b1cfe2a 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -23,7 +23,7 @@
#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
#include <AsteriskSCF/Core/Discovery/ServiceLocatorEventsIf.h>
#include <AsteriskSCF/logger.h>
-#include <AsteriskSCF/ResponseCollector.h>
+#include <AsteriskSCF/Async/ResponseCollector.h>
#include "ServiceLocatorStateReplicationIf.h"
@@ -157,7 +157,7 @@ private:
*/
class LocateCollector :
public IceUtil::Shared,
- public ResponseCollector<const LocateParam&>
+ public AsteriskSCF::Async::ResponseCollector<const LocateParam&>
{
};
diff --git a/src/ServiceLocatorStateListener.cpp b/src/ServiceLocatorStateListener.cpp
index d4df1e5..b5f9733 100644
--- a/src/ServiceLocatorStateListener.cpp
+++ b/src/ServiceLocatorStateListener.cpp
@@ -20,7 +20,7 @@
#include <boost/shared_ptr.hpp>
#include <AsteriskSCF/System/Component/ReplicaIf.h>
-#include <AsteriskSCF/SmartProxy.h>
+// #include <AsteriskSCF/Discovery/SmartProxy.h>
#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
#include <AsteriskSCF/Core/Discovery/ServiceLocatorEventsIf.h>
@@ -36,8 +36,10 @@ using namespace AsteriskSCF::ServiceDiscovery;
class ServiceLocatorStateReplicatorItem
{
public:
- ServiceLocatorStateReplicatorItem(ServiceLocatorManagementImplPtr locatorManagement) :
- mLocatorManagement(locatorManagement) { }
+ ServiceLocatorStateReplicatorItem(const ServiceLocatorManagementImplPtr& locatorManagement) :
+ mLocatorManagement(locatorManagement)
+ {
+ }
~ServiceLocatorStateReplicatorItem()
{
@@ -174,12 +176,9 @@ public:
ServiceLocatorManagementImplPtr mLocatorManagement;
};
-ServiceLocatorStateReplicatorListenerI::ServiceLocatorStateReplicatorListenerI(ServiceLocatorManagementImplPtr management)
- : mImpl(new ServiceLocatorStateReplicatorListenerImpl(management)) {}
-
-ServiceLocatorStateReplicatorListenerI::~ServiceLocatorStateReplicatorListenerI()
+ServiceLocatorStateReplicatorListenerI::ServiceLocatorStateReplicatorListenerI(const ServiceLocatorManagementImplPtr& management)
+ : mImpl(new ServiceLocatorStateReplicatorListenerImpl(management))
{
- delete mImpl;
}
void ServiceLocatorStateReplicatorListenerI::stateRemoved(const Ice::StringSeq& itemKeys, const Ice::Current&)
@@ -192,7 +191,7 @@ void ServiceLocatorStateReplicatorListenerI::stateSet(const ServiceLocatorStateI
mImpl->setStateNoticeImpl(items);
}
-bool ServiceLocatorStateReplicatorListenerI::operator==(ServiceLocatorStateReplicatorListenerI &rhs)
+bool ServiceLocatorStateReplicatorListenerI::operator==(const ServiceLocatorStateReplicatorListenerI &rhs)
{
return mImpl->mId == rhs.mImpl->mId;
}
diff --git a/src/ServiceLocatorStateReplicator.h b/src/ServiceLocatorStateReplicator.h
index 0dea777..cb102d3 100644
--- a/src/ServiceLocatorStateReplicator.h
+++ b/src/ServiceLocatorStateReplicator.h
@@ -22,21 +22,29 @@
#include "ServiceLocatorStateReplicationIf.h"
#include "ServiceLocatorManagement.h"
#include "ServiceManagement.h"
-#include <AsteriskSCF/StateReplicator.h>
+#include <AsteriskSCF/Replication/StateReplicator.h>
-using namespace AsteriskSCF::Core::Discovery::V1;
+#include <boost/shared_ptr.hpp>
-typedef AsteriskSCF::StateReplication::StateReplicator<ServiceLocatorStateReplicator, ServiceLocatorStateItemPtr, std::string, ServiceLocatorStateReplicatorListenerPrx> ServiceLocatorStateReplicatorI;
+struct ServiceLocatorStateReplicatorListenerImpl;
+
+typedef AsteriskSCF::Replication::StateReplicator<
+ AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateReplicator,
+ AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr,
+ std::string,
+ AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateReplicatorListenerPrx>
+ ServiceLocatorStateReplicatorI;
typedef IceUtil::Handle<ServiceLocatorStateReplicatorI> ServiceLocatorStateReplicatorIPtr;
-class ServiceLocatorStateReplicatorListenerI : public ServiceLocatorStateReplicatorListener
+class ServiceLocatorStateReplicatorListenerI :
+ public AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateReplicatorListener
{
public:
- ServiceLocatorStateReplicatorListenerI(AsteriskSCF::ServiceDiscovery::ServiceLocatorManagementImplPtr);
- ~ServiceLocatorStateReplicatorListenerI();
+ ServiceLocatorStateReplicatorListenerI(const AsteriskSCF::ServiceDiscovery::ServiceLocatorManagementImplPtr&);
void stateRemoved(const Ice::StringSeq&, const Ice::Current&);
- void stateSet(const ServiceLocatorStateItemSeq&, const Ice::Current&);
- bool operator==(ServiceLocatorStateReplicatorListenerI &rhs);
+ void stateSet(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemSeq&, const Ice::Current&);
+ bool operator==(const ServiceLocatorStateReplicatorListenerI& rhs);
private:
- struct ServiceLocatorStateReplicatorListenerImpl *mImpl;
+ boost::shared_ptr<ServiceLocatorStateReplicatorListenerImpl> mImpl;
};
+
diff --git a/src/ServiceLocatorStateReplicatorApp.cpp b/src/ServiceLocatorStateReplicatorApp.cpp
index ea85544..cc2aab4 100644
--- a/src/ServiceLocatorStateReplicatorApp.cpp
+++ b/src/ServiceLocatorStateReplicatorApp.cpp
@@ -21,9 +21,9 @@
#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
#include <AsteriskSCF/System/Component/ComponentServiceIf.h>
-#include "ServiceLocatorStateReplicator.h"
#include <AsteriskSCF/logger.h>
#include <AsteriskSCF/Logger/IceLogger.h>
+#include "ServiceLocatorStateReplicator.h"
using namespace std;
using namespace AsteriskSCF::Core;
@@ -31,11 +31,6 @@ using namespace AsteriskSCF::Core::Discovery::V1;
using namespace AsteriskSCF::System::Component::V1;
using namespace AsteriskSCF::System::Logging;
-namespace
-{
-const Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.System.Discovery");
-}
-
class ServiceLocatorStateReplicatorService : public IceBox::Service
{
public:
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 4e2f30a..3406157 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -24,7 +24,7 @@
#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
#include <AsteriskSCF/Core/Discovery/ServiceLocatorEventsIf.h>
#include <AsteriskSCF/logger.h>
-#include <AsteriskSCF/ResponseCollector.h>
+#include <AsteriskSCF/Async/ResponseCollector.h>
#include "ServiceLocatorStateReplicationIf.h"
@@ -189,7 +189,7 @@ ServiceManagementPrx ServiceManagementImpl::getServiceManagementPrx()
*/
class CountedIsSupported :
public IsSupportedCallback,
- public ResponseCollector<bool>
+ public AsteriskSCF::Async::ResponseCollector<bool>
{
public:
CountedIsSupported(const IsSupportedCallbackPtr& callback, size_t numVotes) :
commit 1e1f90023b16565e11678b9e3ddd282a2d22cd9b
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Wed Apr 27 13:59:25 2011 -0500
All Asterisk SCF components built with CMake are written in C++, so there is no need to specify it.
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 30cda7b..b177d0b 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,6 +1,6 @@
include_directories(${API_INCLUDE_DIR})
-asterisk_scf_component_init(service_locator_test CXX)
+asterisk_scf_component_init(service_locator_test)
asterisk_scf_component_add_file(service_locator_test TestServiceLocator.cpp)
asterisk_scf_component_add_file(service_locator_test TestComparatorBlocking.cpp)
asterisk_scf_component_add_ice_libraries(service_locator_test IceStorm)
commit 5867586fe8d25732fe8da1e546a64c2910cdce9d
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Wed Apr 27 11:10:48 2011 -0500
CMakeLists.txt cleanup across the entire tree.
* Consistent formatting.
* Removed old non-integrated build stuff.
* Organized include_directories() calls since they affect every component in
the directory they are executed in.
* Keep all scripts lines for each component together.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4561277..8166a0c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,29 +1,3 @@
-#
-# Asterisk Scalable Communications Framework
-#
-# Copyright (C) 2010 -- Digium, Inc.
-#
-# All rights reserved.
-#
-
-# Service locator build system
-
-if(NOT integrated_build STREQUAL "true")
-
- # Minimum we require is 2.8, any lower and stuff would fail horribly
- cmake_minimum_required(VERSION 2.8)
-
- # Include common AsteriskSCF build infrastructure
- include(cmake/AsteriskSCF.cmake)
-
- # Take care of slice definitions
- add_subdirectory(slice EXCLUDE_FROM_ALL)
-
- # logger is integrated into our build
- set(integrated_build true)
- add_subdirectory(logger)
-endif()
-
asterisk_scf_project(service_locator 3.4)
add_subdirectory(src)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b72ddb2..b1ec31b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,24 +1,16 @@
-#
-# Asterisk Scalable Communications Framework
-#
-# Copyright (C) 2010 -- Digium, Inc.
-#
-# All rights reserved.
-#
-
-include_directories(${utils_dir}/StateReplicator/src)
-include_directories(${utils_dir}/SmartProxy/src)
-
+if(NOT logger_dir)
+ message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
+endif()
+include_directories(${utils_dir}/AmiCollector/include)
+include_directories(${logger_dir}/include)
+include_directories(${API_INCLUDE_DIR})
include_directories(${utils_dir}/StateReplicator/include)
include_directories(${utils_dir}/SmartProxy/include)
asterisk_scf_slice_include_directories(${API_SLICE_DIR})
-# Create the actual standalone service locator component
-asterisk_scf_component_init(service_locator CXX)
-
+asterisk_scf_component_init(service_locator)
asterisk_scf_component_add_slice(service_locator ../local-slice/ServiceLocatorStateReplicationIf.ice)
-
asterisk_scf_component_add_file(service_locator ServiceLocator.cpp)
asterisk_scf_component_add_file(service_locator ServiceLocatorManagement.cpp)
asterisk_scf_component_add_file(service_locator ServiceManagement.cpp)
@@ -28,36 +20,19 @@ asterisk_scf_component_add_file(service_locator ServiceManagement.h)
asterisk_scf_component_add_file(service_locator ServiceLocatorManagement.h)
asterisk_scf_component_add_file(service_locator ServiceLocatorStateReplicator.h)
asterisk_scf_component_add_file(service_locator ServiceLocatorStateListener.cpp)
-
asterisk_scf_component_add_ice_libraries(service_locator IceStorm)
asterisk_scf_component_add_ice_libraries(service_locator IceBox)
-
asterisk_scf_component_add_boost_libraries(service_locator core thread date_time)
-
-if(NOT logger_dir)
- message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
-endif()
-include_directories(${utils_dir}/AmiCollector/include)
-include_directories(${logger_dir}/include)
-include_directories(${API_INCLUDE_DIR})
-
asterisk_scf_component_build_icebox(service_locator)
target_link_libraries(service_locator logging-client)
-
asterisk_scf_component_install(service_locator)
-asterisk_scf_component_init(ServiceLocatorStateReplicator CXX)
-
+asterisk_scf_component_init(ServiceLocatorStateReplicator)
asterisk_scf_component_add_slice(ServiceLocatorStateReplicator ../local-slice/ServiceLocatorStateReplicationIf.ice)
-
asterisk_scf_component_add_file(ServiceLocatorStateReplicator ServiceLocatorStateReplicatorApp.cpp)
asterisk_scf_component_add_file(ServiceLocatorStateReplicator ServiceLocatorStateReplicator.h)
-
asterisk_scf_component_add_ice_libraries(ServiceLocatorStateReplicator IceStorm)
-
asterisk_scf_component_add_boost_libraries(ServiceLocatorStateReplicator thread date_time)
-
asterisk_scf_component_build_icebox(ServiceLocatorStateReplicator)
target_link_libraries(ServiceLocatorStateReplicator logging-client)
-
asterisk_scf_component_install(ServiceLocatorStateReplicator)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 7c26a40..30cda7b 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,23 +1,12 @@
-#
-# Asterisk Scalable Communications Framework
-#
-# Copyright (C) 2010 -- Digium, Inc.
-#
-# All rights reserved.
-#
+include_directories(${API_INCLUDE_DIR})
-# Create the actual standalone service locator test driver component
asterisk_scf_component_init(service_locator_test CXX)
asterisk_scf_component_add_file(service_locator_test TestServiceLocator.cpp)
asterisk_scf_component_add_file(service_locator_test TestComparatorBlocking.cpp)
asterisk_scf_component_add_ice_libraries(service_locator_test IceStorm)
-asterisk_scf_component_add_boost_libraries(service_locator_test
- unit_test_framework thread date_time)
-
-include_directories(${API_INCLUDE_DIR})
+asterisk_scf_component_add_boost_libraries(service_locator_test unit_test_framework thread date_time)
asterisk_scf_component_build_icebox(service_locator_test)
target_link_libraries(service_locator_test asterisk-scf-api)
-
asterisk_scf_test_icebox(service_locator_test config/test_component.config)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/AsteriskSCFIceStorm)
commit ce2465680b718044666afd548a39e91201d89ba2
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Wed Apr 27 09:03:34 2011 -0500
Remove obsolete setting of 'bindir'.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 603e015..4561277 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,8 +22,6 @@ if(NOT integrated_build STREQUAL "true")
# logger is integrated into our build
set(integrated_build true)
add_subdirectory(logger)
-else()
- set(service_locator_bindir ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
endif()
asterisk_scf_project(service_locator 3.4)
commit 705ca60ccac8b822d1754ed02545357ffb061551
Author: Fred Anderson <fanderson at digium.com>
Date: Tue Apr 26 13:24:35 2011 -0500
Fixed warning messages
diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index 8ed6e96..51b23bb 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -57,8 +57,8 @@ typedef std::pair<bool, ServiceManagementImplPtr> LocateParam;
class Comparator_IsSupported_Callback : public IceUtil::Shared
{
public:
- Comparator_IsSupported_Callback(const IsSupportedCallbackPtr& callback) :
- callback(callback)
+ Comparator_IsSupported_Callback(const IsSupportedCallbackPtr& cb) :
+ callback(cb)
{
}
diff --git a/src/ServiceLocatorStateReplicatorApp.cpp b/src/ServiceLocatorStateReplicatorApp.cpp
index 1c03205..ea85544 100644
--- a/src/ServiceLocatorStateReplicatorApp.cpp
+++ b/src/ServiceLocatorStateReplicatorApp.cpp
@@ -108,7 +108,7 @@ void ServiceLocatorStateReplicatorService::initialize(const std::string appName,
mAdapter->activate();
}
-void ServiceLocatorStateReplicatorService::start(const string &name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq& args)
+void ServiceLocatorStateReplicatorService::start(const string &name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq&)
{
initialize(name, ic);
}
@@ -119,7 +119,7 @@ void ServiceLocatorStateReplicatorService::stop()
extern "C"
{
-ASTERISK_SCF_ICEBOX_EXPORT IceBox::Service* create(Ice::CommunicatorPtr communicator)
+ASTERISK_SCF_ICEBOX_EXPORT IceBox::Service* create(Ice::CommunicatorPtr)
{
return new ServiceLocatorStateReplicatorService;
}
commit e80e83fa53d5d1c2617f1e87189110d656cb2fd2
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Mon Apr 25 17:47:30 2011 -0500
Changes to work with new single-build-directory CMake script.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1e6759a..603e015 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,9 +16,6 @@ if(NOT integrated_build STREQUAL "true")
# Include common AsteriskSCF build infrastructure
include(cmake/AsteriskSCF.cmake)
- # This project is C++ based and requires a minimum of 3.4
- asterisk_scf_project(service_locator 3.4 CXX)
-
# Take care of slice definitions
add_subdirectory(slice EXCLUDE_FROM_ALL)
@@ -29,5 +26,7 @@ else()
set(service_locator_bindir ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
endif()
+asterisk_scf_project(service_locator 3.4)
+
add_subdirectory(src)
add_subdirectory(test)
diff --git a/config/test_component.config.in b/config/test_component.config
similarity index 86%
rename from config/test_component.config.in
rename to config/test_component.config
index 6d13371..812d22f 100644
--- a/config/test_component.config.in
+++ b/config/test_component.config
@@ -41,7 +41,7 @@ AsteriskSCFIceStorm.Trace.TopicManager=2
AsteriskSCFIceStorm.Flush.Timeout=2000
# Service Locator State Replicator Configuration
-IceBox.Service.ServiceDiscoveryStateReplicator=../src at ServiceLocatorStateReplicator:create
+IceBox.Service.ServiceDiscoveryStateReplicator=ServiceLocatorStateReplicator:create
# Test endpoints for the state replicator
ServiceLocatorStateReplicator.Endpoints=tcp -p 4413:udp -p 4413
@@ -49,7 +49,7 @@ ServiceLocatorStateReplicator.Endpoints=tcp -p 4413:udp -p 4413
#
# ServiceDiscovery configuration
#
-IceBox.Service.ServiceDiscovery=../src at service_locator:create
+IceBox.Service.ServiceDiscovery=service_locator:create
# Test endpoints for the service locator local adapter
ServiceLocatorLocalAdapter.Endpoints=tcp -p 4412
@@ -77,7 +77,7 @@ LoggerAdapter.Endpoints=default
#
# test configuration
#
-IceBox.Service.ServiceDiscoveryTest=. at service_locator_test:create --report_sink=${CMAKE_BINARY_DIR}/service_locator_test-result.xml --report_format=XML --report_level=detailed
+IceBox.Service.ServiceDiscoveryTest=service_locator_test:create
LocatorService.Proxy=LocatorService:tcp -p 4411
ServiceLocatorManagement.proxy=ServiceLocatorManagement:tcp -p 4422
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 3fc98bd..7c26a40 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -18,10 +18,6 @@ include_directories(${API_INCLUDE_DIR})
asterisk_scf_component_build_icebox(service_locator_test)
target_link_libraries(service_locator_test asterisk-scf-api)
-icebox_add_test(service_locator_test config/test_component.config)
+asterisk_scf_test_icebox(service_locator_test config/test_component.config)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/AsteriskSCFIceStorm)
-
-# Copy our test config file to make it available in the test directory.
-# CMake does a bit of search-and-replace, as well.
-configure_file(../config/test_component.config.in ${CMAKE_CURRENT_BINARY_DIR}/config/test_component.config)
commit f885343e02abd41623c86670b4a238011506334d
Author: Joshua Colp <jcolp at digium.com>
Date: Fri Apr 22 15:58:22 2011 -0300
Remove an include that should not exist. YOU SEE NOTHING!
diff --git a/src/ServiceLocatorStateReplicatorApp.cpp b/src/ServiceLocatorStateReplicatorApp.cpp
index 244485f..1c03205 100644
--- a/src/ServiceLocatorStateReplicatorApp.cpp
+++ b/src/ServiceLocatorStateReplicatorApp.cpp
@@ -19,8 +19,6 @@
#include <IceStorm/IceStorm.h>
#include <IceBox/IceBox.h>
-#include <pjlib.h>
-
#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
#include <AsteriskSCF/System/Component/ComponentServiceIf.h>
#include "ServiceLocatorStateReplicator.h"
commit a5b096d44c9c247cc17f020f3c8702e68c81e86c
Author: Brent Eagles <beagles at digium.com>
Date: Fri Apr 22 14:56:56 2011 -0230
Add ASTERISK_SCF_ICEBOX_EXPORT to the IceBox entry point
diff --git a/test/TestServiceLocator.cpp b/test/TestServiceLocator.cpp
index e52e1fc..85a8cbf 100644
--- a/test/TestServiceLocator.cpp
+++ b/test/TestServiceLocator.cpp
@@ -761,7 +761,7 @@ void ServiceLocatorTest::stop()
extern "C"
{
-IceBox::Service* create(Ice::CommunicatorPtr)
+ASTERISK_SCF_ICEBOX_EXPORT IceBox::Service* create(Ice::CommunicatorPtr)
{
return new ServiceLocatorTest;
}
commit 9d2c897e6ba8aba446b53a61ef8c64f488eb72b0
Author: David M. Lee <dlee at digium.com>
Date: Thu Apr 21 15:14:50 2011 -0500
Fixed nested template argument list.
Some compilers require '> >' instead of '>>' for nested templates.
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 1fe0318..4e2f30a 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -255,7 +255,7 @@ void ServiceManagementImpl::isSupported(const ServiceLocatorParamsPtr& params, c
IsSupportedCallbackPtr myCallback = new CountedIsSupported(
callback, mImpl->mSupportedLocatorParams.size());
- for (vector<boost::shared_ptr<ServiceLocatorParamsSpec>>::iterator
+ for (vector<boost::shared_ptr<ServiceLocatorParamsSpec> >::iterator
spec = mImpl->mSupportedLocatorParams.begin();
spec != mImpl->mSupportedLocatorParams.end();
++spec)
commit 043220484084b440d39c8a5e6f8be2c3410a8b12
Author: Joshua Colp <jcolp at digium.com>
Date: Wed Apr 20 18:49:25 2011 -0300
Update things slightly.
diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index 3481396..59274ab 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -22,7 +22,7 @@
#include <AsteriskSCF/Core/Discovery/ServiceLocatorEventsIf.h>
#include <AsteriskSCF/logger.h>
#include <AsteriskSCF/Logger/IceLogger.h>
-#include <AsterisksCF/System/Component/ReplicaIf.h>
+#include <AsteriskSCF/System/Component/ReplicaIf.h>
#include "ServiceLocatorManagement.h"
#include "ServiceManagement.h"
diff --git a/src/ServiceLocatorStateReplicatorApp.cpp b/src/ServiceLocatorStateReplicatorApp.cpp
index 8a80f0d..244485f 100644
--- a/src/ServiceLocatorStateReplicatorApp.cpp
+++ b/src/ServiceLocatorStateReplicatorApp.cpp
@@ -35,7 +35,7 @@ using namespace AsteriskSCF::System::Logging;
namespace
{
-Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.System.Discovery");
+const Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.System.Discovery");
}
class ServiceLocatorStateReplicatorService : public IceBox::Service
commit 80b89ef014c25bef1c2298191863e303a8618dc6
Merge: b3da3cc 6dba638
Author: Joshua Colp <jcolp at digium.com>
Date: Wed Apr 20 18:35:00 2011 -0300
Merge remote branch 'integration/replication'
commit b3da3ccb85932f5668ffb2ff18a67af72a396d93
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Thu Apr 14 13:25:27 2011 -0500
Minor fixes for various code constructs that trip up GCC with new warning
options enabled (-Wextra, -Wconversion, -Wformat, and others).
diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index 9c4f70b..4924b0a 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -102,8 +102,8 @@ void ServiceLocatorImpl::locateAll_async(const AMD_ServiceLocator_locateAllPtr&
mLocatorServiceManagement->locateAll(cb, params);
}
-void ServiceLocatorApp::start(const string& name, const Ice::CommunicatorPtr& communicator,
- const Ice::StringSeq& args)
+void ServiceLocatorApp::start(const string&, const Ice::CommunicatorPtr& communicator,
+ const Ice::StringSeq&)
{
mIceStorm = new AsteriskSCF::ServiceDiscovery::CollocatedIceStorm("AsteriskSCFIceStorm", communicator->getProperties());
@@ -210,7 +210,7 @@ void ServiceLocatorApp::stop()
extern "C"
{
-ASTERISK_SCF_ICEBOX_EXPORT IceBox::Service* create(Ice::CommunicatorPtr communicator)
+ASTERISK_SCF_ICEBOX_EXPORT IceBox::Service* create(Ice::CommunicatorPtr)
{
return new ServiceLocatorApp;
}
diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index 79fc22e..b4d2943 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -174,21 +174,21 @@ class LocateCallback : public IsSupportedCallback
public:
LocateCallback(const LocateCollectorPtr& collector,
const ServiceManagementImplPtr& management) :
- collector(collector),
- management(management)
+ mCollector(collector),
+ mManagement(management)
{
}
- void result(bool result)
+ void result(bool res)
{
// delegation to thread safe object
// no lock needed
- collector->invoke(LocateParam(result, management));
- collector = 0;
+ mCollector->invoke(LocateParam(res, mManagement));
+ mCollector = 0;
}
private:
- LocateCollectorPtr collector;
- ServiceManagementImplPtr management;
+ LocateCollectorPtr mCollector;
+ ServiceManagementImplPtr mManagement;
};
typedef IceUtil::Handle<LocateCallback> LocateCallbackPtr;
@@ -368,7 +368,7 @@ void ServiceLocatorManagementImpl::removeCompare(const string& guid, const Ice::
{
lg(Info) << "removeCompare(" << guid << ')';
boost::unique_lock<boost::shared_mutex> lock(mImpl->mLock);
- int erased = mImpl->mCompares.erase(guid);
+ std::map<std::string, ServiceLocatorParamsComparePrx>::size_type erased = mImpl->mCompares.erase(guid);
if (!erased)
{
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 6542f01..eeb3fb7 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -189,24 +189,24 @@ class CountedIsSupported :
{
public:
CountedIsSupported(const IsSupportedCallbackPtr& callback, size_t numVotes) :
- callback(callback)
+ mCallback(callback)
{
init(numVotes);
}
- void result(bool result) { invoke(result); }
+ void result(bool res) { invoke(res); }
protected:
- void processInvocation(bool result)
+ void processInvocation(bool res)
{
- // any affirmitive vote means success
- if (result)
+ // any affirmative vote means success
+ if (res)
{
boost::lock_guard<boost::mutex> guard(mMutex);
- if (callback)
+ if (mCallback)
{
- callback->result(true);
- callback = 0;
+ mCallback->result(true);
+ mCallback = 0;
}
}
}
@@ -215,15 +215,15 @@ protected:
{
boost::lock_guard<boost::mutex> guard(mMutex);
// all negative votes means failure
- if (callback)
+ if (mCallback)
{
- callback->result(false);
- callback = 0;
+ mCallback->result(false);
+ mCallback = 0;
}
}
private:
- IsSupportedCallbackPtr callback;
+ IsSupportedCallbackPtr mCallback;
};
/**
diff --git a/test/TestComparatorBlocking.cpp b/test/TestComparatorBlocking.cpp
index 82294d4..c10b0da 100644
--- a/test/TestComparatorBlocking.cpp
+++ b/test/TestComparatorBlocking.cpp
@@ -90,14 +90,14 @@ class BlockingCallback : public IceUtil::Shared
public:
BlockingCallback() : beenCalled(false) {}
- void locateCB(const Ice::ObjectPrx& located)
+ void locateCB(const Ice::ObjectPrx&)
{
boost::unique_lock<boost::mutex> lock(mut);
beenCalled = true;
cond.notify_one();
}
- void locateFailureCB(const Ice::Exception& e)
+ void locateFailureCB(const Ice::Exception&)
{
boost::unique_lock<boost::mutex> lock(mut);
beenCalled = true;
diff --git a/test/TestServiceLocator.cpp b/test/TestServiceLocator.cpp
index 3c7292d..e52e1fc 100644
--- a/test/TestServiceLocator.cpp
+++ b/test/TestServiceLocator.cpp
@@ -735,20 +735,20 @@ BOOST_AUTO_TEST_CASE(FindServiceAfterUnregister)
BOOST_CHECK(!found);
}
-void ServiceLocatorTest::start(std::string const &name,
- Ice::CommunicatorPtr const &communicator,
- Ice::StringSeq const &args)
+void ServiceLocatorTest::start(std::string const& name,
+ Ice::CommunicatorPtr const&,
+ Ice::StringSeq const& args)
{
std::vector<char const *> argv;
argv.push_back(name.c_str());
for (Ice::StringSeq::const_iterator i = args.begin(); i != args.end(); ++i)
{
argv.push_back(i->c_str());
+ mCachedArgs.argc++;
}
// null terminated list
argv.push_back((const char*)0);
- mCachedArgs.argc = argv.size() - 1;
mCachedArgs.argv = (char**)&argv[0];
int r = ::boost::unit_test::unit_test_main(&init_unit_test, mCachedArgs.argc, mCachedArgs.argv);
@@ -761,7 +761,7 @@ void ServiceLocatorTest::stop()
extern "C"
{
-IceBox::Service* create(Ice::CommunicatorPtr communicator)
+IceBox::Service* create(Ice::CommunicatorPtr)
{
return new ServiceLocatorTest;
}
commit d9ef2a8b4092b1258b81e8df01c1c052edb2517f
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Mon Mar 14 06:16:28 2011 -0500
Update to accommodate DynamicLibrary moving to IceUtilInternal.
diff --git a/src/CollocatedIceStorm.cpp b/src/CollocatedIceStorm.cpp
index dbffcf3..54c05fc 100644
--- a/src/CollocatedIceStorm.cpp
+++ b/src/CollocatedIceStorm.cpp
@@ -40,8 +40,8 @@ CollocatedIceStorm::CollocatedIceStorm(const std::string& namePrefix, const Ice:
std::string loadString = mCommunicator->getProperties()->getPropertyWithDefault("IceStorm.EntryPoint", "IceStormService:createIceStorm");
- mLibrary = new IceInternal::DynamicLibrary;
- IceInternal::DynamicLibrary::symbol_type entry = mLibrary->loadEntryPoint(loadString);
+ mLibrary = new IceUtilInternal::DynamicLibrary;
+ IceUtilInternal::DynamicLibrary::symbol_type entry = mLibrary->loadEntryPoint(loadString);
if(entry == 0)
{
throw mLibrary->getErrorMessage();
diff --git a/src/CollocatedIceStorm.h b/src/CollocatedIceStorm.h
index e8b5da5..fb598ae 100644
--- a/src/CollocatedIceStorm.h
+++ b/src/CollocatedIceStorm.h
@@ -15,7 +15,7 @@
*/
#pragma once
-#include <Ice/DynamicLibrary.h>
+#include <IceUtil/DynamicLibrary.h>
#include <Ice/Service.h>
#include <IceBox/IceBox.h>
#include <Ice/Ice.h>
@@ -43,7 +43,7 @@ public:
void stop();
private:
- IceInternal::DynamicLibraryPtr mLibrary;
+ IceUtilInternal::DynamicLibraryPtr mLibrary;
IceBox::ServicePtr mService;
Ice::CommunicatorPtr mCommunicator;
bool mStopped;
commit b9e4e5d98418a006dd18cfe54935607a4a80a7a1
Author: David M. Lee <dlee at digium.com>
Date: Mon Feb 21 09:36:03 2011 -0600
Fixed for new ClassMemberDefault slice translator plugin.
diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index 5bc0c74..79fc22e 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -317,7 +317,7 @@ ServiceInfoSeq ServiceLocatorManagementImpl::getServices(const ::Ice::Current&)
i != mImpl->mServices.end();
++i)
{
- ServiceInfo v = {(*i)->getGuid(), (*i)->getServiceManagementPrx(), (*i)->getStatus(), (*i)->getService()};
+ ServiceInfo v((*i)->getGuid(), (*i)->getServiceManagementPrx(), (*i)->getStatus(), (*i)->getService());
r.push_back(v);
}
return r;
@@ -331,7 +331,7 @@ ServiceInfo ServiceLocatorManagementImpl::getService(const std::string &guid, co
++i)
{
if (guid == (*i)->getGuid()) {
- ServiceInfo r = {(*i)->getGuid(), (*i)->getServiceManagementPrx(), (*i)->getStatus(), (*i)->getService()};
+ ServiceInfo r((*i)->getGuid(), (*i)->getServiceManagementPrx(), (*i)->getStatus(), (*i)->getService());
return r;
}
}
commit 6dba63805671b9ffafa67dbd7dd3a556d3451562
Author: Joshua Colp <jcolp at digium.com>
Date: Sat Jan 22 19:17:42 2011 -0400
Constify the items being passed to the replicateState and removeState functions.
diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index a0b4ff2..dc72db9 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -585,7 +585,7 @@ void ServiceLocatorManagementImpl::removeService(
/**
* Function which replicates state items.
*/
-void ServiceLocatorManagementImpl::replicateState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr item)
+void ServiceLocatorManagementImpl::replicateState(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr& item)
{
if (!item)
{
@@ -615,7 +615,7 @@ void ServiceLocatorManagementImpl::replicateState(AsteriskSCF::Core::Discovery::
/**
* Function which removes state items from the replicator.
*/
-void ServiceLocatorManagementImpl::removeState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr item)
+void ServiceLocatorManagementImpl::removeState(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr& item)
{
if (!item)
{
diff --git a/src/ServiceLocatorManagement.h b/src/ServiceLocatorManagement.h
index f755522..2251ad5 100644
--- a/src/ServiceLocatorManagement.h
+++ b/src/ServiceLocatorManagement.h
@@ -79,8 +79,8 @@ public:
// Replication related functions.
ServiceManagementImplPtr addService(const Ice::ObjectPrx&, const std::string&, const
Ice::Identity&);
- void replicateState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr);
- void removeState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr);
+ void replicateState(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr&);
+ void removeState(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr&);
void setStateReplicator(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateReplicatorPrx);
//
commit 57f91e2f44daef95eeb826020ac3a07cb12eb538
Author: Joshua Colp <jcolp at digium.com>
Date: Sat Jan 22 19:16:29 2011 -0400
This is no longer needed.
diff --git a/local-slice/CMakeLists.txt b/local-slice/CMakeLists.txt
deleted file mode 100644
index 94e9d7d..0000000
--- a/local-slice/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-asterisk_scf_slice_include_directories("${CMAKE_SOURCE_DIR}/slice")
-asterisk_scf_compile_slice(ServiceLocatorStateReplicationIf.ice lib "Service Locator State Replicator" service_locator)
-
commit b4b9514036a1fdb9cee737ec9fd8e4d7f398366e
Author: Joshua Colp <jcolp at digium.com>
Date: Sat Jan 22 19:16:16 2011 -0400
Get to a working state once again.
diff --git a/local-slice/ServiceLocatorStateReplicationIf.ice b/local-slice/ServiceLocatorStateReplicationIf.ice
index abb8e12..c0fc4e2 100644
--- a/local-slice/ServiceLocatorStateReplicationIf.ice
+++ b/local-slice/ServiceLocatorStateReplicationIf.ice
@@ -18,7 +18,7 @@
#include <Ice/BuiltinSequences.ice>
#include <Ice/Identity.ice>
-#include "Core/Discovery/ServiceLocatorIf.ice"
+#include "AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice"
module AsteriskSCF
{
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 997b6c9..b72ddb2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,6 +9,11 @@
include_directories(${utils_dir}/StateReplicator/src)
include_directories(${utils_dir}/SmartProxy/src)
+include_directories(${utils_dir}/StateReplicator/include)
+include_directories(${utils_dir}/SmartProxy/include)
+
+asterisk_scf_slice_include_directories(${API_SLICE_DIR})
+
# Create the actual standalone service locator component
asterisk_scf_component_init(service_locator CXX)
diff --git a/src/ServiceLocatorManagement.h b/src/ServiceLocatorManagement.h
index 168fae9..f755522 100644
--- a/src/ServiceLocatorManagement.h
+++ b/src/ServiceLocatorManagement.h
@@ -20,7 +20,7 @@
#include <IceUtil/Shared.h>
-#include "System/Component/ReplicaIf.h"
+#include <AsteriskSCF/System/Component/ReplicaIf.h>
#include "ServiceLocatorStateReplicationIf.h"
diff --git a/src/ServiceLocatorStateListener.cpp b/src/ServiceLocatorStateListener.cpp
index 1018ad4..d4df1e5 100644
--- a/src/ServiceLocatorStateListener.cpp
+++ b/src/ServiceLocatorStateListener.cpp
@@ -19,11 +19,11 @@
#include <boost/thread.hpp>
#include <boost/shared_ptr.hpp>
-#include "ReplicaIf.h"
-#include "SmartProxy.h"
+#include <AsteriskSCF/System/Component/ReplicaIf.h>
+#include <AsteriskSCF/SmartProxy.h>
-#include "Core/Discovery/ServiceLocatorIf.h"
-#include "Core/Discovery/ServiceLocatorEventsIf.h"
+#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
+#include <AsteriskSCF/Core/Discovery/ServiceLocatorEventsIf.h>
#include "ServiceLocatorManagement.h"
#include "ServiceManagement.h"
diff --git a/src/ServiceLocatorStateReplicator.h b/src/ServiceLocatorStateReplicator.h
index dfaf388..0dea777 100644
--- a/src/ServiceLocatorStateReplicator.h
+++ b/src/ServiceLocatorStateReplicator.h
@@ -17,12 +17,12 @@
#pragma once
#include <Ice/Ice.h>
-#include "Core/Discovery/ServiceLocatorIf.h"
-#include "Core/Discovery/ServiceLocatorEventsIf.h"
+#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
+#include <AsteriskSCF/Core/Discovery/ServiceLocatorEventsIf.h>
#include "ServiceLocatorStateReplicationIf.h"
#include "ServiceLocatorManagement.h"
#include "ServiceManagement.h"
-#include "StateReplicator.h"
+#include <AsteriskSCF/StateReplicator.h>
using namespace AsteriskSCF::Core::Discovery::V1;
diff --git a/src/ServiceLocatorStateReplicatorApp.cpp b/src/ServiceLocatorStateReplicatorApp.cpp
index c125aa2..8a80f0d 100644
--- a/src/ServiceLocatorStateReplicatorApp.cpp
+++ b/src/ServiceLocatorStateReplicatorApp.cpp
@@ -21,11 +21,11 @@
#include <pjlib.h>
-#include "ServiceLocatorIf.h"
-#include "ComponentServiceIf.h"
+#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
+#include <AsteriskSCF/System/Component/ComponentServiceIf.h>
#include "ServiceLocatorStateReplicator.h"
-#include "IceLogger.h"
-#include "logger.h"
+#include <AsteriskSCF/logger.h>
+#include <AsteriskSCF/Logger/IceLogger.h>
using namespace std;
using namespace AsteriskSCF::Core;
commit e443a92d5d8df9effce88c61057e355988c589e1
Author: Joshua Colp <jcolp at digium.com>
Date: Mon Jan 3 09:55:23 2011 -0400
Provide a default value for Ice::Current in the declaration so one does not need to be created before using it elsewhere.
diff --git a/src/ServiceLocatorManagement.h b/src/ServiceLocatorManagement.h
index 98ca5e7..168fae9 100644
--- a/src/ServiceLocatorManagement.h
+++ b/src/ServiceLocatorManagement.h
@@ -95,7 +95,7 @@ public:
void addCompare(const std::string&,
const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsComparePrx&,
const Ice::Current&);
- void removeCompare(const std::string&, const Ice::Current&);
+ void removeCompare(const std::string&, const Ice::Current& = Ice::Current());
void isSupported(const std::string&,
const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr&,
diff --git a/src/ServiceLocatorStateListener.cpp b/src/ServiceLocatorStateListener.cpp
index 38d79dd..1018ad4 100644
--- a/src/ServiceLocatorStateListener.cpp
+++ b/src/ServiceLocatorStateListener.cpp
@@ -36,17 +36,18 @@ using namespace AsteriskSCF::ServiceDiscovery;
class ServiceLocatorStateReplicatorItem
{
public:
- ServiceLocatorStateReplicatorItem(ServiceLocatorManagementImplPtr locatorManagement) : mLocatorManagement(locatorManagement) { }
+ ServiceLocatorStateReplicatorItem(ServiceLocatorManagementImplPtr locatorManagement) :
+ mLocatorManagement(locatorManagement) { }
+
~ServiceLocatorStateReplicatorItem()
{
- Ice::Current current;
if (mService)
{
- mService->unregister(current);
+ mService->unregister();
}
if (!mComparator.empty())
{
- mLocatorManagement->removeCompare(mComparator, current);
+ mLocatorManagement->removeCompare(mComparator);
}
}
@@ -104,7 +105,6 @@ public:
if ((serviceState = ServiceLocatorServiceStateItemPtr::dynamicCast((*item))))
{
- Ice::Current current;
std::map<std::string, boost::shared_ptr<ServiceLocatorStateReplicatorItem> >::iterator i = mStateItems.find((*item)->key);
boost::shared_ptr<ServiceLocatorStateReplicatorItem> localitem;
@@ -124,11 +124,11 @@ public:
// The only thing that can be changed by a subsequent state item is the suspend status
if (serviceState->suspended == true)
{
- localitem->getService()->suspend(current);
+ localitem->getService()->suspend();
}
else
{
- localitem->getService()->unsuspend(current);
+ localitem->getService()->unsuspend();
}
}
else if ((paramsState = ServiceLocatorParamsStateItemPtr::dynamicCast((*item))))
@@ -142,8 +142,7 @@ public:
}
// Parameters are only ever added, they are never modified or removed
- Ice::Current current;
- i->second->getService()->addLocatorParams(paramsState->params, paramsState->compareGuid, current);
+ i->second->getService()->addLocatorParams(paramsState->params, paramsState->compareGuid);
}
else if ((comparatorState = ServiceLocatorComparatorStateItemPtr::dynamicCast((*item))))
{
diff --git a/src/ServiceManagement.h b/src/ServiceManagement.h
index 14b5b13..66fd43f 100644
--- a/src/ServiceManagement.h
+++ b/src/ServiceManagement.h
@@ -39,10 +39,10 @@ public:
//
// AsteriskSCF::Core::Discovery::V1::ServiceManagement interface.
//
- void addLocatorParams(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr&, const std::string&, const Ice::Current&);
- void suspend(const Ice::Current&);
- void unsuspend(const Ice::Current&);
- void unregister(const Ice::Current&);
+ void addLocatorParams(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr&, const std::string&, const Ice::Current& = Ice::Current());
+ void suspend(const Ice::Current& = Ice::Current());
+ void unsuspend(const Ice::Current& = Ice::Current());
+ void unregister(const Ice::Current& = Ice::Current());
AsteriskSCF::Core::Discovery::V1::ServiceStatus getStatus(const Ice::Current&) const { return getStatus(); }
Ice::ObjectPrx getService();
commit 3832f7809439029a156ae8c4fab6396ed7d88f03
Author: Joshua Colp <jcolp at digium.com>
Date: Mon Jan 3 09:42:26 2011 -0400
Add proper logging if a suitable proxy is not available for replication.
diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index bec6a78..a0b4ff2 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -606,8 +606,9 @@ void ServiceLocatorManagementImpl::replicateState(AsteriskSCF::Core::Discovery::
ServiceLocatorStateReplicatorPrx oneway = ServiceLocatorStateReplicatorPrx::uncheckedCast(mImpl->mStateReplicator->ice_oneway());
oneway->setState(items);
}
- catch (...)
+ catch (const Ice::NoEndpointException&)
{
+ lg(Error) << "No endpoint for oneway invocation of replicateState() for state replication." << std::endl;
}
}
@@ -635,8 +636,9 @@ void ServiceLocatorManagementImpl::removeState(AsteriskSCF::Core::Discovery::V1:
ServiceLocatorStateReplicatorPrx oneway = ServiceLocatorStateReplicatorPrx::uncheckedCast(mImpl->mStateReplicator->ice_oneway());
oneway->removeState(items);
}
- catch (...)
+ catch (const Ice::NoEndpointException&)
{
+ lg(Error) << "No endpoint for oneway invocation of replicateState() for state replication." << std::endl;
}
}
commit 5a3992df4a3e1646519055b4a2f044e2c78ca3da
Author: Joshua Colp <jcolp at digium.com>
Date: Mon Jan 3 09:35:33 2011 -0400
Since only one item is ever passed to replicateState and removeState simply make it accept the base class.
diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index 73e24c2..bec6a78 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -108,7 +108,7 @@ public:
mStateItem->key = IceUtil::generateUUID();
mStateItem->name = name;
mStateItem->comparator = compare;
- mManagement->replicateState(0, 0, mStateItem);
+ mManagement->replicateState(mStateItem);
}
/**
@@ -117,7 +117,7 @@ public:
*/
~ServiceLocatorComparator()
{
- mManagement->removeState(0, 0, mStateItem);
+ mManagement->removeState(mStateItem);
}
/**
@@ -585,10 +585,13 @@ void ServiceLocatorManagementImpl::removeService(
/**
* Function which replicates state items.
*/
-void ServiceLocatorManagementImpl::replicateState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr service,
- AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsStateItemPtr params,
- AsteriskSCF::Core::Discovery::V1::ServiceLocatorComparatorStateItemPtr comparator)
+void ServiceLocatorManagementImpl::replicateState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr item)
{
+ if (!item)
+ {
+ return;
+ }
+
if (!mImpl->mStateReplicator || mImpl->mReplicaService->isActive() == false)
{
return;
@@ -596,25 +599,7 @@ void ServiceLocatorManagementImpl::replicateState(AsteriskSCF::Core::Discovery::
ServiceLocatorStateItemSeq items;
- if (service)
- {
- items.push_back(service);
- }
-
- if (params)
- {
- items.push_back(params);
- }
-
- if (comparator)
- {
- items.push_back(comparator);
- }
-
- if (items.size() == 0)
- {
- return;
- }
+ items.push_back(item);
try
{
@@ -629,10 +614,13 @@ void ServiceLocatorManagementImpl::replicateState(AsteriskSCF::Core::Discovery::
/**
* Function which removes state items from the replicator.
*/
-void ServiceLocatorManagementImpl::removeState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr service,
- AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsStateItemPtr params,
- AsteriskSCF::Core::Discovery::V1::ServiceLocatorComparatorStateItemPtr comparator)
+void ServiceLocatorManagementImpl::removeState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr item)
{
+ if (!item)
+ {
+ return;
+ }
+
if (!mImpl->mStateReplicator || mImpl->mReplicaService->isActive() == false)
{
return;
@@ -640,25 +628,7 @@ void ServiceLocatorManagementImpl::removeState(AsteriskSCF::Core::Discovery::V1:
Ice::StringSeq items;
- if (service)
- {
- items.push_back(service->key);
- }
-
- if (params)
- {
- items.push_back(params->key);
- }
-
- if (comparator)
- {
- items.push_back(comparator->key);
- }
-
- if (items.size() == 0)
- {
- return;
- }
+ items.push_back(item->key);
try
{
diff --git a/src/ServiceLocatorManagement.h b/src/ServiceLocatorManagement.h
index b80aaec..98ca5e7 100644
--- a/src/ServiceLocatorManagement.h
+++ b/src/ServiceLocatorManagement.h
@@ -79,12 +79,8 @@ public:
// Replication related functions.
ServiceManagementImplPtr addService(const Ice::ObjectPrx&, const std::string&, const
Ice::Identity&);
- void replicateState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr,
- AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsStateItemPtr,
- AsteriskSCF::Core::Discovery::V1::ServiceLocatorComparatorStateItemPtr);
- void removeState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr,
- AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsStateItemPtr,
- AsteriskSCF::Core::Discovery::V1::ServiceLocatorComparatorStateItemPtr);
+ void replicateState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr);
+ void removeState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr);
void setStateReplicator(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateReplicatorPrx);
//
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index bedbecf..13fddf6 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -64,12 +64,12 @@ public:
mStateItem->serviceKey = serviceState->key;
mStateItem->params = params;
mStateItem->compareGuid = compareGuid;
- mManagement->replicateState(0, mStateItem, 0);
+ mManagement->replicateState(mStateItem);
}
~ServiceLocatorParamsSpec()
{
- mManagement->removeState(0, mStateItem, 0);
+ mManagement->removeState(mStateItem);
}
void isSupported(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr&, const IsSupportedCallbackPtr&);
@@ -108,7 +108,7 @@ public:
{
mLocatorTopic->serviceRegistered(guid);
}
- mManagement->replicateState(mStateItem, 0, 0);
+ mManagement->replicateState(mStateItem);
}
/**
@@ -328,7 +328,7 @@ void ServiceManagementImpl::suspend(const Ice::Current&)
{
lg(Info) << "Suspending " << mImpl->mStateItem->guid << " " << mImpl->mStateItem->service->ice_toString();
mImpl->mStateItem->suspended = true;
- mImpl->mManagement->replicateState(mImpl->mStateItem, 0, 0);
+ mImpl->mManagement->replicateState(mImpl->mStateItem);
}
if (mImpl->mLocatorTopic)
@@ -348,7 +348,7 @@ void ServiceManagementImpl::unsuspend(const Ice::Current&)
{
lg(Info) << "Un-suspending " << mImpl->mStateItem->guid << " " << mImpl->mStateItem->service->ice_toString();
mImpl->mStateItem->suspended = false;
- mImpl->mManagement->replicateState(mImpl->mStateItem, 0, 0);
+ mImpl->mManagement->replicateState(mImpl->mStateItem);
}
if (mImpl->mLocatorTopic)
@@ -380,7 +380,7 @@ void ServiceManagementImpl::unregister(const Ice::Current&)
*/
lg(Info) << "Un-register " << mImpl->mStateItem->guid << " " << mImpl->mStateItem->service->ice_toString();
- mImpl->mManagement->removeState(mImpl->mStateItem, 0, 0);
+ mImpl->mManagement->removeState(mImpl->mStateItem);
mImpl->mAdapter->remove(mImpl->mManagementPrx->ice_getIdentity());
commit c6702d31128aab08e903ed8942374208101853df
Author: Joshua Colp <jcolp at digium.com>
Date: Mon Jan 3 09:28:21 2011 -0400
If we can't talk to the state replicator for some reason give more detail on why not if an exception is thrown.
diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index 5ffdfa6..1eee03a 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -259,6 +259,10 @@ void ServiceLocatorApp::start(const string& name, const Ice::CommunicatorPtr& co
lg(Info) << "Operating in an active state and pushing updates." << endl;
}
}
+ catch (const std::exception& e)
+ {
+ lg(Info) << "Operating in an active and standalone state since we got an exception: " << e.what() << endl;
+ }
catch (...)
{
// If we reach this point then no state replicator is present and we are acting in a stand-alone fashion
commit 7bb626f8158bc6ebf94a38cb924c15b19af9c389
Author: Joshua Colp <jcolp at digium.com>
Date: Mon Jan 3 09:23:32 2011 -0400
Don't prefix local variables with m, since they aren't member variables.
diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index accd7d7..5ffdfa6 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -243,15 +243,15 @@ void ServiceLocatorApp::start(const string& name, const Ice::CommunicatorPtr& co
try
{
mStateReplicator = ServiceLocatorStateReplicatorPrx::checkedCast(communicator->propertyToProxy("ServiceLocator.StateReplicator.Proxy"));
- ServiceLocatorStateReplicatorListenerPtr mReplicatorListener = new ServiceLocatorStateReplicatorListenerI(locatorServiceManagement);
- ServiceLocatorStateReplicatorListenerPrx mReplicatorListenerProxy = ServiceLocatorStateReplicatorListenerPrx::uncheckedCast(mLocalAdapter->addWithUUID(mReplicatorListener));
+ ServiceLocatorStateReplicatorListenerPtr replicatorListener = new ServiceLocatorStateReplicatorListenerI(locatorServiceManagement);
+ ServiceLocatorStateReplicatorListenerPrx replicatorListenerProxy = ServiceLocatorStateReplicatorListenerPrx::uncheckedCast(mLocalAdapter->addWithUUID(replicatorListener));
locatorServiceManagement->setStateReplicator(mStateReplicator);
if (communicator->getProperties()->getPropertyWithDefault("ServiceLocatorStateReplicatorListener", "no") == "yes")
{
mReplicaService->standby();
- mStateReplicator->addListener(mReplicatorListenerProxy);
+ mStateReplicator->addListener(replicatorListenerProxy);
lg(Info) << "Operating as a standby replica." << endl;
}
else
commit 3c3c3e655aae318e216b2c1ba4ad93fcc635c60b
Author: Joshua Colp <jcolp at digium.com>
Date: Mon Jan 3 09:22:08 2011 -0400
Get rid of the logger adapter in favor of the local adapter.
diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index 5d846fe..accd7d7 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -57,7 +57,6 @@ private:
Ice::ObjectAdapterPtr mLocalAdapter;
Ice::ObjectAdapterPtr mDiscoveryAdapter;
Ice::ObjectAdapterPtr mManagementAdapter;
- Ice::ObjectAdapterPtr mLoggerAdapter;
AsteriskSCF::ServiceDiscovery::CollocatedIceStormPtr mIceStorm;
ReplicaPtr mReplicaService;
ServiceLocatorStateReplicatorPrx mStateReplicator;
@@ -170,13 +169,13 @@ void ServiceLocatorApp::start(const string& name, const Ice::CommunicatorPtr& co
{
mIceStorm = new AsteriskSCF::ServiceDiscovery::CollocatedIceStorm("AsteriskSCFIceStorm", communicator->getProperties());
- mLoggerAdapter = communicator->createObjectAdapter("LoggerAdapter");
+ mLocalAdapter = communicator->createObjectAdapter("ServiceLocatorLocalAdapter");
- ConfiguredIceLoggerPtr mIceLogger = createIceLogger(mLoggerAdapter);
+ ConfiguredIceLoggerPtr mIceLogger = createIceLogger(mLocalAdapter);
getLoggerFactory().setLogOutput(mIceLogger->getLogger());
- mLoggerAdapter->activate();
+ mLocalAdapter->activate();
lg(Info) << "Initializing service discovery component";
@@ -223,14 +222,9 @@ void ServiceLocatorApp::start(const string& name, const Ice::CommunicatorPtr& co
lg(Info) << "IceStorm topic manager proxy not present, events disabled.";
}
- mLocalAdapter = communicator->createObjectAdapter(
- "ServiceLocatorLocalAdapter");
-
mReplicaService = new ReplicaImpl(mLocalAdapter);
mLocalAdapter->add(mReplicaService, communicator->stringToIdentity(ReplicaServiceId));
- mLocalAdapter->activate();
-
/* 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.
commit 8158ae940a21e1a82bc460ae4777dfb00ddef155
Author: Joshua Colp <jcolp at digium.com>
Date: Mon Jan 3 09:20:36 2011 -0400
Constify the passing of the locator service management pointer.
diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index dcd9c82..5d846fe 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -124,7 +124,7 @@ private:
class ServiceLocatorImpl : public ServiceLocator
{
public:
- ServiceLocatorImpl(ServiceLocatorManagementImplPtr LocatorServiceManagement) :
+ ServiceLocatorImpl(const ServiceLocatorManagementImplPtr& LocatorServiceManagement) :
mLocatorServiceManagement(LocatorServiceManagement) { };
/**
* Asynchronously locate a service for the given parameters.
commit 12f5496c2f3eda95ff7c9fc8808dc2bf15102ca2
Author: Joshua Colp <jcolp at digium.com>
Date: Mon Jan 3 09:17:59 2011 -0400
Don't prefix state items with m, and don't call a comparator proxy a service call it a comparator.
diff --git a/local-slice/ServiceLocatorStateReplicationIf.ice b/local-slice/ServiceLocatorStateReplicationIf.ice
index 7d4c71f..abb8e12 100644
--- a/local-slice/ServiceLocatorStateReplicationIf.ice
+++ b/local-slice/ServiceLocatorStateReplicationIf.ice
@@ -57,23 +57,23 @@ module V1
class ServiceLocatorServiceStateItem extends ServiceLocatorStateItem
{
- bool mSuspended;
- Object *mService;
- Ice::Identity mManagementIdentity;
- string mGuid;
+ bool suspended;
+ Object *service;
+ Ice::Identity managementIdentity;
+ string guid;
};
class ServiceLocatorParamsStateItem extends ServiceLocatorStateItem
{
- string mServiceKey;
- ServiceLocatorParams mParams;
- string mCompareGuid;
+ string serviceKey;
+ ServiceLocatorParams params;
+ string compareGuid;
};
class ServiceLocatorComparatorStateItem extends ServiceLocatorStateItem
{
- string mName;
- ServiceLocatorParamsCompare *mService;
+ string name;
+ ServiceLocatorParamsCompare *comparator;
};
}; //module V1
diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index 60e4bff..73e24c2 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -106,8 +106,8 @@ public:
mStateItem(new ServiceLocatorComparatorStateItem())
{
mStateItem->key = IceUtil::generateUUID();
- mStateItem->mName = name;
- mStateItem->mService = compare;
+ mStateItem->name = name;
+ mStateItem->comparator = compare;
mManagement->replicateState(0, 0, mStateItem);
}
@@ -137,7 +137,7 @@ public:
Ice::CallbackPtr d = Ice::newCallback(iceCallback,
&Comparator_IsSupported_Callback::finished);
// async forward to the comparator
- mStateItem->mService->begin_isSupported(params, d);
+ mStateItem->comparator->begin_isSupported(params, d);
}
private:
/**
diff --git a/src/ServiceLocatorStateListener.cpp b/src/ServiceLocatorStateListener.cpp
index e6bb3fd..38d79dd 100644
--- a/src/ServiceLocatorStateListener.cpp
+++ b/src/ServiceLocatorStateListener.cpp
@@ -113,7 +113,7 @@ public:
boost::shared_ptr<ServiceLocatorStateReplicatorItem> newitem(new ServiceLocatorStateReplicatorItem(mLocatorManagement));
localitem = newitem;
mStateItems.insert(std::make_pair((*item)->key, newitem));
- ServiceManagementImplPtr service = mLocatorManagement->addService(serviceState->mService, serviceState->mGuid, serviceState->mManagementIdentity);
+ ServiceManagementImplPtr service = mLocatorManagement->addService(serviceState->service, serviceState->guid, serviceState->managementIdentity);
newitem->setService(service);
}
else
@@ -122,7 +122,7 @@ public:
}
// The only thing that can be changed by a subsequent state item is the suspend status
- if (serviceState->mSuspended == true)
+ if (serviceState->suspended == true)
{
localitem->getService()->suspend(current);
}
@@ -134,7 +134,7 @@ public:
else if ((paramsState = ServiceLocatorParamsStateItemPtr::dynamicCast((*item))))
{
// This is special, we have to find the respective service and then add parameters to it
- std::map<std::string, boost::shared_ptr<ServiceLocatorStateReplicatorItem> >::iterator i = mStateItems.find(paramsState->mServiceKey);
+ std::map<std::string, boost::shared_ptr<ServiceLocatorStateReplicatorItem> >::iterator i = mStateItems.find(paramsState->serviceKey);
if ((i == mStateItems.end()))
{
@@ -143,7 +143,7 @@ public:
// Parameters are only ever added, they are never modified or removed
Ice::Current current;
- i->second->getService()->addLocatorParams(paramsState->mParams, paramsState->mCompareGuid, current);
+ i->second->getService()->addLocatorParams(paramsState->params, paramsState->compareGuid, current);
}
else if ((comparatorState = ServiceLocatorComparatorStateItemPtr::dynamicCast((*item))))
{
@@ -158,10 +158,10 @@ public:
try
{
Ice::Current current;
- mLocatorManagement->addCompare(comparatorState->mName, comparatorState->mService, current);
+ mLocatorManagement->addCompare(comparatorState->name, comparatorState->comparator, current);
boost::shared_ptr<ServiceLocatorStateReplicatorItem> newitem(new ServiceLocatorStateReplicatorItem(mLocatorManagement));
mStateItems.insert(std::make_pair((*item)->key, newitem));
- newitem->setComparator(comparatorState->mName);
+ newitem->setComparator(comparatorState->name);
}
catch (...)
{
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 5d8960d..bedbecf 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -61,9 +61,9 @@ public:
mManagement(management)
{
mStateItem->key = IceUtil::generateUUID();
- mStateItem->mServiceKey = serviceState->key;
- mStateItem->mParams = params;
- mStateItem->mCompareGuid = compareGuid;
+ mStateItem->serviceKey = serviceState->key;
+ mStateItem->params = params;
+ mStateItem->compareGuid = compareGuid;
mManagement->replicateState(0, mStateItem, 0);
}
@@ -99,11 +99,11 @@ public:
mManagement(management), mAdapter(adapter), mLocatorTopic(serviceDiscoveryTopic)
{
mStateItem->key = IceUtil::generateUUID();
- mStateItem->mSuspended = false;
- mStateItem->mService = service;
- mStateItem->mGuid = guid;
+ mStateItem->suspended = false;
+ mStateItem->service = service;
+ mStateItem->guid = guid;
mManagementPrx = ServiceManagementPrx::uncheckedCast(mAdapter->add(impl, identity));
- mStateItem->mManagementIdentity = identity;
+ mStateItem->managementIdentity = identity;
if (mLocatorTopic)
{
mLocatorTopic->serviceRegistered(guid);
@@ -169,7 +169,7 @@ ServiceManagementImpl::ServiceManagementImpl(ServiceLocatorManagementImplPtr man
*/
Ice::ObjectPrx ServiceManagementImpl::getService()
{
- return mImpl->mStateItem->mService;
+ return mImpl->mStateItem->service;
}
/**
@@ -245,7 +245,7 @@ void ServiceManagementImpl::isSupported(const ServiceLocatorParamsPtr& params, c
/* If this service is suspended we can just skip the entire check and
* return false now, easy as pie
*/
- if (mImpl->mStateItem->mSuspended)
+ if (mImpl->mStateItem->suspended)
{
lg(Debug) << " ...isSupported(" << params->category << ") = false (suspended)\n";
callback->result(false);
@@ -266,7 +266,7 @@ void ServiceManagementImpl::isSupported(const ServiceLocatorParamsPtr& params, c
const std::string& ServiceManagementImpl::getGuid() const
{
- return mImpl->mStateItem->mGuid;
+ return mImpl->mStateItem->guid;
}
/**
@@ -288,15 +288,15 @@ void ServiceLocatorParamsSpec::isSupported(const ServiceLocatorParamsPtr& params
}
/* This is just a simple comparison that acts as a preliminary, and
* perhaps final, check */
- else if (mStateItem->mParams->category != params->category)
+ else if (mStateItem->params->category != params->category)
{
lg(Debug) << " ...isSupported(" << params->category << ") = false (different categories)\n";
callback->result(false);
}
/* If a comparator was provided then yield to it for a final yay or nay */
- else if (!mStateItem->mCompareGuid.empty())
+ else if (!mStateItem->compareGuid.empty())
{
- mManagement->isSupported(mStateItem->mCompareGuid, params, callback);
+ mManagement->isSupported(mStateItem->compareGuid, params, callback);
}
/* category matches, no comparator to turn us down. it's a match. */
else
@@ -324,16 +324,16 @@ void ServiceManagementImpl::suspend(const Ice::Current&)
{
boost::unique_lock<boost::shared_mutex> lock(mImpl->mLock);
- if (!mImpl->mStateItem->mSuspended)
+ if (!mImpl->mStateItem->suspended)
{
- lg(Info) << "Suspending " << mImpl->mStateItem->mGuid << " " << mImpl->mStateItem->mService->ice_toString();
- mImpl->mStateItem->mSuspended = true;
+ lg(Info) << "Suspending " << mImpl->mStateItem->guid << " " << mImpl->mStateItem->service->ice_toString();
+ mImpl->mStateItem->suspended = true;
mImpl->mManagement->replicateState(mImpl->mStateItem, 0, 0);
}
if (mImpl->mLocatorTopic)
{
- mImpl->mLocatorTopic->serviceSuspended(mImpl->mStateItem->mGuid);
+ mImpl->mLocatorTopic->serviceSuspended(mImpl->mStateItem->guid);
}
}
@@ -344,23 +344,23 @@ void ServiceManagementImpl::unsuspend(const Ice::Current&)
{
boost::unique_lock<boost::shared_mutex> lock(mImpl->mLock);
- if (mImpl->mStateItem->mSuspended)
+ if (mImpl->mStateItem->suspended)
{
- lg(Info) << "Un-suspending " << mImpl->mStateItem->mGuid << " " << mImpl->mStateItem->mService->ice_toString();
- mImpl->mStateItem->mSuspended = false;
+ lg(Info) << "Un-suspending " << mImpl->mStateItem->guid << " " << mImpl->mStateItem->service->ice_toString();
+ mImpl->mStateItem->suspended = false;
mImpl->mManagement->replicateState(mImpl->mStateItem, 0, 0);
}
if (mImpl->mLocatorTopic)
{
- mImpl->mLocatorTopic->serviceUnsuspended(mImpl->mStateItem->mGuid);
+ mImpl->mLocatorTopic->serviceUnsuspended(mImpl->mStateItem->guid);
}
}
ServiceStatus ServiceManagementImpl::getStatus() const
{
boost::unique_lock<boost::shared_mutex> lock(mImpl->mLock);
- if (mImpl->mStateItem->mSuspended)
+ if (mImpl->mStateItem->suspended)
{
return Suspended;
}
@@ -378,7 +378,7 @@ void ServiceManagementImpl::unregister(const Ice::Current&)
/* You'll notice no lock here. That's because we aren't actually modifying any internal state that should
* be protected, and if we did lock here there is a chance for a deadlock which is super sad.
*/
- lg(Info) << "Un-register " << mImpl->mStateItem->mGuid << " " << mImpl->mStateItem->mService->ice_toString();
+ lg(Info) << "Un-register " << mImpl->mStateItem->guid << " " << mImpl->mStateItem->service->ice_toString();
mImpl->mManagement->removeState(mImpl->mStateItem, 0, 0);
@@ -388,7 +388,7 @@ void ServiceManagementImpl::unregister(const Ice::Current&)
if (mImpl->mLocatorTopic)
{
- mImpl->mLocatorTopic->serviceUnregistered(mImpl->mStateItem->mGuid);
+ mImpl->mLocatorTopic->serviceUnregistered(mImpl->mStateItem->guid);
}
}
commit 78153456f35531d951bd20a0be9db7241a28bf3d
Author: Joshua Colp <jcolp at digium.com>
Date: Mon Dec 20 08:40:24 2010 -0400
Remove service locator details from service locator replication slice. The proxies have to be specified in the configuration.
diff --git a/local-slice/ServiceLocatorStateReplicationIf.ice b/local-slice/ServiceLocatorStateReplicationIf.ice
index c475cf8..7d4c71f 100644
--- a/local-slice/ServiceLocatorStateReplicationIf.ice
+++ b/local-slice/ServiceLocatorStateReplicationIf.ice
@@ -32,14 +32,6 @@ module Discovery
["suppress"]
module V1
{
- const string StateReplicatorComponentCategory = "ServiceLocatorStateReplicatorComponent";
- const string StateReplicatorDiscoveryCategory = "ServiceLocatorStateReplicator";
-
- class ServiceLocatorStateReplicatorParams extends AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams
- {
- string mName;
- };
-
class ServiceLocatorStateItem
{
string key;
commit ffa80ea5f956ca2c043576e6f260c5a2497e5f8f
Author: Joshua Colp <jcolp at digium.com>
Date: Sun Dec 19 10:01:31 2010 -0400
Be more descriptive in debug messages about why an isSupported call is true or false.
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 15ad1d2..5d8960d 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -247,6 +247,7 @@ void ServiceManagementImpl::isSupported(const ServiceLocatorParamsPtr& params, c
*/
if (mImpl->mStateItem->mSuspended)
{
+ lg(Debug) << " ...isSupported(" << params->category << ") = false (suspended)\n";
callback->result(false);
return;
}
@@ -282,12 +283,14 @@ void ServiceLocatorParamsSpec::isSupported(const ServiceLocatorParamsPtr& params
// everything/anything, so give it to them
if (params->category.empty())
{
+ lg(Debug) << " ...isSupported(" << params->category << ") = true (empty category)\n";
callback->result(true);
}
/* This is just a simple comparison that acts as a preliminary, and
* perhaps final, check */
else if (mStateItem->mParams->category != params->category)
{
+ lg(Debug) << " ...isSupported(" << params->category << ") = false (different categories)\n";
callback->result(false);
}
/* If a comparator was provided then yield to it for a final yay or nay */
commit 3a037bcd3d5c056aa516d3e1661b482736e63467
Author: Joshua Colp <jcolp at digium.com>
Date: Sun Dec 19 10:00:54 2010 -0400
Use a boost::shared_ptr so the parameters state item does not get prematurely removed.
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 5de72bf..15ad1d2 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -19,6 +19,7 @@
#include <boost/thread.hpp>
#include <boost/thread/shared_mutex.hpp>
+#include <boost/shared_ptr.hpp>
#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
#include <AsteriskSCF/Core/Discovery/ServiceLocatorEventsIf.h>
@@ -138,7 +139,7 @@ public:
/**
* A vector of locator parameters that this service supports.
*/
- std::vector<ServiceLocatorParamsSpec> mSupportedLocatorParams;
+ std::vector< boost::shared_ptr<ServiceLocatorParamsSpec> > mSupportedLocatorParams;
/**
* A proxy that can be used to publish events to the service locator topic.
@@ -253,12 +254,12 @@ void ServiceManagementImpl::isSupported(const ServiceLocatorParamsPtr& params, c
IsSupportedCallbackPtr myCallback = new CountedIsSupported(
callback, mImpl->mSupportedLocatorParams.size());
- for (vector<ServiceLocatorParamsSpec>::iterator
+ for (vector<boost::shared_ptr<ServiceLocatorParamsSpec>>::iterator
spec = mImpl->mSupportedLocatorParams.begin();
spec != mImpl->mSupportedLocatorParams.end();
++spec)
{
- spec->isSupported(params, myCallback);
+ (*spec)->isSupported(params, myCallback);
}
}
@@ -308,7 +309,7 @@ void ServiceManagementImpl::addLocatorParams(const ServiceLocatorParamsPtr& para
{
boost::unique_lock<boost::shared_mutex> lock(mImpl->mLock);
- ServiceLocatorParamsSpec spec(params, compareGuid, mImpl->mManagement, mImpl->mStateItem);
+ boost::shared_ptr<ServiceLocatorParamsSpec> spec(new ServiceLocatorParamsSpec(params, compareGuid, mImpl->mManagement, mImpl->mStateItem));
mImpl->mSupportedLocatorParams.push_back(spec);
}
commit 55d5ae61ad3fa1583e29c5ce2c7c65fc7e24ab50
Author: Joshua Colp <jcolp at digium.com>
Date: Sun Dec 19 09:54:19 2010 -0400
Pass the service state item into the parameters spec so the key can be copied.
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 89a0190..5de72bf 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -53,12 +53,14 @@ class ServiceLocatorParamsSpec
public:
ServiceLocatorParamsSpec(const ServiceLocatorParamsPtr& params,
const std::string& compareGuid,
- ServiceLocatorManagementImplPtr management)
+ ServiceLocatorManagementImplPtr management,
+ ServiceLocatorServiceStateItemPtr serviceState)
:
mStateItem(new ServiceLocatorParamsStateItem()),
mManagement(management)
{
mStateItem->key = IceUtil::generateUUID();
+ mStateItem->mServiceKey = serviceState->key;
mStateItem->mParams = params;
mStateItem->mCompareGuid = compareGuid;
mManagement->replicateState(0, mStateItem, 0);
@@ -306,7 +308,7 @@ void ServiceManagementImpl::addLocatorParams(const ServiceLocatorParamsPtr& para
{
boost::unique_lock<boost::shared_mutex> lock(mImpl->mLock);
- ServiceLocatorParamsSpec spec(params, compareGuid, mImpl->mManagement);
+ ServiceLocatorParamsSpec spec(params, compareGuid, mImpl->mManagement, mImpl->mStateItem);
mImpl->mSupportedLocatorParams.push_back(spec);
}
commit db89112f4d059757e6ad1d32a4f500e9a4412e7c
Author: Joshua Colp <jcolp at digium.com>
Date: Sun Dec 19 09:10:11 2010 -0400
Fix a race condition where it was possible for the service locator to think it was active, thus replicating to itself for a small period of time.
diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index 59ebe3d..dcd9c82 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -256,8 +256,8 @@ void ServiceLocatorApp::start(const string& name, const Ice::CommunicatorPtr& co
if (communicator->getProperties()->getPropertyWithDefault("ServiceLocatorStateReplicatorListener", "no") == "yes")
{
+ mReplicaService->standby();
mStateReplicator->addListener(mReplicatorListenerProxy);
- mReplicaService->standby();
lg(Info) << "Operating as a standby replica." << endl;
}
else
commit b37ab5655657a54fd0a1fc053d02ff2a1cbd23d8
Author: Joshua Colp <jcolp at digium.com>
Date: Sun Dec 19 09:09:31 2010 -0400
Update configuration files and add new ones for state replicator.
diff --git a/config/test_service_locator.config b/config/test_service_locator.config
index d058ee6..2ad533f 100644
--- a/config/test_service_locator.config
+++ b/config/test_service_locator.config
@@ -47,10 +47,17 @@ AsteriskSCFIceStorm.Flush.Timeout=2000
# Test endpoints for the service locator management adapter
ServiceLocatorManagementAdapter.Endpoints=tcp -p 4422
+# Test endpoints for the service locator local adapter
+ServiceLocatorLocalAdapter.Endpoints=tcp -p 4412
+
# Test endpoints for the service locator adapter
ServiceLocatorAdapter.Endpoints=tcp -p 4411
LocatorService.Proxy=LocatorService:tcp -p 4411
+ServiceLocator.StateReplicator.Proxy=ServiceLocatorStateReplicatorService:tcp -p 4413
+
+ServiceLocatorStateReplicatorListener=no
+
# Test endpoints for IceStorm
TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000
diff --git a/config/test_service_locator.config b/config/test_service_locator_listener.config
similarity index 86%
copy from config/test_service_locator.config
copy to config/test_service_locator_listener.config
index d058ee6..12f1482 100644
--- a/config/test_service_locator.config
+++ b/config/test_service_locator_listener.config
@@ -47,10 +47,17 @@ AsteriskSCFIceStorm.Flush.Timeout=2000
# Test endpoints for the service locator management adapter
ServiceLocatorManagementAdapter.Endpoints=tcp -p 4422
+# Test endpoints for the service locator local adapter
+ServiceLocatorLocalAdapter.Endpoints=tcp -p 4412
+
# Test endpoints for the service locator adapter
ServiceLocatorAdapter.Endpoints=tcp -p 4411
LocatorService.Proxy=LocatorService:tcp -p 4411
+ServiceLocator.StateReplicator.Proxy=ServiceLocatorStateReplicatorService:tcp -p 4413
+
+ServiceLocatorStateReplicatorListener=yes
+
# Test endpoints for IceStorm
TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000
diff --git a/config/test_servicelocator_state_replicator.conf b/config/test_servicelocator_state_replicator.conf
new file mode 100644
index 0000000..98a48d4
--- /dev/null
+++ b/config/test_servicelocator_state_replicator.conf
@@ -0,0 +1,11 @@
+# Adapter parameters for this component
+ServiceLocatorStateReplicator.Endpoints=tcp -p 4413:udp -p 4413
+ServiceLocatorStateReplicator.ThreadPool.Size=4
+
+# A proxy to the IceStorm topic manager
+TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000
+
+LocatorService.Proxy=LocatorService:tcp -p 4411
+
+IceBox.InheritProperties=1
+IceBox.Service.ServiceLocatorStateReplicator=ServiceLocatorStateReplicator:create
commit 111b4673736e29555052b53dfd4d920cc593b9ed
Author: Joshua Colp <jcolp at digium.com>
Date: Thu Dec 16 11:08:58 2010 -0400
Get the service locator talking to the state replicator and pushing out state items.
diff --git a/config/test_component.config.in b/config/test_component.config.in
... 21220 lines suppressed ...
--
asterisk-scf/integration/servicediscovery.git
More information about the asterisk-scf-commits
mailing list