[asterisk-scf-commits] asterisk-scf/integration/ice-util-cpp.git branch "retry_deux" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Feb 16 18:26:01 CST 2012


branch "retry_deux" has been updated
       via  60631167b05b1a4f7c8b6f6d315081ded4028f98 (commit)
      from  78c5c399a90d1b4b9a992240fba0682fda7414dc (commit)

Summary of changes:
 .../Discovery/LocatorRegistrationWrapper.h         |   12 ++--
 .../{Helpers => Operations}/OperationContext.h     |   20 ++++---
 .../OperationContextCache.h                        |    4 +-
 src/CMakeLists.txt                                 |    1 +
 src/Component/Component.cpp                        |    2 +-
 src/Helpers/CMakeLists.txt                         |    2 +-
 src/{Helpers => Operations}/CMakeLists.txt         |    2 +-
 src/Operations/OperationContext.cpp                |   56 ++++++++++++++++++++
 .../OperationContextCache.cpp                      |    4 +-
 .../OperationContextCacheTest.cpp                  |    2 +-
 10 files changed, 83 insertions(+), 22 deletions(-)
 rename include/AsteriskSCF/{Helpers => Operations}/OperationContext.h (54%)
 rename include/AsteriskSCF/{Helpers => Operations}/OperationContextCache.h (98%)
 copy src/{Helpers => Operations}/CMakeLists.txt (51%)
 create mode 100644 src/Operations/OperationContext.cpp
 rename src/{Helpers => Operations}/OperationContextCache.cpp (98%)


- Log -----------------------------------------------------------------
commit 60631167b05b1a4f7c8b6f6d315081ded4028f98
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Thu Feb 16 18:25:22 2012 -0600

    Added transaction id to OperationContext, and moved OperationContext support to new namespace.

diff --git a/include/AsteriskSCF/Discovery/LocatorRegistrationWrapper.h b/include/AsteriskSCF/Discovery/LocatorRegistrationWrapper.h
index e870a58..8dd0ba6 100644
--- a/include/AsteriskSCF/Discovery/LocatorRegistrationWrapper.h
+++ b/include/AsteriskSCF/Discovery/LocatorRegistrationWrapper.h
@@ -22,7 +22,7 @@
 
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/Helpers/Retry.h>
-#include <AsteriskSCF/Helpers/OperationContext.h>
+#include <AsteriskSCF/Operations/OperationContext.h>
 
 namespace AsteriskSCF
 {
@@ -57,8 +57,8 @@ public:
         mName(name),
         mParameters(params),
         mComparatorGUID(comparatorGUID),
-        mAddServiceOpContext(new AsteriskSCF::System::V1::OperationContext(IceUtil::generateUUID())),
-        mAddParamsOpContext(new AsteriskSCF::System::V1::OperationContext(IceUtil::generateUUID()))
+        mAddServiceOpContext(AsteriskSCF::Operations::createContext()),
+        mAddParamsOpContext(AsteriskSCF::Operations::createContext())
     {
     }
 
@@ -122,7 +122,7 @@ public:
                 return;
             }
         }
-        mServiceManagement->unregister(AsteriskSCF::createContext());
+        mServiceManagement->unregister(AsteriskSCF::Operations::createContext());
     }
 
     void suspend()
@@ -134,7 +134,7 @@ public:
                 return;
             }
         }
-        mServiceManagement->suspend(AsteriskSCF::createContext());
+        mServiceManagement->suspend(AsteriskSCF::Operations::createContext());
     }
 
     void unsuspend()
@@ -146,7 +146,7 @@ public:
                 return;
             }
         }
-        mServiceManagement->unsuspend(AsteriskSCF::createContext());
+        mServiceManagement->unsuspend(AsteriskSCF::Operations::createContext());
     }
 
     AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx getServiceManagement()
diff --git a/include/AsteriskSCF/Helpers/OperationContext.h b/include/AsteriskSCF/Operations/OperationContext.h
similarity index 54%
rename from include/AsteriskSCF/Helpers/OperationContext.h
rename to include/AsteriskSCF/Operations/OperationContext.h
index 6758d9a..230f7a0 100644
--- a/include/AsteriskSCF/Helpers/OperationContext.h
+++ b/include/AsteriskSCF/Operations/OperationContext.h
@@ -20,15 +20,19 @@
 
 namespace AsteriskSCF
 {
+namespace Operations
+{
 
 /**
- * createContext simply creates a new OperationContext instance with the ID set to a UUID.
+ * Create a new OperationContext with a new transaction id. 
  */
-inline AsteriskSCF::System::V1::OperationContextPtr createContext()
-{
-    AsteriskSCF::System::V1::OperationContextPtr newContext(new AsteriskSCF::System::V1::OperationContext);
-    newContext->id = IceUtil::generateUUID();
-    return newContext;
-}
+ASTSCF_DLL_EXPORT AsteriskSCF::System::V1::OperationContextPtr createContext();
+
+/**
+ * Create a new OperationContext that has the same transaction id as the input argument.
+ *  @param context The source OperationContext that contains the transaction id to use. 
+ */
+ASTSCF_DLL_EXPORT AsteriskSCF::System::V1::OperationContextPtr createContext(const AsteriskSCF::System::V1::OperationContextPtr& context);
 
-} /* End of namespace AsteriskSCF */
+} // End namespace Operations
+} // End namespace AsteriskSCF
diff --git a/include/AsteriskSCF/Helpers/OperationContextCache.h b/include/AsteriskSCF/Operations/OperationContextCache.h
similarity index 98%
rename from include/AsteriskSCF/Helpers/OperationContextCache.h
rename to include/AsteriskSCF/Operations/OperationContextCache.h
index a3a50f9..54a2f89 100644
--- a/include/AsteriskSCF/Helpers/OperationContextCache.h
+++ b/include/AsteriskSCF/Operations/OperationContextCache.h
@@ -24,7 +24,7 @@
 
 namespace AsteriskSCF
 {
-namespace Helpers
+namespace Operations
 {
 
 class OperationContextCachEntry;
@@ -98,5 +98,5 @@ private:
 };
 typedef IceUtil::Handle<OperationContextCache> OperationContextCachePtr;
 
-} // Helpers 
+} // Operations 
 } // AsteriskSCF 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bfb7d7c..29a9913 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,6 +3,7 @@ file(GLOB_RECURSE project_headers ../include/*.h)
 astscf_component_add_files(ASTSCFIceUtilCpp ${project_headers})
 add_subdirectory(CollocatedIceStorm)
 add_subdirectory(Component)
+add_subdirectory(Operations)
 add_subdirectory(Replication)
 add_subdirectory(WorkQueue)
 add_subdirectory(ThreadPool)
diff --git a/src/Component/Component.cpp b/src/Component/Component.cpp
index 4b79ccc..6a0ac23 100644
--- a/src/Component/Component.cpp
+++ b/src/Component/Component.cpp
@@ -28,7 +28,7 @@
 #include <AsteriskSCF/System/Component/ComponentServiceIf.h>
 #include <AsteriskSCF/System/Component/ReplicaIf.h>
 #include <AsteriskSCF/Discovery/LocatorRegistrationWrapper.h>
-#include <AsteriskSCF/Helpers/OperationContext.h>
+#include <AsteriskSCF/Operations/OperationContext.h>
 
 using namespace std;
 using namespace AsteriskSCF::System::Component::V1;
diff --git a/src/Helpers/CMakeLists.txt b/src/Helpers/CMakeLists.txt
index fe359ef..ff99cca 100644
--- a/src/Helpers/CMakeLists.txt
+++ b/src/Helpers/CMakeLists.txt
@@ -1,2 +1,2 @@
 astscf_component_add_files(ASTSCFIceUtilCpp Network.cpp)
-astscf_component_add_files(ASTSCFIceUtilCpp OperationContextCache.cpp)
+
diff --git a/src/Helpers/CMakeLists.txt b/src/Operations/CMakeLists.txt
similarity index 51%
copy from src/Helpers/CMakeLists.txt
copy to src/Operations/CMakeLists.txt
index fe359ef..fb30822 100644
--- a/src/Helpers/CMakeLists.txt
+++ b/src/Operations/CMakeLists.txt
@@ -1,2 +1,2 @@
-astscf_component_add_files(ASTSCFIceUtilCpp Network.cpp)
 astscf_component_add_files(ASTSCFIceUtilCpp OperationContextCache.cpp)
+astscf_component_add_files(ASTSCFIceUtilCpp OperationContext.cpp)
diff --git a/src/Operations/OperationContext.cpp b/src/Operations/OperationContext.cpp
new file mode 100644
index 0000000..f8ab752
--- /dev/null
+++ b/src/Operations/OperationContext.cpp
@@ -0,0 +1,56 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 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.
+ */
+#pragma once
+
+#include <IceUtil/UUID.h>
+#include <AsteriskSCF/System/OperationsIf.h>
+
+using namespace AsteriskSCF::System::V1;
+
+namespace AsteriskSCF
+{
+namespace Operations
+{
+
+    
+/**
+ * Create a new OperationContext with a new transaction id. 
+ */
+OperationContextPtr createContext()
+{
+    AsteriskSCF::System::V1::OperationContextPtr newContext(new AsteriskSCF::System::V1::OperationContext);
+    newContext->id = IceUtil::generateUUID();
+
+    // To make it easy to identify the "source" operation id, we set the transaction id to the 
+    // same value as the original OperationContext id. 
+    newContext->transactionId = newContext->id;
+    return newContext;
+}
+
+/**
+ * Create a new OperationContext that has the same transaction id as the input argument.
+ *  @param context The source OperationContext that contains the transaction id to use. 
+ */
+OperationContextPtr createContext(const OperationContextPtr& operationContext)
+{
+    AsteriskSCF::System::V1::OperationContextPtr newContext(new AsteriskSCF::System::V1::OperationContext);
+    newContext->id = IceUtil::generateUUID();
+    newContext->transactionId = operationContext->transactionId;
+    return newContext;
+}
+
+} // End namespace Operations
+} // End namespace AsteriskSCF
diff --git a/src/Helpers/OperationContextCache.cpp b/src/Operations/OperationContextCache.cpp
similarity index 98%
rename from src/Helpers/OperationContextCache.cpp
rename to src/Operations/OperationContextCache.cpp
index 888fc63..09a8f7c 100644
--- a/src/Helpers/OperationContextCache.cpp
+++ b/src/Operations/OperationContextCache.cpp
@@ -15,7 +15,7 @@
  */
 #include <boost/thread/locks.hpp>
 
-#include <AsteriskSCF/Helpers/OperationContextCache.h>
+#include <AsteriskSCF/Operations/OperationContextCache.h>
 
 using namespace AsteriskSCF::System::V1;
 using namespace AsteriskSCF::System::Logging;
@@ -27,7 +27,7 @@ Logger lg = AsteriskSCF::System::Logging::getLoggerFactory().getLogger("Asterisk
 
 namespace AsteriskSCF
 {
-namespace Helpers
+namespace Operations
 {
 
 /**
diff --git a/test/OperationContextCache/OperationContextCacheTest.cpp b/test/OperationContextCache/OperationContextCacheTest.cpp
index 1f2822e..ac9aa45 100644
--- a/test/OperationContextCache/OperationContextCacheTest.cpp
+++ b/test/OperationContextCache/OperationContextCacheTest.cpp
@@ -17,7 +17,7 @@
 #include <Ice/Properties.h>
 #include <Ice/Initialize.h>
 
-#include <AsteriskSCF/Helpers/OperationContextCache.h>
+#include <AsteriskSCF/Operations/OperationContextCache.h>
 #include <AsteriskSCF/Logger.h>
 
 #include <boost/lexical_cast.hpp>

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


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



More information about the asterisk-scf-commits mailing list