[asterisk-scf-commits] asterisk-scf/integration/routing.git branch "refactor_startup" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu May 19 16:46:36 CDT 2011


branch "refactor_startup" has been updated
       via  ef2d04492bb9514e3df98c16d63dc69711a63e29 (commit)
       via  b73c922a6897ebcdad2ef02db42d7f68839d4b70 (commit)
       via  973f8ef1950d29e82853abf9a74cd3b60cfb2ded (commit)
      from  7044f8c24025b5790f48704f4c54988e6f86f68e (commit)

Summary of changes:
 src/BasicRoutingServiceApp.cpp         |  109 +++++++++++++++++---------------
 src/BasicRoutingStateReplicatorApp.cpp |   10 ++--
 src/CMakeLists.txt                     |    3 +-
 src/EndpointRegistry.cpp               |    4 +-
 src/EndpointRegistry.h                 |    2 +-
 src/ReplicationContext.cpp             |    2 +-
 src/ReplicationContext.h               |    4 +-
 src/RoutingServiceEventPublisher.h     |    2 +-
 src/RoutingStateReplicatorListener.h   |    2 +-
 src/SessionRouter.h                    |    2 +-
 src/SessionRouterOperation.h           |    4 +-
 test/CMakeLists.txt                    |    3 +-
 test/TestRouting.cpp                   |    2 +-
 13 files changed, 76 insertions(+), 73 deletions(-)


- Log -----------------------------------------------------------------
commit ef2d04492bb9514e3df98c16d63dc69711a63e29
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Thu May 19 16:38:43 2011 -0500

    Incorporated review feedback.

diff --git a/src/BasicRoutingServiceApp.cpp b/src/BasicRoutingServiceApp.cpp
index 066684b..f8934ce 100644
--- a/src/BasicRoutingServiceApp.cpp
+++ b/src/BasicRoutingServiceApp.cpp
@@ -61,12 +61,6 @@ namespace AsteriskSCF
 namespace BasicRoutingService
 {
 
-enum ServiceManagementType
-{
-    SUSPEND_SERVICE,
-    RESUME_SERVICE
-};
-
 class ComponentServiceImpl;
 typedef ::IceUtil::Handle<ComponentServiceImpl> ComponentServiceImplPtr;
 
@@ -105,9 +99,10 @@ private:
     void initialize();
     void locateBridgeManager();
     void locateStateReplicator();
-    void registerWithServiceLocator(bool includeComponentService);
-    void deregisterFromServiceLocator(bool includeComponentService);
-    void manageRegisteredServants(ServiceManagementType type, bool includeComponentService);
+    void registerWithServiceLocator(bool includeBackplaneServices);
+    void deregisterFromServiceLocator(bool includeBackplaneServices);
+    void suspendRegisteredServants(bool includeBackplaneServices);
+    void unsuspendRegisteredServants(bool includeBackplaneServices);
 
     void listenToStateReplicator();
     void stopListeningToStateReplicator();
@@ -407,10 +402,10 @@ void setCategory(const AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx& s
  * Register this component's primary public interfaces with the Service Locator.
  * This enables other Asterisk SCF components to locate the interfaces we are publishing.
  *
- * @param includeManagementServices If true, registers our management interfaces
+ * @param includeBackplaneServices If true, registers our management interfaces
  * in addition to all our other interfaces. 
  */
-void BasicRoutingServiceApp::registerWithServiceLocator(bool includeManagementServices)
+void BasicRoutingServiceApp::registerWithServiceLocator(bool includeBackplaneServices)
 {
     try
     {
@@ -439,7 +434,7 @@ void BasicRoutingServiceApp::registerWithServiceLocator(bool includeManagementSe
 
         setCategory(mSessionRouterManagement, Routing::V1::SessionRouterDiscoveryCategory);
 
-        if (includeManagementServices)
+        if (includeBackplaneServices)
         {
             // Register the ComponentService interface with the Service Locator.
             // Note that this interface goes on the management adapter.
@@ -467,11 +462,11 @@ void BasicRoutingServiceApp::registerWithServiceLocator(bool includeManagementSe
 /**
  * Deregister this component's interfaces from the Service Locator.
  *
- * @param includeManagementServices If true, deregisters our management interfaces
+ * @param includeBackplaneServices If true, deregisters our management interfaces
  * in addition to all our other interfaces, making this component unreachable from the 
  * rest of Asterisk SCF. 
  */
-void BasicRoutingServiceApp::deregisterFromServiceLocator(bool includeManagementServices)
+void BasicRoutingServiceApp::deregisterFromServiceLocator(bool includeBackplaneServices)
 {
     try
     {
@@ -479,7 +474,7 @@ void BasicRoutingServiceApp::deregisterFromServiceLocator(bool includeManagement
         mAdminManagement->unregister();
         mSessionRouterManagement->unregister();
 
-        if (includeManagementServices)
+        if (includeBackplaneServices)
         {
             mComponentServiceManagement->unregister();
         }
@@ -491,40 +486,51 @@ void BasicRoutingServiceApp::deregisterFromServiceLocator(bool includeManagement
 }
 
 /**
- * Suspends or unsuspends this component's primary public interfaces 
+ * Suspends this component's primary public interfaces 
  * within the Service Locator. When suspended in this manner, the ServiceLocator
  * will not consider the component during lookup requests. 
  *
- * @param type Type of management operation. 
- *
- * @param includeManagementServices If true, affects our management interfaces
+ * @param includeBackplaneServices If true, affects our management interfaces
  * in addition to all our other interfaces.
  */
-void BasicRoutingServiceApp::manageRegisteredServants(ServiceManagementType type, bool includeManagementServices)
+void BasicRoutingServiceApp::suspendRegisteredServants(bool includeBackplaneServices)
 {
     try
     {
-        if (type == SUSPEND_SERVICE)
-        {
-            mRegistryLocatorManagement->suspend();
-            mAdminManagement->suspend();
-            mSessionRouterManagement->suspend();
+        mRegistryLocatorManagement->suspend();
+        mAdminManagement->suspend();
+        mSessionRouterManagement->suspend();
 
-            if (includeManagementServices)
-            {
-                mComponentServiceManagement->suspend();
-            }
-        }
-        else if (type == RESUME_SERVICE)
+        if (includeBackplaneServices)
         {
-            mRegistryLocatorManagement->unsuspend();
-            mAdminManagement->unsuspend();
-            mSessionRouterManagement->unsuspend();
+            mComponentServiceManagement->suspend();
+        }
+    }
+    catch(const std::exception& e)
+    {
+        lg(Error) << BOOST_CURRENT_FUNCTION << e.what();
+    }
+}
 
-            if (includeManagementServices)
-            {
-                mComponentServiceManagement->unsuspend();
-            }
+/**
+ * Unsuspends this component's primary public interfaces 
+ * within the Service Locator. This allows them to be 
+ * located again via the Service Locator. 
+ *
+ * @param includeBackplaneServices If true, affects our management interfaces
+ * in addition to all our other interfaces.
+ */
+void BasicRoutingServiceApp::unsuspendRegisteredServants(bool includeBackplaneServices)
+{
+    try
+    {
+        mRegistryLocatorManagement->unsuspend();
+        mAdminManagement->unsuspend();
+        mSessionRouterManagement->unsuspend();
+
+        if (includeBackplaneServices)
+        {
+            mComponentServiceManagement->unsuspend();
         }
     }
     catch(const std::exception& e)
@@ -726,7 +732,7 @@ void BasicRoutingServiceApp::resume()
         mServiceAdapter->activate();
 
         // Re-enable lookups of our interfaces in the ServiceLocator. 
-        manageRegisteredServants(RESUME_SERVICE, false);
+        unsuspendRegisteredServants(false);
     }
 
     mRunning = true;
@@ -744,7 +750,7 @@ void BasicRoutingServiceApp::suspendService(bool shuttingDown)
         // so don't waste the bandwidth. 
         if (!shuttingDown)
         {
-            manageRegisteredServants(SUSPEND_SERVICE, false);
+            suspendRegisteredServants(false);
         }
 
         // Remove our interfaces from the state replicator.

commit b73c922a6897ebcdad2ef02db42d7f68839d4b70
Merge: 973f8ef 7044f8c
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Thu May 19 16:06:56 2011 -0500

    Merge branch 'refactor_startup' of git.asterisk.org:asterisk-scf/integration/routing


commit 973f8ef1950d29e82853abf9a74cd3b60cfb2ded
Author: Brent Eagles <beagles at digium.com>
Date:   Sun May 15 15:18:30 2011 -0230

    Apply changes to comply with ice-util-cpp restructuring.

diff --git a/src/BasicRoutingServiceApp.cpp b/src/BasicRoutingServiceApp.cpp
index 08e2572..cc0cd4f 100644
--- a/src/BasicRoutingServiceApp.cpp
+++ b/src/BasicRoutingServiceApp.cpp
@@ -19,13 +19,13 @@
 #include <boost/thread.hpp>
 #include <boost/shared_ptr.hpp>
 
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 #include <AsteriskSCF/Core/Routing/RoutingIf.h>
 #include <AsteriskSCF/System/Component/ReplicaIf.h>
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/System/Component/ComponentServiceIf.h>
 #include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
 
-#include <AsteriskSCF/SmartProxy.h>
 #include <AsteriskSCF/Logger/IceLogger.h>
 #include <AsteriskSCF/logger.h>
 
@@ -47,8 +47,8 @@ using namespace AsteriskSCF::Core::Routing::V1;
 using namespace AsteriskSCF::Core::Discovery::V1;
 using namespace AsteriskSCF::System::Component::V1;
 using namespace AsteriskSCF::System::Logging;
-using namespace AsteriskSCF::SmartProxy;
 using namespace AsteriskSCF::BasicRoutingService::V1;
+using namespace AsteriskSCF::Discovery;
 
 namespace
 {
@@ -121,17 +121,17 @@ private:
     ServiceLocatorManagementPrx mServiceLocatorManagement;
     ServiceLocatorPrx mServiceLocator;
 
-    Discovery::V1::ServiceManagementPrx mRegistryLocatorManagement;
-    Discovery::V1::ServiceManagementPrx mAdminManagement;
-    Discovery::V1::ServiceManagementPrx mComponentServiceManagement;
-    Discovery::V1::ServiceManagementPrx mSessionRouterManagement;
+    ServiceManagementPrx mRegistryLocatorManagement;
+    ServiceManagementPrx mAdminManagement;
+    ServiceManagementPrx mComponentServiceManagement;
+    ServiceManagementPrx mSessionRouterManagement;
 
     // Our published interfaces.
     BasicSessionRouterPtr mSessionRouter;
     RoutingServiceAdminPtr mAdminInteface;
     ComponentServiceImplPtr mComponentService;
     ComponentTestPtr mComponentTest;
-    AsteriskSCF::SmartProxy::SmartProxy<BridgeManagerPrx> mBridgeManager;
+    AsteriskSCF::Discovery::SmartProxy<BridgeManagerPrx> mBridgeManager;
     RoutingServiceEventPublisherPtr mEventPublisher;
     boost::shared_ptr<OperationReplicaCache> mOperationReplicaCache;
     EndpointRegistryPtr mEndpointRegistry;
@@ -139,7 +139,7 @@ private:
     // Replication support
     ReplicationContextPtr mReplicationContext;
     ReplicaManagementPtr mReplicaManagement;
-    AsteriskSCF::SmartProxy::SmartProxy<RoutingStateReplicatorPrx> mStateReplicator;
+    AsteriskSCF::Discovery::SmartProxy<RoutingStateReplicatorPrx> mStateReplicator;
     RoutingStateReplicatorListenerPtr mReplicatorListener;
 
     RoutingStateReplicatorListenerPrx mReplicatorListenerProxy;
@@ -387,7 +387,7 @@ void BasicRoutingServiceApp::stopListeningToStateReplicator()
  * Helper function to add some parameters to one of our registered interfaces in the ServiceLocator, so that
  * other components can look up our interfaces.
  */
-void setCategory(const Discovery::V1::ServiceManagementPrx& serviceManagement, const string& category)
+void setCategory(const AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx& serviceManagement, const string& category)
 {
     // Add category as a parameter to enable other components look this component up.
     ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams;
@@ -494,7 +494,7 @@ void BasicRoutingServiceApp::locateBridgeManager()
 {
     try
     {
-        mBridgeManager = AsteriskSCF::SmartProxy::SmartProxy<BridgeManagerPrx>(
+        mBridgeManager = AsteriskSCF::Discovery::SmartProxy<BridgeManagerPrx>(
             mServiceLocator,
             new ServiceLocatorParams(BridgeServiceDiscoveryCategory),
             lg);
@@ -518,7 +518,7 @@ void BasicRoutingServiceApp::locateStateReplicator()
 
     try
     {
-        AsteriskSCF::SmartProxy::SmartProxy<RoutingStateReplicatorPrx> replicator(mServiceLocator, replicatorParams, lg);
+        AsteriskSCF::Discovery::SmartProxy<RoutingStateReplicatorPrx> replicator(mServiceLocator, replicatorParams, lg);
         mReplicationContext->setReplicatorService(replicator);
     }
     catch(const AsteriskSCF::Core::Discovery::V1::ServiceNotFound&)
@@ -632,7 +632,6 @@ void BasicRoutingServiceApp::initialize()
     }
 
     locateBridgeManager();
-
     locateStateReplicator();
 }
 
diff --git a/src/BasicRoutingStateReplicatorApp.cpp b/src/BasicRoutingStateReplicatorApp.cpp
index 31bdcc9..7da31d9 100644
--- a/src/BasicRoutingStateReplicatorApp.cpp
+++ b/src/BasicRoutingStateReplicatorApp.cpp
@@ -23,7 +23,7 @@
 #include <AsteriskSCF/System/Component/ComponentServiceIf.h>
 #include <AsteriskSCF/logger.h>
 #include <AsteriskSCF/Logger/IceLogger.h>
-#include <AsteriskSCF/StateReplicator.h>
+#include <AsteriskSCF/Replication/StateReplicator.h>
 #include "BasicRoutingStateReplicationIf.h"
 
 using namespace std;
@@ -45,10 +45,10 @@ namespace AsteriskSCF
 namespace BasicRoutingService
 {
 
-typedef AsteriskSCF::StateReplication::StateReplicator< AsteriskSCF::BasicRoutingService::V1::RoutingStateReplicator, 
-                                                         AsteriskSCF::BasicRoutingService::V1::RoutingStateItemPtr, 
-                                                         std::string, 
-                                                          AsteriskSCF::BasicRoutingService::V1::RoutingStateReplicatorListenerPrx> RoutingStateReplicatorI;
+typedef AsteriskSCF::Replication::StateReplicator< AsteriskSCF::BasicRoutingService::V1::RoutingStateReplicator, 
+                                                   AsteriskSCF::BasicRoutingService::V1::RoutingStateItemPtr, 
+                                                   std::string, 
+                                                   AsteriskSCF::BasicRoutingService::V1::RoutingStateReplicatorListenerPrx> RoutingStateReplicatorI;
 typedef IceUtil::Handle<RoutingStateReplicatorI> RoutingStateReplicatorIPtr;
 
 };
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 79868d9..a0419c4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -4,10 +4,9 @@ endif()
 
 include_directories(${logger_dir}/include)
 include_directories(${API_INCLUDE_DIR})
-include_directories(${utils_dir}/SmartProxy/include)
+include_directories(${utils_dir}/include)
 find_package(Lua51 REQUIRED)
 include_directories(${LUA_INCLUDE_DIR})
-include_directories(${utils_dir}/AmiCollector/include)
 include_directories(${util_cpp_dir}/Threading/include)
 include_directories(${util_cpp_dir}/StateMachine/include)
 
diff --git a/src/EndpointRegistry.cpp b/src/EndpointRegistry.cpp
index 92e77f8..8756701 100644
--- a/src/EndpointRegistry.cpp
+++ b/src/EndpointRegistry.cpp
@@ -18,7 +18,7 @@
 #include <boost/thread/shared_mutex.hpp>
 
 #include <AsteriskSCF/logger.h>
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 
 #include "RoutingServiceEventPublisher.h"
 #include "EndpointRegistry.h"
@@ -31,7 +31,7 @@ using namespace ::AsteriskSCF::Core::Routing::V1;
 using namespace ::AsteriskSCF::System::Logging;
 using namespace ::AsteriskSCF::Core::Routing::V1::Event;
 using namespace ::AsteriskSCF::BasicRoutingService::V1;
-using namespace ::AsteriskSCF::SmartProxy;
+using namespace ::AsteriskSCF::Discovery;
 
 namespace
 {
diff --git a/src/EndpointRegistry.h b/src/EndpointRegistry.h
index 8a53599..4e7e32e 100644
--- a/src/EndpointRegistry.h
+++ b/src/EndpointRegistry.h
@@ -18,7 +18,7 @@
 #include <boost/shared_ptr.hpp>
 
 #include <AsteriskSCF/Core/Routing/RoutingIf.h>
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 
 #include "BasicRoutingStateReplicationIf.h"
 #include "ReplicationContext.h"
diff --git a/src/ReplicationContext.cpp b/src/ReplicationContext.cpp
index f9f1f21..5541373 100644
--- a/src/ReplicationContext.cpp
+++ b/src/ReplicationContext.cpp
@@ -18,7 +18,7 @@
 
 #include "ReplicationContext.h"
 
-using namespace ::AsteriskSCF::SmartProxy;
+using namespace ::AsteriskSCF::Discovery;
 
 namespace AsteriskSCF
 {
diff --git a/src/ReplicationContext.h b/src/ReplicationContext.h
index 167063d..d335864 100644
--- a/src/ReplicationContext.h
+++ b/src/ReplicationContext.h
@@ -17,7 +17,7 @@
 
 #include <boost/shared_ptr.hpp>
 
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 #include "BasicRoutingStateReplicationIf.h"
 #include "TestContext.h"
 
@@ -25,7 +25,7 @@ namespace AsteriskSCF
 {
 namespace BasicRoutingService
 {
-typedef AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::BasicRoutingService::V1::RoutingStateReplicatorPrx> ReplicatorServicePrx;
+typedef AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::BasicRoutingService::V1::RoutingStateReplicatorPrx> ReplicatorServicePrx;
 
 class ReplicationContextPriv;
 
diff --git a/src/RoutingServiceEventPublisher.h b/src/RoutingServiceEventPublisher.h
index 58461c8..059b6ad 100644
--- a/src/RoutingServiceEventPublisher.h
+++ b/src/RoutingServiceEventPublisher.h
@@ -19,7 +19,7 @@
 #include <boost/shared_ptr.hpp>
 
 #include <AsteriskSCF/Core/Routing/RoutingIf.h>
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 
 #include "BasicRoutingStateReplicationIf.h"
 
diff --git a/src/RoutingStateReplicatorListener.h b/src/RoutingStateReplicatorListener.h
index 61b8ea2..5732494 100644
--- a/src/RoutingStateReplicatorListener.h
+++ b/src/RoutingStateReplicatorListener.h
@@ -19,7 +19,7 @@
 #include <Ice/Ice.h>
 #include <boost/shared_ptr.hpp>
 
-#include <AsteriskSCF/StateReplicator.h>
+#include <AsteriskSCF/Replication/StateReplicator.h>
 
 #include "BasicRoutingStateReplicationIf.h"
 #include "OperationReplicaCache.h"
diff --git a/src/SessionRouter.h b/src/SessionRouter.h
index e1ae20b..6a32948 100644
--- a/src/SessionRouter.h
+++ b/src/SessionRouter.h
@@ -18,7 +18,7 @@
 #include <Ice/Ice.h>
 #include <boost/shared_ptr.hpp>
 
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 #include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
 #include <AsteriskSCF/Threading/WorkQueue.h>
 #include "EndpointRegistry.h"
diff --git a/src/SessionRouterOperation.h b/src/SessionRouterOperation.h
index 5129dc6..6c0ad93 100644
--- a/src/SessionRouterOperation.h
+++ b/src/SessionRouterOperation.h
@@ -24,7 +24,7 @@
 #include <AsteriskSCF/StateMachine/SimpleStateMachine.h>
 
 #include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 #include <AsteriskSCF/Core/Routing/RoutingIf.h>
 #include <AsteriskSCF/logger.h>
 #include "ReplicationContext.h"
@@ -68,7 +68,7 @@ public:
     const boost::shared_ptr<AsteriskSCF::Threading::WorkQueue> workQueue;
     const ReplicationContextPtr replicationContext;
 
-    AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx> bridgeManager;
+    AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx> bridgeManager;
 
 };
 
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index a86d993..a8ed76f 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -16,8 +16,7 @@ asterisk_scf_component_add_file(RoutingTest MockEndpointLocator.cpp)
 asterisk_scf_component_add_ice_libraries(RoutingTest IceStorm)
 asterisk_scf_component_add_boost_libraries(RoutingTest unit_test_framework)
 
-include_directories(${API_INCLUDE_DIR})
-include_directories(${utils_dir}/TestFixture/include)
+include_directories(${utils_dir}/include)
 
 asterisk_scf_component_build_icebox(RoutingTest)
 target_link_libraries(RoutingTest asterisk-scf-api)
diff --git a/test/TestRouting.cpp b/test/TestRouting.cpp
index 3d9cae2..2dab880 100644
--- a/test/TestRouting.cpp
+++ b/test/TestRouting.cpp
@@ -24,7 +24,7 @@
 #include <IceBox/IceBox.h>
 #include <IceUtil/UUID.h>
 
-#include <AsteriskSCF/IceBoxBoostTest.h>
+#include <AsteriskSCF/Testing/IceBoxBoostTest.h>
 #include <AsteriskSCF/Core/Routing/RoutingIf.h>
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>

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


-- 
asterisk-scf/integration/routing.git



More information about the asterisk-scf-commits mailing list