[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "locate-with-id" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Jun 28 20:54:12 CDT 2011


branch "locate-with-id" has been created
        at  dcfca3f485a267892681bcf5639e7fcf7a9ba797 (commit)

- Log -----------------------------------------------------------------
commit dcfca3f485a267892681bcf5639e7fcf7a9ba797
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Tue Jun 28 20:53:16 2011 -0500

    Mods for changes to ServiceLocator.

diff --git a/local-slice/SipConfigurationIf.ice b/local-slice/SipConfigurationIf.ice
index ddfe65d..ee45b3a 100644
--- a/local-slice/SipConfigurationIf.ice
+++ b/local-slice/SipConfigurationIf.ice
@@ -33,17 +33,6 @@ module V1
    const string ConfigurationDiscoveryCategory = "SipConfiguration";
 
    /**
-    * Service locator parameters class for discovering the configuration service
-    */
-   unsliceable class SipConfigurationParams extends AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams
-   {
-       /**
-	* Unique name for the configuration service
-	*/
-       string name;
-   };
-
-   /**
     * Local visitor class for visiting SIP configuration groups
     */
    local class SipConfigurationGroupVisitor extends AsteriskSCF::System::Configuration::V1::ConfigurationGroupVisitor
diff --git a/local-slice/SipStateReplicationIf.ice b/local-slice/SipStateReplicationIf.ice
index aae6991..43b71c2 100644
--- a/local-slice/SipStateReplicationIf.ice
+++ b/local-slice/SipStateReplicationIf.ice
@@ -32,11 +32,6 @@ module V1
    const string StateReplicatorComponentCategory = "SipStateReplicatorComponent";
    const string StateReplicatorDiscoveryCategory = "SipStateReplicator";
 
-   unsliceable class SipStateReplicatorParams extends AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams
-   {
-      string mName;
-   };
-
    class SipStateItem
    {
       string key;
diff --git a/src/SipSessionManagerApp.cpp b/src/SipSessionManagerApp.cpp
index 7e4bb4e..21dc803 100644
--- a/src/SipSessionManagerApp.cpp
+++ b/src/SipSessionManagerApp.cpp
@@ -234,28 +234,6 @@ private:
 };
 
 /**
- * Comparator implementation for name based configuration service locating
- */
-class SipConfigurationCompare : public ServiceLocatorParamsCompare
-{
-public:
-    SipConfigurationCompare(const string& name) : mName(name) {}
-    bool isSupported(const ServiceLocatorParamsPtr &params, const Ice::Current &)
-    {
-        SipConfigurationParamsPtr configParams = SipConfigurationParamsPtr::dynamicCast(params);
-        if (configParams->name == mName)
-        {
-            return true;
-        }
-        return false;
-    }
-private:
-    string mName;
-};
-
-typedef IceUtil::Handle<SipConfigurationCompare> SipConfigurationComparePtr;
-
-/**
  * Helper function to add some parameters to one of our registered interfaces in the ServiceLocator, so that
  * other components can look up our interfaces.
  */
@@ -305,18 +283,11 @@ void SipSessionManager::registerWithServiceLocator()
 		mServiceLocatorManagement->addService(mConfigurationServiceProxy, ""));
 
 	    // Populate the configuration parameters with details so we can be found
-	    SipConfigurationParamsPtr configurationParams = new SipConfigurationParams();
+	    ServiceLocatorParamsPtr configurationParams = new ServiceLocatorParams();
 	    configurationParams->category = ConfigurationDiscoveryCategory;
-	    configurationParams->name = mCommunicator->getProperties()->getPropertyWithDefault("SipConfiguration.Name", "");
-
-	    // Add our custom comparator so we can support multiple simultaneous configuration sinks
-	    SipConfigurationComparePtr configNameCompare = new SipConfigurationCompare(configurationParams->name);
-	    ServiceLocatorParamsComparePrx configCompareProxy = ServiceLocatorParamsComparePrx::uncheckedCast(
-		mLocalAdapter->addWithUUID(configNameCompare));
-
-	    mConfigCompareGuid = IceUtil::generateUUID();
-	    mServiceLocatorManagement->addCompare(mConfigCompareGuid, configCompareProxy);
-	    mConfigurationManagement->addLocatorParams(configurationParams, mConfigCompareGuid);
+	    configurationParams->service = mCommunicator->getProperties()->getPropertyWithDefault("SipConfiguration.Service", "");
+	    configurationParams->id = mCommunicator->getProperties()->getPropertyWithDefault("SipConfiguration.Id", "");
+	    mConfigurationManagement->addLocatorParams(configurationParams, "");
 	}
 
         // TBD... We may have other interfaces to publish to the Service Locator.
@@ -379,9 +350,11 @@ void SipSessionManager::locateStateReplicator()
         mServiceLocator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
     }
 
-    SIP::V1::SipStateReplicatorParamsPtr replicatorParams = new SIP::V1::SipStateReplicatorParams();
+    ServiceLocatorParamsPtr replicatorParams = new ServiceLocatorParams();
     replicatorParams->category = SIP::V1::StateReplicatorDiscoveryCategory;
-    replicatorParams->mName =
+    replicatorParams->service =
+        mCommunicator->getProperties()->getPropertyWithDefault("Sip.StateReplicatorService", "default");
+    replicatorParams->id =
         mCommunicator->getProperties()->getPropertyWithDefault("Sip.StateReplicatorName", "default");
 
     try
diff --git a/src/SipStateReplicatorApp.cpp b/src/SipStateReplicatorApp - Copy.cpp
similarity index 87%
copy from src/SipStateReplicatorApp.cpp
copy to src/SipStateReplicatorApp - Copy.cpp
index a93b109..868fa7c 100644
--- a/src/SipStateReplicatorApp.cpp
+++ b/src/SipStateReplicatorApp - Copy.cpp	
@@ -112,44 +112,6 @@ private:
     SipStateReplicatorService& mService; // TODO: Reference?
 };
 
-class SipStateReplicatorCompare : public ServiceLocatorParamsCompare
-{
-public:
-    SipStateReplicatorCompare(const string&  name) : mName(name) {}
-    bool isSupported(const ServiceLocatorParamsPtr &params, const Ice::Current &)
-    {
-        SipStateReplicatorParamsPtr sipParams = SipStateReplicatorParamsPtr::dynamicCast(params);
-        if (sipParams->mName == mName)
-        {
-            return true;
-        }
-        return false;
-    }
-private:
-    string mName;
-};
-
-typedef IceUtil::Handle<SipStateReplicatorCompare> SipStateReplicatorComparePtr;
-
-class SipConfigurationCompare : public ServiceLocatorParamsCompare
-{
-public:
-    SipConfigurationCompare(const string& name) : mName(name) {}
-    bool isSupported(const ServiceLocatorParamsPtr &params, const Ice::Current &)
-    {
-        SipConfigurationParamsPtr configParams = SipConfigurationParamsPtr::dynamicCast(params);
-        if (configParams->name == mName)
-        {
-            return true;
-        }
-        return false;
-    }
-private:
-    string mName;
-};
-
-typedef IceUtil::Handle<SipConfigurationCompare> SipConfigurationComparePtr;
-
 class ConfigurationReplicatorI : public ConfigurationReplicator
 {
 public:
@@ -222,11 +184,14 @@ void SipStateReplicatorService::registerWithServiceLocator(const Ice::Communicat
 
         ServiceLocatorParamsPtr discoveryParams = new ServiceLocatorParams();
         discoveryParams->category = AsteriskSCF::SIP::V1::StateReplicatorDiscoveryCategory;
+        discoveryParams->service = ic->getProperties()->getPropertyWithDefault("SipStateReplicator.Service", "default");
 
-        string replicatorName = ic->getProperties()->getPropertyWithDefault("SipStateReplicator.Name", "default");
-        SipStateReplicatorCompare* nameCompare = new SipStateReplicatorCompare(replicatorName);
+        ServiceLocatorParamsPtr nameParams = new ServiceLocatorParams;
+        nameParams->category = AsteriskSCF::SIP::V1::StateReplicatorDiscoveryCategory;
+        nameParams->service = ic->getProperties()->getPropertyWithDefault("SipStateReplicator.Service", "default");
+        nameParams->id = ic->getProperties()->getPropertyWithDefault("SipStateReplicator.Name", "default");
         ServiceLocatorParamsComparePrx compareProxy =
-            ServiceLocatorParamsComparePrx::uncheckedCast(mAdapter->addWithUUID(nameCompare));
+            ServiceLocatorParamsComparePrx::uncheckedCast(mAdapter->addWithUUID(nameParams));
 
         string compareGuid = IceUtil::generateUUID();
         mServiceLocatorManagement->addCompare(compareGuid, compareProxy);
@@ -237,12 +202,15 @@ void SipStateReplicatorService::registerWithServiceLocator(const Ice::Communicat
             mServiceLocatorManagement->addService(mConfigurationPublisher, ""));
 
         // Populate the configuration parameters with details so we can be found
-        SipConfigurationParamsPtr configurationParams = new SipConfigurationParams();
+        ServiceLocatorParamsPtr configurationParams = new ServiceLocatorParams();
         configurationParams->category = ConfigurationDiscoveryCategory;
-        configurationParams->name = ic->getProperties()->getPropertyWithDefault("SipConfiguration.Name", "");
+        configurationParams->service = ic->getProperties()->getPropertyWithDefault("SipConfiguration.Service", "default");
+        configurationParams->id = ic->getProperties()->getPropertyWithDefault("SipConfiguration.Name", "");
 
         // Add our custom comparator so we can support multiple simultaneous configuration sinks
-        SipConfigurationComparePtr configNameCompare = new SipConfigurationCompare(configurationParams->name);
+        ServiceLocatorParamsPtr configNameCompare = new ServiceLocatorParams;
+        configurationParams->category = ConfigurationDiscoveryCategory;
+        configNameCompare->id = configurationParams->id;
         ServiceLocatorParamsComparePrx configCompareProxy = ServiceLocatorParamsComparePrx::uncheckedCast(
             mAdapter->addWithUUID(configNameCompare));
 
diff --git a/src/SipStateReplicatorApp.cpp b/src/SipStateReplicatorApp.cpp
index a93b109..28ed3cb 100644
--- a/src/SipStateReplicatorApp.cpp
+++ b/src/SipStateReplicatorApp.cpp
@@ -112,44 +112,6 @@ private:
     SipStateReplicatorService& mService; // TODO: Reference?
 };
 
-class SipStateReplicatorCompare : public ServiceLocatorParamsCompare
-{
-public:
-    SipStateReplicatorCompare(const string&  name) : mName(name) {}
-    bool isSupported(const ServiceLocatorParamsPtr &params, const Ice::Current &)
-    {
-        SipStateReplicatorParamsPtr sipParams = SipStateReplicatorParamsPtr::dynamicCast(params);
-        if (sipParams->mName == mName)
-        {
-            return true;
-        }
-        return false;
-    }
-private:
-    string mName;
-};
-
-typedef IceUtil::Handle<SipStateReplicatorCompare> SipStateReplicatorComparePtr;
-
-class SipConfigurationCompare : public ServiceLocatorParamsCompare
-{
-public:
-    SipConfigurationCompare(const string& name) : mName(name) {}
-    bool isSupported(const ServiceLocatorParamsPtr &params, const Ice::Current &)
-    {
-        SipConfigurationParamsPtr configParams = SipConfigurationParamsPtr::dynamicCast(params);
-        if (configParams->name == mName)
-        {
-            return true;
-        }
-        return false;
-    }
-private:
-    string mName;
-};
-
-typedef IceUtil::Handle<SipConfigurationCompare> SipConfigurationComparePtr;
-
 class ConfigurationReplicatorI : public ConfigurationReplicator
 {
 public:
@@ -222,33 +184,20 @@ void SipStateReplicatorService::registerWithServiceLocator(const Ice::Communicat
 
         ServiceLocatorParamsPtr discoveryParams = new ServiceLocatorParams();
         discoveryParams->category = AsteriskSCF::SIP::V1::StateReplicatorDiscoveryCategory;
-
-        string replicatorName = ic->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);
-        mStateReplicationManagement->addLocatorParams(discoveryParams, compareGuid);
+        discoveryParams->service = ic->getProperties()->getPropertyWithDefault("SipStateReplicator.Service", "default");
+        discoveryParams->id = ic->getProperties()->getPropertyWithDefault("SipStateReplicator.Name", "default");
+        mStateReplicationManagement->addLocatorParams(discoveryParams, "");
 
         // Publish the configuration service IceStorm topic so everybody gets configuration
         mConfigurationManagement = ServiceManagementPrx::uncheckedCast(
             mServiceLocatorManagement->addService(mConfigurationPublisher, ""));
 
         // Populate the configuration parameters with details so we can be found
-        SipConfigurationParamsPtr configurationParams = new SipConfigurationParams();
+        ServiceLocatorParamsPtr configurationParams = new ServiceLocatorParams();
         configurationParams->category = ConfigurationDiscoveryCategory;
-        configurationParams->name = ic->getProperties()->getPropertyWithDefault("SipConfiguration.Name", "");
-
-        // Add our custom comparator so we can support multiple simultaneous configuration sinks
-        SipConfigurationComparePtr configNameCompare = new SipConfigurationCompare(configurationParams->name);
-        ServiceLocatorParamsComparePrx configCompareProxy = ServiceLocatorParamsComparePrx::uncheckedCast(
-            mAdapter->addWithUUID(configNameCompare));
-
-        mConfigCompareGuid = IceUtil::generateUUID();
-        mServiceLocatorManagement->addCompare(mConfigCompareGuid, configCompareProxy);
-        mConfigurationManagement->addLocatorParams(configurationParams, mConfigCompareGuid);
+        configurationParams->service = ic->getProperties()->getPropertyWithDefault("SipConfiguration.Service", "default");
+        configurationParams->id = ic->getProperties()->getPropertyWithDefault("SipConfiguration.Name", "");
+        mConfigurationManagement->addLocatorParams(configurationParams, "");
 
         // TBD... We may have other interfaces to publish to the Service Locator.
     }

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list