001/*
002 * JPPF.
003 * Copyright (C) 2005-2016 JPPF Team.
004 * http://www.jppf.org
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.jppf.management;
020
021import org.jppf.utils.LocalizationUtils;
022
023/**
024 * An enumeration of the possible pending actions for a node, set via one of the
025 * {@code shutdown(false)} or {@code restart(false)} methods of {@link JPPFNodeAdminMBean}. 
026 * @author Laurent Cohen
027 */
028public enum NodePendingAction {
029  /**
030   * There is no pending qction.
031   */
032  NONE("node.pending.none"),
033  /**
034   * A deferred shutdown was requested.
035   */
036  SHUTDOWN("node.pending.shutdown"),
037  /**
038   * A deferred restart was requested.
039   */
040  RESTART("node.pending.restart");
041
042  /**
043   * Base name for the localization resource bundles.
044   */
045  private static final String I18N = "org.jppf.server.i18n.server_messages";
046  /**
047   * The name to display.
048   */
049  private final String displayName;
050
051  /**
052   * Initialize this enum element with the specified localized display name.
053   * @param msg the display name ot localize.
054   */
055  private NodePendingAction(final String msg) {
056    displayName = msg;
057  }
058
059  @Override
060  public String toString() {
061    return LocalizationUtils.getLocalized(I18N, displayName);
062  }
063}