[asterisk-scf-commits] asterisk-scf/release/ice-util-cpp.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Feb 10 11:37:02 CST 2012


branch "master" has been updated
       via  7f7102094df3e6156379bf254e8c9ab868f6c90b (commit)
      from  e94c750e182b375000357a2c7c92d878ea51ae32 (commit)

Summary of changes:
 .../Component/ComponentStateReplicator.h           |    5 +++-
 src/Component/ComponentStateReplicator.cpp         |   24 +++++++++++++++----
 2 files changed, 23 insertions(+), 6 deletions(-)


- Log -----------------------------------------------------------------
commit 7f7102094df3e6156379bf254e8c9ab868f6c90b
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Fri Feb 10 11:36:42 2012 -0600

    Fixes for configuration registration with ServiceLocator.

diff --git a/include/AsteriskSCF/Component/ComponentStateReplicator.h b/include/AsteriskSCF/Component/ComponentStateReplicator.h
index ffeac17..7ede98c 100644
--- a/include/AsteriskSCF/Component/ComponentStateReplicator.h
+++ b/include/AsteriskSCF/Component/ComponentStateReplicator.h
@@ -34,7 +34,8 @@ class ASTSCF_DLL_EXPORT ComponentStateReplicator : public AsteriskSCF::Component
 public:
     ComponentStateReplicator(const AsteriskSCF::System::Logging::Logger& logger,
               const std::string& componentDiscoveryCategory,
-              bool replicatesConfiguration);
+              bool replicatesConfiguration,
+              const std::string& configurationDiscoveryCategory);
 
 protected:
    
@@ -119,7 +120,9 @@ private:
     AsteriskSCF::System::Configuration::V1::ConfigurationReplicatorPtr mConfigurationReplicator;
     AsteriskSCF::CollocatedIceStorm::CollocatedIceStormPtr mIceStorm;
     Ice::ObjectPrx mConfigurationPublisher;
+    AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx mConfigurationManagement;
     bool mReplicatesConfiguration;
+    std::string mConfigurationDiscoveryCategory;
 };
 
 } // end namespace Component
diff --git a/src/Component/ComponentStateReplicator.cpp b/src/Component/ComponentStateReplicator.cpp
index c8e70f8..2b8686e 100644
--- a/src/Component/ComponentStateReplicator.cpp
+++ b/src/Component/ComponentStateReplicator.cpp
@@ -78,11 +78,14 @@ void ConfigurationReplicatorImpl::registerConfigurationService(const AsteriskSCF
         }
     }
 }
-ComponentStateReplicator::ComponentStateReplicator(const AsteriskSCF::System::Logging::Logger& logger,
-                     const string& componentDiscoveryCategory,
-                     bool replicatesConfiguration) :
-      Component(logger, componentDiscoveryCategory),
-      mReplicatesConfiguration(replicatesConfiguration)
+ComponentStateReplicator::ComponentStateReplicator(
+      const AsteriskSCF::System::Logging::Logger& logger,
+      const string& componentDiscoveryCategory,
+      bool replicatesConfiguration,
+      const string& configurationDiscoveryCategory) :
+          Component(logger, componentDiscoveryCategory),
+          mReplicatesConfiguration(replicatesConfiguration),
+          mConfigurationDiscoveryCategory(configurationDiscoveryCategory)
 {
 }
 
@@ -189,6 +192,17 @@ void ComponentStateReplicator::onPreServiceCreation()
     if (mReplicatesConfiguration)
     {
         createConfigurationReplicationService();
+
+        // Publish the configuration service IceStorm topic so everybody gets configuration
+        mConfigurationManagement = ServiceManagementPrx::uncheckedCast(
+            getServiceLocatorManagement()->addService(mConfigurationPublisher, ""));
+
+        ServiceLocatorParamsPtr configurationParams = new ServiceLocatorParams();
+        configurationParams->category = mConfigurationDiscoveryCategory;
+        configurationParams->service = getCommunicator()->getProperties()->getPropertyWithDefault(getName() + ".ServiceName", 
+            "default");
+        configurationParams->id = getCommunicator()->getProperties()->getPropertyWithDefault(getName() + ".Name", "");
+        mConfigurationManagement->addLocatorParams(configurationParams, "");
     }
 }
 

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


-- 
asterisk-scf/release/ice-util-cpp.git



More information about the asterisk-scf-commits mailing list