geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbarr...@apache.org
Subject [1/3] geode git commit: GEODE-2346: renamed Gemfire* to Geode*
Date Thu, 26 Jan 2017 19:40:54 GMT
Repository: geode
Updated Branches:
  refs/heads/next-gen-native-client-software-grant 2c88dfee8 -> 3b389a086


GEODE-2346: renamed Gemfire* to Geode*


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/009be9b8
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/009be9b8
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/009be9b8

Branch: refs/heads/next-gen-native-client-software-grant
Commit: 009be9b8e2a6784012b6d0d6800c2e57b65e1568
Parents: 2c88dfe
Author: Ernest Burghardt <eburghardt@pivotal.io>
Authored: Tue Jan 24 14:33:28 2017 -0800
Committer: Ernest Burghardt <eburghardt@pivotal.io>
Committed: Tue Jan 24 14:33:28 2017 -0800

----------------------------------------------------------------------
 .../src/statistics/GemfireStatisticsFactory.cpp | 276 -------------------
 .../src/statistics/GemfireStatisticsFactory.hpp | 153 ----------
 .../src/statistics/GeodeStatisticsFactory.cpp   | 276 +++++++++++++++++++
 .../src/statistics/GeodeStatisticsFactory.hpp   | 153 ++++++++++
 4 files changed, 429 insertions(+), 429 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/009be9b8/src/cppcache/src/statistics/GemfireStatisticsFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/GemfireStatisticsFactory.cpp b/src/cppcache/src/statistics/GemfireStatisticsFactory.cpp
deleted file mode 100644
index 9a7d815..0000000
--- a/src/cppcache/src/statistics/GemfireStatisticsFactory.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gfcpp/gfcpp_globals.hpp>
-
-#include <ace/Recursive_Thread_Mutex.h>
-#include <ace/OS.h>
-#include <ace/Thread_Mutex.h>
-#include <ace/Guard_T.h>
-#include <gfcpp/Exception.hpp>
-#include "GemfireStatisticsFactory.hpp"
-#include <gfcpp/Log.hpp>
-#include <string>
-#include "AtomicStatisticsImpl.hpp"
-#include "OsStatisticsImpl.hpp"
-#include "HostStatHelper.hpp"
-
-using namespace apache::geode::client;
-using namespace apache::geode::statistics;
-
-/**
- * static member initialization
- */
-GemfireStatisticsFactory* GemfireStatisticsFactory::s_singleton = NULL;
-
-GemfireStatisticsFactory::GemfireStatisticsFactory(
-    StatisticsManager* statMngr) {
-  m_name = "GemfireStatisticsFactory";
-  m_id = ACE_OS::getpid();
-  m_statsListUniqueId = 1;
-
-  m_statMngr = statMngr;
-}
-
-GemfireStatisticsFactory* GemfireStatisticsFactory::initInstance(
-    StatisticsManager* statMngr) {
-  if (!s_singleton) {
-    s_singleton = new GemfireStatisticsFactory(statMngr);
-  }
-
-  return s_singleton;
-}
-
-GemfireStatisticsFactory* GemfireStatisticsFactory::getExistingInstance() {
-  GF_D_ASSERT(!!s_singleton);
-
-  s_singleton->getId();  // should fault if !s_singleton
-
-  return s_singleton;
-}
-
-/**************************Dtor*******************************************/
-void GemfireStatisticsFactory::clean() {
-  if (s_singleton != NULL) {
-    delete s_singleton;
-    s_singleton = NULL;
-  }
-}
-
-GemfireStatisticsFactory::~GemfireStatisticsFactory() {
-  try {
-    m_statMngr = NULL;
-
-    // Clean Map : Delete all the pointers of StatisticsType from the map.
-    if (statsTypeMap.total_size() == 0) return;
-
-    ACE_Map_Manager<std::string, StatisticsTypeImpl*,
-                    ACE_Recursive_Thread_Mutex>::iterator iterFind =
-        statsTypeMap.begin();
-    while (iterFind != statsTypeMap.end()) {
-      delete (*iterFind).int_id_;
-      (*iterFind).int_id_ = NULL;
-      iterFind++;
-    }
-    statsTypeMap.unbind_all();
-
-  } catch (const Exception& ex) {
-    Log::warningCatch("~GemfireStatisticsFactory swallowing GemFire exception",
-                      ex);
-
-  } catch (const std::exception& ex) {
-    std::string what = "~GemfireStatisticsFactory swallowing std::exception: ";
-    what += ex.what();
-    LOGWARN(what.c_str());
-
-  } catch (...) {
-    LOGERROR("~GemfireStatisticsFactory swallowing unknown exception");
-  }
-}
-
-const char* GemfireStatisticsFactory::getName() { return m_name; }
-
-int64 GemfireStatisticsFactory::getId() { return m_id; }
-
-Statistics* GemfireStatisticsFactory::createStatistics(StatisticsType* type) {
-  return createAtomicStatistics(type, NULL, 0);
-}
-
-Statistics* GemfireStatisticsFactory::createStatistics(StatisticsType* type,
-                                                       const char* textId) {
-  return createAtomicStatistics(type, textId, 0);
-}
-
-Statistics* GemfireStatisticsFactory::createStatistics(StatisticsType* type,
-                                                       const char* textId,
-                                                       int64 numericId) {
-  return createAtomicStatistics(type, textId, 0);
-}
-
-Statistics* GemfireStatisticsFactory::createOsStatistics(StatisticsType* type,
-                                                         const char* textId,
-                                                         int64 numericId) {
-  // Validate input
-  if (type == NULL) {
-    throw IllegalArgumentException("StatisticsType* is Null");
-  }
-
-  int64 myUniqueId;
-  {
-    ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListUniqueIdLock);
-    myUniqueId = m_statsListUniqueId++;
-  }
-
-  Statistics* result =
-      new OsStatisticsImpl(type, textId, numericId, myUniqueId, this);
-  { m_statMngr->addStatisticsToList(result); }
-
-  return result;
-}
-
-Statistics* GemfireStatisticsFactory::createAtomicStatistics(
-    StatisticsType* type) {
-  return createAtomicStatistics(type, NULL, 0);
-}
-
-Statistics* GemfireStatisticsFactory::createAtomicStatistics(
-    StatisticsType* type, const char* textId) {
-  return createAtomicStatistics(type, textId, 0);
-}
-
-Statistics* GemfireStatisticsFactory::createAtomicStatistics(
-    StatisticsType* type, const char* textId, int64 numericId) {
-  // Validate input
-  if (type == NULL) {
-    throw IllegalArgumentException("StatisticsType* is Null");
-  }
-  int64 myUniqueId;
-
-  {
-    ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListUniqueIdLock);
-    myUniqueId = m_statsListUniqueId++;
-  }
-
-  Statistics* result =
-      new AtomicStatisticsImpl(type, textId, numericId, myUniqueId, this);
-
-  { m_statMngr->addStatisticsToList(result); }
-
-  return result;
-}
-
-Statistics* GemfireStatisticsFactory::findFirstStatisticsByType(
-    StatisticsType* type) {
-  return (m_statMngr->findFirstStatisticsByType(type));
-}
-
-StatisticsTypeImpl* GemfireStatisticsFactory::addType(StatisticsTypeImpl* st) {
-  StatisticsTypeImpl* st1;
-  std::string temp(st->getName());
-  int status;
-  try {
-    status = statsTypeMap.rebind(temp, st, st1);
-  } catch (const std::exception& ex) {
-    throw IllegalArgumentException(ex.what());
-  } catch (...) {
-    throw IllegalArgumentException("addType: unknown exception");
-  }
-  if (status == 1) {
-  } else if (status == -1) {
-    throw IllegalArgumentException(
-        "GemfireStatisticsFactory::addType: failed "
-        "to add new type %s",
-        temp.c_str());
-  }
-  return st;
-}
-
-/**
- * Creates  a StatisticType for the given shared class.
- */
-StatisticsType* GemfireStatisticsFactory::createType(
-    const char* name, const char* description, StatisticDescriptor** stats,
-    int32 statsLength) {
-  StatisticsTypeImpl* st =
-      new StatisticsTypeImpl(name, description, stats, statsLength);
-
-  if (st != NULL) {
-    st = addType(st);
-  } else {
-    throw OutOfMemoryException(
-        "GemfireStatisticsFactory::createType :: out memory");
-  }
-  return st;
-}
-
-StatisticsType* GemfireStatisticsFactory::findType(const char* name) {
-  std::string statName = name;
-  StatisticsTypeImpl* st = NULL;
-  int status = statsTypeMap.find(statName, st);
-  if (status == -1) {
-    std::string temp(name);
-    std::string s = "There is no statistic named \"" + temp + "\"";
-    // LOGWARN(s.c_str());
-    // throw IllegalArgumentException(s.c_str());
-    return NULL;
-  } else {
-    return st;
-  }
-}
-
-StatisticDescriptor* GemfireStatisticsFactory::createIntCounter(
-    const char* name, const char* description, const char* units,
-    int8 largerBetter) {
-  return StatisticDescriptorImpl::createIntCounter(name, description, units,
-                                                   largerBetter);
-}
-
-StatisticDescriptor* GemfireStatisticsFactory::createLongCounter(
-    const char* name, const char* description, const char* units,
-    int8 largerBetter) {
-  return StatisticDescriptorImpl::createLongCounter(name, description, units,
-                                                    largerBetter);
-}
-
-StatisticDescriptor* GemfireStatisticsFactory::createDoubleCounter(
-    const char* name, const char* description, const char* units,
-    int8 largerBetter) {
-  return StatisticDescriptorImpl::createDoubleCounter(name, description, units,
-                                                      largerBetter);
-}
-
-StatisticDescriptor* GemfireStatisticsFactory::createIntGauge(
-    const char* name, const char* description, const char* units,
-    int8 largerBetter) {
-  return StatisticDescriptorImpl::createIntGauge(name, description, units,
-                                                 largerBetter);
-}
-
-StatisticDescriptor* GemfireStatisticsFactory::createLongGauge(
-    const char* name, const char* description, const char* units,
-    int8 largerBetter) {
-  return StatisticDescriptorImpl::createLongGauge(name, description, units,
-                                                  largerBetter);
-}
-
-StatisticDescriptor* GemfireStatisticsFactory::createDoubleGauge(
-    const char* name, const char* description, const char* units,
-    int8 largerBetter) {
-  return StatisticDescriptorImpl::createDoubleGauge(name, description, units,
-                                                    largerBetter);
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/009be9b8/src/cppcache/src/statistics/GemfireStatisticsFactory.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/GemfireStatisticsFactory.hpp b/src/cppcache/src/statistics/GemfireStatisticsFactory.hpp
deleted file mode 100644
index 1d59e3f..0000000
--- a/src/cppcache/src/statistics/GemfireStatisticsFactory.hpp
+++ /dev/null
@@ -1,153 +0,0 @@
-
-
-#ifndef _GEMFIRE_STATISTICS_GEMFIRESTATISTICSFACTORY_HPP_
-#define _GEMFIRE_STATISTICS_GEMFIRESTATISTICSFACTORY_HPP_
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <gfcpp/gfcpp_globals.hpp>
-
-#include <sys/types.h>
-#ifndef WIN32
-#include <unistd.h>
-#endif
-#include <vector>
-#include <ace/Recursive_Thread_Mutex.h>
-#include <ace/Map_Manager.h>
-#include "StatisticsTypeImpl.hpp"
-#include <gfcpp/statistics/StatisticsFactory.hpp>
-#include "StatisticsManager.hpp"
-#include <gfcpp/ExceptionTypes.hpp>
-
-using namespace apache::geode::client;
-
-/** @file
-*/
-
-namespace apache {
-namespace geode {
-namespace statistics {
-
-class StatisticsManager;
-
-/**
- * Gemfire's implementation of {@link StatisticsFactory}.
- *
- */
-class GemfireStatisticsFactory : public StatisticsFactory {
- private:
-  //--------------------Properties-------------------------------------------------
-
-  const char* m_name;
-
-  int64 m_id;
-
-  StatisticsManager* m_statMngr;
-
-  static GemfireStatisticsFactory* s_singleton;
-
-  //------------------  methods ------------------------------
-
-  GemfireStatisticsFactory(StatisticsManager* statMngr);
-
-  int64 m_statsListUniqueId;  // Creates a unique id for each stats object in
-                              // the list
-
-  ACE_Recursive_Thread_Mutex m_statsListUniqueIdLock;
-
-  /* Maps a stat name to its StatisticDescriptor*/
-  ACE_Map_Manager<std::string, StatisticsTypeImpl*, ACE_Recursive_Thread_Mutex>
-      statsTypeMap;
-
-  StatisticsTypeImpl* addType(StatisticsTypeImpl* t);
-
-  //////////////////////////public member functions///////////////////////////
-
- public:
-  ~GemfireStatisticsFactory();
-
-  static void clean();
-
-  const char* getName();
-
-  int64 getId();
-
-  static GemfireStatisticsFactory* initInstance(StatisticsManager* statMngr);
-
-  static GemfireStatisticsFactory* getExistingInstance();
-
-  //------------ StatisticsFactory methods: Statistics
-  //------------------------------
-  Statistics* createStatistics(StatisticsType* type);
-
-  Statistics* createStatistics(StatisticsType* type, const char* textId);
-
-  Statistics* createStatistics(StatisticsType* type, const char* textId,
-                               int64 numericId);
-
-  Statistics* createOsStatistics(StatisticsType* type, const char* textId,
-                                 int64 numericId);
-
-  Statistics* createAtomicStatistics(StatisticsType* type);
-
-  Statistics* createAtomicStatistics(StatisticsType* type, const char* textId);
-
-  Statistics* createAtomicStatistics(StatisticsType* type, const char* textId,
-                                     int64 numericId);
-
-  //------------ StatisticsFactory methods: Statistics Type
-  //------------------------------
-  StatisticsType* createType(const char* name, const char* description,
-                             StatisticDescriptor** stats, int32 statsLength);
-
-  StatisticsType* findType(const char* name);
-
-  //------------ StatisticsFactory methods: Statistics Descriptor
-  //---------------------
-  StatisticDescriptor* createIntCounter(const char* name,
-                                        const char* description,
-                                        const char* units, int8 largerBetter);
-
-  StatisticDescriptor* createLongCounter(const char* name,
-                                         const char* description,
-                                         const char* units, int8 largerBetter);
-
-  StatisticDescriptor* createDoubleCounter(const char* name,
-                                           const char* description,
-                                           const char* units,
-                                           int8 largerBetter);
-
-  StatisticDescriptor* createIntGauge(const char* name, const char* description,
-                                      const char* units, int8 largerBetter);
-
-  StatisticDescriptor* createLongGauge(const char* name,
-                                       const char* description,
-                                       const char* units, int8 largerBetter);
-
-  StatisticDescriptor* createDoubleGauge(const char* name,
-                                         const char* description,
-                                         const char* units, int8 largerBetter);
-
-  /** Return the first instance that matches the type, or NULL */
-  Statistics* findFirstStatisticsByType(StatisticsType* type);
-
-};  // class
-
-}  // namespace client
-}  // namespace geode
-}  // namespace apache
-
-#endif  //  _GEMFIRE_STATISTICS_GEMFIRESTATISTICSFACTORY_HPP_

http://git-wip-us.apache.org/repos/asf/geode/blob/009be9b8/src/cppcache/src/statistics/GeodeStatisticsFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/GeodeStatisticsFactory.cpp b/src/cppcache/src/statistics/GeodeStatisticsFactory.cpp
new file mode 100644
index 0000000..9a7d815
--- /dev/null
+++ b/src/cppcache/src/statistics/GeodeStatisticsFactory.cpp
@@ -0,0 +1,276 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gfcpp/gfcpp_globals.hpp>
+
+#include <ace/Recursive_Thread_Mutex.h>
+#include <ace/OS.h>
+#include <ace/Thread_Mutex.h>
+#include <ace/Guard_T.h>
+#include <gfcpp/Exception.hpp>
+#include "GemfireStatisticsFactory.hpp"
+#include <gfcpp/Log.hpp>
+#include <string>
+#include "AtomicStatisticsImpl.hpp"
+#include "OsStatisticsImpl.hpp"
+#include "HostStatHelper.hpp"
+
+using namespace apache::geode::client;
+using namespace apache::geode::statistics;
+
+/**
+ * static member initialization
+ */
+GemfireStatisticsFactory* GemfireStatisticsFactory::s_singleton = NULL;
+
+GemfireStatisticsFactory::GemfireStatisticsFactory(
+    StatisticsManager* statMngr) {
+  m_name = "GemfireStatisticsFactory";
+  m_id = ACE_OS::getpid();
+  m_statsListUniqueId = 1;
+
+  m_statMngr = statMngr;
+}
+
+GemfireStatisticsFactory* GemfireStatisticsFactory::initInstance(
+    StatisticsManager* statMngr) {
+  if (!s_singleton) {
+    s_singleton = new GemfireStatisticsFactory(statMngr);
+  }
+
+  return s_singleton;
+}
+
+GemfireStatisticsFactory* GemfireStatisticsFactory::getExistingInstance() {
+  GF_D_ASSERT(!!s_singleton);
+
+  s_singleton->getId();  // should fault if !s_singleton
+
+  return s_singleton;
+}
+
+/**************************Dtor*******************************************/
+void GemfireStatisticsFactory::clean() {
+  if (s_singleton != NULL) {
+    delete s_singleton;
+    s_singleton = NULL;
+  }
+}
+
+GemfireStatisticsFactory::~GemfireStatisticsFactory() {
+  try {
+    m_statMngr = NULL;
+
+    // Clean Map : Delete all the pointers of StatisticsType from the map.
+    if (statsTypeMap.total_size() == 0) return;
+
+    ACE_Map_Manager<std::string, StatisticsTypeImpl*,
+                    ACE_Recursive_Thread_Mutex>::iterator iterFind =
+        statsTypeMap.begin();
+    while (iterFind != statsTypeMap.end()) {
+      delete (*iterFind).int_id_;
+      (*iterFind).int_id_ = NULL;
+      iterFind++;
+    }
+    statsTypeMap.unbind_all();
+
+  } catch (const Exception& ex) {
+    Log::warningCatch("~GemfireStatisticsFactory swallowing GemFire exception",
+                      ex);
+
+  } catch (const std::exception& ex) {
+    std::string what = "~GemfireStatisticsFactory swallowing std::exception: ";
+    what += ex.what();
+    LOGWARN(what.c_str());
+
+  } catch (...) {
+    LOGERROR("~GemfireStatisticsFactory swallowing unknown exception");
+  }
+}
+
+const char* GemfireStatisticsFactory::getName() { return m_name; }
+
+int64 GemfireStatisticsFactory::getId() { return m_id; }
+
+Statistics* GemfireStatisticsFactory::createStatistics(StatisticsType* type) {
+  return createAtomicStatistics(type, NULL, 0);
+}
+
+Statistics* GemfireStatisticsFactory::createStatistics(StatisticsType* type,
+                                                       const char* textId) {
+  return createAtomicStatistics(type, textId, 0);
+}
+
+Statistics* GemfireStatisticsFactory::createStatistics(StatisticsType* type,
+                                                       const char* textId,
+                                                       int64 numericId) {
+  return createAtomicStatistics(type, textId, 0);
+}
+
+Statistics* GemfireStatisticsFactory::createOsStatistics(StatisticsType* type,
+                                                         const char* textId,
+                                                         int64 numericId) {
+  // Validate input
+  if (type == NULL) {
+    throw IllegalArgumentException("StatisticsType* is Null");
+  }
+
+  int64 myUniqueId;
+  {
+    ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListUniqueIdLock);
+    myUniqueId = m_statsListUniqueId++;
+  }
+
+  Statistics* result =
+      new OsStatisticsImpl(type, textId, numericId, myUniqueId, this);
+  { m_statMngr->addStatisticsToList(result); }
+
+  return result;
+}
+
+Statistics* GemfireStatisticsFactory::createAtomicStatistics(
+    StatisticsType* type) {
+  return createAtomicStatistics(type, NULL, 0);
+}
+
+Statistics* GemfireStatisticsFactory::createAtomicStatistics(
+    StatisticsType* type, const char* textId) {
+  return createAtomicStatistics(type, textId, 0);
+}
+
+Statistics* GemfireStatisticsFactory::createAtomicStatistics(
+    StatisticsType* type, const char* textId, int64 numericId) {
+  // Validate input
+  if (type == NULL) {
+    throw IllegalArgumentException("StatisticsType* is Null");
+  }
+  int64 myUniqueId;
+
+  {
+    ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_statsListUniqueIdLock);
+    myUniqueId = m_statsListUniqueId++;
+  }
+
+  Statistics* result =
+      new AtomicStatisticsImpl(type, textId, numericId, myUniqueId, this);
+
+  { m_statMngr->addStatisticsToList(result); }
+
+  return result;
+}
+
+Statistics* GemfireStatisticsFactory::findFirstStatisticsByType(
+    StatisticsType* type) {
+  return (m_statMngr->findFirstStatisticsByType(type));
+}
+
+StatisticsTypeImpl* GemfireStatisticsFactory::addType(StatisticsTypeImpl* st) {
+  StatisticsTypeImpl* st1;
+  std::string temp(st->getName());
+  int status;
+  try {
+    status = statsTypeMap.rebind(temp, st, st1);
+  } catch (const std::exception& ex) {
+    throw IllegalArgumentException(ex.what());
+  } catch (...) {
+    throw IllegalArgumentException("addType: unknown exception");
+  }
+  if (status == 1) {
+  } else if (status == -1) {
+    throw IllegalArgumentException(
+        "GemfireStatisticsFactory::addType: failed "
+        "to add new type %s",
+        temp.c_str());
+  }
+  return st;
+}
+
+/**
+ * Creates  a StatisticType for the given shared class.
+ */
+StatisticsType* GemfireStatisticsFactory::createType(
+    const char* name, const char* description, StatisticDescriptor** stats,
+    int32 statsLength) {
+  StatisticsTypeImpl* st =
+      new StatisticsTypeImpl(name, description, stats, statsLength);
+
+  if (st != NULL) {
+    st = addType(st);
+  } else {
+    throw OutOfMemoryException(
+        "GemfireStatisticsFactory::createType :: out memory");
+  }
+  return st;
+}
+
+StatisticsType* GemfireStatisticsFactory::findType(const char* name) {
+  std::string statName = name;
+  StatisticsTypeImpl* st = NULL;
+  int status = statsTypeMap.find(statName, st);
+  if (status == -1) {
+    std::string temp(name);
+    std::string s = "There is no statistic named \"" + temp + "\"";
+    // LOGWARN(s.c_str());
+    // throw IllegalArgumentException(s.c_str());
+    return NULL;
+  } else {
+    return st;
+  }
+}
+
+StatisticDescriptor* GemfireStatisticsFactory::createIntCounter(
+    const char* name, const char* description, const char* units,
+    int8 largerBetter) {
+  return StatisticDescriptorImpl::createIntCounter(name, description, units,
+                                                   largerBetter);
+}
+
+StatisticDescriptor* GemfireStatisticsFactory::createLongCounter(
+    const char* name, const char* description, const char* units,
+    int8 largerBetter) {
+  return StatisticDescriptorImpl::createLongCounter(name, description, units,
+                                                    largerBetter);
+}
+
+StatisticDescriptor* GemfireStatisticsFactory::createDoubleCounter(
+    const char* name, const char* description, const char* units,
+    int8 largerBetter) {
+  return StatisticDescriptorImpl::createDoubleCounter(name, description, units,
+                                                      largerBetter);
+}
+
+StatisticDescriptor* GemfireStatisticsFactory::createIntGauge(
+    const char* name, const char* description, const char* units,
+    int8 largerBetter) {
+  return StatisticDescriptorImpl::createIntGauge(name, description, units,
+                                                 largerBetter);
+}
+
+StatisticDescriptor* GemfireStatisticsFactory::createLongGauge(
+    const char* name, const char* description, const char* units,
+    int8 largerBetter) {
+  return StatisticDescriptorImpl::createLongGauge(name, description, units,
+                                                  largerBetter);
+}
+
+StatisticDescriptor* GemfireStatisticsFactory::createDoubleGauge(
+    const char* name, const char* description, const char* units,
+    int8 largerBetter) {
+  return StatisticDescriptorImpl::createDoubleGauge(name, description, units,
+                                                    largerBetter);
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/009be9b8/src/cppcache/src/statistics/GeodeStatisticsFactory.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/GeodeStatisticsFactory.hpp b/src/cppcache/src/statistics/GeodeStatisticsFactory.hpp
new file mode 100644
index 0000000..1d59e3f
--- /dev/null
+++ b/src/cppcache/src/statistics/GeodeStatisticsFactory.hpp
@@ -0,0 +1,153 @@
+
+
+#ifndef _GEMFIRE_STATISTICS_GEMFIRESTATISTICSFACTORY_HPP_
+#define _GEMFIRE_STATISTICS_GEMFIRESTATISTICSFACTORY_HPP_
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <gfcpp/gfcpp_globals.hpp>
+
+#include <sys/types.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#include <vector>
+#include <ace/Recursive_Thread_Mutex.h>
+#include <ace/Map_Manager.h>
+#include "StatisticsTypeImpl.hpp"
+#include <gfcpp/statistics/StatisticsFactory.hpp>
+#include "StatisticsManager.hpp"
+#include <gfcpp/ExceptionTypes.hpp>
+
+using namespace apache::geode::client;
+
+/** @file
+*/
+
+namespace apache {
+namespace geode {
+namespace statistics {
+
+class StatisticsManager;
+
+/**
+ * Gemfire's implementation of {@link StatisticsFactory}.
+ *
+ */
+class GemfireStatisticsFactory : public StatisticsFactory {
+ private:
+  //--------------------Properties-------------------------------------------------
+
+  const char* m_name;
+
+  int64 m_id;
+
+  StatisticsManager* m_statMngr;
+
+  static GemfireStatisticsFactory* s_singleton;
+
+  //------------------  methods ------------------------------
+
+  GemfireStatisticsFactory(StatisticsManager* statMngr);
+
+  int64 m_statsListUniqueId;  // Creates a unique id for each stats object in
+                              // the list
+
+  ACE_Recursive_Thread_Mutex m_statsListUniqueIdLock;
+
+  /* Maps a stat name to its StatisticDescriptor*/
+  ACE_Map_Manager<std::string, StatisticsTypeImpl*, ACE_Recursive_Thread_Mutex>
+      statsTypeMap;
+
+  StatisticsTypeImpl* addType(StatisticsTypeImpl* t);
+
+  //////////////////////////public member functions///////////////////////////
+
+ public:
+  ~GemfireStatisticsFactory();
+
+  static void clean();
+
+  const char* getName();
+
+  int64 getId();
+
+  static GemfireStatisticsFactory* initInstance(StatisticsManager* statMngr);
+
+  static GemfireStatisticsFactory* getExistingInstance();
+
+  //------------ StatisticsFactory methods: Statistics
+  //------------------------------
+  Statistics* createStatistics(StatisticsType* type);
+
+  Statistics* createStatistics(StatisticsType* type, const char* textId);
+
+  Statistics* createStatistics(StatisticsType* type, const char* textId,
+                               int64 numericId);
+
+  Statistics* createOsStatistics(StatisticsType* type, const char* textId,
+                                 int64 numericId);
+
+  Statistics* createAtomicStatistics(StatisticsType* type);
+
+  Statistics* createAtomicStatistics(StatisticsType* type, const char* textId);
+
+  Statistics* createAtomicStatistics(StatisticsType* type, const char* textId,
+                                     int64 numericId);
+
+  //------------ StatisticsFactory methods: Statistics Type
+  //------------------------------
+  StatisticsType* createType(const char* name, const char* description,
+                             StatisticDescriptor** stats, int32 statsLength);
+
+  StatisticsType* findType(const char* name);
+
+  //------------ StatisticsFactory methods: Statistics Descriptor
+  //---------------------
+  StatisticDescriptor* createIntCounter(const char* name,
+                                        const char* description,
+                                        const char* units, int8 largerBetter);
+
+  StatisticDescriptor* createLongCounter(const char* name,
+                                         const char* description,
+                                         const char* units, int8 largerBetter);
+
+  StatisticDescriptor* createDoubleCounter(const char* name,
+                                           const char* description,
+                                           const char* units,
+                                           int8 largerBetter);
+
+  StatisticDescriptor* createIntGauge(const char* name, const char* description,
+                                      const char* units, int8 largerBetter);
+
+  StatisticDescriptor* createLongGauge(const char* name,
+                                       const char* description,
+                                       const char* units, int8 largerBetter);
+
+  StatisticDescriptor* createDoubleGauge(const char* name,
+                                         const char* description,
+                                         const char* units, int8 largerBetter);
+
+  /** Return the first instance that matches the type, or NULL */
+  Statistics* findFirstStatisticsByType(StatisticsType* type);
+
+};  // class
+
+}  // namespace client
+}  // namespace geode
+}  // namespace apache
+
+#endif  //  _GEMFIRE_STATISTICS_GEMFIRESTATISTICSFACTORY_HPP_


Mime
View raw message