All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gemstone.gemfire.admin.internal.GemFireHealthConfigImpl Maven / Gradle / Ivy

There is a newer version: 2.0-BETA
Show newest version
/*
 * Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
 *
 * Licensed 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. See accompanying
 * LICENSE file.
 */
package com.gemstone.gemfire.admin.internal;

import com.gemstone.gemfire.admin.*;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;

// @todo davidw Delegate to a "parent" config for properties that are not overridden.
// This will be made easier with a special HealthConfigAttribute class.
/**
 * The implementation of GemFireHealthConfig
 *
 *
 * @author David Whitlock
 *
 * @since 3.5
 */
public class GemFireHealthConfigImpl
  extends CacheHealthConfigImpl
  implements GemFireHealthConfig {

  private static final long serialVersionUID = -6797673296902808018L;

  /** The name of the host to which this configuration applies. */
  private String hostName;

  /** The number of seconds to wait between evaluating the health of
   * GemFire. */
  private int interval = DEFAULT_HEALTH_EVALUATION_INTERVAL;

  ////////////////////////  Constructors  ////////////////////////

  /**
   * Creates a new GemFireHealthConfigImpl that applies
   * to the host with the given name.
   *
   * @param hostName
   *        The name of the host to which this configuration applies.
   *        If null, then this is the "default"
   *        configuration. 
   */
  public GemFireHealthConfigImpl(String hostName) {
    this.hostName = hostName;
  }

  ///////////////////////  Instance Methods  ///////////////////////

  public String getHostName() {
    return this.hostName;
  }

  public void setHealthEvaluationInterval(int interval) {
    this.interval = interval;
  }

  public int getHealthEvaluationInterval() {
    return this.interval;
  }

  @Override
  public String toString() {
    if (this.hostName == null) {
      return LocalizedStrings.GemFireHealthConfigImpl_DEFAULT_GEMFIRE_HEALTH_CONFIGURATION.toLocalizedString();

    } else {
      return LocalizedStrings.GemFireHealthConfigImpl_GEMFIRE_HEALTH_CONFIGURATION_FOR_HOST_0.toLocalizedString(this.hostName);
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy