[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Sep 23 11:09:21 CDT 2010


branch "master" has been updated
       via  b44edb278caaf91626aadbdb850cdaab21cd8e93 (commit)
      from  7eaef3468a69d7debf5b30dca76718ac5365aa9a (commit)

Summary of changes:
 local-slice/SipStateReplicationIf.ice |    2 +-
 src/SipStateReplicatorApp.cpp         |   23 +++++++++++++++++++----
 2 files changed, 20 insertions(+), 5 deletions(-)


- Log -----------------------------------------------------------------
commit b44edb278caaf91626aadbdb850cdaab21cd8e93
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Sep 23 11:09:29 2010 -0500

    Actually add the state replicator to the service locator.

diff --git a/local-slice/SipStateReplicationIf.ice b/local-slice/SipStateReplicationIf.ice
index 4354ab6..be1874e 100644
--- a/local-slice/SipStateReplicationIf.ice
+++ b/local-slice/SipStateReplicationIf.ice
@@ -12,8 +12,8 @@ module SIP
 ["suppress"]
 module V1
 {
+   const string StateReplicatorComponentCategory = "SipStateReplicatorComponent";
    const string StateReplicatorDiscoveryCategory = "SipStateReplicator";
-   const string StateReplicatorCompareGuid = "SipStateReplicatorCompare";
 
    class SipStateReplicatorParams extends AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams
    {
diff --git a/src/SipStateReplicatorApp.cpp b/src/SipStateReplicatorApp.cpp
index 464d1e1..6797a3e 100644
--- a/src/SipStateReplicatorApp.cpp
+++ b/src/SipStateReplicatorApp.cpp
@@ -42,11 +42,13 @@ private:
    Ice::ObjectAdapterPtr mAdapter;
    ServiceLocatorManagementPrx mServiceLocatorManagement;
    Discovery::V1::ServiceManagementPrx mComponentServiceManagement;
+   Discovery::V1::ServiceManagementPrx mStateReplicationManagement;
    ComponentServicePtr mComponentService;
    SipStateReplicatorIPtr mStateReplicator;
 };
 
 static const string ComponentServiceId("SipStateReplicatorComponent");
+static const string ServiceDiscoveryId("SipStateReplicatorService");
 
 /**
  * This class provides implementation for the ComponentService interface, which
@@ -128,19 +130,31 @@ void SipStateReplicatorApp::registerWithServiceLocator()
 		ComponentServicePrx componentServicePrx = ComponentServicePrx::checkedCast(componentServiceObjectPrx);
 
 		// The GUID passed in to add service needs to be unique for reporting.
-		string componentServiceGuid(AsteriskSCF::SIP::V1::StateReplicatorDiscoveryCategory);
+		string componentServiceGuid(AsteriskSCF::SIP::V1::StateReplicatorComponentCategory);
 		mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(componentServicePrx, componentServiceGuid));
 
 		// Add category as a parameter to enable other components look this component up.
 		ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
-		genericparams->category = AsteriskSCF::SIP::V1::StateReplicatorDiscoveryCategory;
+		genericparams->category = AsteriskSCF::SIP::V1::StateReplicatorComponentCategory;
+
+		mComponentServiceManagement->addLocatorParams(genericparams, "");
+
+		Ice::ObjectPrx stateReplicatorObjectPrx = mAdapter->createDirectProxy(communicator()->stringToIdentity(ServiceDiscoveryId));
+		SipStateReplicatorPrx stateReplicatorPrx = SipStateReplicatorPrx::checkedCast(stateReplicatorObjectPrx);
+
+		string stateReplicationGuid(AsteriskSCF::SIP::V1::StateReplicatorDiscoveryCategory);
+		mStateReplicationManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(stateReplicatorPrx, stateReplicationGuid));
+
+		ServiceLocatorParamsPtr discoveryParams = new ServiceLocatorParams();
+		discoveryParams->category = AsteriskSCF::SIP::V1::StateReplicatorDiscoveryCategory;
+
 		string replicatorName = communicator()->getProperties()->getPropertyWithDefault("SipStateReplicator.Name", "default");
 		SipStateReplicatorCompare* nameCompare = new SipStateReplicatorCompare(replicatorName);
 		ServiceLocatorParamsComparePrx compareProxy = ServiceLocatorParamsComparePrx::uncheckedCast(mAdapter->addWithUUID(nameCompare));
 
 		string compareGuid = IceUtil::generateUUID();
 		mServiceLocatorManagement->addCompare(compareGuid, compareProxy);
-		mComponentServiceManagement->addLocatorParams(genericparams, compareGuid);
+		mStateReplicationManagement->addLocatorParams(discoveryParams, compareGuid);
 
 		// TBD... We may have other interfaces to publish to the Service Locator.
 	}
@@ -169,12 +183,13 @@ void SipStateReplicatorApp::deregisterFromServiceLocator()
 
 void SipStateReplicatorApp::initialize(const std::string appName)
 {
-   mStateReplicator = new SipStateReplicatorI(communicator()->getProperties()->getPropertyWithDefault("SipStateReplicator.Name", "default"));
    mAdapter = communicator()->createObjectAdapter("SipStateReplicator");
    mAppName = appName;
    // Create and publish our ComponentService interface support.
    mComponentService = new ComponentServiceImpl(*this);
    mAdapter->add(mComponentService, communicator()->stringToIdentity(ComponentServiceId));
+   mStateReplicator = new SipStateReplicatorI(communicator()->getProperties()->getPropertyWithDefault("SipStateReplicator.Name", "default"));
+   mAdapter->add(mStateReplicator, communicator()->stringToIdentity(ServiceDiscoveryId));
 
    mAdapter->activate();
 }

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list