diff options
| author | Keith Wall <kwall@apache.org> | 2012-08-30 20:54:43 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2012-08-30 20:54:43 +0000 |
| commit | a881ed80bf589ebb8e70a59d7a886a8b447e7105 (patch) | |
| tree | 6979ab09de77394056fd0234d3ff7271b2197fc5 /qpid/java/broker-plugins/management-http | |
| parent | 0e96a636c825288987e07212aa556197e0fb43f6 (diff) | |
| download | qpid-python-a881ed80bf589ebb8e70a59d7a886a8b447e7105.tar.gz | |
QPID-4270: Change web management plugin to log management operational log messages.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1379139 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/management-http')
| -rw-r--r-- | qpid/java/broker-plugins/management-http/MANIFEST.MF | 1 | ||||
| -rw-r--r-- | qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/Management.java | 58 |
2 files changed, 51 insertions, 8 deletions
diff --git a/qpid/java/broker-plugins/management-http/MANIFEST.MF b/qpid/java/broker-plugins/management-http/MANIFEST.MF index 525801f65f..c6c5c65277 100644 --- a/qpid/java/broker-plugins/management-http/MANIFEST.MF +++ b/qpid/java/broker-plugins/management-http/MANIFEST.MF @@ -21,6 +21,7 @@ Import-Package: org.apache.qpid, org.apache.qpid.server.exchange, org.apache.qpid.server.logging, org.apache.qpid.server.logging.actors, + org.apache.qpid.server.logging.messages, org.apache.qpid.server.message, org.apache.qpid.server.model, org.apache.qpid.server.model.adapter, diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/Management.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/Management.java index 38a8722852..cdb5e0607c 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/Management.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/Management.java @@ -28,6 +28,8 @@ import java.util.Collection; import org.apache.commons.configuration.ConfigurationException; import org.apache.log4j.Logger; +import org.apache.qpid.server.logging.actors.CurrentActor; +import org.apache.qpid.server.logging.messages.ManagementConsoleMessages; import org.apache.qpid.server.management.plugin.servlet.DefinedFileServlet; import org.apache.qpid.server.management.plugin.servlet.FileServlet; import org.apache.qpid.server.management.plugin.servlet.api.ExchangesServlet; @@ -56,6 +58,7 @@ import org.apache.qpid.server.model.User; import org.apache.qpid.server.model.VirtualHost; import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.server.registry.IApplicationRegistry; +import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.SessionManager; import org.eclipse.jetty.server.nio.SelectChannelConnector; @@ -66,12 +69,13 @@ import org.eclipse.jetty.util.ssl.SslContextFactory; public class Management { + private static final String OPERATIONAL_LOGGING_NAME = "Web"; private final Logger _logger = Logger.getLogger(Management.class); - private Broker _broker; + private final Broker _broker; - private Collection<Server> _servers = new ArrayList<Server>(); + private final Collection<Server> _servers = new ArrayList<Server>(); public Management() throws ConfigurationException, IOException { @@ -206,28 +210,34 @@ public class Management public void start() throws Exception { + CurrentActor.get().message(ManagementConsoleMessages.STARTUP(OPERATIONAL_LOGGING_NAME)); + for (Server server : _servers) { server.start(); + + logOperationalListenMessages(server); } + + CurrentActor.get().message(ManagementConsoleMessages.READY(OPERATIONAL_LOGGING_NAME)); } public void stop() throws Exception { for (Server server : _servers) { + logOperationalShutdownMessage(server); + server.stop(); } + + CurrentActor.get().message(ManagementConsoleMessages.STOPPED(OPERATIONAL_LOGGING_NAME)); } private String getKeyStorePath(IApplicationRegistry appRegistry) throws ConfigurationException, FileNotFoundException { - String keyStorePath = null; - if (System.getProperty("javax.net.ssl.keyStore") != null) - { - keyStorePath = System.getProperty("javax.net.ssl.keyStore"); - } - else + String keyStorePath = System.getProperty("javax.net.ssl.keyStore"); + if (keyStorePath == null) { keyStorePath = appRegistry.getConfiguration().getManagementKeyStorePath(); } @@ -251,4 +261,36 @@ public class Management return keyStorePath; } + private void logOperationalListenMessages(Server server) + { + Connector[] connectors = server.getConnectors(); + for (Connector connector : connectors) + { + CurrentActor.get().message(ManagementConsoleMessages.LISTENING(stringifyConnectorScheme(connector), connector.getPort())); + if (connector instanceof SslSocketConnector) + { + SslContextFactory sslContextFactory = ((SslSocketConnector)connector).getSslContextFactory(); + if (sslContextFactory != null && sslContextFactory.getKeyStorePath() != null) + { + CurrentActor.get().message(ManagementConsoleMessages.SSL_KEYSTORE(sslContextFactory.getKeyStorePath())); + } + } + } + } + + private void logOperationalShutdownMessage(Server server) + { + Connector[] connectors = server.getConnectors(); + for (Connector connector : connectors) + { + CurrentActor.get().message(ManagementConsoleMessages.SHUTTING_DOWN(stringifyConnectorScheme(connector), connector.getPort())); + } + } + + private String stringifyConnectorScheme(Connector connector) + { + return connector instanceof SslSocketConnector ? "HTTPS" : "HTTP"; + } + + } |
