[asterisk-scf-commits] asterisk-scf/integration/servicediscovery.git branch "replication" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Jan 3 14:03:05 UTC 2011


branch "replication" has been updated
       via  e7c674faf444f306ed1e915db8c64340af8e3b74 (commit)
       via  be00bf7f48c939ff31800f02bd7b2281bdf2a3b2 (commit)
       via  ba342fe71263e06dbbc1552737da08ea23147702 (commit)
       via  0a201ae45bf95a06ba75885dc8b3c4a3aa12bac6 (commit)
       via  57008def063281f918ce5cc2c8004b0b7adb963b (commit)
       via  110b950ce730c54706f46ebaa04324efc164f3d7 (commit)
       via  a9e953747e862058bf6af9b9f29160c644fec79c (commit)
       via  3f132776448abcca79d354acd8aaddb87cd82295 (commit)
      from  991b83ca4c64fd3bc44bee52097b1f6985491229 (commit)

Summary of changes:
 local-slice/ServiceLocatorStateReplicationIf.ice |   18 +++---
 src/ServiceLocator.cpp                           |   24 +++----
 src/ServiceLocatorManagement.cpp                 |   74 +++++++---------------
 src/ServiceLocatorManagement.h                   |   10 +--
 src/ServiceLocatorStateListener.cpp              |   27 ++++----
 src/ServiceManagement.cpp                        |   60 +++++++++---------
 src/ServiceManagement.h                          |    8 +-
 7 files changed, 93 insertions(+), 128 deletions(-)


- Log -----------------------------------------------------------------
commit e7c674faf444f306ed1e915db8c64340af8e3b74
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Jan 3 09:55:23 2011 -0400

    Provide a default value for Ice::Current in the declaration so one does not need to be created before using it elsewhere.

diff --git a/src/ServiceLocatorManagement.h b/src/ServiceLocatorManagement.h
index e27f1cf..bac5f0d 100644
--- a/src/ServiceLocatorManagement.h
+++ b/src/ServiceLocatorManagement.h
@@ -95,7 +95,7 @@ public:
     void addCompare(const std::string&,
         const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsComparePrx&,
         const Ice::Current&);
-    void removeCompare(const std::string&, const Ice::Current&);
+    void removeCompare(const std::string&, const Ice::Current& = Ice::Current());
 
     void isSupported(const std::string&,
         const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr&,
diff --git a/src/ServiceLocatorStateListener.cpp b/src/ServiceLocatorStateListener.cpp
index 38d79dd..1018ad4 100644
--- a/src/ServiceLocatorStateListener.cpp
+++ b/src/ServiceLocatorStateListener.cpp
@@ -36,17 +36,18 @@ using namespace AsteriskSCF::ServiceDiscovery;
 class ServiceLocatorStateReplicatorItem
 {
 public:
-    ServiceLocatorStateReplicatorItem(ServiceLocatorManagementImplPtr locatorManagement) : mLocatorManagement(locatorManagement) { }
+    ServiceLocatorStateReplicatorItem(ServiceLocatorManagementImplPtr locatorManagement) :
+	  mLocatorManagement(locatorManagement) { }
+
     ~ServiceLocatorStateReplicatorItem()
     {
-	Ice::Current current;
 	if (mService)
 	{
-	    mService->unregister(current);
+	    mService->unregister();
 	}
 	if (!mComparator.empty())
 	{
-	    mLocatorManagement->removeCompare(mComparator, current);
+	    mLocatorManagement->removeCompare(mComparator);
 	}
     }
 
@@ -104,7 +105,6 @@ public:
 
 	    if ((serviceState = ServiceLocatorServiceStateItemPtr::dynamicCast((*item))))
 	    {
-		Ice::Current current;
 		std::map<std::string, boost::shared_ptr<ServiceLocatorStateReplicatorItem> >::iterator i = mStateItems.find((*item)->key);
 	        boost::shared_ptr<ServiceLocatorStateReplicatorItem> localitem;
 
@@ -124,11 +124,11 @@ public:
 		// The only thing that can be changed by a subsequent state item is the suspend status
 		if (serviceState->suspended == true)
 		{
-		    localitem->getService()->suspend(current);
+		    localitem->getService()->suspend();
 		}
 		else
 		{
-		    localitem->getService()->unsuspend(current);
+		    localitem->getService()->unsuspend();
 		}
 	    }
 	    else if ((paramsState = ServiceLocatorParamsStateItemPtr::dynamicCast((*item))))
@@ -142,8 +142,7 @@ public:
 		}
 
 		// Parameters are only ever added, they are never modified or removed
-		Ice::Current current;
-		i->second->getService()->addLocatorParams(paramsState->params, paramsState->compareGuid, current);
+		i->second->getService()->addLocatorParams(paramsState->params, paramsState->compareGuid);
 	    }
 	    else if ((comparatorState = ServiceLocatorComparatorStateItemPtr::dynamicCast((*item))))
 	    {
diff --git a/src/ServiceManagement.h b/src/ServiceManagement.h
index 14b5b13..66fd43f 100644
--- a/src/ServiceManagement.h
+++ b/src/ServiceManagement.h
@@ -39,10 +39,10 @@ public:
     //
     // AsteriskSCF::Core::Discovery::V1::ServiceManagement interface.
     //
-    void addLocatorParams(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr&, const std::string&, const Ice::Current&);
-    void suspend(const Ice::Current&);
-    void unsuspend(const Ice::Current&);
-    void unregister(const Ice::Current&);
+    void addLocatorParams(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr&, const std::string&, const Ice::Current& = Ice::Current());
+    void suspend(const Ice::Current& = Ice::Current());
+    void unsuspend(const Ice::Current& = Ice::Current());
+    void unregister(const Ice::Current& = Ice::Current());
     AsteriskSCF::Core::Discovery::V1::ServiceStatus getStatus(const Ice::Current&) const { return getStatus(); }
 
     Ice::ObjectPrx getService();

commit be00bf7f48c939ff31800f02bd7b2281bdf2a3b2
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Jan 3 09:42:26 2011 -0400

    Add proper logging if a suitable proxy is not available for replication.

diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index 6ad0298..5fc4674 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -590,8 +590,9 @@ void ServiceLocatorManagementImpl::replicateState(AsteriskSCF::Core::Discovery::
         ServiceLocatorStateReplicatorPrx oneway = ServiceLocatorStateReplicatorPrx::uncheckedCast(mImpl->mStateReplicator->ice_oneway());
         oneway->setState(items);
     }
-    catch (...)
+	catch (const Ice::NoEndpointException&)
     {
+	    lg(Error) << "No endpoint for oneway invocation of replicateState() for state replication." << std::endl;
     }
 }
 
@@ -619,8 +620,9 @@ void ServiceLocatorManagementImpl::removeState(AsteriskSCF::Core::Discovery::V1:
         ServiceLocatorStateReplicatorPrx oneway = ServiceLocatorStateReplicatorPrx::uncheckedCast(mImpl->mStateReplicator->ice_oneway());
         oneway->removeState(items);
     }
-    catch (...)
+	catch (const Ice::NoEndpointException&)
     {
+	    lg(Error) << "No endpoint for oneway invocation of replicateState() for state replication." << std::endl;
     }
 }
 

commit ba342fe71263e06dbbc1552737da08ea23147702
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Jan 3 09:35:33 2011 -0400

    Since only one item is ever passed to replicateState and removeState simply make it accept the base class.

diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index a69d1e0..6ad0298 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -102,7 +102,7 @@ public:
 	mStateItem->key = IceUtil::generateUUID();
 	mStateItem->name = name;
 	mStateItem->comparator = compare;
-	mManagement->replicateState(0, 0, mStateItem);
+	mManagement->replicateState(mStateItem);
     }
 
     /**
@@ -111,7 +111,7 @@ public:
      */
     ~ServiceLocatorComparator()
     {
-	mManagement->removeState(0, 0, mStateItem);
+	mManagement->removeState(mStateItem);
     }
 
     /**
@@ -569,10 +569,13 @@ void ServiceLocatorManagementImpl::removeService(const ServiceManagementImplPtr&
 /**
  * Function which replicates state items.
  */
-void ServiceLocatorManagementImpl::replicateState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr service,
-    AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsStateItemPtr params,
-    AsteriskSCF::Core::Discovery::V1::ServiceLocatorComparatorStateItemPtr comparator)
+void ServiceLocatorManagementImpl::replicateState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr item)
 {
+	if (!item)
+	{
+		return;
+	}
+
     if (!mImpl->mStateReplicator || mImpl->mReplicaService->isActive() == false)
     {
         return;
@@ -580,25 +583,7 @@ void ServiceLocatorManagementImpl::replicateState(AsteriskSCF::Core::Discovery::
 
     ServiceLocatorStateItemSeq items;
 
-    if (service)
-    {
-	items.push_back(service);
-    }
-
-    if (params)
-    {
-	items.push_back(params);
-    }
-
-    if (comparator)
-    {
-	items.push_back(comparator);
-    }
-
-    if (items.size() == 0)
-    {
-        return;
-    }
+	items.push_back(item);
 
     try
     {
@@ -613,10 +598,13 @@ void ServiceLocatorManagementImpl::replicateState(AsteriskSCF::Core::Discovery::
 /**
  * Function which removes state items from the replicator.
  */
-void ServiceLocatorManagementImpl::removeState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr service,
-    AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsStateItemPtr params,
-    AsteriskSCF::Core::Discovery::V1::ServiceLocatorComparatorStateItemPtr comparator)
+void ServiceLocatorManagementImpl::removeState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr item)
 {
+	if (!item)
+	{
+		return;
+	}
+
     if (!mImpl->mStateReplicator || mImpl->mReplicaService->isActive() == false)
     {
         return;
@@ -624,25 +612,7 @@ void ServiceLocatorManagementImpl::removeState(AsteriskSCF::Core::Discovery::V1:
 
     Ice::StringSeq items;
 
-    if (service)
-    {
-	items.push_back(service->key);
-    }
-
-    if (params)
-    {
-	items.push_back(params->key);
-    }
-
-    if (comparator)
-    {
-	items.push_back(comparator->key);
-    }
-
-    if (items.size() == 0)
-    {
-        return;
-    }
+	items.push_back(item->key);
 
     try
     {
diff --git a/src/ServiceLocatorManagement.h b/src/ServiceLocatorManagement.h
index df75daf..e27f1cf 100644
--- a/src/ServiceLocatorManagement.h
+++ b/src/ServiceLocatorManagement.h
@@ -79,12 +79,8 @@ public:
     // Replication related functions.
     ServiceManagementImplPtr addService(const Ice::ObjectPrx&, const std::string&, const
         Ice::Identity&);
-    void replicateState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr, 
-        AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsStateItemPtr,
-        AsteriskSCF::Core::Discovery::V1::ServiceLocatorComparatorStateItemPtr);
-    void removeState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr,
-        AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsStateItemPtr,
-        AsteriskSCF::Core::Discovery::V1::ServiceLocatorComparatorStateItemPtr);	
+    void replicateState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr);
+    void removeState(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateItemPtr);	
     void setStateReplicator(AsteriskSCF::Core::Discovery::V1::ServiceLocatorStateReplicatorPrx);
 
     //
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 75fba8a..002101d 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -61,12 +61,12 @@ public:
 	mStateItem->serviceKey = serviceState->key;
 	mStateItem->params = params;
 	mStateItem->compareGuid = compareGuid;
-	mManagement->replicateState(0, mStateItem, 0);
+	mManagement->replicateState(mStateItem);
     }
 
     ~ServiceLocatorParamsSpec()
     {
-	mManagement->removeState(0, mStateItem, 0);
+	mManagement->removeState(mStateItem);
     }
 
     void isSupported(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr&, const IsSupportedCallbackPtr&);
@@ -105,7 +105,7 @@ public:
         {
             mLocatorTopic->serviceRegistered(guid);
         }
-	mManagement->replicateState(mStateItem, 0, 0);
+	mManagement->replicateState(mStateItem);
     }
 
     /**
@@ -324,7 +324,7 @@ void ServiceManagementImpl::suspend(const Ice::Current&)
     {
         lg(Info) << "Suspending " << mImpl->mStateItem->guid << " " << mImpl->mStateItem->service->ice_toString();
         mImpl->mStateItem->suspended = true;
-	mImpl->mManagement->replicateState(mImpl->mStateItem, 0, 0);
+	mImpl->mManagement->replicateState(mImpl->mStateItem);
     }
 
     if (mImpl->mLocatorTopic)
@@ -344,7 +344,7 @@ void ServiceManagementImpl::unsuspend(const Ice::Current&)
     {
         lg(Info) << "Un-suspending " << mImpl->mStateItem->guid << " " << mImpl->mStateItem->service->ice_toString();
         mImpl->mStateItem->suspended = false;
-	mImpl->mManagement->replicateState(mImpl->mStateItem, 0, 0);
+	mImpl->mManagement->replicateState(mImpl->mStateItem);
     }
 
     if (mImpl->mLocatorTopic)
@@ -376,7 +376,7 @@ void ServiceManagementImpl::unregister(const Ice::Current&)
      */
     lg(Info) << "Un-register " << mImpl->mStateItem->guid << " " << mImpl->mStateItem->service->ice_toString();
 
-    mImpl->mManagement->removeState(mImpl->mStateItem, 0, 0);
+    mImpl->mManagement->removeState(mImpl->mStateItem);
 
     mImpl->mAdapter->remove(mImpl->mManagementPrx->ice_getIdentity());
 

commit 0a201ae45bf95a06ba75885dc8b3c4a3aa12bac6
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Jan 3 09:28:21 2011 -0400

    If we can't talk to the state replicator for some reason give more detail on why not if an exception is thrown.

diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index 8bc9dd1..701769f 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -259,6 +259,10 @@ void ServiceLocatorApp::start(const string& name, const Ice::CommunicatorPtr& co
             lg(Info) << "Operating in an active state and pushing updates." << endl;
         }
     }
+	catch (const std::exception& e)
+    {
+		lg(Info) << "Operating in an active and standalone state since we got an exception: " << e.what() << endl;
+    }
     catch (...)
     {
 	// If we reach this point then no state replicator is present and we are acting in a stand-alone fashion

commit 57008def063281f918ce5cc2c8004b0b7adb963b
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Jan 3 09:23:32 2011 -0400

    Don't prefix local variables with m, since they aren't member variables.

diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index 0ebfd5e..8bc9dd1 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -243,15 +243,15 @@ void ServiceLocatorApp::start(const string& name, const Ice::CommunicatorPtr& co
     try
     {
 	mStateReplicator = ServiceLocatorStateReplicatorPrx::checkedCast(communicator->propertyToProxy("ServiceLocator.StateReplicator.Proxy"));
-        ServiceLocatorStateReplicatorListenerPtr mReplicatorListener = new ServiceLocatorStateReplicatorListenerI(locatorServiceManagement);
-        ServiceLocatorStateReplicatorListenerPrx mReplicatorListenerProxy = ServiceLocatorStateReplicatorListenerPrx::uncheckedCast(mLocalAdapter->addWithUUID(mReplicatorListener));
+        ServiceLocatorStateReplicatorListenerPtr replicatorListener = new ServiceLocatorStateReplicatorListenerI(locatorServiceManagement);
+        ServiceLocatorStateReplicatorListenerPrx replicatorListenerProxy = ServiceLocatorStateReplicatorListenerPrx::uncheckedCast(mLocalAdapter->addWithUUID(replicatorListener));
 
 	locatorServiceManagement->setStateReplicator(mStateReplicator);
 
         if (communicator->getProperties()->getPropertyWithDefault("ServiceLocatorStateReplicatorListener", "no") == "yes")
         {
 	    mReplicaService->standby();
-            mStateReplicator->addListener(mReplicatorListenerProxy);
+            mStateReplicator->addListener(replicatorListenerProxy);
             lg(Info) << "Operating as a standby replica." << endl;
         }
         else

commit 110b950ce730c54706f46ebaa04324efc164f3d7
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Jan 3 09:22:08 2011 -0400

    Get rid of the logger adapter in favor of the local adapter.

diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index e576583..0ebfd5e 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -57,7 +57,6 @@ private:
     Ice::ObjectAdapterPtr mLocalAdapter;
     Ice::ObjectAdapterPtr mDiscoveryAdapter;
     Ice::ObjectAdapterPtr mManagementAdapter;
-    Ice::ObjectAdapterPtr mLoggerAdapter;
     AsteriskSCF::ServiceDiscovery::CollocatedIceStormPtr mIceStorm;
     ReplicaPtr mReplicaService;
     ServiceLocatorStateReplicatorPrx mStateReplicator;
@@ -170,13 +169,13 @@ void ServiceLocatorApp::start(const string& name, const Ice::CommunicatorPtr& co
 {
     mIceStorm = new AsteriskSCF::ServiceDiscovery::CollocatedIceStorm("AsteriskSCFIceStorm", communicator->getProperties());
 
-    mLoggerAdapter = communicator->createObjectAdapter("LoggerAdapter");
+	mLocalAdapter = communicator->createObjectAdapter("ServiceLocatorLocalAdapter");
 
-    ConfiguredIceLoggerPtr mIceLogger = createIceLogger(mLoggerAdapter);
+    ConfiguredIceLoggerPtr mIceLogger = createIceLogger(mLocalAdapter);
 
     getLoggerFactory().setLogOutput(mIceLogger->getLogger());
 
-    mLoggerAdapter->activate();
+    mLocalAdapter->activate();
 
     lg(Info) << "Initializing service discovery component";
 
@@ -223,14 +222,9 @@ void ServiceLocatorApp::start(const string& name, const Ice::CommunicatorPtr& co
         lg(Info) << "IceStorm topic manager proxy not present, events disabled.";
     }
 
-    mLocalAdapter = communicator->createObjectAdapter(
-        "ServiceLocatorLocalAdapter");
-
     mReplicaService = new ReplicaImpl(mLocalAdapter);
     mLocalAdapter->add(mReplicaService, communicator->stringToIdentity(ReplicaServiceId));
 
-    mLocalAdapter->activate();
-
     /* Management and discovery use separate adapters to provide a level of security,
      * management may want to be protected so arbitrary people can't inject bad services
      * into the infrastructure while discovery as a read only function may be allowed to all.

commit a9e953747e862058bf6af9b9f29160c644fec79c
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Jan 3 09:20:36 2011 -0400

    Constify the passing of the locator service management pointer.

diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index a397676..e576583 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -124,7 +124,7 @@ private:
 class ServiceLocatorImpl : public ServiceLocator
 {
 public:
-    ServiceLocatorImpl(ServiceLocatorManagementImplPtr LocatorServiceManagement) :
+    ServiceLocatorImpl(const ServiceLocatorManagementImplPtr& LocatorServiceManagement) :
         mLocatorServiceManagement(LocatorServiceManagement) { };
     /**
      * Asynchronously locate a service for the given parameters.

commit 3f132776448abcca79d354acd8aaddb87cd82295
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Jan 3 09:17:59 2011 -0400

    Don't prefix state items with m, and don't call a comparator proxy a service call it a comparator.

diff --git a/local-slice/ServiceLocatorStateReplicationIf.ice b/local-slice/ServiceLocatorStateReplicationIf.ice
index 7d4c71f..abb8e12 100644
--- a/local-slice/ServiceLocatorStateReplicationIf.ice
+++ b/local-slice/ServiceLocatorStateReplicationIf.ice
@@ -57,23 +57,23 @@ module V1
 
    class ServiceLocatorServiceStateItem extends ServiceLocatorStateItem
    {
-       bool mSuspended;
-       Object *mService;
-       Ice::Identity mManagementIdentity;
-       string mGuid;
+       bool suspended;
+       Object *service;
+       Ice::Identity managementIdentity;
+       string guid;
    };
 
    class ServiceLocatorParamsStateItem extends ServiceLocatorStateItem
    {
-       string mServiceKey;
-       ServiceLocatorParams mParams;
-       string mCompareGuid;
+       string serviceKey;
+       ServiceLocatorParams params;
+       string compareGuid;
    };
 
    class ServiceLocatorComparatorStateItem extends ServiceLocatorStateItem
    {
-       string mName;
-       ServiceLocatorParamsCompare *mService;
+       string name;
+       ServiceLocatorParamsCompare *comparator;
    };
 
 }; //module V1
diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index c1f63dd..a69d1e0 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -100,8 +100,8 @@ public:
 	mStateItem(new ServiceLocatorComparatorStateItem())
     {
 	mStateItem->key = IceUtil::generateUUID();
-	mStateItem->mName = name;
-	mStateItem->mService = compare;
+	mStateItem->name = name;
+	mStateItem->comparator = compare;
 	mManagement->replicateState(0, 0, mStateItem);
     }
 
@@ -131,7 +131,7 @@ public:
         Ice::CallbackPtr d = Ice::newCallback(iceCallback,
             &Comparator_IsSupported_Callback::finished);
         // async forward to the comparator
-        mStateItem->mService->begin_isSupported(params, d);
+        mStateItem->comparator->begin_isSupported(params, d);
     }
 private:
     /**
diff --git a/src/ServiceLocatorStateListener.cpp b/src/ServiceLocatorStateListener.cpp
index e6bb3fd..38d79dd 100644
--- a/src/ServiceLocatorStateListener.cpp
+++ b/src/ServiceLocatorStateListener.cpp
@@ -113,7 +113,7 @@ public:
 		    boost::shared_ptr<ServiceLocatorStateReplicatorItem> newitem(new ServiceLocatorStateReplicatorItem(mLocatorManagement));
                     localitem = newitem;
                     mStateItems.insert(std::make_pair((*item)->key, newitem));
-		    ServiceManagementImplPtr service = mLocatorManagement->addService(serviceState->mService, serviceState->mGuid, serviceState->mManagementIdentity);
+		    ServiceManagementImplPtr service = mLocatorManagement->addService(serviceState->service, serviceState->guid, serviceState->managementIdentity);
 		    newitem->setService(service);
 		}
 		else
@@ -122,7 +122,7 @@ public:
 		}
 
 		// The only thing that can be changed by a subsequent state item is the suspend status
-		if (serviceState->mSuspended == true)
+		if (serviceState->suspended == true)
 		{
 		    localitem->getService()->suspend(current);
 		}
@@ -134,7 +134,7 @@ public:
 	    else if ((paramsState = ServiceLocatorParamsStateItemPtr::dynamicCast((*item))))
 	    {
 		// This is special, we have to find the respective service and then add parameters to it
-		std::map<std::string, boost::shared_ptr<ServiceLocatorStateReplicatorItem> >::iterator i = mStateItems.find(paramsState->mServiceKey);
+		std::map<std::string, boost::shared_ptr<ServiceLocatorStateReplicatorItem> >::iterator i = mStateItems.find(paramsState->serviceKey);
 
 	        if ((i == mStateItems.end()))
 		{
@@ -143,7 +143,7 @@ public:
 
 		// Parameters are only ever added, they are never modified or removed
 		Ice::Current current;
-		i->second->getService()->addLocatorParams(paramsState->mParams, paramsState->mCompareGuid, current);
+		i->second->getService()->addLocatorParams(paramsState->params, paramsState->compareGuid, current);
 	    }
 	    else if ((comparatorState = ServiceLocatorComparatorStateItemPtr::dynamicCast((*item))))
 	    {
@@ -158,10 +158,10 @@ public:
 		try
 		{
 		    Ice::Current current;
-		    mLocatorManagement->addCompare(comparatorState->mName, comparatorState->mService, current);
+		    mLocatorManagement->addCompare(comparatorState->name, comparatorState->comparator, current);
 		    boost::shared_ptr<ServiceLocatorStateReplicatorItem> newitem(new ServiceLocatorStateReplicatorItem(mLocatorManagement));
 		    mStateItems.insert(std::make_pair((*item)->key, newitem));
-		    newitem->setComparator(comparatorState->mName);
+		    newitem->setComparator(comparatorState->name);
 		}
 		catch (...)
 		{
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index ff8c595..75fba8a 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -58,9 +58,9 @@ public:
         mManagement(management)
     {
 	mStateItem->key = IceUtil::generateUUID();
-	mStateItem->mServiceKey = serviceState->key;
-	mStateItem->mParams = params;
-	mStateItem->mCompareGuid = compareGuid;
+	mStateItem->serviceKey = serviceState->key;
+	mStateItem->params = params;
+	mStateItem->compareGuid = compareGuid;
 	mManagement->replicateState(0, mStateItem, 0);
     }
 
@@ -96,11 +96,11 @@ public:
         mManagement(management), mAdapter(adapter), mLocatorTopic(serviceDiscoveryTopic)
     {
 	mStateItem->key = IceUtil::generateUUID();
-	mStateItem->mSuspended = false;
-	mStateItem->mService = service;
-	mStateItem->mGuid = guid;
+	mStateItem->suspended = false;
+	mStateItem->service = service;
+	mStateItem->guid = guid;
 	mManagementPrx = ServiceManagementPrx::uncheckedCast(mAdapter->add(impl, identity));
-	mStateItem->mManagementIdentity = identity;
+	mStateItem->managementIdentity = identity;
         if (mLocatorTopic)
         {
             mLocatorTopic->serviceRegistered(guid);
@@ -166,7 +166,7 @@ ServiceManagementImpl::ServiceManagementImpl(ServiceLocatorManagementImplPtr man
  */
 Ice::ObjectPrx ServiceManagementImpl::getService()
 {
-    return mImpl->mStateItem->mService;
+    return mImpl->mStateItem->service;
 }
 
 /**
@@ -240,7 +240,7 @@ void ServiceManagementImpl::isSupported(const ServiceLocatorParamsPtr& params, c
     /* If this service is suspended we can just skip the entire check and
      * return false now, easy as pie
      */
-    if (mImpl->mStateItem->mSuspended)
+    if (mImpl->mStateItem->suspended)
     {
         lg(Debug) << "  ...isSupported(" << params->category << ") = false (suspended)\n";
         callback->result(false);
@@ -261,7 +261,7 @@ void ServiceManagementImpl::isSupported(const ServiceLocatorParamsPtr& params, c
 
 const std::string& ServiceManagementImpl::getGuid() const
 {
-    return mImpl->mStateItem->mGuid;
+    return mImpl->mStateItem->guid;
 }
 
 /**
@@ -284,15 +284,15 @@ void ServiceLocatorParamsSpec::isSupported(const ServiceLocatorParamsPtr& params
     }
     /* This is just a simple comparison that acts as a preliminary, and
      * perhaps final, check */
-    else if (mStateItem->mParams->category != params->category)
+    else if (mStateItem->params->category != params->category)
     {
         lg(Debug) << "  ...isSupported(" << params->category << ") = false (different categories)\n";
         callback->result(false);
     }
     /* If a comparator was provided then yield to it for a final yay or nay */
-    else if (!mStateItem->mCompareGuid.empty())
+    else if (!mStateItem->compareGuid.empty())
     {
-        mManagement->isSupported(mStateItem->mCompareGuid, params, callback);
+        mManagement->isSupported(mStateItem->compareGuid, params, callback);
     }
     /* category matches, no comparator to turn us down.  it's a match. */
     else
@@ -320,16 +320,16 @@ void ServiceManagementImpl::suspend(const Ice::Current&)
 {
     boost::unique_lock<boost::shared_mutex> lock(mImpl->mLock);
 
-    if (!mImpl->mStateItem->mSuspended)
+    if (!mImpl->mStateItem->suspended)
     {
-        lg(Info) << "Suspending " << mImpl->mStateItem->mGuid << " " << mImpl->mStateItem->mService->ice_toString();
-        mImpl->mStateItem->mSuspended = true;
+        lg(Info) << "Suspending " << mImpl->mStateItem->guid << " " << mImpl->mStateItem->service->ice_toString();
+        mImpl->mStateItem->suspended = true;
 	mImpl->mManagement->replicateState(mImpl->mStateItem, 0, 0);
     }
 
     if (mImpl->mLocatorTopic)
     {
-        mImpl->mLocatorTopic->serviceSuspended(mImpl->mStateItem->mGuid);
+        mImpl->mLocatorTopic->serviceSuspended(mImpl->mStateItem->guid);
     }
 }
 
@@ -340,23 +340,23 @@ void ServiceManagementImpl::unsuspend(const Ice::Current&)
 {
     boost::unique_lock<boost::shared_mutex> lock(mImpl->mLock);
 
-    if (mImpl->mStateItem->mSuspended)
+    if (mImpl->mStateItem->suspended)
     {
-        lg(Info) << "Un-suspending " << mImpl->mStateItem->mGuid << " " << mImpl->mStateItem->mService->ice_toString();
-        mImpl->mStateItem->mSuspended = false;
+        lg(Info) << "Un-suspending " << mImpl->mStateItem->guid << " " << mImpl->mStateItem->service->ice_toString();
+        mImpl->mStateItem->suspended = false;
 	mImpl->mManagement->replicateState(mImpl->mStateItem, 0, 0);
     }
 
     if (mImpl->mLocatorTopic)
     {
-        mImpl->mLocatorTopic->serviceUnsuspended(mImpl->mStateItem->mGuid);
+        mImpl->mLocatorTopic->serviceUnsuspended(mImpl->mStateItem->guid);
     }
 }
 
 ServiceStatus ServiceManagementImpl::getStatus() const
 {
     boost::unique_lock<boost::shared_mutex> lock(mImpl->mLock);
-    if (mImpl->mStateItem->mSuspended)
+    if (mImpl->mStateItem->suspended)
     {
         return Suspended;
     }
@@ -374,7 +374,7 @@ void ServiceManagementImpl::unregister(const Ice::Current&)
     /* You'll notice no lock here. That's because we aren't actually modifying any internal state that should
      * be protected, and if we did lock here there is a chance for a deadlock which is super sad.
      */
-    lg(Info) << "Un-register " << mImpl->mStateItem->mGuid << " " << mImpl->mStateItem->mService->ice_toString();
+    lg(Info) << "Un-register " << mImpl->mStateItem->guid << " " << mImpl->mStateItem->service->ice_toString();
 
     mImpl->mManagement->removeState(mImpl->mStateItem, 0, 0);
 
@@ -384,7 +384,7 @@ void ServiceManagementImpl::unregister(const Ice::Current&)
 
     if (mImpl->mLocatorTopic)
     {
-        mImpl->mLocatorTopic->serviceUnregistered(mImpl->mStateItem->mGuid);
+        mImpl->mLocatorTopic->serviceUnregistered(mImpl->mStateItem->guid);
     }
 }
 

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


-- 
asterisk-scf/integration/servicediscovery.git



More information about the asterisk-scf-commits mailing list