001/*
002 * Copyright 2012-2017 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.admin;
018
019/**
020 * An MBean contract to control and monitor a running {@code SpringApplication} via JMX.
021 * Intended for internal use only.
022 *
023 * @author Stephane Nicoll
024 * @since 1.3.0
025 */
026public interface SpringApplicationAdminMXBean {
027
028        /**
029         * Specify if the application has fully started and is now ready.
030         * @return {@code true} if the application is ready
031         * @see org.springframework.boot.context.event.ApplicationReadyEvent
032         */
033        boolean isReady();
034
035        /**
036         * Specify if the application runs in an embedded web container. Return {@code false}
037         * on a web application that hasn't fully started yet, so it is preferable to wait for
038         * the application to be {@link #isReady() ready}.
039         * @return {@code true} if the application runs in an embedded web container
040         * @see #isReady()
041         */
042        boolean isEmbeddedWebApplication();
043
044        /**
045         * Return the value of the specified key from the application
046         * {@link org.springframework.core.env.Environment Environment}.
047         * @param key the property key
048         * @return the property value or {@code null} if it does not exist
049         */
050        String getProperty(String key);
051
052        /**
053         * Shutdown the application.
054         * @see org.springframework.context.ConfigurableApplicationContext#close()
055         */
056        void shutdown();
057
058}