001/*
002 * JPPF.
003 * Copyright (C) 2005-2018 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 java.util.Map;
022
023import javax.management.MBeanServer;
024import javax.management.remote.*;
025
026/**
027 * Interface for JMX remote servers associated to drivers and nodes.
028 * @author Laurent Cohen
029 */
030public interface JMXServer {
031  /**
032   * Start the MBean server and associated resources.
033   * @param cl - the default classloader to be used by the JMX remote connector.
034   * @throws Exception if an error occurs when starting the server or one of its components.
035   * @exclude
036   */
037  void start(ClassLoader cl) throws Exception;
038
039  /**
040   * Stop the MBean server and associated resources.
041   * @throws Exception if an error occurs when stopping the server or one of its components.
042   * @exclude
043   */
044  void stop() throws Exception;
045
046  /**
047   * Get a reference to the MBean server.
048   * @return an <code>MBeanServer</code> instance.
049   */
050  MBeanServer getMBeanServer();
051
052  /**
053   * Determine whether this JMX server is stopped.
054   * @return <code>true</code> if this JMX server is stopped, <code>false</code> otherwise.
055   */
056  boolean isStopped();
057
058  /**
059   * Get a unique identifier for this management server. This id must be unique across JPPF nodes and servers.
060   * @return the id as a string.
061   * @deprecated use {@link #getUuid()} instead.
062   */
063  String getId();
064
065  /**
066   * Get a unique identifier for this management server. This id must be unique across JPPF nodes and servers.
067   * @return the id as a string.
068   */
069  String getUuid();
070
071  /**
072   * Get the host interface on which the JMX server is listeneing for connections.
073   * @return the host as a string.
074   */
075  String getManagementHost();
076
077  /**
078   * Get the port on which the connector is listening for connections from remote clients.
079   * @return the port number as an int.
080   */
081  int getManagementPort();
082
083  /**
084   * Get an optional {@link MBeanServerForwarder} associated with the underlying remote connector server.
085   * @return an {@link MBeanServerForwarder} instance, or {@code null} if node is associated with this jmx server.
086   */
087  MBeanServerForwarder getMBeanServerForwarder();
088
089  /**
090   * Get the JMX connector server.
091   * @return a {@link JMXConnectorServer} instance.
092   */
093  JMXConnectorServer getConnectorServer();
094
095  /**
096   * Get the environment used at the creation of this server.
097   * @return a JMX environment map.
098   */
099  Map<String, ?> getEnvironment();
100}