From a6e0cd3a7847c18bfa302208b5b6719d07be56af Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Sat, 11 Jul 2009 17:16:16 +0000 Subject: QPID-1927: move mbean interfaces to management-common, make broker module depend on management-common, modify build system to copy management-common.jar when required (eg for binary releases). QPID-1928: remove unused AMQException throws clause and import from ManagedQueue,UserManagement. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@793206 13f79535-47bb-0310-9956-ffa450edef68 --- java/broker-plugins/build.xml | 2 +- .../exchanges/diagnostic/DiagnosticExchange.java | 4 +- java/broker/build.xml | 2 +- .../apache/qpid/server/AMQBrokerManagerMBean.java | 6 +- .../management/ConfigurationManagement.java | 43 ---- .../management/ConfigurationManagementMBean.java | 3 +- .../qpid/server/exchange/AbstractExchange.java | 1 + .../qpid/server/exchange/DirectExchange.java | 4 +- .../qpid/server/exchange/FanoutExchange.java | 4 +- .../qpid/server/exchange/HeadersExchange.java | 4 +- .../qpid/server/exchange/ManagedExchange.java | 99 --------- .../apache/qpid/server/exchange/TopicExchange.java | 4 +- .../logging/management/LoggingManagement.java | 136 ------------ .../logging/management/LoggingManagementMBean.java | 3 +- .../qpid/server/management/MBeanAttribute.java | 41 ---- .../qpid/server/management/MBeanConstructor.java | 39 ---- .../qpid/server/management/MBeanDescription.java | 38 ---- .../qpid/server/management/MBeanIntrospector.java | 6 + .../management/MBeanInvocationHandlerImpl.java | 6 +- .../qpid/server/management/MBeanOperation.java | 43 ---- .../server/management/MBeanOperationParameter.java | 37 ---- .../qpid/server/management/ManagedBroker.java | 98 --------- .../server/protocol/AMQProtocolSessionMBean.java | 5 +- .../qpid/server/protocol/ManagedConnection.java | 136 ------------ .../apache/qpid/server/queue/AMQQueueMBean.java | 5 +- .../org/apache/qpid/server/queue/ManagedQueue.java | 245 --------------------- .../access/management/AMQUserManagementMBean.java | 6 +- .../security/access/management/UserManagement.java | 121 ---------- .../server/virtualhost/ManagedVirtualHost.java | 2 +- .../qpid/server/AMQBrokerManagerMBeanTest.java | 2 +- .../qpid/server/exchange/ExchangeMBeanTest.java | 2 + .../management/LoggingManagementMBeanTest.java | 1 + java/build.xml | 4 +- .../common/mbeans/ConfigurationManagement.java | 42 ++++ .../common/mbeans/LoggingManagement.java | 136 ++++++++++++ .../management/common/mbeans/ManagedBroker.java | 98 +++++++++ .../common/mbeans/ManagedConnection.java | 136 ++++++++++++ .../management/common/mbeans/ManagedExchange.java | 98 +++++++++ .../management/common/mbeans/ManagedQueue.java | 243 ++++++++++++++++++++ .../management/common/mbeans/UserManagement.java | 120 ++++++++++ .../common/mbeans/annotations/MBeanAttribute.java | 41 ++++ .../mbeans/annotations/MBeanConstructor.java | 39 ++++ .../mbeans/annotations/MBeanDescription.java | 38 ++++ .../common/mbeans/annotations/MBeanOperation.java | 43 ++++ .../annotations/MBeanOperationParameter.java | 37 ++++ java/module.xml | 3 + java/systests/build.xml | 2 +- 47 files changed, 1120 insertions(+), 1108 deletions(-) delete mode 100644 java/broker/src/main/java/org/apache/qpid/server/configuration/management/ConfigurationManagement.java delete mode 100644 java/broker/src/main/java/org/apache/qpid/server/exchange/ManagedExchange.java delete mode 100644 java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagement.java delete mode 100644 java/broker/src/main/java/org/apache/qpid/server/management/MBeanAttribute.java delete mode 100644 java/broker/src/main/java/org/apache/qpid/server/management/MBeanConstructor.java delete mode 100644 java/broker/src/main/java/org/apache/qpid/server/management/MBeanDescription.java delete mode 100644 java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperation.java delete mode 100644 java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperationParameter.java delete mode 100644 java/broker/src/main/java/org/apache/qpid/server/management/ManagedBroker.java delete mode 100644 java/broker/src/main/java/org/apache/qpid/server/protocol/ManagedConnection.java delete mode 100644 java/broker/src/main/java/org/apache/qpid/server/queue/ManagedQueue.java delete mode 100644 java/broker/src/main/java/org/apache/qpid/server/security/access/management/UserManagement.java create mode 100644 java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ConfigurationManagement.java create mode 100644 java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/LoggingManagement.java create mode 100644 java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedBroker.java create mode 100644 java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedConnection.java create mode 100644 java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedExchange.java create mode 100644 java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java create mode 100644 java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java create mode 100644 java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanAttribute.java create mode 100644 java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanConstructor.java create mode 100644 java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanDescription.java create mode 100644 java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanOperation.java create mode 100644 java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanOperationParameter.java (limited to 'java') diff --git a/java/broker-plugins/build.xml b/java/broker-plugins/build.xml index 9787eeebc3..b12b3e3132 100644 --- a/java/broker-plugins/build.xml +++ b/java/broker-plugins/build.xml @@ -20,7 +20,7 @@ nn - or more contributor license agreements. See the NOTICE file --> - + diff --git a/java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/diagnostic/DiagnosticExchange.java b/java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/diagnostic/DiagnosticExchange.java index 027d220538..aa64fab6cd 100644 --- a/java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/diagnostic/DiagnosticExchange.java +++ b/java/broker-plugins/src/main/java/org/apache/qpid/extras/exchanges/diagnostic/DiagnosticExchange.java @@ -34,12 +34,12 @@ import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.BasicContentHeaderProperties; import org.apache.qpid.framing.FieldTable; import org.apache.qpid.server.exchange.AbstractExchange; -import org.apache.qpid.server.management.MBeanConstructor; -import org.apache.qpid.server.management.MBeanDescription; import org.apache.qpid.server.queue.IncomingMessage; import org.apache.qpid.server.queue.AMQQueue; import org.apache.qpid.junit.extensions.util.SizeOf; +import org.apache.qpid.management.common.mbeans.annotations.MBeanConstructor; +import org.apache.qpid.management.common.mbeans.annotations.MBeanDescription; /** * diff --git a/java/broker/build.xml b/java/broker/build.xml index 26dcde2918..1e8b817320 100644 --- a/java/broker/build.xml +++ b/java/broker/build.xml @@ -20,7 +20,7 @@ --> - + diff --git a/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java b/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java index 11d2c27eab..e29c2b52b7 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java +++ b/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java @@ -44,13 +44,13 @@ import javax.management.ObjectName; import org.apache.qpid.AMQException; import org.apache.qpid.framing.AMQShortString; +import org.apache.qpid.management.common.mbeans.ManagedBroker; +import org.apache.qpid.management.common.mbeans.annotations.MBeanConstructor; +import org.apache.qpid.management.common.mbeans.annotations.MBeanDescription; import org.apache.qpid.server.exchange.Exchange; import org.apache.qpid.server.exchange.ExchangeFactory; import org.apache.qpid.server.exchange.ExchangeRegistry; import org.apache.qpid.server.management.AMQManagedObject; -import org.apache.qpid.server.management.MBeanConstructor; -import org.apache.qpid.server.management.MBeanDescription; -import org.apache.qpid.server.management.ManagedBroker; import org.apache.qpid.server.management.ManagedObject; import org.apache.qpid.server.queue.AMQQueue; import org.apache.qpid.server.queue.AMQQueueFactory; diff --git a/java/broker/src/main/java/org/apache/qpid/server/configuration/management/ConfigurationManagement.java b/java/broker/src/main/java/org/apache/qpid/server/configuration/management/ConfigurationManagement.java deleted file mode 100644 index 8e4bf01c6a..0000000000 --- a/java/broker/src/main/java/org/apache/qpid/server/configuration/management/ConfigurationManagement.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * - * 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.configuration.management; - -import javax.management.MBeanOperationInfo; - -import org.apache.commons.configuration.ConfigurationException; -import org.apache.qpid.server.management.MBeanOperation; - -public interface ConfigurationManagement -{ - - String TYPE = "ConfigurationManagement"; - int VERSION = 1; - - /** - * Reload the - * @throws ConfigurationException - */ - @MBeanOperation(name="reloadSecurityConfiguration", - description = "Force a reload of the security configuration sections", - impact = MBeanOperationInfo.ACTION) - void reloadSecurityConfiguration() throws ConfigurationException; - -} diff --git a/java/broker/src/main/java/org/apache/qpid/server/configuration/management/ConfigurationManagementMBean.java b/java/broker/src/main/java/org/apache/qpid/server/configuration/management/ConfigurationManagementMBean.java index ead6053d70..1541d3d892 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/configuration/management/ConfigurationManagementMBean.java +++ b/java/broker/src/main/java/org/apache/qpid/server/configuration/management/ConfigurationManagementMBean.java @@ -23,6 +23,7 @@ package org.apache.qpid.server.configuration.management; import javax.management.NotCompliantMBeanException; import org.apache.commons.configuration.ConfigurationException; +import org.apache.qpid.management.common.mbeans.ConfigurationManagement; import org.apache.qpid.server.management.AMQManagedObject; import org.apache.qpid.server.registry.ApplicationRegistry; @@ -41,7 +42,7 @@ public class ConfigurationManagementMBean extends AMQManagedObject implements Co } @Override - public void reloadSecurityConfiguration() throws ConfigurationException + public void reloadSecurityConfiguration() throws Exception { ApplicationRegistry.getInstance().getConfiguration().reparseConfigFile(); } diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java index 30af09ce4b..393822790a 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java +++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java @@ -33,6 +33,7 @@ import javax.management.openmbean.ArrayType; import org.apache.qpid.AMQException; import org.apache.qpid.framing.AMQShortString; +import org.apache.qpid.management.common.mbeans.ManagedExchange; import org.apache.qpid.server.management.AMQManagedObject; import org.apache.qpid.server.management.Managable; import org.apache.qpid.server.management.ManagedObject; diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java index e9af92bad8..8eba14d8b6 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java +++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java @@ -34,12 +34,12 @@ import javax.management.openmbean.TabularDataSupport; import org.apache.log4j.Logger; import org.apache.qpid.AMQException; +import org.apache.qpid.management.common.mbeans.annotations.MBeanConstructor; +import org.apache.qpid.management.common.mbeans.annotations.MBeanDescription; import org.apache.qpid.protocol.AMQConstant; import org.apache.qpid.exchange.ExchangeDefaults; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.FieldTable; -import org.apache.qpid.server.management.MBeanConstructor; -import org.apache.qpid.server.management.MBeanDescription; import org.apache.qpid.server.queue.IncomingMessage; import org.apache.qpid.server.queue.AMQQueue; import org.apache.qpid.server.virtualhost.VirtualHost; diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java index e9fd4d548b..35a7dfa1d9 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java +++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java @@ -22,12 +22,12 @@ package org.apache.qpid.server.exchange; import org.apache.log4j.Logger; import org.apache.qpid.AMQException; +import org.apache.qpid.management.common.mbeans.annotations.MBeanConstructor; +import org.apache.qpid.management.common.mbeans.annotations.MBeanDescription; import org.apache.qpid.protocol.AMQConstant; import org.apache.qpid.exchange.ExchangeDefaults; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.FieldTable; -import org.apache.qpid.server.management.MBeanConstructor; -import org.apache.qpid.server.management.MBeanDescription; import org.apache.qpid.server.queue.IncomingMessage; import org.apache.qpid.server.queue.AMQQueue; import org.apache.qpid.server.virtualhost.VirtualHost; diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchange.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchange.java index 1ee1f35de6..f66e041f13 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchange.java +++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/HeadersExchange.java @@ -22,6 +22,8 @@ package org.apache.qpid.server.exchange; import org.apache.log4j.Logger; import org.apache.qpid.AMQException; +import org.apache.qpid.management.common.mbeans.annotations.MBeanConstructor; +import org.apache.qpid.management.common.mbeans.annotations.MBeanDescription; import org.apache.qpid.protocol.AMQConstant; import org.apache.qpid.exchange.ExchangeDefaults; import org.apache.qpid.framing.AMQShortString; @@ -29,8 +31,6 @@ import org.apache.qpid.framing.AMQTypedValue; import org.apache.qpid.framing.BasicContentHeaderProperties; import org.apache.qpid.framing.ContentHeaderBody; import org.apache.qpid.framing.FieldTable; -import org.apache.qpid.server.management.MBeanConstructor; -import org.apache.qpid.server.management.MBeanDescription; import org.apache.qpid.server.queue.IncomingMessage; import org.apache.qpid.server.queue.AMQQueue; import org.apache.qpid.server.virtualhost.VirtualHost; diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/ManagedExchange.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/ManagedExchange.java deleted file mode 100644 index 317ff385ab..0000000000 --- a/java/broker/src/main/java/org/apache/qpid/server/exchange/ManagedExchange.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * - * 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.exchange; - -import java.io.IOException; - -import javax.management.JMException; -import javax.management.MBeanOperationInfo; -import javax.management.openmbean.TabularData; - -import org.apache.qpid.server.management.MBeanAttribute; -import org.apache.qpid.server.management.MBeanOperation; -import org.apache.qpid.server.management.MBeanOperationParameter; -import org.apache.qpid.server.queue.ManagedQueue; - -/** - * The management interface exposed to allow management of an Exchange. - * @author Robert J. Greig - * @author Bhupendra Bhardwaj - * @version 0.1 - */ -public interface ManagedExchange -{ - static final String TYPE = "Exchange"; - static final int VERSION = 1; - - /** - * Returns the name of the managed exchange. - * @return the name of the exchange. - * @throws IOException - */ - @MBeanAttribute(name="Name", description=TYPE + " Name") - String getName() throws IOException; - - @MBeanAttribute(name="ExchangeType", description="Exchange Type") - String getExchangeType() throws IOException; - - @MBeanAttribute(name="TicketNo", description="Exchange Ticket No") - Integer getTicketNo() throws IOException; - - /** - * Tells if the exchange is durable or not. - * @return true if the exchange is durable. - * @throws IOException - */ - @MBeanAttribute(name="Durable", description="true if Exchange is durable") - boolean isDurable() throws IOException; - - /** - * Tells if the exchange is set for autodelete or not. - * @return true if the exchange is set as autodelete. - * @throws IOException - */ - @MBeanAttribute(name="AutoDelete", description="true if Exchange is AutoDelete") - boolean isAutoDelete() throws IOException; - - // Operations - - /** - * Returns all the bindings this exchange has with the queues. - * @return the bindings with the exchange. - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="bindings", description="view the queue bindings for this exchange") - TabularData bindings() throws IOException, JMException; - - /** - * Creates new binding with the given queue and binding. - * @param queueName - * @param binding - * @throws JMException - */ - @MBeanOperation(name="createNewBinding", - description="create a new binding with this exchange", - impact= MBeanOperationInfo.ACTION) - void createNewBinding(@MBeanOperationParameter(name= ManagedQueue.TYPE, description="Queue name") String queueName, - @MBeanOperationParameter(name="Binding", description="New binding")String binding) - throws JMException; - -} diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java index bc303a219d..aaf3bbdcaa 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java +++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java @@ -23,13 +23,13 @@ package org.apache.qpid.server.exchange; import org.apache.log4j.Logger; import org.apache.qpid.AMQException; import org.apache.qpid.common.AMQPFilterTypes; +import org.apache.qpid.management.common.mbeans.annotations.MBeanConstructor; +import org.apache.qpid.management.common.mbeans.annotations.MBeanDescription; import org.apache.qpid.protocol.AMQConstant; import org.apache.qpid.exchange.ExchangeDefaults; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.FieldTable; import org.apache.qpid.framing.AMQShortStringTokenizer; -import org.apache.qpid.server.management.MBeanConstructor; -import org.apache.qpid.server.management.MBeanDescription; import org.apache.qpid.server.queue.IncomingMessage; import org.apache.qpid.server.queue.AMQQueue; import org.apache.qpid.server.virtualhost.VirtualHost; diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagement.java b/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagement.java deleted file mode 100644 index f723ab206c..0000000000 --- a/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagement.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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.logging.management; - -import java.io.IOException; - -import org.apache.qpid.server.management.MBeanAttribute; -import org.apache.qpid.server.management.MBeanOperation; -import org.apache.qpid.server.management.MBeanOperationParameter; - -import javax.management.MBeanOperationInfo; -import javax.management.openmbean.TabularData; - -public interface LoggingManagement -{ - String TYPE = "LoggingManagement"; - int VERSION = 1; - - //TabularType and contained CompositeType key/description information - String[] COMPOSITE_ITEM_NAMES = {"LoggerName", "Level"}; - String[] COMPOSITE_ITEM_DESCRIPTIONS = {"Name of the logger", "Level of the logger"}; - String[] TABULAR_UNIQUE_INDEX = {COMPOSITE_ITEM_NAMES[0]}; - - /** - * Attribute to represent the log4j xml configuration file's LogWatch interval. - * @return The logwatch interval in seconds. - */ - @MBeanAttribute(name="Log4jLogWatchInterval", - description = "The log4j xml configuration file LogWatch interval (in seconds). 0 indicates not being checked.") - Integer getLog4jLogWatchInterval(); - - /** - * Attribute to represent the available log4j logger output levels. - * @return The logging level names. - */ - @MBeanAttribute(name="AvailableLoggerLevels", description = "The values to which log output level can be set.") - String[] getAvailableLoggerLevels(); - - - //****** log4j runtime operations ****** // - - /** - * Sets the level of an active Log4J logger - * @param logger The name of the logger - * @param level The level to set the logger to - * @return True if successful, false if unsuccessful (eg if an invalid level is specified) - */ - @MBeanOperation(name = "setRuntimeLoggerLevel", description = "Set the runtime logging level for an active log4j logger.", - impact = MBeanOperationInfo.ACTION) - boolean setRuntimeLoggerLevel(@MBeanOperationParameter(name = "logger", description = "Logger name")String logger, - @MBeanOperationParameter(name = "level", description = "Logger level")String level); - - /** - * Retrieves a TabularData set of the active log4j loggers and their levels - * @return TabularData set of CompositeData rows with logger name and level, or null if there is a problem with the TabularData type - */ - @MBeanOperation(name = "viewEffectiveRuntimeLoggerLevels", description = "View the effective runtime logging level " + - "for active log4j logger's.", impact = MBeanOperationInfo.INFO) - TabularData viewEffectiveRuntimeLoggerLevels(); - - /** - * Sets the level of the active Log4J RootLogger - * @param level The level to set the RootLogger to - * @return True if successful, false if unsuccessful (eg if an invalid level is specified) - */ - @MBeanOperation(name = "setRuntimeRootLoggerLevel", description = "Set the runtime logging level for the active log4j Root Logger.", - impact = MBeanOperationInfo.ACTION) - boolean setRuntimeRootLoggerLevel(@MBeanOperationParameter(name = "level", description = "Logger level")String level); - - /** - * Attribute to represent the level of the active Log4J RootLogger - * @return The level of the RootLogger. - */ - @MBeanAttribute(name = "getRuntimeRootLoggerLevel", description = "Get the runtime logging level for the active log4j Root Logger.") - String getRuntimeRootLoggerLevel(); - - - //****** log4j XML configuration file operations ****** // - - /** - * Updates the level of an existing Log4J logger within the xml configuration file - * @param logger The name of the logger - * @param level The level to set the logger to - * @return True if successful, false if unsuccessful (eg if an invalid logger or level is specified) - * @throws IOException if there is an error parsing the configuration file. - */ - @MBeanOperation(name = "setConfigFileLoggerLevel", description = "Set the logging level for an existing logger " + - "in the log4j xml configuration file", impact = MBeanOperationInfo.ACTION) - boolean setConfigFileLoggerLevel(@MBeanOperationParameter(name = "logger", description = "logger name")String logger, - @MBeanOperationParameter(name = "level", description = "Logger level")String level) throws IOException; - - /** - * Retrieves a TabularData set of the existing Log4J loggers within the xml configuration file - * @return TabularData set of CompositeData rows with logger name and level, or null if there is a problem with the TabularData type - * @throws IOException if there is an error parsing the configuration file. - */ - @MBeanOperation(name = "viewConfigFileLoggerLevels", description = "Get the logging level defined for the logger's " + - "in the log4j xml configuration file.", impact = MBeanOperationInfo.INFO) - TabularData viewConfigFileLoggerLevels() throws IOException; - - /** - * Updates the level of the Log4J RootLogger within the xml configuration file if it is present - * @param level The level to set the logger to - * @return True if successful, false if not (eg an invalid level is specified, or root logger level isnt already defined) - * @throws IOException if there is an error parsing the configuration file. - */ - @MBeanOperation(name = "setConfigFileRootLoggerLevel", description = "Set the logging level for the Root Logger " + - "in the log4j xml configuration file.", impact = MBeanOperationInfo.ACTION) - boolean setConfigFileRootLoggerLevel(@MBeanOperationParameter(name = "level", description = "Logger level")String level) throws IOException; - - /** - * Attribute to represent the level of the Log4J RootLogger within the xml configuration file - * @return The level of the RootLogger, or null if it is not present - */ - @MBeanAttribute(name = "getConfigFileRootLoggerLevel", description = "Get the logging level for the Root Logger " + - "in the log4j xml configuration file.") - String getConfigFileRootLoggerLevel() throws IOException; -} diff --git a/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java b/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java index cd3f85f8ca..3cebb1353b 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java +++ b/java/broker/src/main/java/org/apache/qpid/server/logging/management/LoggingManagementMBean.java @@ -26,7 +26,8 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.List; -import org.apache.qpid.server.management.MBeanDescription; +import org.apache.qpid.management.common.mbeans.LoggingManagement; +import org.apache.qpid.management.common.mbeans.annotations.MBeanDescription; import org.apache.qpid.server.management.AMQManagedObject; import org.apache.log4j.Level; diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanAttribute.java b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanAttribute.java deleted file mode 100644 index 7d42297699..0000000000 --- a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanAttribute.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.management; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation for MBean attributes. This should be used with getter or setter - * methods of attributes. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Inherited -public @interface MBeanAttribute -{ - String name(); - String description(); -} diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanConstructor.java b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanConstructor.java deleted file mode 100644 index 9138e03085..0000000000 --- a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanConstructor.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.management; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation for MBean constructors. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.CONSTRUCTOR) -@Inherited -public @interface MBeanConstructor -{ - String value(); -} diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanDescription.java b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanDescription.java deleted file mode 100644 index 448fed3280..0000000000 --- a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanDescription.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.management; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation for MBean class. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -@Inherited -public @interface MBeanDescription { - String value(); -} diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java index 0c2ec2aebd..9c2a455897 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java +++ b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanIntrospector.java @@ -32,6 +32,12 @@ import javax.management.MBeanOperationInfo; import javax.management.MBeanParameterInfo; import javax.management.NotCompliantMBeanException; +import org.apache.qpid.management.common.mbeans.annotations.MBeanAttribute; +import org.apache.qpid.management.common.mbeans.annotations.MBeanConstructor; +import org.apache.qpid.management.common.mbeans.annotations.MBeanDescription; +import org.apache.qpid.management.common.mbeans.annotations.MBeanOperation; +import org.apache.qpid.management.common.mbeans.annotations.MBeanOperationParameter; + /** * This class is a utility class to introspect the MBean class and the management * interface class for various purposes. diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java index e9b4d85e66..a68934d358 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java +++ b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java @@ -20,9 +20,9 @@ */ package org.apache.qpid.server.management; -import org.apache.qpid.server.configuration.management.ConfigurationManagement; -import org.apache.qpid.server.logging.management.LoggingManagement; -import org.apache.qpid.server.security.access.management.UserManagement; +import org.apache.qpid.management.common.mbeans.ConfigurationManagement; +import org.apache.qpid.management.common.mbeans.LoggingManagement; +import org.apache.qpid.management.common.mbeans.UserManagement; import org.apache.log4j.Logger; import javax.management.remote.MBeanServerForwarder; diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperation.java b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperation.java deleted file mode 100644 index a2dca3e51d..0000000000 --- a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperation.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.management; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.management.MBeanOperationInfo; - -/** - * Annotation for MBean operations. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Inherited -public @interface MBeanOperation -{ - String name(); - String description(); - int impact() default MBeanOperationInfo.INFO; -} diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperationParameter.java b/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperationParameter.java deleted file mode 100644 index aba5ec70d8..0000000000 --- a/java/broker/src/main/java/org/apache/qpid/server/management/MBeanOperationParameter.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.management; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation for MBean operation parameters. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.PARAMETER) -public @interface MBeanOperationParameter { - String name(); - String description(); -} diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/ManagedBroker.java b/java/broker/src/main/java/org/apache/qpid/server/management/ManagedBroker.java deleted file mode 100644 index c18417fc43..0000000000 --- a/java/broker/src/main/java/org/apache/qpid/server/management/ManagedBroker.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * - * 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.management; - -import java.io.IOException; - -import javax.management.JMException; -import javax.management.MBeanOperationInfo; - -import org.apache.qpid.server.exchange.ManagedExchange; -import org.apache.qpid.server.queue.ManagedQueue; - -/** - * The ManagedBroker is the management interface to expose management - * features of the Broker. - * - * @author Bhupendra Bhardwaj - * @version 0.1 - */ -public interface ManagedBroker -{ - static final String TYPE = "VirtualHostManager"; - - static final int VERSION = 1 ; - - /** - * Creates a new Exchange. - * @param name - * @param type - * @param durable - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="createNewExchange", description="Creates a new Exchange", impact= MBeanOperationInfo.ACTION) - void createNewExchange(@MBeanOperationParameter(name="name", description="Name of the new exchange")String name, - @MBeanOperationParameter(name="ExchangeType", description="Type of the exchange")String type, - @MBeanOperationParameter(name="durable", description="true if the Exchang should be durable")boolean durable) - throws IOException, JMException; - - /** - * unregisters all the channels, queuebindings etc and unregisters - * this exchange from managed objects. - * @param exchange - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="unregisterExchange", - description="Unregisters all the related channels and queuebindings of this exchange", - impact= MBeanOperationInfo.ACTION) - void unregisterExchange(@MBeanOperationParameter(name= ManagedExchange.TYPE, description="Exchange Name")String exchange) - throws IOException, JMException; - - /** - * Create a new Queue on the Broker server - * @param queueName - * @param durable - * @param owner - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="createNewQueue", description="Create a new Queue on the Broker server", impact= MBeanOperationInfo.ACTION) - void createNewQueue(@MBeanOperationParameter(name="queue name", description="Name of the new queue")String queueName, - @MBeanOperationParameter(name="owner", description="Owner name")String owner, - @MBeanOperationParameter(name="durable", description="true if the queue should be durable")boolean durable) - throws IOException, JMException; - - /** - * Unregisters the Queue bindings, removes the subscriptions and unregisters - * from the managed objects. - * @param queueName - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="deleteQueue", - description="Unregisters the Queue bindings, removes the subscriptions and deletes the queue", - impact= MBeanOperationInfo.ACTION) - void deleteQueue(@MBeanOperationParameter(name= ManagedQueue.TYPE, description="Queue Name")String queueName) - throws IOException, JMException; -} diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java index 5dd3cc075a..9f7c74ba5e 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java +++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java @@ -60,11 +60,12 @@ import org.apache.qpid.AMQException; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.ConnectionCloseBody; import org.apache.qpid.framing.MethodRegistry; +import org.apache.qpid.management.common.mbeans.ManagedConnection; +import org.apache.qpid.management.common.mbeans.annotations.MBeanConstructor; +import org.apache.qpid.management.common.mbeans.annotations.MBeanDescription; import org.apache.qpid.protocol.AMQConstant; import org.apache.qpid.server.AMQChannel; import org.apache.qpid.server.management.AMQManagedObject; -import org.apache.qpid.server.management.MBeanConstructor; -import org.apache.qpid.server.management.MBeanDescription; import org.apache.qpid.server.management.ManagedObject; /** diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/ManagedConnection.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/ManagedConnection.java deleted file mode 100644 index e75b09a0cb..0000000000 --- a/java/broker/src/main/java/org/apache/qpid/server/protocol/ManagedConnection.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * - * 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.protocol; - -import java.io.IOException; -import java.util.Date; -import java.security.Principal; - -import javax.management.JMException; -import javax.management.MBeanOperationInfo; -import javax.management.openmbean.TabularData; - -import org.apache.qpid.server.management.MBeanAttribute; -import org.apache.qpid.server.management.MBeanOperation; -import org.apache.qpid.server.management.MBeanOperationParameter; - -/** - * The management interface exposed to allow management of Connections. - * @author Bhupendra Bhardwaj - * @version 0.1 - */ -public interface ManagedConnection -{ - static final String TYPE = "Connection"; - static final int VERSION = 1; - - @MBeanAttribute(name = "ClientId", description = "Client Id") - String getClientId(); - - @MBeanAttribute(name = "AuthorizedId", description = "User Name") - String getAuthorizedId(); - - @MBeanAttribute(name = "Version", description = "Client Version") - String getVersion(); - - /** - * Tells the remote address of this connection. - * @return remote address - */ - @MBeanAttribute(name="RemoteAddress", description=TYPE + " Address") - String getRemoteAddress(); - - /** - * Tells the last time, the IO operation was done. - * @return last IO time. - */ - @MBeanAttribute(name="LastIOTime", description="The last time, the IO operation was done") - Date getLastIoTime(); - - /** - * Tells the total number of bytes written till now. - * @return number of bytes written. - * - @MBeanAttribute(name="WrittenBytes", description="The total number of bytes written till now") - Long getWrittenBytes(); - */ - /** - * Tells the total number of bytes read till now. - * @return number of bytes read. - * - @MBeanAttribute(name="ReadBytes", description="The total number of bytes read till now") - Long getReadBytes(); - */ - - /** - * Threshold high value for no of channels. This is useful in setting notifications or - * taking required action is there are more channels being created. - * @return threshold limit for no of channels - */ - Long getMaximumNumberOfChannels(); - - /** - * Sets the threshold high value for number of channels for a connection - * @param value - */ - @MBeanAttribute(name="MaximumNumberOfChannels", description="The threshold high value for number of channels for this connection") - void setMaximumNumberOfChannels(Long value); - - //********** Operations *****************// - - /** - * channel details of all the channels opened for this connection. - * @return general channel details - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="channels", description="Channel details for this connection") - TabularData channels() throws IOException, JMException; - - /** - * Commits the transactions if the channel is transactional. - * @param channelId - * @throws JMException - */ - @MBeanOperation(name="commitTransaction", - description="Commits the transactions for given channel Id, if the channel is transactional", - impact= MBeanOperationInfo.ACTION) - void commitTransactions(@MBeanOperationParameter(name="channel Id", description="channel Id")int channelId) throws JMException; - - /** - * Rollsback the transactions if the channel is transactional. - * @param channelId - * @throws JMException - */ - @MBeanOperation(name="rollbackTransactions", - description="Rollsback the transactions for given channel Id, if the channel is transactional", - impact= MBeanOperationInfo.ACTION) - void rollbackTransactions(@MBeanOperationParameter(name="channel Id", description="channel Id")int channelId) throws JMException; - - /** - * Closes all the related channels and unregisters this connection from managed objects. - */ - @MBeanOperation(name="closeConnection", - description="Closes this connection and all related channels", - impact= MBeanOperationInfo.ACTION) - void closeConnection() throws Exception; -} diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java index a6beb6cbf5..392e2c64ba 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java @@ -30,9 +30,10 @@ import org.apache.qpid.framing.BasicContentHeaderProperties; import org.apache.qpid.framing.CommonContentHeaderProperties; import org.apache.qpid.framing.ContentHeaderBody; import org.apache.qpid.framing.abstraction.ContentChunk; +import org.apache.qpid.management.common.mbeans.ManagedQueue; +import org.apache.qpid.management.common.mbeans.annotations.MBeanConstructor; +import org.apache.qpid.management.common.mbeans.annotations.MBeanDescription; import org.apache.qpid.server.management.AMQManagedObject; -import org.apache.qpid.server.management.MBeanConstructor; -import org.apache.qpid.server.management.MBeanDescription; import org.apache.qpid.server.management.ManagedObject; import org.apache.qpid.server.store.StoreContext; diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/ManagedQueue.java b/java/broker/src/main/java/org/apache/qpid/server/queue/ManagedQueue.java deleted file mode 100644 index 579656893b..0000000000 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/ManagedQueue.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * - * 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.queue; - -import java.io.IOException; - -import javax.management.JMException; -import javax.management.MBeanOperationInfo; -import javax.management.openmbean.CompositeData; -import javax.management.openmbean.TabularData; - -import org.apache.qpid.AMQException; -import org.apache.qpid.server.management.MBeanAttribute; -import org.apache.qpid.server.management.MBeanOperation; -import org.apache.qpid.server.management.MBeanOperationParameter; - -/** - * The management interface exposed to allow management of a queue. - * @author Robert J. Greig - * @author Bhupendra Bhardwaj - * @version 0.1 - */ -public interface ManagedQueue -{ - static final String TYPE = "Queue"; - static final int VERSION = 2; - - /** - * Returns the Name of the ManagedQueue. - * @return the name of the managedQueue. - * @throws IOException - */ - @MBeanAttribute(name="Name", description = TYPE + " Name") - String getName() throws IOException; - - /** - * Total number of messages on the queue, which are yet to be delivered to the consumer(s). - * @return number of undelivered message in the Queue. - * @throws IOException - */ - @MBeanAttribute(name="MessageCount", description = "Total number of undelivered messages on the queue") - Integer getMessageCount() throws IOException; - - /** - * Tells the total number of messages receieved by the queue since startup. - * @return total number of messages received. - * @throws IOException - */ - @MBeanAttribute(name="ReceivedMessageCount", description="The total number of messages receieved by the queue since startup") - Long getReceivedMessageCount() throws IOException; - - /** - * Size of messages in the queue - * @return - * @throws IOException - */ - @MBeanAttribute(name="QueueDepth", description="The total size(Bytes) of messages in the queue") - Long getQueueDepth() throws IOException, JMException; - - /** - * Returns the total number of active subscribers to the queue. - * @return the number of active subscribers - * @throws IOException - */ - @MBeanAttribute(name="ActiveConsumerCount", description="The total number of active subscribers to the queue") - Integer getActiveConsumerCount() throws IOException; - - /** - * Returns the total number of subscribers to the queue. - * @return the number of subscribers. - * @throws IOException - */ - @MBeanAttribute(name="ConsumerCount", description="The total number of subscribers to the queue") - Integer getConsumerCount() throws IOException; - - /** - * Tells the Owner of the ManagedQueue. - * @return the owner's name. - * @throws IOException - */ - @MBeanAttribute(name="Owner", description = "Owner") - String getOwner() throws IOException; - - /** - * Tells whether this ManagedQueue is durable or not. - * @return true if this ManagedQueue is a durable queue. - * @throws IOException - */ - @MBeanAttribute(name="Durable", description = "true if the AMQQueue is durable") - boolean isDurable() throws IOException; - - /** - * Tells if the ManagedQueue is set to AutoDelete. - * @return true if the ManagedQueue is set to AutoDelete. - * @throws IOException - */ - @MBeanAttribute(name="AutoDelete", description = "true if the AMQQueue is AutoDelete") - boolean isAutoDelete() throws IOException; - - /** - * Returns the maximum age of a message (expiration time) in milliseconds - * @return the maximum age - * @throws IOException - */ - Long getMaximumMessageAge() throws IOException; - - /** - * Sets the maximum age of a message in milliseconds - * @param age maximum age of message. - * @throws IOException - */ - @MBeanAttribute(name="MaximumMessageAge", description="Threshold high value(milliseconds) for message age") - void setMaximumMessageAge(Long age) throws IOException; - - /** - * Returns the maximum size of a message (in Bytes) allowed to be accepted by the - * ManagedQueue. This is useful in setting notifications or taking - * appropriate action, if the size of the message received is more than - * the allowed size. - * @return the maximum size of a message allowed to be aceepted by the - * ManagedQueue. - * @throws IOException - */ - Long getMaximumMessageSize() throws IOException; - - /** - * Sets the maximum size of the message (in Bytes) that is allowed to be - * accepted by the Queue. - * @param size maximum size of message. - * @throws IOException - */ - @MBeanAttribute(name="MaximumMessageSize", description="Threshold high value(Bytes) for a message size") - void setMaximumMessageSize(Long size) throws IOException; - - /** - * Tells the maximum number of messages that can be stored in the queue. - * This is useful in setting the notifications or taking required - * action is the number of message increase this limit. - * @return maximum muber of message allowed to be stored in the queue. - * @throws IOException - */ - Long getMaximumMessageCount() throws IOException; - - /** - * Sets the maximum number of messages allowed to be stored in the queue. - * @param value the maximum number of messages allowed to be stored in the queue. - * @throws IOException - */ - @MBeanAttribute(name="MaximumMessageCount", description="Threshold high value for number of undelivered messages in the queue") - void setMaximumMessageCount(Long value) throws IOException; - - /** - * This is useful for setting notifications or taking required action if the size of messages - * stored in the queue increases over this limit. - * @return threshold high value for Queue Depth - * @throws IOException - */ - Long getMaximumQueueDepth() throws IOException; - - /** - * Sets the maximum size of all the messages together, that can be stored - * in the queue. - * @param value - * @throws IOException - */ - @MBeanAttribute(name="MaximumQueueDepth", description="The threshold high value(Bytes) for Queue Depth") - void setMaximumQueueDepth(Long value) throws IOException; - - - //********** Operations *****************// - - - /** - * Returns a subset of all the messages stored in the queue. The messages - * are returned based on the given index numbers. - * @param fromIndex - * @param toIndex - * @return - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="viewMessages", - description="Message headers for messages in this queue within given index range. eg. from index 1 - 100") - TabularData viewMessages(@MBeanOperationParameter(name="from index", description="from index")int fromIndex, - @MBeanOperationParameter(name="to index", description="to index")int toIndex) - throws IOException, JMException, AMQException; - - @MBeanOperation(name="viewMessageContent", description="The message content for given Message Id") - CompositeData viewMessageContent(@MBeanOperationParameter(name="Message Id", description="Message Id")long messageId) - throws IOException, JMException; - - /** - * Deletes the first message from top. - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="deleteMessageFromTop", description="Deletes the first message from top", - impact= MBeanOperationInfo.ACTION) - void deleteMessageFromTop() throws IOException, JMException; - - /** - * Clears the queue by deleting all the undelivered messages from the queue. - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="clearQueue", - description="Clears the queue by deleting all the undelivered messages from the queue", - impact= MBeanOperationInfo.ACTION) - void clearQueue() throws IOException, JMException; - - /** - * Moves the messages in given range of message Ids to given Queue. QPID-170 - * @param fromMessageId first in the range of message ids - * @param toMessageId last in the range of message ids - * @param toQueue where the messages are to be moved - * @throws IOException - * @throws JMException - * @throws AMQException - */ - @MBeanOperation(name="moveMessages", - description="You can move messages to another queue from this queue ", - impact= MBeanOperationInfo.ACTION) - void moveMessages(@MBeanOperationParameter(name="from MessageId", description="from MessageId")long fromMessageId, - @MBeanOperationParameter(name="to MessageId", description="to MessageId")long toMessageId, - @MBeanOperationParameter(name= ManagedQueue.TYPE, description="to Queue Name")String toQueue) - throws IOException, JMException, AMQException; -} diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java b/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java index 121f571abe..b71484f0b2 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java +++ b/java/broker/src/main/java/org/apache/qpid/server/security/access/management/AMQUserManagementMBean.java @@ -20,13 +20,13 @@ */ package org.apache.qpid.server.security.access.management; -import org.apache.qpid.server.management.MBeanDescription; +import org.apache.qpid.management.common.mbeans.UserManagement; +import org.apache.qpid.management.common.mbeans.annotations.MBeanDescription; +import org.apache.qpid.management.common.mbeans.annotations.MBeanOperation; import org.apache.qpid.server.management.AMQManagedObject; -import org.apache.qpid.server.management.MBeanOperation; import org.apache.qpid.server.management.MBeanInvocationHandlerImpl; import org.apache.qpid.server.security.auth.database.PrincipalDatabase; import org.apache.qpid.server.security.auth.sasl.UsernamePrincipal; -import org.apache.qpid.server.security.access.management.UserManagement; import org.apache.log4j.Logger; import org.apache.commons.configuration.ConfigurationException; diff --git a/java/broker/src/main/java/org/apache/qpid/server/security/access/management/UserManagement.java b/java/broker/src/main/java/org/apache/qpid/server/security/access/management/UserManagement.java deleted file mode 100644 index 9fcdd4cd17..0000000000 --- a/java/broker/src/main/java/org/apache/qpid/server/security/access/management/UserManagement.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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.security.access.management; - -import org.apache.qpid.server.management.MBeanOperation; -import org.apache.qpid.server.management.MBeanOperationParameter; -import org.apache.qpid.server.management.MBeanAttribute; -import org.apache.qpid.AMQException; - -import javax.management.openmbean.TabularData; -import javax.management.openmbean.CompositeData; -import javax.management.JMException; -import javax.management.MBeanOperationInfo; -import java.io.IOException; - -public interface UserManagement -{ - - String TYPE = "UserManagement"; - int VERSION = 2; - - //********** Operations *****************// - /** - * set password for user - * - * @param username The username to create - * @param password The password for the user - * - * @return The result of the operation - */ - @MBeanOperation(name = "setPassword", description = "Set password for user.", - impact = MBeanOperationInfo.ACTION) - boolean setPassword(@MBeanOperationParameter(name = "username", description = "Username")String username, - @MBeanOperationParameter(name = "password", description = "Password")char[] password); - - /** - * set rights for users with given details - * - * @param username The username to create - * @param read The set of permission to give the new user - * @param write The set of permission to give the new user - * @param admin The set of permission to give the new user - * - * @return The result of the operation - */ - @MBeanOperation(name = "setRights", description = "Set access rights for user.", - impact = MBeanOperationInfo.ACTION) - boolean setRights(@MBeanOperationParameter(name = "username", description = "Username")String username, - @MBeanOperationParameter(name = "read", description = "Administration read")boolean read, - @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write, - @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin); - - /** - * Create users with given details - * - * @param username The username to create - * @param password The password for the user - * @param read The set of permission to give the new user - * @param write The set of permission to give the new user - * @param admin The set of permission to give the new user - * - * @return The result of the operation - */ - @MBeanOperation(name = "createUser", description = "Create new user from system.", - impact = MBeanOperationInfo.ACTION) - boolean createUser(@MBeanOperationParameter(name = "username", description = "Username")String username, - @MBeanOperationParameter(name = "password", description = "Password")char[] password, - @MBeanOperationParameter(name = "read", description = "Administration read")boolean read, - @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write, - @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin); - - /** - * View users returns all the users that are currently available to the system. - * - * @param username The user to delete - * - * @return The result of the operation - */ - @MBeanOperation(name = "deleteUser", description = "Delete user from system.", - impact = MBeanOperationInfo.ACTION) - boolean deleteUser(@MBeanOperationParameter(name = "username", description = "Username")String username); - - - /** - * Reload the date from disk - * - * @return The result of the operation - */ - @MBeanOperation(name = "reloadData", description = "Reload the authentication file from disk.", - impact = MBeanOperationInfo.ACTION) - boolean reloadData(); - - /** - * View users returns all the users that are currently available to the system. - * - * @return a table of users data (Username, read, write, admin) - */ - @MBeanOperation(name = "viewUsers", description = "All users with access rights to the system.", - impact = MBeanOperationInfo.INFO) - TabularData viewUsers(); - - -} diff --git a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/ManagedVirtualHost.java b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/ManagedVirtualHost.java index f4c81fbbb8..2f0c56cc86 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/ManagedVirtualHost.java +++ b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/ManagedVirtualHost.java @@ -22,7 +22,7 @@ package org.apache.qpid.server.virtualhost; import java.io.IOException; -import org.apache.qpid.server.management.MBeanAttribute; +import org.apache.qpid.management.common.mbeans.annotations.MBeanAttribute; /** * The management interface exposed to allow management of an Exchange. diff --git a/java/broker/src/test/java/org/apache/qpid/server/AMQBrokerManagerMBeanTest.java b/java/broker/src/test/java/org/apache/qpid/server/AMQBrokerManagerMBeanTest.java index b94f2ef76f..68d4de4af4 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/AMQBrokerManagerMBeanTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/AMQBrokerManagerMBeanTest.java @@ -22,8 +22,8 @@ package org.apache.qpid.server; import junit.framework.TestCase; import org.apache.qpid.framing.AMQShortString; +import org.apache.qpid.management.common.mbeans.ManagedBroker; import org.apache.qpid.server.exchange.ExchangeRegistry; -import org.apache.qpid.server.management.ManagedBroker; import org.apache.qpid.server.queue.QueueRegistry; import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.server.registry.IApplicationRegistry; diff --git a/java/broker/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java b/java/broker/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java index 8ce7b4c0e1..e223ba8d15 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/exchange/ExchangeMBeanTest.java @@ -21,6 +21,8 @@ package org.apache.qpid.server.exchange; import junit.framework.TestCase; + +import org.apache.qpid.management.common.mbeans.ManagedExchange; import org.apache.qpid.server.queue.QueueRegistry; import org.apache.qpid.server.queue.AMQQueue; import org.apache.qpid.server.queue.AMQQueueFactory; diff --git a/java/broker/src/test/java/org/apache/qpid/server/logging/management/LoggingManagementMBeanTest.java b/java/broker/src/test/java/org/apache/qpid/server/logging/management/LoggingManagementMBeanTest.java index 40153be331..da60db2772 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/logging/management/LoggingManagementMBeanTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/logging/management/LoggingManagementMBeanTest.java @@ -34,6 +34,7 @@ import javax.management.openmbean.TabularDataSupport; import org.apache.log4j.Level; import org.apache.log4j.Logger; +import org.apache.qpid.management.common.mbeans.LoggingManagement; import junit.framework.TestCase; diff --git a/java/build.xml b/java/build.xml index bd30467a9b..155fef8656 100644 --- a/java/build.xml +++ b/java/build.xml @@ -22,10 +22,10 @@ - + - + + + + diff --git a/java/systests/build.xml b/java/systests/build.xml index 11af9c21bf..1e44116119 100644 --- a/java/systests/build.xml +++ b/java/systests/build.xml @@ -20,7 +20,7 @@ nn - or more contributor license agreements. See the NOTICE file --> - + -- cgit v1.2.1