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

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

The 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.AdminDistributedSystem;
import com.gemstone.gemfire.admin.ManagedEntity;
import com.gemstone.gemfire.admin.ManagedEntityConfig;

/**
 * Provides internal-only functionality that is expected of all
 * ManagedEntitys.  This functionality is used by the
 * {@link ManagedEntityController} to manage the entity.
 *
 * @author David Whitlock
 * @since 4.0
 */
public interface InternalManagedEntity extends ManagedEntity {

  /** The state of a managed entity is unknown. */
  public static final int UNKNOWN = 10;

  /** A managed entity is stopped */
  public static final int STOPPED = 11;

  /** A managed entity is stopping (being stopped) */
  public static final int STOPPING = 12;

  /** A managed entity is starting */
  public static final int STARTING = 13;

  /** A managed entity is running (is started) */
  public static final int RUNNING = 14;

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

  /**
   * Returns the ManagedEntityConfig for this
   * ManagedEntity. 
   */
  public ManagedEntityConfig getEntityConfig();

  /**
   * Returns a brief description (such as "locator") of this managed
   * entity. 
   */
  public String getEntityType();

  /**
   * Returns the (local) command to execute in order to start this
   * managed entity.  The command includes the full path to the
   * executable (include $GEMFIRE/bin) and any
   * command-line arguments.  It does not take the {@linkplain
   * ManagedEntityConfig#getRemoteCommand remote command} into account.
   */
  public String getStartCommand();

  /**
   * Returns the (local) command to execute in order to stop this
   * managed entity.
   */
  public String getStopCommand();

  /**
   * Returns the (local) command to execute in order to determine
   * whether or not this managed entity is runing.
   */
  public String getIsRunningCommand();

  /**
   * Returns a descriptive, one-word, unique id for a newly-created
   * ManagedEntity.   This ensures that we do not have
   * collisions in the ids of entities.
   */
  public String getNewId();

  /**
   * Returns the distributed system to which this managed entity
   * belongs.
   */
  public AdminDistributedSystem getDistributedSystem();

  /**
   * Sets the state of this managed entity and informs threads that
   * are waiting for a state change.  See bug 32455.
   *
   * @return The previous state of this managed entity.
   *
   * @see #RUNNING
   */
  public int setState(int state);

}