ConfigFileParser * Environment::getConfigPointer() {
  if (config == nullptr) {
    initializeConfig();
  }

  return config;
}
ConfigFileParser& Environment::getConfig() {
  if (config == nullptr) {
    initializeConfig();
  }

  return *config;
}
/*!
 * \brief Constructor of TConfiguration.
 */
TConfiguration::TConfiguration(TJvmInfo *info) {
  jvmInfo = info;
  isLoaded = false;
  firstCollected = false; /* Don't collected yet, */

  /* Initialize each configurations. */
  initializeConfig(NULL);
}
/*!
 * \brief Copy constructor of TConfiguration.
 */
TConfiguration::TConfiguration(const TConfiguration &src) {
  jvmInfo = src.jvmInfo;
  isLoaded = src.isLoaded;
  alertThreshold = src.alertThreshold;
  heapAlertThreshold = src.heapAlertThreshold;

  /* Initialize each configurations. */
  initializeConfig(&src);
}
/*!
 * \brief Copy constructor of TConfiguration.
 */
TConfiguration::TConfiguration(const TConfiguration &src) {
  jvmInfo = src.jvmInfo;
  isLoaded = false; // Set to false to load configuration from src.
  alertThreshold = src.alertThreshold;
  heapAlertThreshold = src.heapAlertThreshold;

  /* Initialize each configurations. */
  initializeConfig(&src);

  isLoaded = src.isLoaded;
}
Exemple #6
0
void Environment::init() {
  int argument;

  // default installation dir
  if (datadir.empty()) {
#ifndef _WIN32
    datadir = "/usr/share/glportal/data/";
#else
    datadir = "data/";
#endif
  }
  initializeConfig();
}
Exemple #7
0
void Environment::init() {
  if (dataDir.empty()) {
    std::vector<std::string> dataDirPaths = {
      "data"
    };

    if(OperatingSystem::IsLinux()){
      dataDirPaths.push_back("/usr/local/share/glportal/data");
      dataDirPaths.push_back("/usr/share/glportal/data");
    }

    for (auto & path : dataDirPaths) {
      if (Path::DirectoryExist(path)) {
        dataDir = path;
        Util::Log(Info, "DataDir") << path;

        break;
      }
    }
  }
  initializeConfig();
}