Author: robbie Date: Thu Jul 16 12:59:15 2009 New Revision: 794660 URL: http://svn.apache.org/viewvc?rev=794660&view=rev Log: QPID-1946: add server information mbean to expose version info for the broker and its JMX management API
Added: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/information/ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/information/management/ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/information/management/ServerInformationMBean.java qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java?rev=794660&r1=794659&r2=794660&view=diff ============================================================================== --- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java (original) +++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java Thu Jul 16 12:59:15 2009 @@ -50,6 +50,7 @@ import org.apache.qpid.pool.ReadWriteThreadModel; import org.apache.qpid.server.configuration.ServerConfiguration; import org.apache.qpid.server.configuration.management.ConfigurationManagementMBean; +import org.apache.qpid.server.information.management.ServerInformationMBean; import org.apache.qpid.server.logging.management.LoggingManagementMBean; import org.apache.qpid.server.protocol.AMQPFastProtocolHandler; import org.apache.qpid.server.protocol.AMQPProtocolProvider; @@ -273,6 +274,10 @@ ConfigurationManagementMBean configMBean = new ConfigurationManagementMBean(); configMBean.register(); + ServerInformationMBean sysInfoMBean = + new ServerInformationMBean(QpidProperties.getBuildVersion(), QpidProperties.getReleaseVersion()); + sysInfoMBean.register(); + //fixme .. use QpidProperties.getVersionString when we have fixed the classpath issues // that are causing the broker build to pick up the wrong properties file and hence say // Starting Qpid Client Added: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/information/management/ServerInformationMBean.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/information/management/ServerInformationMBean.java?rev=794660&view=auto ============================================================================== --- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/information/management/ServerInformationMBean.java (added) +++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/information/management/ServerInformationMBean.java Thu Jul 16 12:59:15 2009 @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + * + * + */ +package org.apache.qpid.server.information.management; + +import java.io.IOException; + +import org.apache.qpid.management.common.mbeans.ServerInformation; +import org.apache.qpid.management.common.mbeans.annotations.MBeanDescription; +import org.apache.qpid.server.management.AMQManagedObject; + +import javax.management.JMException; + +/** MBean class for the ServerInformationMBean. */ +...@mbeandescription("Server Information Interface") +public class ServerInformationMBean extends AMQManagedObject implements ServerInformation +{ + private String buildVersion; + private String productVersion; + + public ServerInformationMBean(String buildVersion, String productVersion) throws JMException + { + super(ServerInformation.class, ServerInformation.TYPE, ServerInformation.VERSION); + this.buildVersion = buildVersion; + this.productVersion = productVersion; + } + + public String getObjectInstanceName() + { + return ServerInformation.TYPE; + } + + public Integer getManagementApiMajorVersion() throws IOException + { + return QPID_JMX_API_MAJOR_VERSION; + } + + public Integer getManagementApiMinorVersion() throws IOException + { + return QPID_JMX_API_MINOR_VERSION; + } + + public String getBuildVersion() throws IOException + { + return buildVersion; + } + + public String getProductVersion() throws IOException + { + return productVersion; + } + + +} Added: qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java?rev=794660&view=auto ============================================================================== --- qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java (added) +++ qpid/trunk/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java Thu Jul 16 12:59:15 2009 @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + * + * + */ +package org.apache.qpid.management.common.mbeans; + +import java.io.IOException; + +import org.apache.qpid.management.common.mbeans.annotations.MBeanAttribute; + + +public interface ServerInformation +{ + String TYPE = "ServerInformation"; + int VERSION = 1; + + //API version info for the brokers JMX management interface + int QPID_JMX_API_MAJOR_VERSION = 1; + int QPID_JMX_API_MINOR_VERSION = 3; + + /** + * Attribute to represent the major version number for the management API. + * @return The major management version number. + */ + @MBeanAttribute(name="ManagementApiMajorVersion", + description = "The major version number for the broker management API") + Integer getManagementApiMajorVersion() throws IOException; + + /** + * Attribute to represent the minor version number for the management API. + * @return The minor management version number. + */ + @MBeanAttribute(name="ManagementApiMinorVersion", + description = "The minor version number for the broker management API") + Integer getManagementApiMinorVersion() throws IOException; + + /** + * Attribute to represent the build version string. + * @return The build version string + */ + @MBeanAttribute(name="BuildVersion", + description = "The repository build version string") + String getBuildVersion() throws IOException; + + /** + * Attribute to represent the product version string. + * @return The product version string + */ + @MBeanAttribute(name="ProductVersion", + description = "The product version string") + String getProductVersion() throws IOException; +} --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org