[asterisk-scf-commits] asterisk-scf/integration/routing.git branch "sessionparty" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Aug 23 18:52:19 CDT 2011


branch "sessionparty" has been created
        at  8819a53aca0ab6f70388de8768ba49a8ae4032a7 (commit)

- Log -----------------------------------------------------------------
commit 8819a53aca0ab6f70388de8768ba49a8ae4032a7
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Tue Aug 23 18:52:27 2011 -0500

    Session API changes.

diff --git a/test/MockSession.cpp b/test/MockSession.cpp
index 319eff5..38d3462 100644
--- a/test/MockSession.cpp
+++ b/test/MockSession.cpp
@@ -20,6 +20,7 @@
 #include "SharedTestData.h"
 
 using namespace AsteriskSCF::SessionCommunications::V1;
+using namespace AsteriskSCF::SessionCommunications::PartyIdentification::V1;
 using namespace std;
 
 namespace AsteriskSCF
@@ -63,6 +64,31 @@ MockSession::MockSession(const string& legId,
       mBridgePrx(0)
 {
     mSessionInfo->role = legId; // for testing
+
+    NamePtr name = new Name("bar");
+    NumberPtr number = new Number("100");
+    IdPtr testId = new Id(name, number);
+    IdSeq idSeq;
+    idSeq.push_back(testId);
+    mCaller = new Caller(idSeq);
+
+    mSessionOwnerId = new SessionOwnerId(idSeq);
+
+    NamePtr dialedName = new Name("foo");
+    NumberPtr dialedNumber = new Number("104");
+    IdPtr dialedId = new Id(dialedName, dialedNumber);
+    IdSeq dialedSeq;
+    dialedSeq.push_back(dialedId);
+    mDialed = new Dialed(dialedNumber);
+
+    NamePtr redirName = new Name("scud");
+    NumberPtr redirNumber = new Number("666");
+    IdPtr connectedId = new Id(redirName, redirNumber);
+    IdSeq idSeq2;
+    idSeq2.push_back(connectedId);
+    mConnectedLine = new ConnectedLine(idSeq2);
+
+        mRedirecting = new Redirecting(dialedId, connectedId, 1);
 }
 
 MockSession::~MockSession()
@@ -193,6 +219,30 @@ void MockSession::removeSessionController_async(
     cb->ice_response();
 }
 
+void MockSession::getCaller_async(const AMD_Session_getCallerPtr& cb, const Ice::Current&)
+{
+    cb->ice_response(mCaller);
+}
+
+void MockSession::getDialed_async(const AMD_Session_getDialedPtr& cb, const Ice::Current&)
+{
+    cb->ice_response(mDialed);
+}
+
+void MockSession::getSessionOwnerId_async(const AMD_Session_getSessionOwnerIdPtr& cb, const ::Ice::Current&)
+{
+    cb->ice_response(mSessionOwnerId);
+}
+
+void MockSession::getConnectedLine_async(const AMD_Session_getConnectedLinePtr& cb, const ::Ice::Current&)
+{
+    cb->ice_response(mConnectedLine);
+}
+
+void MockSession::getRedirecting_async(const AMD_Session_getRedirectingPtr& cb, const Ice::Current& )
+{
+    cb->ice_response(mRedirecting);
+}
 
 /**
  * We're not actually dispatching this AMD
diff --git a/test/MockSession.h b/test/MockSession.h
index 55b821a..990e653 100644
--- a/test/MockSession.h
+++ b/test/MockSession.h
@@ -89,6 +89,17 @@ public:
         const AsteriskSCF::SessionCommunications::V1::SessionControllerPrx&,
         const Ice::Current&);
 
+    void getCaller_async(const AsteriskSCF::SessionCommunications::V1::AMD_Session_getCallerPtr& cb, 
+                         const Ice::Current&);
+    void getDialed_async(const AsteriskSCF::SessionCommunications::V1::AMD_Session_getDialedPtr& cb, 
+                         const Ice::Current&);
+    void getSessionOwnerId_async(const AsteriskSCF::SessionCommunications::V1::AMD_Session_getSessionOwnerIdPtr& cb, 
+                            const ::Ice::Current&);
+    void getConnectedLine_async(const AsteriskSCF::SessionCommunications::V1::AMD_Session_getConnectedLinePtr& cb,  
+                                const ::Ice::Current&);
+    void getRedirecting_async(const AsteriskSCF::SessionCommunications::V1::AMD_Session_getRedirectingPtr& cb, 
+                              const Ice::Current& );
+
 public:
     void setProxy(const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionPrx);
     const std::string& getId() const {return mId;}
@@ -110,6 +121,11 @@ private:
     bool mBridgeSet;
     bool mBridgeReplaced;
     AsteriskSCF::SessionCommunications::V1::BridgePrx mBridgePrx;
+    AsteriskSCF::SessionCommunications::PartyIdentification::V1::SessionOwnerIdPtr  mSessionOwnerId;
+    AsteriskSCF::SessionCommunications::PartyIdentification::V1::CallerPtr mCaller;
+    AsteriskSCF::SessionCommunications::PartyIdentification::V1::DialedPtr mDialed;
+    AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLinePtr mConnectedLine;
+    AsteriskSCF::SessionCommunications::PartyIdentification::V1::RedirectingPtr mRedirecting;
 };
 typedef IceUtil::Handle<MockSession> MockSessionPtr;
 

commit 5e024c9a91e66d142645f2e108fb7309e4c3f7bd
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Thu Aug 11 17:04:26 2011 -0500

    Update for changes to collections classes in ice-util-cpp.

diff --git a/test/MockSessionEndpoint.h b/test/MockSessionEndpoint.h
index d83bb3b..d93eb44 100644
--- a/test/MockSessionEndpoint.h
+++ b/test/MockSessionEndpoint.h
@@ -17,7 +17,7 @@
 
 #include <Ice/Ice.h>
 #include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
-#include <AsteriskSCF/Collections/Set.h>
+#include <AsteriskSCF/Collections/ProxySet.h>
 #include "MockSession.h"
 
 namespace AsteriskSCF

commit 0783c1cad75377312d39b24ddc84176baafe1899
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Wed Aug 10 20:24:31 2011 -0500

    gcc hates unused, named params.

diff --git a/test/MockSessionEndpoint.cpp b/test/MockSessionEndpoint.cpp
index 06e5992..6c5bcf0 100644
--- a/test/MockSessionEndpoint.cpp
+++ b/test/MockSessionEndpoint.cpp
@@ -63,7 +63,7 @@ void MockSessionEndpoint::setProxy(const SessionEndpointPrx& proxy)
     mProxy = proxy;
 }
 
-void MockSessionEndpoint::addDefaultSessionListener(const SessionListenerPrx& listener, const Ice::Current& current)
+void MockSessionEndpoint::addDefaultSessionListener(const SessionListenerPrx& listener, const Ice::Current& )
 {
     mDefaultSessionListeners.add(listener);
 }
@@ -74,13 +74,13 @@ void MockSessionEndpoint::removeDefaultSessionListener(const SessionListenerPrx&
 }
 
 void MockSessionEndpoint::addDefaultSessionCookies(
-        const AsteriskSCF::SessionCommunications::V1::SessionCookies& cookies,
+        const AsteriskSCF::SessionCommunications::V1::SessionCookies&,
         const Ice::Current&)
 {
 }
 
 void MockSessionEndpoint::removeDefaultSessionCookies(
-        const AsteriskSCF::SessionCommunications::V1::SessionCookies& cookies,
+        const AsteriskSCF::SessionCommunications::V1::SessionCookies&,
         const Ice::Current&)
 {
 }

commit 6aa3e3ccdd378af050a1fd101483ff294f8ea05d
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Wed Aug 10 19:14:48 2011 -0500

    Updates to account for changes to the SessionEndpoint API for default session cookies and listeners.

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 49d760c..a3c697d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,4 +1,5 @@
 include_directories(${astscf-ice-util-cpp_dir}/include)
+include_directories(${logger_dir}/include)
 
 astscf_component_init(RoutingTest)
 astscf_component_add_files(RoutingTest TestRouting.cpp)
@@ -18,3 +19,4 @@ astscf_component_add_boost_libraries(RoutingTest unit_test_framework)
 astscf_component_add_slice_collection_libraries(RoutingTest ASTSCF)
 astscf_component_build_icebox(RoutingTest)
 astscf_test_icebox(RoutingTest config/routingtest.conf)
+target_link_libraries(RoutingTest astscf-ice-util-cpp)
diff --git a/test/MockSessionEndpoint.cpp b/test/MockSessionEndpoint.cpp
index 8bf3f85..06e5992 100644
--- a/test/MockSessionEndpoint.cpp
+++ b/test/MockSessionEndpoint.cpp
@@ -28,6 +28,13 @@ namespace AsteriskSCF
 namespace RoutingTest
 {
 
+MockSessionEndpoint::MockSessionEndpoint(const std::string& id) :
+    mId(id), 
+    mCounter(0),
+    mDefaultSessionListeners(SharedTestData::instance.adapterIn, "MockSessionDefaultListeners")  
+{
+}
+
 SessionPrx MockSessionEndpoint::createSession(const string& dest, const SessionListenerPrx&, const Ice::Current&)
 {
     string sessionId = dest + "_" + mId + "_" + boost::lexical_cast<string>(++mCounter);
@@ -56,6 +63,28 @@ void MockSessionEndpoint::setProxy(const SessionEndpointPrx& proxy)
     mProxy = proxy;
 }
 
+void MockSessionEndpoint::addDefaultSessionListener(const SessionListenerPrx& listener, const Ice::Current& current)
+{
+    mDefaultSessionListeners.add(listener);
+}
+
+void MockSessionEndpoint::removeDefaultSessionListener(const SessionListenerPrx& listener, const Ice::Current&)
+{
+    mDefaultSessionListeners.remove(listener);
+}
+
+void MockSessionEndpoint::addDefaultSessionCookies(
+        const AsteriskSCF::SessionCommunications::V1::SessionCookies& cookies,
+        const Ice::Current&)
+{
+}
+
+void MockSessionEndpoint::removeDefaultSessionCookies(
+        const AsteriskSCF::SessionCommunications::V1::SessionCookies& cookies,
+        const Ice::Current&)
+{
+}
+
 void MockSessionEndpoint::perTestCleanup()
 {
     for(SessionSeq::iterator i = mSessionPrxList.begin(); i != mSessionPrxList.end(); ++i)
diff --git a/test/MockSessionEndpoint.h b/test/MockSessionEndpoint.h
index 55a2de6..d83bb3b 100644
--- a/test/MockSessionEndpoint.h
+++ b/test/MockSessionEndpoint.h
@@ -17,6 +17,7 @@
 
 #include <Ice/Ice.h>
 #include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
+#include <AsteriskSCF/Collections/Set.h>
 #include "MockSession.h"
 
 namespace AsteriskSCF
@@ -31,7 +32,7 @@ class MockSessionEndpoint : public AsteriskSCF::SessionCommunications::V1::Sessi
 {
 public:
     // Constructors
-    MockSessionEndpoint(const std::string& id) : mId(id), mCounter(0) {}
+    MockSessionEndpoint(const std::string& id);
 
 public:
     // Overrides
@@ -39,6 +40,17 @@ public:
     AsteriskSCF::SessionCommunications::V1::SessionPrx createSession(const std::string& dest, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current&);
     AsteriskSCF::SessionCommunications::V1::SessionSeq getSessions(const Ice::Current&);
 
+    void addDefaultSessionListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, 
+           const Ice::Current& current);
+    void removeDefaultSessionListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, 
+           const Ice::Current&);
+    void addDefaultSessionCookies(
+          const AsteriskSCF::SessionCommunications::V1::SessionCookies& cookies,
+          const Ice::Current&);
+    void removeDefaultSessionCookies(
+          const AsteriskSCF::SessionCommunications::V1::SessionCookies& cookies,
+          const Ice::Current&);
+
 public:
     // Implementation
 
@@ -52,6 +64,7 @@ private:
     std::string mId;
     AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx mProxy;
     int mCounter;
+    AsteriskSCF::Collections::ProxySet<AsteriskSCF::SessionCommunications::V1::SessionListenerPrx> mDefaultSessionListeners;
 };
 typedef IceUtil::Handle<MockSessionEndpoint> MockSessionEndpointPtr;
 

commit d385c84a1e71127cf0df930af45e244a6930a5e3
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Mon Aug 8 11:12:25 2011 -0500

    Correct build problem for recent integration of base component.
    static_pointer_cast wasn't found in boost namespace without qualifier.

diff --git a/src/Component.cpp b/src/Component.cpp
index 4272c34..7d5f03d 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -133,7 +133,7 @@ void Component::listenToStateReplicators()
 {
     boost::unique_lock<boost::shared_mutex> lock(mReplicatorLock); 
     RoutingReplicationContextPtr routingReplicationContext = 
-        static_pointer_cast<RoutingReplicationContext>(getReplicationContext());
+        boost::static_pointer_cast<RoutingReplicationContext>(getReplicationContext());
 
     if (mListeningToReplicator == true)
     {
@@ -171,7 +171,7 @@ void Component::stopListeningToStateReplicators()
 {
     boost::unique_lock<boost::shared_mutex> lock(mReplicatorLock); 
     RoutingReplicationContextPtr routingReplicationContext = 
-        static_pointer_cast<RoutingReplicationContext>(getReplicationContext());
+        boost::static_pointer_cast<RoutingReplicationContext>(getReplicationContext());
 
     if ((!routingReplicationContext->getReplicator().isInitialized()) || (mListeningToReplicator == false))
     {
@@ -266,7 +266,7 @@ void Component::locateStateReplicator()
     try
     {
         RoutingReplicationContextPtr routingReplicationContext = 
-            static_pointer_cast<RoutingReplicationContext>(getReplicationContext());
+            boost::static_pointer_cast<RoutingReplicationContext>(getReplicationContext());
 
         ReplicatorSmartPrx replicator(getServiceLocator(), replicatorParams, lg);
         routingReplicationContext->setReplicator(replicator);
@@ -293,7 +293,7 @@ void Component::createPrimaryServices()
     {
         // Get the replication context specific to routing. 
         RoutingReplicationContextPtr routingReplicationContext = 
-            static_pointer_cast<RoutingReplicationContext>(getReplicationContext());
+            boost::static_pointer_cast<RoutingReplicationContext>(getReplicationContext());
 
         // Create a helper class for publishing events. 
         mEventPublisher = new RoutingServiceEventPublisher(getServiceAdapter());

commit be71dc1506fc7d694c9e97d3aae20ac3e070bd8e
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Mon Aug 8 03:10:00 2011 -0500

    Uses base Component class and expanded ServiceLocatorParams.

diff --git a/config/routingtest.conf b/config/routingtest.conf
index a7fb9d0..e9a026c 100644
--- a/config/routingtest.conf
+++ b/config/routingtest.conf
@@ -3,7 +3,7 @@
 Ice.Default.CollocationOptimized=0
 
 Ice.Warn.UnknownProperties=0
-Ice.ThreadPool.Client.Size=4
+Ice.ThreadPool.Client.Size=6
 
 #Ice.Admin.Endpoints=tcp -p 10006
 #Ice.Admin.InstanceName=IceBox
@@ -46,7 +46,7 @@ RoutingService.ThreadPool.Size=8
 RoutingService.ThreadPool.SizeMax=14
 RoutingService.ThreadPool.SizeWarn=9
 RoutingService.Standby=no
-RoutingService.StateReplicatorName=Replicator
+RoutingService.StateReplicatorId=Replicator
 RoutingService.ComponentTest=yes
 
 RoutingService2.Endpoints=tcp -p 10052
@@ -55,7 +55,7 @@ RoutingService2.ThreadPool.Size=8
 RoutingService2.ThreadPool.SizeMax=14
 RoutingService2.ThreadPool.SizeWarn=9
 RoutingService2.Standby=yes
-RoutingService2.StateReplicatorName=Replicator
+RoutingService2.StateReplicatorId=Replicator
 
 Replicator.InstanceName=Replicator
 Replicator.Endpoints=default -p 10054
@@ -83,10 +83,11 @@ BackupLocatorRegistry.Proxy=RoutingServiceLocatorRegistry:tcp -p 10052
 SessionRouter.Proxy=SessionRouter:tcp -p 10050
 BackupSessionRouter.Proxy=SessionRouter:tcp -p 10052
 
-Replica.Proxy=BasicRoutingServiceReplica:tcp -p 10051
-BackupReplica.Proxy=BasicRoutingServiceReplica:tcp -p 10053
+Replica.Proxy=Replica:tcp -p 10051
+BackupReplica.Proxy=Replica:tcp -p 10053
 
-RoutingComponent.Proxy=BasicRoutingComponent:tcp -p 10051
+# Proxy to the Component Service inteface
+RoutingComponent.Proxy=ComponentService:tcp -p 10051
 
 TestRoutingAdapterIn.ThreadPool.Size=8
 TestRoutingAdapterIn.ThreadPool.SizeMax=14
diff --git a/slice/AsteriskSCF/Replication/BasicRoutingService/BasicRoutingStateReplicationIf.ice b/slice/AsteriskSCF/Replication/BasicRoutingService/BasicRoutingStateReplicationIf.ice
index 507444c..43bb438 100644
--- a/slice/AsteriskSCF/Replication/BasicRoutingService/BasicRoutingStateReplicationIf.ice
+++ b/slice/AsteriskSCF/Replication/BasicRoutingService/BasicRoutingStateReplicationIf.ice
@@ -34,11 +34,6 @@ module V1
     const string StateReplicatorComponentCategory = "RoutingStateReplicatorComponent";
     const string StateReplicatorDiscoveryCategory = "RoutingStateReplicator";
 
-    unsliceable class RoutingStateReplicatorParams extends AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams
-    {
-       string name;
-    };
-
     ///////////////////////////////////////////////////////////////////////
     // These classes and interfaces implement the replication 
     // pattern of Asterisk SCF.
diff --git a/src/BasicRoutingServiceApp.cpp b/src/BasicRoutingServiceApp.cpp
deleted file mode 100644
index ef38e4a..0000000
--- a/src/BasicRoutingServiceApp.cpp
+++ /dev/null
@@ -1,827 +0,0 @@
-/*
- * Asterisk SCF -- An open-source communications framework.
- *
- * Copyright (C) 2010-2011, Digium, Inc.
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk SCF project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE.txt file
- * at the top of the source tree.
- */
-#include <Ice/Ice.h>
-#include <IceBox/IceBox.h>
-
-#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/Logger/IceLogger.h>
-#include <AsteriskSCF/logger.h>
-
-#include "AsteriskSCF/Threading/SimpleWorkQueue.h"
-#include "RoutingStateReplicatorListener.h"
-#include "LuaScriptProcessor.h"
-#include "RoutingServiceEventPublisher.h"
-#include "EndpointRegistry.h"
-#include "RoutingAdmin.h"
-#include "SessionRouter.h"
-#include "OperationReplicaCache.h"
-#include "ReplicationContext.h"
-#include "TestContext.h"
-
-using namespace std;
-using namespace AsteriskSCF::SessionCommunications::V1;
-using namespace AsteriskSCF::Core;
-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::Replication::BasicRoutingService::V1;
-using namespace AsteriskSCF::Discovery;
-
-namespace
-{
-Logger lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
-}
-using namespace AsteriskSCF::Core::Routing::V1::Event;
-
-namespace AsteriskSCF
-{
-namespace BasicRoutingService
-{
-
-class ComponentServiceImpl;
-typedef ::IceUtil::Handle<ComponentServiceImpl> ComponentServiceImplPtr;
-
-class ReplicaControl;
-typedef ::IceUtil::Handle<ReplicaControl> ReplicaControlPtr;
-
-class BasicRoutingServiceApp : public IceBox::Service
-{
-public:
-    BasicRoutingServiceApp() 
-        : mImplementationId("BasicRoutingService"),
-          mDone(false), 
-          mInitialized(false), 
-          mRunning(false),
-          mPublishTestInterface(false),
-          mSessionContext(new SessionContext()),
-          mWorkQueue( new AsteriskSCF::Threading::SimpleWorkQueue("SessionRouterWorkQueue")),
-          mListeningToReplicator(false)
-    {
-    }
-
-    void resume();
-    void suspend();
-
-    void activated();
-    void onStandby();
-    bool isActive();
-
-    ////// Overrides of IceBox::Service
-
-    virtual void start(const string& name, const ::Ice::CommunicatorPtr& ic, const ::Ice::StringSeq& args);
-    virtual void stop();
-
-private:
-    void suspendService(bool shuttingDown);
-    void initialize();
-    void locateBridgeManager();
-    void locateStateReplicator();
-    void registerWithServiceLocator(bool includeBackplaneServices);
-    void deregisterFromServiceLocator(bool includeBackplaneServices);
-    void suspendRegisteredServants(bool includeBackplaneServices);
-    void unsuspendRegisteredServants(bool includeBackplaneServices);
-
-    void listenToStateReplicator();
-    void stopListeningToStateReplicator();
-
-    /**
-     * Get an impementation-specific ID for createing service discovery guids. 
-     * This is not the same as the app name, which is configurable. 
-     */
-    const std::string mImplementationId; 
-    bool mDone;
-    bool mInitialized;
-    bool mRunning;
-    bool mPublishTestInterface;
-    SessionContextPtr mSessionContext;
-    boost::shared_ptr<AsteriskSCF::Threading::SimpleWorkQueue> mWorkQueue;
-
-    std::string mAppName;
-    ServiceLocatorManagementPrx mServiceLocatorManagement;
-    ServiceLocatorPrx mServiceLocator;
-
-    ServiceManagementPrx mRegistryLocatorManagement;
-    ServiceManagementPrx mAdminManagement;
-    ServiceManagementPrx mComponentServiceManagement;
-    ServiceManagementPrx mReplicaManagement;
-    ServiceManagementPrx mSessionRouterManagement;
-
-    // Our published interfaces.
-    BasicSessionRouterPtr mSessionRouter;
-    SessionRouterPrx mSessionRouterPrx;
-
-    RoutingServiceAdminPtr mAdminInteface;
-    RoutingServiceAdminPrx mAdminPrx;
-
-    ComponentServiceImplPtr mComponentService;
-    ComponentServicePrx mComponentServicePrx;
-
-    ComponentTestPtr mComponentTest;
-    ComponentTestPrx mComponentTestPrx;
-
-    AsteriskSCF::Discovery::SmartProxy<BridgeManagerPrx> mBridgeManager;
-    RoutingServiceEventPublisherPtr mEventPublisher;
-    boost::shared_ptr<OperationReplicaCache> mOperationReplicaCache;
-
-    EndpointRegistryPtr mEndpointRegistry;
-    LocatorRegistryPrx mEndpointRegistryPrx;
-
-    // Replication support
-    ReplicationContextPtr mReplicationContext;
-    ReplicaPrx mReplicaPrx;
-
-    ReplicaControlPtr mReplicaControl;
-    AsteriskSCF::Discovery::SmartProxy<RoutingStateReplicatorPrx> mStateReplicator;
-    RoutingStateReplicatorListenerPtr mReplicatorListener;
-
-    RoutingStateReplicatorListenerPrx mReplicatorListenerProxy;
-    bool mListeningToReplicator;
-
-    // Implementation
-    ::Ice::ObjectAdapterPtr mServiceAdapter;
-    ::Ice::ObjectAdapterPtr mBackplaneAdapter;
-
-    ::Ice::CommunicatorPtr mCommunicator;
-
-    boost::shared_mutex mReplicatorLock;
-};
-typedef ::IceUtil::Handle<BasicRoutingServiceApp> BasicRoutingServiceAppPtr;
-
-static const string RegistryLocatorObjectId("RoutingServiceLocatorRegistry");
-static const string RoutingAdminObjectId("RoutingAdmin");
-static const string ComponentServiceId("BasicRoutingComponent");
-static const string SessionRouterObjectId("SessionRouter");
-static const string ReplicaServiceId("BasicRoutingServiceReplica");
-
-/**
- * This class provides implementation for the ComponentService interface.
- * Every Asterisk SCF component is expected to expose the ComponentService interface.
- */
-class ComponentServiceImpl : public ComponentService
-{
-public:
-    ComponentServiceImpl(BasicRoutingServiceApp* app) :
-        mApp(app)
-    {
-    }
-
-public: // Overrides of the ComponentService interface.
-    void suspend(const ::Ice::Current&)
-    {
-        mApp->suspend();
-    }
-
-    void resume(const ::Ice::Current&)
-    {
-        mApp->resume();
-    }
-
-    void shutdown(const ::Ice::Current&)
-    {
-        mApp->stop();
-    }
-
-    void shutdownNotice()
-    {
-        mApp = 0;
-    }
-
-private:
-    BasicRoutingServiceAppPtr mApp;
-};
-
-/** 
- * This interface is published as a facet of the Component Service interface.
- * It exists to allow more elaborate interaction with a component during testing.
- */
-class ComponentTestImpl : public ComponentTest
-{
-public:
-    ComponentTestImpl(const TestContextPtr& testContext) :
-        mTestContext(testContext)
-    {
-    }
-
-    void setTestMode(const ::std::string& mode, const ::Ice::Current&)
-    {
-        mTestContext->setTestMode(mode);
-    }
-
-    void setTestModeWithArgs(const ::std::string& mode, 
-                             const ComponentTestParamSeq&, 
-                             const ::Ice::Current&)
-    {
-        mTestContext->setTestMode(mode);
-    }
-
-    void clearTestMode(const string&, const ::Ice::Current&)
-    {
-       mTestContext->clearTestMode();
-    }
-
-    void clearTestModes(const ::Ice::Current&)
-    {
-        mTestContext->clearTestMode();
-    }
-
-private:
-    TestContextPtr mTestContext;
-};
-
-/**
- * This class provides implementation for this component's Replica management interface.
- */
-class ReplicaControl : public Replica
-{
-public:
-    /**
-     * Constructor. 
-     *  @param app 
-     *  @param adapter The adapter is assumed to have been activated. 
-     */
-    ReplicaControl(BasicRoutingServiceApp* app, ::Ice::ObjectAdapterPtr adapter) : mApp(app), mAdapter(adapter)
-    { 
-    }
-
-    bool isActive(const ::Ice::Current&)
-    {
-        return mApp->isActive();
-    }
-
-    bool activate(const ::Ice::Current&)
-    {
-        mApp->activated();
-
-        for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener = mListeners.begin(); listener != mListeners.end(); ++listener)
-        {
-            (*listener)->activated(ReplicaPrx::uncheckedCast(mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
-        }
-
-        return true;
-    }
-
-    void standby(const ::Ice::Current&)
-    {
-        mApp->onStandby();
-
-        for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener = mListeners.begin(); 
-             listener != mListeners.end(); ++listener)
-        {
-            (*listener)->onStandby(ReplicaPrx::uncheckedCast(mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
-        }
-    }
-
-    void addListener(const AsteriskSCF::System::Component::V1::ReplicaListenerPrx& listener, const ::Ice::Current&)
-    {
-        mListeners.push_back(listener);
-    }
-
-    void removeListener(const AsteriskSCF::System::Component::V1::ReplicaListenerPrx& listener, const ::Ice::Current&)
-    {
-        mListeners.erase(std::remove(mListeners.begin(), mListeners.end(), listener), mListeners.end());
-    }
-
-private:
-    BasicRoutingServiceAppPtr mApp;
-
-    /**
-     * Pointer to the object adapter we exist on.
-     */
-    ::Ice::ObjectAdapterPtr mAdapter;
-
-    /**
-     * Listeners that we need to push state change notifications out to.
-     */
-    vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx> mListeners;
-};
-
-bool BasicRoutingServiceApp::isActive()
-{
-    // The Replication Context is tracking our current status. 
-    return mReplicationContext->isComponentActive();
-}
-
-void BasicRoutingServiceApp::activated()
-{
-    mReplicationContext->setComponentActive();
-    stopListeningToStateReplicator();
-}
-
-void BasicRoutingServiceApp::onStandby()
-{
-    mReplicationContext->setComponentStandby();
-    listenToStateReplicator();
-}
-
-/** 
- * Register as a listener to our state replicator. 
- * A component in standby mode will do this to monitor state changes
- * being sent from an active component. 
- */
-void BasicRoutingServiceApp::listenToStateReplicator()
-{
-    boost::unique_lock<boost::shared_mutex> lock(mReplicatorLock); 
-
-    if ((mReplicationContext->getReplicatorService() == 0) || (mListeningToReplicator == true))
-    {
-        return;
-    }
-
-    try
-    {
-        // Are we in standby mode?
-        if (mReplicationContext->isComponentActive() == false)
-        {
-            AsteriskSCF::Replication::BasicRoutingService::V1::RoutingStateReplicatorPrx oneWayStateReplicator = 
-                  AsteriskSCF::Replication::BasicRoutingService::V1::RoutingStateReplicatorPrx::uncheckedCast(mReplicationContext->getReplicatorService()->ice_oneway());
-
-            oneWayStateReplicator->addListener(mReplicatorListenerProxy);
-            mListeningToReplicator = true;
-        }
-    }
-    catch (const Ice::Exception& e)
-    {
-        lg(Error) << e.what();
-        throw;
-    }
-}
-
-/** 
- * Unregister as a listener to our state replicator. 
- * A component in active mode doesn't neeed to listen to
- * state replication data. 
- */
-void BasicRoutingServiceApp::stopListeningToStateReplicator()
-{
-    boost::unique_lock<boost::shared_mutex> lock(mReplicatorLock); 
-
-    if ((mReplicationContext->getReplicatorService() == 0) || (mListeningToReplicator == false))
-    {
-        return;
-    }
-
-    try
-    {
-        AsteriskSCF::Replication::BasicRoutingService::V1::RoutingStateReplicatorPrx oneWayStateReplicator = 
-                AsteriskSCF::Replication::BasicRoutingService::V1::RoutingStateReplicatorPrx::uncheckedCast(mReplicationContext->getReplicatorService()->ice_oneway());
-
-        oneWayStateReplicator->removeListener(mReplicatorListenerProxy);
-
-        mListeningToReplicator = false;
-    }
-    catch (const Ice::Exception& e)
-    {
-        lg(Error) << e.what();
-        throw;
-    }
-}
-
-/**
- * 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 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;
-    genericparams->category = category;
-    serviceManagement->addLocatorParams(genericparams, "");
-}
-
-/**
- * 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 includeBackplaneServices If true, registers our management interfaces
- * in addition to all our other interfaces. 
- */
-void BasicRoutingServiceApp::registerWithServiceLocator(bool includeBackplaneServices)
-{
-    try
-    {
-        // Register our RoutingAdmin interface with the Service Locator.
-        string adminServiceGuid(mImplementationId + "." + Routing::V1::RoutingServiceAdminDiscoveryCategory); // Should be unique for reporting.
-        mAdminManagement = mServiceLocatorManagement->addService(mAdminPrx, adminServiceGuid);
-        setCategory(mAdminManagement, Routing::V1::RoutingServiceAdminDiscoveryCategory);
-
-        // Register our RegistryLocator interface with the Service Locator.
-        string locatorServiceGuid(mImplementationId + "." + Routing::V1::RoutingServiceLocatorRegistryDiscoveryCategory);  // Should be unique for reporting.
-        mRegistryLocatorManagement = mServiceLocatorManagement->addService(mEndpointRegistryPrx, locatorServiceGuid);
-        setCategory(mRegistryLocatorManagement, Routing::V1::RoutingServiceLocatorRegistryDiscoveryCategory);
-
-        // Register the SessionRouter interface with the Service Locator.
-        string sessionRouterGuid(mImplementationId + "." + Routing::V1::SessionRouterDiscoveryCategory);   // Should be unique
-        mSessionRouterManagement = mServiceLocatorManagement->addService(mSessionRouterPrx, sessionRouterGuid);
-        setCategory(mSessionRouterManagement, Routing::V1::SessionRouterDiscoveryCategory);
-
-        if (includeBackplaneServices)
-        {
-            // Register the ComponentService interface with the Service Locator.
-            // Note that this interface goes on the management adapter.
-            string componentServiceGuid(mImplementationId + "." + Routing::V1::ComponentServiceDiscoveryCategory);   // Should be unique for reporting.
-            mComponentServiceManagement = mServiceLocatorManagement->addService(mComponentServicePrx, componentServiceGuid);
-            setCategory(mComponentServiceManagement, ComponentServiceId); // This really needs a custom comparator.
-
-            if (mPublishTestInterface)
-            {
-                // Register our test servant as a facet of the ComponentService interface.
-                mComponentTestPrx = ComponentTestPrx::uncheckedCast(
-                    mBackplaneAdapter->addFacet(mComponentTest, 
-                                                mComponentServicePrx->ice_getIdentity(), 
-                                                AsteriskSCF::System::Component::V1::ComponentTestFacet));
-            }
-
-            // Register the Replica interface with the Service Locator.
-            string replicaServiceGuid(mImplementationId + "." + "ReplicaControl");   // Should be unique for reporting.
-            mReplicaManagement = mServiceLocatorManagement->addService(mReplicaPrx, replicaServiceGuid);
-            setCategory(mReplicaManagement, ReplicaServiceId);  // This really needs a custom comparator.
-        }
-    }
-    catch(const std::exception& e)
-    {
-        lg(Error) << "Unable to publish component interfaces in " << mAppName << BOOST_CURRENT_FUNCTION << ". Exception: " << e.what();
-        throw; // rethrow
-    }
-}
-
-/**
- * Deregister this component's interfaces from the Service Locator.
- *
- * @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 includeBackplaneServices)
-{
-    try
-    {
-        mRegistryLocatorManagement->unregister();
-        mAdminManagement->unregister();
-        mSessionRouterManagement->unregister();
-
-        if (includeBackplaneServices)
-        {
-            mComponentServiceManagement->unregister();
-            mReplicaManagement->unregister();
-        }
-    }
-    catch(const std::exception& e)
-    {
-        lg(Error) << BOOST_CURRENT_FUNCTION << e.what();
-    }
-}
-
-/**
- * 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 includeBackplaneServices If true, affects our management interfaces
- * in addition to all our other interfaces.
- */
-void BasicRoutingServiceApp::suspendRegisteredServants(bool includeBackplaneServices)
-{
-    try
-    {
-        mRegistryLocatorManagement->suspend();
-        mAdminManagement->suspend();
-        mSessionRouterManagement->suspend();
-
-        if (includeBackplaneServices)
-        {
-            mComponentServiceManagement->suspend();
-        
-            mReplicaManagement->suspend();
-        }
-    }
-    catch(const std::exception& e)
-    {
-        lg(Error) << BOOST_CURRENT_FUNCTION << e.what();
-    }
-}
-
-/**
- * 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();
-            mReplicaManagement->unsuspend();
-        }
-    }
-    catch(const std::exception& e)
-    {
-        lg(Error) << BOOST_CURRENT_FUNCTION << e.what();
-    }
-}
-
-/**
- * Locate the BridgeManager using the Service Locator.
- */
-void BasicRoutingServiceApp::locateBridgeManager()
-{
-    try
-    {
-        mBridgeManager = AsteriskSCF::Discovery::SmartProxy<BridgeManagerPrx>(
-            mServiceLocator,
-            new ServiceLocatorParams(BridgeServiceDiscoveryCategory),
-            lg);
-    }
-    catch(const AsteriskSCF::Core::Discovery::V1::ServiceNotFound&)
-    {
-        lg(Debug) << "BridgeManager not found. (Safe to ignore ServiceNotFound for briding during startup.)";
-    }
-
-    mSessionContext->bridgeManager = mBridgeManager;
-}
-
-/**
- * Locate our State Replicator using the Service Locator.
- */
-void BasicRoutingServiceApp::locateStateReplicator()
-{
-    RoutingStateReplicatorParamsPtr replicatorParams = new RoutingStateReplicatorParams();
-    replicatorParams->category = StateReplicatorDiscoveryCategory;
-    replicatorParams->name = mCommunicator->getProperties()->getPropertyWithDefault(mAppName + ".StateReplicatorName", "default");
-
-    try
-    {
-        AsteriskSCF::Discovery::SmartProxy<RoutingStateReplicatorPrx> replicator(mServiceLocator, replicatorParams, lg);
-        mReplicationContext->setReplicatorService(replicator);
-    }
-    catch(const AsteriskSCF::Core::Discovery::V1::ServiceNotFound&)
-    {
-        lg(Error) << "StateReplicator not found. Check configuration.";
-        throw;
-    }
-}
-
-/**
- * Create the primary functional objects of this component.
- *   @param appName Name of the application or component.
- */
-void BasicRoutingServiceApp::initialize()
-{
-    try
-    {
-        // Create the adapter that our functional services are published on.
-        mServiceAdapter = mCommunicator->createObjectAdapter(mAppName);
-
-        // Create an adapter that is bound to the dedicated (non-movable) address of this component. 
-        mBackplaneAdapter = mCommunicator->createObjectAdapter(mAppName + ".Backplane");
-
-        // NOTE: In the near future, Standalone instances are the only instances that default to being active. 
-        // When that is in place, non-standalone instances will need to be made active via the Replica interface. 
-        string standaloneProp = mCommunicator->getProperties()->getPropertyWithDefault(mAppName + ".Standalone", "no");
-        bool standalone = (standaloneProp == "yes") || (standaloneProp == "true");
-
-        string standbyProp = mCommunicator->getProperties()->getPropertyWithDefault(mAppName + ".Standby", "no");
-        bool active = (standbyProp == "no") || (standbyProp == "false");
-
-        // Create the replication context.
-        mReplicationContext = ReplicationContextPtr(new ReplicationContext(active, standalone));
-
-        mEventPublisher = new RoutingServiceEventPublisher(mServiceAdapter);
-
-        // setup the logger
-        ConfiguredIceLoggerPtr mIceLogger = createIceLogger(mServiceAdapter);
-        getLoggerFactory().setLogOutput(mIceLogger->getLogger());
-
-        // Create and configure the EndpointRegistry.
-        mEndpointRegistry = new EndpointRegistry(ScriptProcessorPtr(new LuaScriptProcessor()), mEventPublisher, mReplicationContext);
-        mEndpointRegistryPrx = LocatorRegistryPrx::uncheckedCast(
-            mServiceAdapter->add(mEndpointRegistry, mCommunicator->stringToIdentity(RegistryLocatorObjectId)));
-
-        // Check to see if we're configured to publish a test interface.
-        mPublishTestInterface = (mCommunicator->getProperties()->getPropertyWithDefault(mAppName + ".ComponentTest", "no") == "yes");
-
-        if (mPublishTestInterface)
-        {
-            // Create and publish the ComponentTest servant. This will be exposed
-            // as a facet of ComponentService.
-            mComponentTest = new ComponentTestImpl(mReplicationContext->getTestContext());
-        }
-
-        // Create the session context needed to construct operations.
-        mSessionContext = SessionContextPtr(new SessionContext(mServiceAdapter, 
-                                                             mEndpointRegistry, 
-                                                             mEventPublisher, 
-                                                             mWorkQueue,
-                                                             mReplicationContext));
-                
-        // Create the replica cache. 
-        mOperationReplicaCache = OperationReplicaCachePtr(new OperationReplicaCache(mSessionContext));
-
-        // Create publish the SessionRouter interface.
-        mSessionRouter = new SessionRouter(mSessionContext, mOperationReplicaCache);
-        mSessionRouterPrx = SessionRouterPrx::uncheckedCast(
-             mServiceAdapter->add(mSessionRouter, mCommunicator->stringToIdentity(SessionRouterObjectId)));
-
-        // Create and publish the Admin interface support.
-        mAdminInteface = new RoutingAdmin(mEndpointRegistry);
-        mAdminPrx = RoutingServiceAdminPrx::uncheckedCast(
-            mServiceAdapter->add(mAdminInteface, mCommunicator->stringToIdentity(RoutingAdminObjectId)));
-
-        // Create and publish the ComponentService interface on the backplane adapter. 
-        mComponentService = new ComponentServiceImpl(this);
-        mComponentServicePrx = ComponentServicePrx::uncheckedCast(
-            mBackplaneAdapter->add(mComponentService, mCommunicator->stringToIdentity(ComponentServiceId)));
-
-        // Create and publish our Replica interface on the management adapter. This interface allows this component
-        // to be activated or placed in standby mode. 
-        mReplicaControl = new ReplicaControl(this, mBackplaneAdapter);
-        mReplicaPrx = ReplicaPrx::uncheckedCast(
-            mBackplaneAdapter->add(mReplicaControl, mCommunicator->stringToIdentity(ReplicaServiceId)));
-
-        // Create and publish our state replicator listener interface on the backplane adapter. 
-        mReplicatorListener = new RoutingStateReplicatorListenerImpl(mEndpointRegistry, mOperationReplicaCache);
-        RoutingStateReplicatorListenerPrx replicatorListener = RoutingStateReplicatorListenerPrx::uncheckedCast(mBackplaneAdapter->addWithUUID(mReplicatorListener));
-        mReplicatorListenerProxy = RoutingStateReplicatorListenerPrx::uncheckedCast(replicatorListener->ice_oneway());
-
-        if (active)
-        {
-            activated();
-        } 
-        else
-        {
-            onStandby();
-        }
-
-        mServiceAdapter->activate();
-        mBackplaneAdapter->activate();
-
-        // Get a proxy to the management interface for the Service Locator manager.
-        // This isso we can add ourselves into the system discovery mechanisms.
-        mServiceLocatorManagement = ServiceLocatorManagementPrx::checkedCast(mCommunicator->propertyToProxy("LocatorServiceManagement.Proxy"));
-
-        // Get a proxy to the interface for the Service Locator.
-        // This is so we can find the other components we depend on.
-        mServiceLocator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
-
-        mInitialized = true;
-    }
-    catch(const ::Ice::Exception &e)
-    {
-        lg(Error) << "Problems in " << mAppName << BOOST_CURRENT_FUNCTION << e.what();
-        throw e;
-    }
-
-    locateBridgeManager();
-    locateStateReplicator();
-}
-
-/**
- * Implementation of the required IceBox::Service start method.
- */
-void BasicRoutingServiceApp::start(const string& name, const ::Ice::CommunicatorPtr& communicator, const ::Ice::StringSeq&)
-{
-    lg(Info) << "Starting...";
-
-    mCommunicator = communicator;
-    mAppName = name;
-
-    if (!mInitialized)
-    {
-        initialize();
-    }
-    else
-    {
-        mServiceAdapter->activate();
-        mBackplaneAdapter->activate();
-    }
-
-    // Plug into the Asterisk SCF discovery system so that the interfaces we provide
-    // can be located.
-    registerWithServiceLocator(true);
-    
-    // Register with the state replicator in case we are in standby mode. 
-    listenToStateReplicator();
-
-    mRunning = true;
-    lg(Info) << "Started";
-}
-
-/**
- * Things we do to resume operation after a pause().
- */
-void BasicRoutingServiceApp::resume()
-{
-    if (!mRunning)
-    {
-        // If we're in standby by mode, listen for state replication.
-       listenToStateReplicator();
-
-        // Reactivate the service adapter. 
-        mServiceAdapter->activate();
-
-        // Re-enable lookups of our interfaces in the ServiceLocator. 
-        unsuspendRegisteredServants(false);
-    }
-
-    mRunning = true;
-}
-
-/** 
- * Utility function to suspend the service for a suspend() or stop().
- */
-void BasicRoutingServiceApp::suspendService(bool shuttingDown)
-{
-    if (mRunning)
-    {
-        // Suspend lookups of our interfaces in the ServiceLocator. If shutting down,
-        // we'll be deregestering our interfaces with the ServiceLocator,
-        // so don't waste the bandwidth. 
-        if (!shuttingDown)
-        {
-            suspendRegisteredServants(false);
-        }
-
-        // Remove our interfaces from the state replicator.
-        stopListeningToStateReplicator();
-
-        // Deactive the service adapter. 
-        // The adapter that services the ComponentService stays active. 
-        mServiceAdapter->deactivate();
-    }
-
-    mRunning = false;
-}
-
-/** 
- * Handle a notice from the ComponentService. 
- */
-void BasicRoutingServiceApp::suspend()
-{
-    lg(Info) << "Suspending...";
-
-    suspendService(false);
-
-    lg(Info) << "Suspended.";
-}
-
-/**
- * Implementation of the required IceBox::Service stop method.
- */
-void BasicRoutingServiceApp::stop()
-{
-    lg(Info) << "Stopping...";
-
-    suspendService(true);
-
-    deregisterFromServiceLocator(true);
-
-    // Turn off our management interface. 
-    // Only a start() directly from IceBox can restart us now. 
-    mBackplaneAdapter->deactivate();
-
-    lg(Info) << "Stopped.";
-}
-
-} // end BasicRoutingService
-} // end AsteriskSCF
-
-
-extern "C"
-{
-ASTSCF_DLL_EXPORT IceBox::Service* create(::Ice::CommunicatorPtr)
-{
-    return new AsteriskSCF::BasicRoutingService::BasicRoutingServiceApp;
-}
-}
-
diff --git a/src/BasicRoutingStateReplicatorApp.cpp b/src/BasicRoutingStateReplicatorApp.cpp
index 198b97a..e07e2ec 100644
--- a/src/BasicRoutingStateReplicatorApp.cpp
+++ b/src/BasicRoutingStateReplicatorApp.cpp
@@ -126,34 +126,20 @@ private:
     BasicRoutingStateReplicatorServicePtr mService;
 };
 
-class BasicRoutingStateReplicatorCompare : public ServiceLocatorParamsCompare
-{
-public:
-    BasicRoutingStateReplicatorCompare(const std::string& name) : mName(name) {}
-    bool isSupported(const ServiceLocatorParamsPtr &params, const Ice::Current &)
-    {
-        RoutingStateReplicatorParamsPtr routingParams = RoutingStateReplicatorParamsPtr::dynamicCast(params);
-        if (routingParams->name == mName)
-        {
-            return true;
-        }
-        return false;
-    }
-private:
-    string mName;
-};
-
-typedef IceUtil::Handle<BasicRoutingStateReplicatorCompare> BasicRoutingStateReplicatorComparePtr;
-
 /**
  * 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 Discovery::V1::ServiceManagementPrx& serviceManagement, 
+		 const string& category,
+		 const string& service,
+		 const string& id="")
 {
     // Add category as a parameter to enable other components look this component up.
     ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams;
     genericparams->category = category;
+    genericparams->service = service;
+    genericparams->id = id;
     serviceManagement->addLocatorParams(genericparams, "");
 }
 
@@ -165,26 +151,20 @@ void BasicRoutingStateReplicatorService::registerWithServiceLocator()
 {
     try
     {
+	string serviceName = mCommunicator->getProperties()->getPropertyWithDefault(
+		mAppName + ".ServiceName", "default");
+
         // Add our ComponentService interface and add it to the Service Locator.
         // Note that this interface has its own adapter.
         string componentServiceGuid(StateReplicatorComponentCategory);
         mComponentServiceManagement = mServiceLocatorManagement->addService(mComponentServicePrx, componentServiceGuid);
-        setCategory(mComponentServiceManagement,  StateReplicatorComponentCategory);
+        setCategory(mComponentServiceManagement,  StateReplicatorComponentCategory, serviceName);
 
         // Add our Replicator interface and add it to the Service Locator.
-        string stateReplicationGuid(StateReplicatorDiscoveryCategory);
-        mStateReplicationManagement = mServiceLocatorManagement->addService(mStateReplicatorPrx, stateReplicationGuid);
-
-        ServiceLocatorParamsPtr discoveryParams = new ServiceLocatorParams();
-        discoveryParams->category = StateReplicatorDiscoveryCategory;
+        mStateReplicationManagement = mServiceLocatorManagement->addService(mStateReplicatorPrx, StateReplicatorDiscoveryCategory);
 
         string replicatorName = mCommunicator->getProperties()->getPropertyWithDefault(mAppName + ".InstanceName", "default");
-        ServiceLocatorParamsComparePrx compareProxy = ServiceLocatorParamsComparePrx::uncheckedCast(
-                                                    mServiceAdapter->addWithUUID(new BasicRoutingStateReplicatorCompare(replicatorName)));
-
-        string compareGuid = IceUtil::generateUUID();
-        mServiceLocatorManagement->addCompare(compareGuid, compareProxy);
-        mStateReplicationManagement->addLocatorParams(discoveryParams, compareGuid);
+	setCategory(mStateReplicationManagement, StateReplicatorDiscoveryCategory, serviceName, replicatorName);
     }
     catch(...)
     {
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 214d391..03c845f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -7,7 +7,7 @@ include_directories(${LUA_INCLUDE_DIR})
 
 astscf_component_init(BasicRoutingService)
 astscf_component_add_slices(BasicRoutingService PROJECT AsteriskSCF/Replication/BasicRoutingService/BasicRoutingStateReplicationIf.ice)
-astscf_component_add_files(BasicRoutingService BasicRoutingServiceApp.cpp)
+astscf_component_add_files(BasicRoutingService Component.cpp)
 astscf_component_add_files(BasicRoutingService SessionRouter.cpp)
 astscf_component_add_files(BasicRoutingService SessionRouter.h)
 astscf_component_add_files(BasicRoutingService RoutingAdmin.cpp)
@@ -31,17 +31,14 @@ astscf_component_add_files(BasicRoutingService SessionListener.h)
 astscf_component_add_files(BasicRoutingService SessionListener.cpp)
 astscf_component_add_files(BasicRoutingService OperationReplicaCache.h)
 astscf_component_add_files(BasicRoutingService OperationReplicaCache.cpp)
-astscf_component_add_files(BasicRoutingService ReplicationContext.h)
-astscf_component_add_files(BasicRoutingService ReplicationContext.cpp)
-astscf_component_add_files(BasicRoutingService TestContext.h)
-astscf_component_add_files(BasicRoutingService TestContext.cpp)
+astscf_component_add_files(BasicRoutingService RoutingReplicationContext.h)
 astscf_component_add_files(BasicRoutingService RoutingStateReplicatorListener.h)
 astscf_component_add_files(BasicRoutingService RoutingStateReplicatorListener.cpp)
 astscf_component_add_ice_libraries(BasicRoutingService IceStorm)
 astscf_component_add_boost_libraries(BasicRoutingService thread date_time core regex)
 astscf_component_add_slice_collection_libraries(BasicRoutingService ASTSCF)
 astscf_component_build_icebox(BasicRoutingService)
-target_link_libraries(BasicRoutingService ${LUA_LIBRARIES} logging-client astscf-util-cpp)
+target_link_libraries(BasicRoutingService ${LUA_LIBRARIES} logging-client astscf-util-cpp  astscf-ice-util-cpp)
 if(UNIX)
   target_link_libraries(BasicRoutingService dl)
 endif()
diff --git a/src/Component.cpp b/src/Component.cpp
new file mode 100644
index 0000000..4272c34
--- /dev/null
+++ b/src/Component.cpp
@@ -0,0 +1,374 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2010-2011, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk SCF project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE.txt file
+ * at the top of the source tree.
+ */
+#include <Ice/Ice.h>
+#include <IceBox/IceBox.h>
+
+#include <boost/thread.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include <AsteriskSCF/Discovery/SmartProxy.h>
+#include <AsteriskSCF/Core/Routing/RoutingIf.h>
+#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
+#include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
+
+#include <AsteriskSCF/Logger/IceLogger.h>
+#include <AsteriskSCF/logger.h>
+
+#include <AsteriskSCF/Component/Component.h>
+#include "AsteriskSCF/Threading/SimpleWorkQueue.h"
+#include "RoutingStateReplicatorListener.h"
+#include "LuaScriptProcessor.h"
+#include "RoutingServiceEventPublisher.h"
+#include "EndpointRegistry.h"
+#include "RoutingAdmin.h"
+#include "SessionRouter.h"
+#include "OperationReplicaCache.h"
+#include "RoutingReplicationContext.h"
+
+using namespace std;
+using namespace AsteriskSCF::SessionCommunications::V1;
+using namespace AsteriskSCF::Core;
+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::Replication::BasicRoutingService::V1;
+
+using namespace AsteriskSCF::Replication;
+using namespace AsteriskSCF::Discovery;
+
+namespace
+{
+Logger lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
+}
+using namespace AsteriskSCF::Core::Routing::V1::Event;
+
+namespace AsteriskSCF
+{
+namespace BasicRoutingService
+{
+class Component : public AsteriskSCF::Component::Component
+{
+public:
+    Component() 
+        : AsteriskSCF::Component::Component(lg, 
+                                      ComponentServiceDiscoveryCategory),
+          mSessionContext(new SessionContext()),
+          mWorkQueue( new AsteriskSCF::Threading::SimpleWorkQueue("SessionRouterWorkQueue")),
+          mListeningToReplicator(false)
+    {
+    }
+
+private:
+    // Required base Component overrides
+    virtual void createPrimaryServices();
+    virtual void preparePrimaryServicesForDiscovery();
+    virtual void createReplicationStateListeners();
+    virtual void stopListeningToStateReplicators();
+    virtual void listenToStateReplicators();
+    virtual void findRemoteServices();
+
+    // Other base Component overrides
+    virtual ReplicationContextPtr createReplicationContext(ReplicationStateType state);
+
+    void locateBridgeManager();
+    void locateStateReplicator();
+
+    SessionContextPtr mSessionContext;
+    boost::shared_ptr<AsteriskSCF::Threading::SimpleWorkQueue> mWorkQueue;
+
+    LocatorRegistrationWrapperPtr mAdminRegistration;
+    LocatorRegistrationWrapperPtr mRegistryLocatorRegistration;
+    LocatorRegistrationWrapperPtr mSessionRouterRegistration;
+
+    // Our published interfaces.
+    BasicSessionRouterPtr mSessionRouter;
+    SessionRouterPrx mSessionRouterPrx;
+
+    RoutingServiceAdminPtr mAdminInteface;
+    RoutingServiceAdminPrx mAdminPrx;
+
+    EndpointRegistryPtr mEndpointRegistry;
+    LocatorRegistryPrx mEndpointRegistryPrx;
+
+    // Remote services
+    AsteriskSCF::Discovery::SmartProxy<BridgeManagerPrx> mBridgeManager;
+
+    // Support objects.
+    RoutingServiceEventPublisherPtr mEventPublisher;
+    boost::shared_ptr<OperationReplicaCache> mOperationReplicaCache;
+
+    // Replication support
+    AsteriskSCF::Discovery::SmartProxy<RoutingStateReplicatorPrx> mStateReplicator;
+    RoutingStateReplicatorListenerPtr mReplicatorListener;
+    RoutingStateReplicatorListenerPrx mReplicatorListenerProxy;
+    bool mListeningToReplicator;
+    boost::shared_mutex mReplicatorLock;
+};
+typedef ::IceUtil::Handle<Component> ComponentPtr;
+
+static const string RegistryLocatorObjectId("RoutingServiceLocatorRegistry");
+static const string RoutingAdminObjectId("RoutingAdmin");
+static const string SessionRouterObjectId("SessionRouter");
+
+/** 
+ * Register as a listener to our state replicator. 
+ * A component in standby mode will do this to monitor state changes
+ * being sent from an active component. 
+ */
+void Component::listenToStateReplicators()
+{
+    boost::unique_lock<boost::shared_mutex> lock(mReplicatorLock); 
+    RoutingReplicationContextPtr routingReplicationContext = 
+        static_pointer_cast<RoutingReplicationContext>(getReplicationContext());
+
+    if (mListeningToReplicator == true)
+    {
+        return;
+    }
+
+    if (!routingReplicationContext->getReplicator().isInitialized())
+    {
+        lg(Error) << getName() << " : State replicator could not be found. Unable to listen for state updates!";
+        return;
+    }
+
+    try
+    {
+        // Are we in standby mode?
+        if (routingReplicationContext->getState() == STANDBY_IN_REPLICA_GROUP)
+        {
+            routingReplicationContext->getReplicator().tryOneWay()->addListener(mReplicatorListenerProxy);
+            mListeningToReplicator = true;
+        }
+    }
+    catch (const Ice::Exception& e)
+    {
+        lg(Error) << e.what();
+        throw;
+    }
+}
+
+/** 
+ * Unregister as a listener to our state replicator. 
+ * A component in active mode doesn't neeed to listen to
+ * state replication data. 
+ */
+void Component::stopListeningToStateReplicators()
+{
+    boost::unique_lock<boost::shared_mutex> lock(mReplicatorLock); 
+    RoutingReplicationContextPtr routingReplicationContext = 
+        static_pointer_cast<RoutingReplicationContext>(getReplicationContext());
+
+    if ((!routingReplicationContext->getReplicator().isInitialized()) || (mListeningToReplicator == false))
+    {
+        return;
+    }
+
+    try
+    {
+        routingReplicationContext->getReplicator().tryOneWay()->removeListener(mReplicatorListenerProxy);
+        mListeningToReplicator = false;
+    }
+    catch (const Ice::Exception& e)
+    {
+        lg(Error) << e.what();
+        throw;
+    }
+}
+
+/**
+ * Prepare this component's public interfaces for discovery via the Service Locator.
+ * This enables other Asterisk SCF components to locate the interfaces we are publishing.
+ */
+void Component::preparePrimaryServicesForDiscovery()
+{
+    try
+    {
+        // Wrap our RoutingAdmin interface for the Service Locator.
+        mAdminRegistration = wrapServiceForRegistration(mAdminPrx, 
+                                                        RoutingServiceAdminDiscoveryCategory);
+        managePrimaryService(mAdminRegistration);
+
+
+        // Wrap our RegistryLocator interface for the Service Locator.
+        mRegistryLocatorRegistration = wrapServiceForRegistration(mEndpointRegistryPrx,
+                                                                  RoutingServiceLocatorRegistryDiscoveryCategory);
+        managePrimaryService(mRegistryLocatorRegistration);
+                      
+
+        // Wrap the SessionRouter interface for the Service Locator.
+        mSessionRouterRegistration = wrapServiceForRegistration(mSessionRouterPrx,
+                                                                SessionRouterDiscoveryCategory);
+        managePrimaryService(mSessionRouterRegistration);
+    }
+    catch(const std::exception& e)
+    {
+        lg(Error) << "Unable to publish component interfaces in " << getName() << BOOST_CURRENT_FUNCTION << 
+            ". Exception: " << e.what();
+        throw; // rethrow
+    }
+}
+
+/**
+ * Locate the BridgeManager using the Service Locator.
+ */
+void Component::locateBridgeManager()
+{
+    try
+    {
+       std::string serviceName = getCommunicator()->getProperties()->getPropertyWithDefault(
+          getName() + ".BridgeServiceName", "default");
+
+        mBridgeManager = AsteriskSCF::Discovery::SmartProxy<BridgeManagerPrx>(
+            getServiceLocator(),
+            new ServiceLocatorParams(BridgeManagerDiscoveryCategory, serviceName, ""),
+            lg);
+    }
+    catch(const AsteriskSCF::Core::Discovery::V1::ServiceNotFound&)
+    {
+        lg(Debug) << "BridgeManager not found. (Safe to ignore ServiceNotFound for briding during startup.)";
+    }
+
+    mSessionContext->bridgeManager = mBridgeManager;
+}
+
+/**
+ * Locate our State Replicator using the Service Locator.
+ */
+void Component::locateStateReplicator()
+{
+    if (getReplicationContext()->getState() == ACTIVE_STANDALONE)
+    {
+        return;
+    }
+
+    ServiceLocatorParamsPtr replicatorParams = new ServiceLocatorParams;
+    replicatorParams->category = StateReplicatorDiscoveryCategory;    
+    replicatorParams->service = getCommunicator()->getProperties()->getPropertyWithDefault(
+          getName() + ".StateReplicatorService", "default");
+    replicatorParams->id = getCommunicator()->getProperties()->getPropertyWithDefault(
+         getName() + ".StateReplicatorId", "");
+
+    try
+    {
+        RoutingReplicationContextPtr routingReplicationContext = 
+            static_pointer_cast<RoutingReplicationContext>(getReplicationContext());
+
+        ReplicatorSmartPrx replicator(getServiceLocator(), replicatorParams, lg);
+        routingReplicationContext->setReplicator(replicator);
+    }
+    catch(const AsteriskSCF::Core::Discovery::V1::ServiceNotFound&)
+    {
+        lg(Error) << getName() << ": StateReplicator not found. Check configuration.";
+        throw;
+    }
+}
+
+/**
+ * Override of factory method to create our replication context. 
+ */
+ReplicationContextPtr Component::createReplicationContext(ReplicationStateType state)
+{
+    RoutingReplicationContextPtr context(new RoutingReplicationContext(state, getTestContext()));
+    return context;
+}
+
+void Component::createPrimaryServices()
+{
+    try
+    {
+        // Get the replication context specific to routing. 
+        RoutingReplicationContextPtr routingReplicationContext = 
+            static_pointer_cast<RoutingReplicationContext>(getReplicationContext());
+
+        // Create a helper class for publishing events. 
+        mEventPublisher = new RoutingServiceEventPublisher(getServiceAdapter());
+
+        // Create and configure the EndpointRegistry.
+        mEndpointRegistry = new EndpointRegistry(ScriptProcessorPtr(new LuaScriptProcessor()), 
+            mEventPublisher, routingReplicationContext);
+        mEndpointRegistryPrx = LocatorRegistryPrx::uncheckedCast(getServiceAdapter()->add(
+            mEndpointRegistry, getCommunicator()->stringToIdentity(RegistryLocatorObjectId)));
+
+        // Create the session context needed to construct operations.
+       mSessionContext = SessionContextPtr(new SessionContext(getServiceAdapter(), 
+                                                                mEndpointRegistry, 
+                                                                mEventPublisher, 
+                                                                mWorkQueue,
+                                                                routingReplicationContext));
+                
+        // Create the replica cache. 
+        mOperationReplicaCache = OperationReplicaCachePtr(new OperationReplicaCache(mSessionContext));
+
+        // Create the SessionRouter interface.
+        mSessionRouter = new SessionRouter(mSessionContext, mOperationReplicaCache);
+        mSessionRouterPrx = SessionRouterPrx::uncheckedCast(
+                getServiceAdapter()->add(mSessionRouter, getCommunicator()->stringToIdentity(SessionRouterObjectId)));
+
+        // Create and publish the Admin interface support.
+        mAdminInteface = new RoutingAdmin(mEndpointRegistry);
+        mAdminPrx = RoutingServiceAdminPrx::uncheckedCast(
+            getServiceAdapter()->add(mAdminInteface, getCommunicator()->stringToIdentity(RoutingAdminObjectId)));
+    }
+    catch(const Ice::Exception& e)
+    {
+        lg(Error) << "Unable to create services in " << getName() << BOOST_CURRENT_FUNCTION << 
+            ". Exception: " << e.what();
+        throw;
+    }
+}
+
+void Component::createReplicationStateListeners()
+{
+    RoutingStateReplicatorListenerPrx prx;
+    try
+    {
+        // Create and publish our state replicator listener interface on the backplane adapter. 
+        mReplicatorListener = new RoutingStateReplicatorListenerImpl(mEndpointRegistry, mOperationReplicaCache);
+        prx = 
+            RoutingStateReplicatorListenerPrx::uncheckedCast(getBackplaneAdapter()->addWithUUID(mReplicatorListener));
+  
+        mReplicatorListenerProxy = RoutingStateReplicatorListenerPrx::uncheckedCast(prx->ice_oneway());
+    }
+    catch (const Ice::NoEndpointException&)
+    {
+        mReplicatorListenerProxy = prx; // use the two-way if configuration prohibits oneway.
+    }
+    catch(const Ice::Exception &e)
+    {
+        lg(Error) << "Problems in " << getName() << " " << BOOST_CURRENT_FUNCTION << e.what();
+        throw;
+    }
+}
+
+void Component::findRemoteServices() 
+{
+    locateBridgeManager();
+    locateStateReplicator();
+}
+
+} // end BasicRoutingService
+} // end AsteriskSCF
+
+extern "C"
+{
+ASTSCF_DLL_EXPORT IceBox::Service* create(::Ice::CommunicatorPtr)
+{
+    return new AsteriskSCF::BasicRoutingService::Component;
+}
+}
+
diff --git a/src/ConnectBridgedSessionsWithDestinationOperation.cpp b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
index 449d36c..844bd7e 100644
--- a/src/ConnectBridgedSessionsWithDestinationOperation.cpp
+++ b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
@@ -47,7 +47,7 @@ class ConnectBridgedSessionsWithDestReplicatingListener :
 {
 public:
     ConnectBridgedSessionsWithDestReplicatingListener(ConnectBridgedSessionsWithDestinationOperationPtr op, 
-                                                      const ReplicationContextPtr& replication)  
+                                                      const RoutingReplicationContextPtr& replication)  
                                                          : mOperationId(op->getOperationId()),
                                                            mOperation(op), 
                                                            mReplicationContext(replication)
@@ -77,7 +77,8 @@ public:
                 ConnectBridgedSessionsWithDestinationOpStartPtr 
                      opStart(new ConnectBridgedSessionsWithDestinationOpStart());
                 opStart->operationId = mOperation->getOperationId();
-                opStart->key = mOperation->getOperationId() + ConnectBridgedSessionsWithDestStartKeyMod;
+                opStart->key = mOperation->getOperationId() + 
+                     ConnectBridgedSessionsWithDestStartKeyMod;
                 opStart->sessionToReplace = mOperation->getSessionToReplace();
                 opStart->destination = mOperation->getDestination();
 
@@ -91,7 +92,8 @@ public:
             ConnectBridgedSessionsWithDestinationOpWaitLookupStatePtr 
                  waitLookup(new ConnectBridgedSessionsWithDestinationOpWaitLookupState());
             waitLookup->operationId = mOperation->getOperationId();
-            waitLookup->key = mOperation->getOperationId() + RouteSessionOpWaitLookupKeyMod;
+            waitLookup->key = mOperation->getOperationId() + 
+                 RouteSessionOpWaitLookupKeyMod;
             waitLookup->endpoints = mOperation->getLookupResult();
             waitLookup->remainingSessions = mOperation->getRemainingSessions();
 
@@ -109,7 +111,7 @@ public:
         RoutingStateItemSeq setItems;
 
         setItems.push_back(item);
-        mReplicationContext->getReplicatorService()->setState(setItems);
+        mReplicationContext->getReplicator()->setState(setItems);
         
         // Cache the replicated items.
         mReplicatedState.push_back(item);
@@ -133,7 +135,7 @@ public:
             {
                 // We just completed the entire operation. 
                 // Remove the items that represented this operation's state transitions from the state replicator.
-                mReplicationContext->getReplicatorService()->removeStateForItems(mReplicatedState);
+                mReplicationContext->getReplicator()->removeStateForItems(mReplicatedState);
             }
         }
         catch(...)
@@ -166,7 +168,8 @@ public:
             ConnectBridgedSessionsWithDestinationOpBridgingStatePtr 
                  bridgeOp(new ConnectBridgedSessionsWithDestinationOpBridgingState());
             bridgeOp->operationId = mOperation->getOperationId();
-            bridgeOp->key = mOperation->getOperationId() + RouteSessionOpBridgingKeyMod;
+            bridgeOp->key = mOperation->getOperationId() + 
+                    RouteSessionOpBridgingKeyMod;
             bridgeOp->bridge = mOperation->getBridge();
 
             pushState(bridgeOp);
@@ -183,7 +186,7 @@ private:
     RoutingStateItemSeq mReplicatedState;
     std::string mOperationId;
     ConnectBridgedSessionsWithDestinationOperationPtr mOperation;
-    ReplicationContextPtr mReplicationContext;
+    RoutingReplicationContextPtr mReplicationContext;
 
 }; // end ConnectBridgedSessionsWithDestReplicatingListener
 
@@ -208,7 +211,7 @@ void ConnectBridgedSessionsWithDestinationOperation::initStateMachine()
 ConnectBridgedSessionsWithDestinationOperation::ConnectBridgedSessionsWithDestinationOperation(
                           const AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr& cb,
                           const std::string& operationId,
-                          const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
+                          const SessionPrx& sessionToReplace, 
                           const ::std::string& destination, 
                           const ::Ice::Current& current,
                           const SessionContextPtr& context,
@@ -232,7 +235,7 @@ ConnectBridgedSessionsWithDestinationOperation::ConnectBridgedSessionsWithDestin
 ConnectBridgedSessionsWithDestinationOperationPtr ConnectBridgedSessionsWithDestinationOperation::create(
                           const AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr& cb,
                           const std::string& operationId,
-                          const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
+                          const SessionPrx& sessionToReplace, 
                           const ::std::string& destination, 
                           const ::Ice::Current& current,
                           const SessionContextPtr& context,
@@ -247,7 +250,8 @@ ConnectBridgedSessionsWithDestinationOperationPtr ConnectBridgedSessionsWithDest
                                                         context,
                                                         listener) );
 
-    boost::shared_ptr<SimpleStateMachine<ConnectBridgedSessionsWithDestinationOp::OperationState>::StateMachineListener> replicatingListener(new ConnectBridgedSessionsWithDestReplicatingListener(op, context->replicationContext));
+    boost::shared_ptr<SimpleStateMachine<ConnectBridgedSessionsWithDestinationOp::OperationState>::StateMachineListener> 
+        replicatingListener(new ConnectBridgedSessionsWithDestReplicatingListener(op, context->replicationContext));
     op->addStateMachineListener(replicatingListener);
 
     return op;
@@ -280,7 +284,8 @@ ConnectBridgedSessionsWithDestinationOperation::~ConnectBridgedSessionsWithDesti
         lg(Debug) << "ConnectBridgedSessionsWithDestinationOperation() being destroyed for " << mDestination ;
 }
 
-void ConnectBridgedSessionsWithDestinationOperation::reflectUpdate(const AsteriskSCF::Replication::BasicRoutingService::V1::OperationStateItemPtr& stateItem)
+void ConnectBridgedSessionsWithDestinationOperation::reflectUpdate(
+    const OperationStateItemPtr& stateItem)
 {
     ConnectBridgedSessionsWithDestinationOpStartPtr start;
     ConnectBridgedSessionsWithDestinationOpWaitLookupStatePtr waitLookup;
@@ -300,7 +305,8 @@ void ConnectBridgedSessionsWithDestinationOperation::reflectUpdate(const Asteris
     }
 }
 
-void ConnectBridgedSessionsWithDestinationOperation::reflectUpdate(const ConnectBridgedSessionsWithDestinationOpStartPtr& item)
+void ConnectBridgedSessionsWithDestinationOperation::reflectUpdate(
+    const ConnectBridgedSessionsWithDestinationOpStartPtr& item)
 {
     mSessionToReplace = item->sessionToReplace;
     mDestination = item->destination;
@@ -309,13 +315,15 @@ void ConnectBridgedSessionsWithDestinationOperation::reflectUpdate(const Connect
     mReplicatedStates.push_back(ConnectBridgedSessionsWithDestinationOp::STATE_LOOKUP);
 }
 
-void ConnectBridgedSessionsWithDestinationOperation::reflectUpdate(const ConnectBridgedSessionsWithDestinationOpWaitLookupStatePtr& item)
+void ConnectBridgedSessionsWithDestinationOperation::reflectUpdate(
+    const ConnectBridgedSessionsWithDestinationOpWaitLookupStatePtr& item)
 {
     mLookupResult = item->endpoints;
     mReplicatedStates.push_back(ConnectBridgedSessionsWithDestinationOp::STATE_WAIT_LOOKUP_RESULTS);
 }
 
-void ConnectBridgedSessionsWithDestinationOperation::reflectUpdate(const ConnectBridgedSessionsWithDestinationOpBridgingStatePtr& item)
+void ConnectBridgedSessionsWithDestinationOperation::reflectUpdate(
+    const ConnectBridgedSessionsWithDestinationOpBridgingStatePtr& item)
 {
     mBridge = item->bridge;
 
@@ -495,7 +503,7 @@ void ConnectBridgedSessionsWithDestinationOperation::establishBridgeState()
     // Test instrumentation
     if (mSessionContext->replicationContext->getTestContext().get() != 0)
     {
-        if (mSessionContext->replicationContext->getTestContext()->getTestMode() == "ConnectBridgedSessWithDestFailover")
+        if (mSessionContext->replicationContext->getTestContext()->hasTestMode("ConnectBridgedSessWithDestFailover"))
         {
             // We're going to just shutdown this operation right here, with no replies to the caller. 
             // This is so that an external test can verify the replica can take it the rest of the way.
diff --git a/src/EndpointRegistry.cpp b/src/EndpointRegistry.cpp
index bc794ca..97cc956 100644
--- a/src/EndpointRegistry.cpp
+++ b/src/EndpointRegistry.cpp
@@ -82,7 +82,7 @@ class EndpointRegistryPriv
 public:
     EndpointRegistryPriv(const ScriptProcessorPtr& scriptProcessor, 
                          const RoutingEventsPtr& eventPublisher, 
-                         const ReplicationContextPtr& replicationContext) :
+                         const RoutingReplicationContextPtr& replicationContext) :
             mScriptProcessor(scriptProcessor), 
             mEventPublisher(eventPublisher),
             mReplicationContext(replicationContext)
@@ -124,7 +124,7 @@ public:
      */
     void forwardRemoveEndpointLocator(const std::string& locatorId, Event::OperationResult result)
     {
-        if (!mReplicationContext->isComponentActive())
+        if (!mReplicationContext->isReplicating())
         {
             return;
         }
@@ -141,7 +141,8 @@ public:
                 addEndpointItem->key = locatorId;
                 removeItems.push_back(addEndpointItem);
 
-                mReplicationContext->getReplicatorService()->removeStateForItems(removeItems);
+                lg(Debug) << BOOST_CURRENT_FUNCTION << ": Sending replicator state removal for locator " << locatorId;
+                mReplicationContext->getReplicator()->removeStateForItems(removeItems);
             }
             catch(const Ice::Exception& e)
             {
@@ -161,7 +162,7 @@ public:
                                    const EndpointLocatorPrx& locator, 
                                    Event::OperationResult result)
     {
-        if (!mReplicationContext->isComponentActive())
+        if (!mReplicationContext->isReplicating())
         {
             return;
         }
@@ -181,7 +182,9 @@ public:
 
                 setItems.push_back(addEndpointItem);
 
-                mReplicationContext->getReplicatorService()->setState(setItems);
+                lg(Debug) << BOOST_CURRENT_FUNCTION << ": Sending replicator state update for new locator " << locatorId;
+                mReplicationContext->getReplicator()->setState(setItems);
+
             }
             catch(const Ice::Exception& e)
             {
@@ -198,7 +201,7 @@ public:
                                             const EndpointLocatorPrx& locator, 
                                             OperationResult result)
     {
-        if (!mReplicationContext->isComponentActive())
+        if (!mReplicationContext->isReplicating())
         {
             return;
         }
@@ -216,7 +219,7 @@ public:
                     removeItem->key = locatorId;
                     removeItems.push_back(removeItem);
 
-                    mReplicationContext->getReplicatorService()->removeStateForItems(removeItems);
+                    mReplicationContext->getReplicator()->removeStateForItems(removeItems);
 
                     // Now add the item with the new values. 
                     RoutingStateItemSeq setItems;
@@ -227,7 +230,7 @@ public:
 
                     setItems.push_back(addEndpointItem);
 
-                    mReplicationContext->getReplicatorService()->setState(setItems);
+                    mReplicationContext->getReplicator()->setState(setItems);
                 }
             }
             catch(const Ice::Exception& e)
@@ -255,7 +258,7 @@ public:
     ScriptProcessorPtr mScriptProcessor;
     EndpointLocatorMap mEndpointLocatorMap;
     const RoutingEventsPtr mEventPublisher;
-    ReplicationContextPtr mReplicationContext;
+    RoutingReplicationContextPtr mReplicationContext;
 };
 
 /**
@@ -362,7 +365,7 @@ typedef IceUtil::Handle<LookupResultCollector> LookupResultCollectorPtr;
  */
 EndpointRegistry::EndpointRegistry(const ScriptProcessorPtr& scriptProcessor, 
                                    const RoutingEventsPtr& eventPublisher,
-                                   const ReplicationContextPtr& replicationContext) :
+                                   const RoutingReplicationContextPtr& replicationContext) :
     mImpl(new EndpointRegistryPriv(scriptProcessor, eventPublisher, replicationContext))
 {
 }
diff --git a/src/EndpointRegistry.h b/src/EndpointRegistry.h
index 4e7e32e..e1413c5 100644
--- a/src/EndpointRegistry.h
+++ b/src/EndpointRegistry.h
@@ -21,7 +21,7 @@
 #include <AsteriskSCF/Discovery/SmartProxy.h>
 
 #include "BasicRoutingStateReplicationIf.h"
-#include "ReplicationContext.h"
+#include "RoutingReplicationContext.h"
 #include "ScriptProcessor.h"
 
 namespace AsteriskSCF
@@ -36,7 +36,7 @@ class EndpointRegistry : public AsteriskSCF::Core::Routing::V1::LocatorRegistry
 public:
     EndpointRegistry(const ScriptProcessorPtr& scriptProcessor, 
                      const AsteriskSCF::Core::Routing::V1::Event::RoutingEventsPtr& eventPublisher,
-                     const ReplicationContextPtr& replicationContext);
+                     const RoutingReplicationContextPtr& replicationContext);
 
     /**
      * Configure the EndpointRegistry to use a different scriptProcessor than the
diff --git a/src/ReplicationContext.cpp b/src/ReplicationContext.cpp
deleted file mode 100644
index ad58952..0000000
--- a/src/ReplicationContext.cpp
+++ /dev/null
... 852 lines suppressed ...


-- 
asterisk-scf/integration/routing.git



More information about the asterisk-scf-commits mailing list