diff options
| author | Alex Rudyy <orudyy@apache.org> | 2015-04-15 09:47:28 +0000 |
|---|---|---|
| committer | Alex Rudyy <orudyy@apache.org> | 2015-04-15 09:47:28 +0000 |
| commit | 0a0baee45ebcff44635907d457c4ff6810b09c87 (patch) | |
| tree | 8bfb0f9eddbc23cff88af69be80ab3ce7d47011c /qpid/java/management/common/src/main | |
| parent | 54aa3d7070da16ce55c28ccad3f7d0871479e461 (diff) | |
| download | qpid-python-0a0baee45ebcff44635907d457c4ff6810b09c87.tar.gz | |
QPID-6481: Move java source tree to top level
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1673693 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/management/common/src/main')
22 files changed, 0 insertions, 2841 deletions
diff --git a/qpid/java/management/common/src/main/java/management-common.bnd b/qpid/java/management/common/src/main/java/management-common.bnd deleted file mode 100644 index bf54effad9..0000000000 --- a/qpid/java/management/common/src/main/java/management-common.bnd +++ /dev/null @@ -1,27 +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. -# - -ver: 0.31.0 - -Bundle-SymbolicName: qpid-management-common -Bundle-Version: ${ver} -Export-Package: *;version=${ver} -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: jmxremote.sasl;resolution:=optional - diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/JMXConnnectionFactory.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/JMXConnnectionFactory.java deleted file mode 100644 index 25267cc888..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/JMXConnnectionFactory.java +++ /dev/null @@ -1,289 +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.management.common; - -import org.apache.qpid.management.common.sasl.CRAMMD5HashedSaslClientFactory; -import org.apache.qpid.management.common.sasl.Constants; -import org.apache.qpid.management.common.sasl.JCAProvider; -import org.apache.qpid.management.common.sasl.SaslProvider; -import org.apache.qpid.management.common.sasl.UserPasswordCallbackHandler; -import org.apache.qpid.management.common.sasl.UsernameHashedPasswordCallbackHandler; - -import javax.management.remote.JMXConnector; -import javax.management.remote.JMXConnectorFactory; -import javax.management.remote.JMXServiceURL; -import javax.net.ssl.SSLException; -import javax.security.auth.callback.CallbackHandler; -import javax.security.sasl.SaslClientFactory; -import java.io.IOException; -import java.security.Security; -import java.util.HashMap; -import java.util.Map; - -public class JMXConnnectionFactory { - - private static final String NON_JRMP_SERVER = "non-JRMP server at remote endpoint"; - private static final String SERVER_SUPPORTED_PROFILES = "The server supported profiles"; - private static final String CLIENT_REQUIRED_PROFILES = "do not match the client required profiles"; - - public static JMXConnector getJMXConnection(long timeout, String host, int port, String username, String password) - throws SSLException, IOException, Exception - { - //auto-negotiate an RMI or JMXMP (SASL/CRAM-MD5 or SASL/PLAIN) JMX connection to broker - try - { - return createJMXconnector("RMI", timeout, host, port, username, password); - } - catch (IOException rmiIOE) - { - // check if the ioe was raised because we tried connecting to a non RMI-JRMP based JMX server - boolean jrmpServer = !rmiIOE.getMessage().contains(NON_JRMP_SERVER); - - if (jrmpServer) - { - //it was an RMI-JRMP based JMX server, so something else went wrong. Check for SSL issues. - Throwable rmiIOECause = rmiIOE.getCause(); - boolean isSSLException = false; - if (rmiIOECause != null) - { - isSSLException = rmiIOECause instanceof SSLException; - } - - //if it was an SSLException based cause, throw it - if (isSSLException) - { - throw (SSLException) rmiIOECause; - } - else - { - //can't determine cause, throw new IOE citing the original as cause - IOException nioe = new IOException(); - nioe.initCause(rmiIOE); - throw nioe; - } - } - else - { - try - { - //It wasnt an RMI ConnectorServer at the broker end. Try to establish a JMXMP SASL/CRAM-MD5 connection instead. - return createJMXconnector("JMXMP_CRAM-MD5", timeout, host, port, username, password); - } - catch (IOException cramIOE) - { - // check if the IOE was raised because we tried connecting to a SASL/PLAIN server using SASL/CRAM-MD5 - boolean plainProfileServer = cramIOE.getMessage().contains(SERVER_SUPPORTED_PROFILES + - " [" + Constants.SASL_PLAIN + "] " + CLIENT_REQUIRED_PROFILES + " [" + Constants.SASL_CRAMMD5 + "]"); - - if (!plainProfileServer) - { - IOException nioe = new IOException(); - nioe.initCause(cramIOE); - throw nioe; - } - else - { - try - { - // Try to establish a JMXMP SASL/PLAIN connection instead. - return createJMXconnector("JMXMP_PLAIN", timeout, host, port, username, password); - } - catch (IOException plainIOE) - { - /* Out of options now. Check that the IOE was raised because we tried connecting to a server - * which didnt support SASL/PLAIN. If so, signal an unknown profile type. If not, raise the exception. */ - boolean unknownProfile = plainIOE.getMessage().contains(CLIENT_REQUIRED_PROFILES + " [" + Constants.SASL_PLAIN + "]"); - - if (unknownProfile) - { - throw new Exception("Unknown JMXMP authentication mechanism, unable to connect."); - } - else - { - IOException nioe = new IOException(); - nioe.initCause(plainIOE); - throw nioe; - } - } - } - } - } - } - } - - private static JMXConnector createJMXconnector(String connectionType, long timeout, String host, int port, - String userName, String password) throws IOException, Exception - { - Map<String, Object> env = new HashMap<String, Object>(); - JMXServiceURL jmxUrl = null; - - if (connectionType.equalsIgnoreCase("RMI")) - { - jmxUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/jmxrmi"); - - //Add user credential's to environment map for RMIConnector startup. - //These will be used for authentication by the remote RMIConnectorServer if supported, or ignored otherwise. - env.put(JMXConnector.CREDENTIALS, new String[] {userName,password}); - } - else if (connectionType.contains("JMXMP")) - { - // Check that the JMXMPConnector is available to provide SASL support - final String jmxmpcClass = "javax.management.remote.jmxmp.JMXMPConnector"; - - try - { - Class.forName(jmxmpcClass); - } - catch (ClassNotFoundException cnfe) - { - throw new Exception("JMXMPConnector class not found, unable to connect to specified server.\n\n" - + "Please add the jmxremote_optional.jar to the jmxremote.sasl plugin folder, or the classpath."); - } - - jmxUrl = new JMXServiceURL("jmxmp", host, port); - env = new HashMap<String, Object>(); - - /* set the package in which to find the JMXMP ClientProvider.class file loaded by the - * jmxremote.sasl plugin (from the jmxremote_optional.jar) */ - env.put("jmx.remote.protocol.provider.pkgs", "com.sun.jmx.remote.protocol"); - - if (connectionType.equalsIgnoreCase("JMXMP_CRAM-MD5")) - { - Map<String, Class<? extends SaslClientFactory>> map = new HashMap<String, Class<? extends SaslClientFactory>>(); - map.put("CRAM-MD5-HASHED", CRAMMD5HashedSaslClientFactory.class); - Security.addProvider(new JCAProvider(map)); - - CallbackHandler handler = new UsernameHashedPasswordCallbackHandler( - userName, password); - env.put("jmx.remote.profiles", Constants.SASL_CRAMMD5); - env.put("jmx.remote.sasl.callback.handler", handler); - } - else if (connectionType.equalsIgnoreCase("JMXMP_PLAIN")) - { - Security.addProvider(new SaslProvider()); - CallbackHandler handler = new UserPasswordCallbackHandler(userName, password); - env.put("jmx.remote.profiles", Constants.SASL_PLAIN); - env.put("jmx.remote.sasl.callback.handler", handler); - } - else - { - throw new Exception("Unknown JMXMP authentication mechanism"); - } - } - else - { - throw new Exception("Unknown connection type"); - } - - ConnectWaiter connector = new ConnectWaiter(jmxUrl, env); - Thread connectorThread = new Thread(connector); - connectorThread.start(); - connectorThread.join(timeout); - - if(connector.getJmxc() == null) - { - if (connector.getConnectionException() != null) - { - throw connector.getConnectionException(); - } - else - { - throw new IOException("Timed out connecting to " + host + ":" + port); - } - } - - return connector.getJmxc(); - } - - private static class ConnectWaiter implements Runnable - { - private Exception _connectionException; - private JMXConnector _jmxc; - private JMXServiceURL _jmxUrl; - private Map<String, ?> _env; - private boolean _connectionRetrieved; - - public ConnectWaiter(JMXServiceURL url, Map<String, ?> env) - { - _jmxUrl = url; - _env = env; - } - - public void run() - { - try - { - synchronized (this) - { - if(_connectionRetrieved) - { - _jmxc = null; - _connectionRetrieved = false; - _connectionException = null; - } - } - - JMXConnector conn = JMXConnectorFactory.connect(_jmxUrl, _env); - - synchronized (this) - { - if(_connectionRetrieved) - { - //The app thread already timed out the attempt and retrieved the - //null connection, so just close this orphaned connection - try - { - conn.close(); - } - catch (IOException e) - { - //ignore - } - } - else - { - _jmxc = conn; - } - } - } - catch (Exception ex) - { - _connectionException = ex; - } - } - - public Exception getConnectionException() - { - return _connectionException; - } - - public JMXConnector getJmxc() - { - synchronized (this) - { - _connectionRetrieved = true; - - return _jmxc; - } - } - } -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/LoggingManagement.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/LoggingManagement.java deleted file mode 100644 index ced943d01a..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/LoggingManagement.java +++ /dev/null @@ -1,163 +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.management.common.mbeans; - -import org.apache.qpid.management.common.mbeans.annotations.MBeanAttribute; -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperation; -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperationParameter; - -import javax.management.MBeanOperationInfo; -import javax.management.openmbean.TabularData; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -/** - * Interface for the LoggingManagement MBean - * @since Qpid JMX API 1.2 - */ -public interface LoggingManagement -{ - String TYPE = "LoggingManagement"; - - //TabularType and contained CompositeType key/description information - //For compatibility reasons, DONT MODIFY the existing key values if expanding the set. - String LOGGER_NAME = "LoggerName"; - String LOGGER_LEVEL = "Level"; - List<String> COMPOSITE_ITEM_NAMES = Collections.unmodifiableList(Arrays.asList(LOGGER_NAME, LOGGER_LEVEL)); - List<String> COMPOSITE_ITEM_DESCRIPTIONS = Collections.unmodifiableList(Arrays.asList("Name of the logger", "Level of the logger")); - List<String> TABULAR_UNIQUE_INDEX = Collections.unmodifiableList(Arrays.asList(LOGGER_NAME)); - - /** - * Attribute to represent the log4j xml configuration file's LogWatch interval. - * @return The logwatch interval in seconds. - * @since Qpid JMX API 1.2 - */ - @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. - * @since Qpid JMX API 1.2 - */ - @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) - * @since Qpid JMX API 1.2 - */ - @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 - * @since Qpid JMX API 1.2 - */ - @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) - * @since Qpid JMX API 1.2 - */ - @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. - * @since Qpid JMX API 1.2 - */ - @MBeanAttribute(name = "getRuntimeRootLoggerLevel", description = "Get the runtime logging level for the active log4j Root Logger.") - String getRuntimeRootLoggerLevel(); - - - //****** log4j XML configuration file operations ****** // - - /** - * Reloads the log4j configuration file, applying any changes made. - * - * @throws IOException - * @since Qpid JMX API 1.4 - */ - @MBeanOperation(name = "reloadConfigFile", description = "Reload the log4j xml configuration file", impact = MBeanOperationInfo.ACTION) - void reloadConfigFile() throws IOException; - - /** - * 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. - * @since Qpid JMX API 1.2 - */ - @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. - * @since Qpid JMX API 1.2 - */ - @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. - * @since Qpid JMX API 1.2 - */ - @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 - * @since Qpid JMX API 1.2 - */ - @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/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedBroker.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedBroker.java deleted file mode 100644 index 91f80b27c4..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedBroker.java +++ /dev/null @@ -1,266 +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.management.common.mbeans; - -import org.apache.qpid.management.common.mbeans.annotations.MBeanAttribute; -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperation; -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperationParameter; - -import javax.management.JMException; -import javax.management.MBeanException; -import javax.management.MBeanOperationInfo; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * The ManagedBroker is the management interface to expose management - * features of the Broker. - * - * @version Qpid JMX API 2.2 - * @since Qpid JMX API 1.3 - */ -public interface ManagedBroker -{ - static final String TYPE = "VirtualHostManager"; - - /** - * Returns an array of the exchange types available for creation. - * @since Qpid JMX API 1.3 - * @throws IOException - */ - @MBeanAttribute(name="ExchangeTypes", description = "The types of Exchange available for creation.") - String[] getExchangeTypes() throws IOException; - - /** - * Returns a list containing the names of the attributes available for the Queue mbeans. - * @since Qpid JMX API 1.3 - * @throws IOException - */ - @MBeanOperation(name = "retrieveQueueAttributeNames", description = "Retrieve the attribute names for queues in this virtualhost", - impact = MBeanOperationInfo.INFO) - List<String> retrieveQueueAttributeNames() throws IOException; - - /** - * Returns a List of Object Lists containing the requested attribute values (in the same sequence requested) for each queue in the virtualhost. - * If a particular attribute cant be found or raises an mbean/reflection exception whilst being gathered its value is substituted with the String "-". - * @since Qpid JMX API 1.3 - * @throws IOException - */ - @MBeanOperation(name = "retrieveQueueAttributeValues", description = "Retrieve the indicated attributes for queues in this virtualhost", - impact = MBeanOperationInfo.INFO) - List<List<Object>> retrieveQueueAttributeValues(@MBeanOperationParameter(name="attributes", description="Attributes to retrieve") String[] attributes) throws IOException; - - /** - * Creates a new Exchange. - * - * @param name - * @param type - * @param durable - * @throws IOException - * @throws JMException - * @throws MBeanException - */ - @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, MBeanException; - - /** - * unregisters all the channels, queuebindings etc and unregisters - * this exchange from managed objects. - * - * @param exchange - * @throws IOException - * @throws JMException - * @throws MBeanException - */ - @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, MBeanException; - - /** - * Create a new Queue on the Broker server. - * - * @param queueName - * @param durable - * @param owner - * @throws IOException - * @throws JMException - * @throws MBeanException - */ - @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, MBeanException; - - /** - * Create a new Queue in the VirtualHost - * - * @since Qpid JMX API 2.4 - * @param queueName name of the new queue - * @param durable true if the queue should be durable - * @param owner owner - * @param arguments declaration arguments for use when creating the queue, may be null. - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="createNewQueue", description="Create a new Queue in the VirtualHost", 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, - @MBeanOperationParameter(name="arguments", description="Map of arguments")Map<String,Object> arguments) - throws IOException, JMException; - - /** - * Unregisters the Queue bindings, removes the subscriptions and unregisters - * from the managed objects. - * - * @param queueName - * @throws IOException - * @throws JMException - * @throws MBeanException - */ - @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, MBeanException; - - /** - * Resets all message and data statistics for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanOperation(name="resetStatistics", - description="Resets all message and data statistics for the virtual host", - impact= MBeanOperationInfo.ACTION) - void resetStatistics() throws Exception; - - /** - * Peak rate of messages delivered per second for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="PeakMessageDeliveryRate", description=TYPE + " Peak Message Delivery Rate") - double getPeakMessageDeliveryRate(); - - /** - * Peak rate of bytes delivered per second for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="PeakDataDeliveryRate", description=TYPE + " Peak Data Delivery Rate") - double getPeakDataDeliveryRate(); - - /** - * Rate of messages delivered per second for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="MessageDeliveryRate", description=TYPE + " Message Delivery Rate") - double getMessageDeliveryRate(); - - /** - * Rate of bytes delivered per second for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="DataDeliveryRate", description=TYPE + " Data Delivery Rate") - double getDataDeliveryRate(); - - /** - * Total count of messages delivered for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="TotalMessagesDelivered", description=TYPE + " Total Messages Delivered") - long getTotalMessagesDelivered(); - - /** - * Total count of bytes for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="TotalDataDelivered", description=TYPE + " Total Data Delivered") - long getTotalDataDelivered(); - - /** - * Peak rate of messages received per second for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="PeakMessageReceiptRate", description=TYPE + " Peak Message Receipt Rate") - double getPeakMessageReceiptRate(); - - /** - * Peak rate of bytes received per second for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="PeakDataReceiptRate", description=TYPE + " Peak Data Receipt Rate") - double getPeakDataReceiptRate(); - - /** - * Rate of messages received per second for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="MessageReceiptRate", description=TYPE + " Message Receipt Rate") - double getMessageReceiptRate(); - - /** - * Rate of bytes received per second for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="DataReceiptRate", description=TYPE + " Data Receipt Rate") - double getDataReceiptRate(); - - /** - * Total count of messages received for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="TotalMessagesReceived", description=TYPE + " Total Messages Received") - long getTotalMessagesReceived(); - - /** - * Total count of bytes received for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="TotalDataReceived", description=TYPE + " Total Data Received") - long getTotalDataReceived(); - - /** - * Is statistics collection enabled for this connection. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="StatisticsEnabled", description=TYPE + " Statistics Enabled") - boolean isStatisticsEnabled(); -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedConnection.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedConnection.java deleted file mode 100644 index bf74fa5b13..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedConnection.java +++ /dev/null @@ -1,249 +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.management.common.mbeans; - -import org.apache.qpid.management.common.mbeans.annotations.MBeanAttribute; -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperation; -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperationParameter; - -import javax.management.JMException; -import javax.management.MBeanOperationInfo; -import javax.management.openmbean.TabularData; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -/** - * The management interface exposed to allow management of Connections. - * - * @version Qpid JMX API 2.2 - * @since Qpid JMX API 1.3 - */ -public interface ManagedConnection -{ - static final String TYPE = "Connection"; - - //TabularType and contained CompositeType key/description information - //For compatibility reasons, DONT MODIFY the existing key values if expanding the set. - //"Flow Blocked" added in Qpid JMX API 1.5 - String CHAN_ID = "Channel Id"; - String TRANSACTIONAL = "Transactional"; - String DEFAULT_QUEUE = "Default Queue"; - String UNACKED_COUNT = "Unacknowledged Message Count"; - String FLOW_BLOCKED = "Flow Blocked"; - List<String> COMPOSITE_ITEM_NAMES_DESC = Collections.unmodifiableList(Arrays.asList(CHAN_ID, TRANSACTIONAL, DEFAULT_QUEUE, UNACKED_COUNT, FLOW_BLOCKED)); - List<String> TABULAR_UNIQUE_INDEX = Collections.unmodifiableList(Arrays.asList(CHAN_ID)); - - @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(); - - /** - * 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 - */ - @MBeanAttribute(name="MaximumNumberOfChannels", description="The threshold high value for number of channels for this connection") - Long getMaximumNumberOfChannels(); - - //********** 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; - - /** - * Resets message and data statistics for this connection. - * - * @since Qpid JMX API 2.2 - */ - @MBeanOperation(name="resetStatistics", - description="Resets message and data statistics for this connection", - impact= MBeanOperationInfo.ACTION) - void resetStatistics() throws Exception; - - /** - * Peak rate of messages delivered per second for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="PeakMessageDeliveryRate", description=TYPE + " Peak Message Delivery Rate") - double getPeakMessageDeliveryRate(); - - /** - * Peak rate of bytes delivered per second for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="PeakDataDeliveryRate", description=TYPE + " Peak Data Delivery Rate") - double getPeakDataDeliveryRate(); - - /** - * Rate of messages delivered per second for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="MessageDeliveryRate", description=TYPE + " Message Delivery Rate") - double getMessageDeliveryRate(); - - /** - * Rate of bytes delivered per second for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="DataDeliveryRate", description=TYPE + " Data Delivery Rate") - double getDataDeliveryRate(); - - /** - * Total count of messages delivered for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="TotalMessagesDelivered", description=TYPE + " Total Messages Delivered") - long getTotalMessagesDelivered(); - - /** - * Total count of bytes for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="TotalDataDelivered", description=TYPE + " Total Data Delivered") - long getTotalDataDelivered(); - - /** - * Peak rate of messages received per second for this connection. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="PeakMessageReceiptRate", description=TYPE + " Peak Message Receipt Rate") - double getPeakMessageReceiptRate(); - - /** - * Peak rate of bytes received per second for this connection. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="PeakDataReceiptRate", description=TYPE + " Peak Data Receipt Rate") - double getPeakDataReceiptRate(); - - /** - * Rate of messages received per second for this connection. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="MessageReceiptRate", description=TYPE + " Message Receipt Rate") - double getMessageReceiptRate(); - - /** - * Rate of bytes received per second for this connection. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="DataReceiptRate", description=TYPE + " Data Receipt Rate") - double getDataReceiptRate(); - - /** - * Total count of messages received for this connection. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="TotalMessagesReceived", description=TYPE + " Total Messages Received") - long getTotalMessagesReceived(); - - /** - * Total count of bytes received for this connection. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="TotalDataReceived", description=TYPE + " Total Data Received") - long getTotalDataReceived(); - - /** - * Is statistics collection enabled for this connection. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="StatisticsEnabled", description=TYPE + " Statistics Enabled") - boolean isStatisticsEnabled(); - - /** - * Sets statistics collection enabled/disabled for this connection. - * - * @param enabled - * @since Qpid JMX API 2.2 - */ - void setStatisticsEnabled(boolean enabled); -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedExchange.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedExchange.java deleted file mode 100644 index b6e1ed22ff..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedExchange.java +++ /dev/null @@ -1,149 +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.management.common.mbeans; - -import org.apache.qpid.management.common.mbeans.annotations.MBeanAttribute; -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperation; -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperationParameter; - -import javax.management.JMException; -import javax.management.MBeanOperationInfo; -import javax.management.openmbean.TabularData; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -/** - * The management interface exposed to allow management of an Exchange. - * - * @version 1.8 - */ -public interface ManagedExchange -{ - static final String TYPE = "Exchange"; - - //TabularType and contained CompositeType key/description info for DIRECT/TOPIC/FANOUT exchanges. - //For compatibility reasons, DONT MODIFY the existing key values if expanding the set. - String BINDING_KEY = "Binding Key"; - String QUEUE_NAMES = "Queue Names"; - - List<String> COMPOSITE_ITEM_NAMES = Collections.unmodifiableList(Arrays.asList(BINDING_KEY, QUEUE_NAMES)); - List<String> COMPOSITE_ITEM_DESCRIPTIONS = Collections.unmodifiableList(Arrays.asList(BINDING_KEY, QUEUE_NAMES)); - List<String> TABULAR_UNIQUE_INDEX = Collections.unmodifiableList(Arrays.asList(BINDING_KEY)); - - //TabularType and contained CompositeType key/description info for HEADERS exchange only. - //For compatibility reasons, DONT MODIFY the existing key values if expanding the set. - String HDR_BINDING_NUMBER = "Binding No"; - String HDR_QUEUE_NAME = "Queue Name"; - String HDR_QUEUE_BINDINGS = "Queue Bindings"; - - List<String> HEADERS_COMPOSITE_ITEM_NAMES = Collections.unmodifiableList(Arrays.asList(HDR_BINDING_NUMBER, HDR_QUEUE_NAME, HDR_QUEUE_BINDINGS)); - List<String> HEADERS_COMPOSITE_ITEM_DESC = Collections.unmodifiableList(Arrays.asList(HDR_BINDING_NUMBER, HDR_QUEUE_NAME, HDR_QUEUE_BINDINGS)); - List<String> HEADERS_TABULAR_UNIQUE_INDEX = Collections.unmodifiableList(Arrays.asList(HDR_BINDING_NUMBER)); - - /** - * 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; - - /** - * Creates new binding with the given queue using given binding key and binding arguments. - * @param queueName - * @param binding - * @param arguments - * @throws JMException - * @since Qpid JMX API 2.7 - */ - @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, - @MBeanOperationParameter(name="Arguments", description="Binding arguments")Map<String, Object> arguments) - throws JMException; - - /** - * Removes an exchange binding from a queue. - * - * @param queueName the Queue name - * @param binding the binding key - * @throws IOException - * @throws JMException - * @since Qpid JMX API 1.8 - */ - @MBeanOperation(name="removeBinding", - description="Removes an exchange binding from the Queue", - impact= MBeanOperationInfo.ACTION) - void removeBinding(@MBeanOperationParameter(name= ManagedQueue.TYPE, description="Queue name") String queueName, - @MBeanOperationParameter(name="Binding", description="Binding key")String binding) - throws IOException, JMException; -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java deleted file mode 100644 index 4032cb78df..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java +++ /dev/null @@ -1,535 +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.management.common.mbeans; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; - -import javax.management.JMException; -import javax.management.MBeanOperationInfo; -import javax.management.openmbean.CompositeData; -import javax.management.openmbean.TabularData; - -import org.apache.qpid.management.common.mbeans.annotations.MBeanAttribute; -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperation; -import org.apache.qpid.management.common.mbeans.annotations.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"; - - //TabularType and contained CompositeType key/description information for message list - //For compatibility reasons, DONT MODIFY the existing key values if expanding the set. - //"Queue Position" added in Qpid JMX API 1.3 - String MSG_AMQ_ID = "AMQ MessageId"; - String MSG_HEADER = "Header"; - String MSG_SIZE = "Size(bytes)"; - String MSG_REDELIVERED = "Redelivered"; - String MSG_QUEUE_POS = "Queue Position"; - String MSG_DELIVERY_COUNT = "Delivery Count"; - List<String> VIEW_MSGS_COMPOSITE_ITEM_NAMES_DESC = Collections.unmodifiableList(Arrays.asList(MSG_AMQ_ID, MSG_HEADER, MSG_SIZE, MSG_REDELIVERED, MSG_QUEUE_POS, MSG_DELIVERY_COUNT)); - List<String> VIEW_MSGS_TABULAR_UNIQUE_INDEX = Collections.unmodifiableList(Arrays.asList(MSG_QUEUE_POS)); - - //CompositeType key/description information for message content - //For compatibility reasons, DONT MODIFY the existing key values if expanding the set. - String MIME = "MimeType"; - String ENCODING = "Encoding"; - String CONTENT = "Content"; - List<String> VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC = Collections.unmodifiableList(Arrays.asList(MSG_AMQ_ID, MIME, ENCODING, CONTENT)); - - /** Date/time format used for message expiration and message timestamp formatting */ - String JMSTIMESTAMP_DATETIME_FORMAT = "MM-dd-yy HH:mm:ss.SSS z"; - - //Individual attribute name constants - static final String ATTR_NAME = "Name"; - static final String ATTR_DESCRIPTION = "Description"; - static final String ATTR_QUEUE_TYPE = "QueueType"; - static final String ATTR_OWNER = "Owner"; - static final String ATTR_MAX_MSG_AGE = "MaximumMessageAge"; - static final String ATTR_MAX_MSG_COUNT = "MaximumMessageCount"; - static final String ATTR_MAX_QUEUE_DEPTH = "MaximumQueueDepth"; - static final String ATTR_MAX_MSG_SIZE = "MaximumMessageSize"; - static final String ATTR_MAXIMUM_DELIVERY_COUNT = "MaximumDeliveryCount"; - static final String ATTR_DURABLE = "Durable"; - static final String ATTR_AUTODELETE = "AutoDelete"; - static final String ATTR_CONSUMER_COUNT = "ConsumerCount"; - static final String ATTR_ACTIVE_CONSUMER_COUNT = "ActiveConsumerCount"; - static final String ATTR_MSG_COUNT = "MessageCount"; - static final String ATTR_QUEUE_DEPTH = "QueueDepth"; - static final String ATTR_RCVD_MSG_COUNT = "ReceivedMessageCount"; - static final String ATTR_CAPACITY = "Capacity"; - static final String ATTR_FLOW_OVERFULL = "FlowOverfull"; - static final String ATTR_FLOW_RESUME_CAPACITY = "FlowResumeCapacity"; - static final String ATTR_EXCLUSIVE = "Exclusive"; - static final String ATTR_ALT_EXCHANGE = "AlternateExchange"; - static final String ATTR_SHARED_MESSAGE_GROUP = "MessageGroupSharedGroups"; - static final String ATTR_MESSAGE_GROUP_KEY = "MessageGroupKey"; - static final String ATTR_OLDEST_MESSAGE_AGE = "OldestMessageAge"; - - //All attribute names constant - static final List<String> QUEUE_ATTRIBUTES - = Collections.unmodifiableList( - new ArrayList<String>( - new HashSet<String>( - Arrays.asList( - ATTR_NAME, - ATTR_QUEUE_TYPE, - ATTR_DESCRIPTION, - ATTR_OWNER, - ATTR_MAX_MSG_AGE, - ATTR_MAX_MSG_COUNT, - ATTR_MAX_QUEUE_DEPTH, - ATTR_MAX_MSG_SIZE, - ATTR_MAXIMUM_DELIVERY_COUNT, - ATTR_DURABLE, - ATTR_AUTODELETE, - ATTR_CONSUMER_COUNT, - ATTR_ACTIVE_CONSUMER_COUNT, - ATTR_MSG_COUNT, - ATTR_QUEUE_DEPTH, - ATTR_RCVD_MSG_COUNT, - ATTR_CAPACITY, - ATTR_FLOW_OVERFULL, - ATTR_FLOW_RESUME_CAPACITY, - ATTR_EXCLUSIVE, - ATTR_ALT_EXCHANGE, - ATTR_SHARED_MESSAGE_GROUP, - ATTR_MESSAGE_GROUP_KEY, - ATTR_OLDEST_MESSAGE_AGE - )))); - - /** - * 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; - - /** - * Maximum number of times a message is permitted to be delivered or zero if not enforced. - * - * @since Qpid JMX API 2.4 - * @return maximum delivery count - * @throws IOException - */ - @MBeanAttribute(name="MaximumDeliveryCount", description = "Maximum number of times a message is permitted to be delivered or zero if not enforced") - Integer getMaximumDeliveryCount() 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 - * - * Since Qpid JMX API 1.2 this operation returns in units of bytes. Prior to this, the result was in units of kilobytes. - * @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 nuumber 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. - * - * Since Qpid JMX API 1.2 this operation returns in units of bytes. Prior to this, the result was in units of kilobytes. - * @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; - - - /** - * Returns the current flow control Capacity of the queue in bytes. - * - * @since Qpid JMX API 1.6 - * @return Capacity at which flow control is enforced - * @throws IOException - */ - Long getCapacity() throws IOException; - - /** - * Sets the Capacity in bytes above which flow is blocked. - * - * @since Qpid JMX API 1.6 - * @param value the capacity in bytes - * @throws IOException - * @throws IllegalArgumentException If the given value is less than the queue FloeResumeCapacity - */ - @MBeanAttribute(name="Capacity", description="The flow control Capacity (Bytes) of the queue") - void setCapacity(Long value) throws IOException, IllegalArgumentException; - - /** - * Gets the free text queue description. - * @since Qpid JMX API 2.5 - */ - String getDescription(); - - /** - * Sets the free text queue description. - * @since Qpid JMX API 2.5 - */ - @MBeanAttribute(name="Description", description="Free text description of the queue") - void setDescription(String string); - - /** - * Returns the current flow control FlowResumeCapacity of the queue in bytes. - * - * @since Qpid JMX API 1.6 - * @return Capacity below which flow resumes in bytes - * @throws IOException - */ - Long getFlowResumeCapacity() throws IOException; - - /** - * Sets the FlowResumeCapacity in bytes below which flow resumes. - * - * @since Qpid JMX API 1.6 - * @param value of the resume capacity in bytes - * @throws IOException - * @throws IllegalArgumentException If the given value exceeds the queue Capacity - */ - @MBeanAttribute(name="FlowResumeCapacity", description="The flow resume Capacity (Bytes) of the queue") - void setFlowResumeCapacity(Long value) throws IOException, IllegalArgumentException; - - /** - * Indicates whether the Queue is currently considered overfull by the FlowControl system - * - * @since Qpid JMX API 1.6 - * @throws IOException - */ - @MBeanAttribute(name="FlowOverfull", description="true if the queue is considered overfull by the Flow Control system") - boolean isFlowOverfull() throws IOException; - - /** - * Returns whether the queue is exclusive or not. - * - * @since Qpid JMX API 2.0 - * @return whether the queue is exclusive. - * @throws IOException - */ - boolean isExclusive() throws IOException; - - /** - * Sets whether the queue is exclusive or not. - * - * @since Qpid JMX API 2.0 - * @param exclusive the capacity in bytes - * @throws IOException - * @throws JMException - */ - @MBeanAttribute(name="Exclusive", description="Whether the queue is Exclusive or not") - void setExclusive(boolean exclusive) throws IOException, JMException; - - /** - * Sets the Alternate Exchange for the queue, for use in dead letter queue functionality. - * - * @since Qpid JMX API 2.4 - * @param exchangeName the name of the exchange to use. Specifying null or the empty string will clear the - * alternate exchange. - * @throws IOException - * @throws JMException - */ - @MBeanAttribute(name="AlternateExchange", description="Alternate exchange for the queue") - void setAlternateExchange(String exchangeName) throws IOException, JMException; - - /** - * Returns the name of the Alternate Exchange for the queue, or null if there isn't one. - * - * @since Qpid JMX API 2.4 - * @return the name of the Alternate Exchange for the queue, or null if there isn't one - * @throws IOException - */ - String getAlternateExchange() throws IOException; - - - /** - * Gets the queue type - * @since Qpid JMX API 2.5 - */ - @MBeanAttribute(name="QueueType", description="Type of the queue e.g. standard, priority, etc") - String getQueueType(); - - /** - * Gets the message group key - * @since Qpid JMX API 2.7 - */ - @MBeanAttribute(name="MessageGroupKey", description="Message header name to hold message group value") - String getMessageGroupKey(); - - /** - * Gets the message group key - * @since Qpid JMX API 2.7 - */ - @MBeanAttribute(name="MessageGroupSharedGroups", description="If set indicates that while two messages of the same group cannot be processed by different consumers concurrently, no guarantee is made that subsequent messages are always sent to the same consumer") - boolean isMessageGroupSharedGroups(); - - /** - * Gets the arrival time of the oldest message in the queue - * @since Qpid JMX API 2.8 - */ - @MBeanAttribute(name= ATTR_OLDEST_MESSAGE_AGE, description="the age (in milliseconds since the epoch of the oldest message in the queue (or 0 if the queue is empty)") - Long getOldestMessageAge(); - - //********** Operations *****************// - - - /** - * Returns a subset of all the messages stored in the queue. The messages - * are returned based on the given index numbers. - * - * Deprecated as of Qpid JMX API 1.3 - * @param fromIndex - * @param toIndex - * @return - * @throws IOException - * @throws JMException - */ - @Deprecated - @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; - - /** - * Returns a subset (up to 2^31 messages at a time) of all the messages stored on the queue. - * The messages are returned based on the given queue position range. - * @param startPosition - * @param endPosition - * @return - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="viewMessages", - description="Message headers for messages in this queue within given queue positions range. eg. from index 1 - 100") - TabularData viewMessages(@MBeanOperationParameter(name="start position", description="start position")long startPosition, - @MBeanOperationParameter(name="end position", description="end position")long endPosition) - throws IOException, JMException; - - /** - * Returns the content for the given AMQ Message ID. - * - * @throws IOException - * @throws JMException - */ - @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. - * - * Deprecated as of Qpid JMX API 1.3 - * @throws IOException - * @throws JMException - */ - @Deprecated - @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 messages from the queue that have not been acquired by consumers" - * - * Since Qpid JMX API 1.3 this returns the number of messages deleted. Prior to this, the return type was void. - * @return the number of messages deleted - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="clearQueue", - description="Clears the queue by deleting all the messages from the queue " + - "that have not been acquired by consumers", - impact= MBeanOperationInfo.ACTION) - Long 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 - */ - @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; - - /** - * Deletes the messages in given range of AMQ message Ids in the given Queue. - * @param fromMessageId first in the range of message ids - * @param toMessageId last in the range of message ids - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="deleteMessages", - description="Delete a range of messages from a specified queue", - impact= MBeanOperationInfo.ACTION) - void deleteMessages(@MBeanOperationParameter(name="from MessageId", description="from MessageId")long fromMessageId, - @MBeanOperationParameter(name="to MessageId", description="to MessageId")long toMessageId) - throws IOException, JMException; - - /** - * Copies the messages in given range of AMQ message Ids to a given Queue. - * @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 copied - * @throws IOException - * @throws JMException - */ - @MBeanOperation(name="copyMessages", - description="Copies a range of messages to a specified queue", - impact= MBeanOperationInfo.ACTION) - void copyMessages(@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; - -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java deleted file mode 100644 index 2b51711664..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ServerInformation.java +++ /dev/null @@ -1,202 +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.management.common.mbeans; - -import java.io.IOException; - -import javax.management.MBeanOperationInfo; - -import org.apache.qpid.management.common.mbeans.annotations.MBeanAttribute; -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperation; - -/** - * Interface for the ServerInformation MBean - * - * @version Qpid JMX API 2.3 - * @since Qpid JMX API 1.3 - */ -public interface ServerInformation -{ - String TYPE = "ServerInformation"; - - /* API version info for the brokers JMX management interface - * - * As the ServerInformation MBean was only introduced in Qpid JMX API 1.3 it is not possible to use it - * for identifying earlier broker JMX APIs for compatibility purposes. However, this can be accomplished - * by inspecting the 'version' property key of the UserManagement MBean JMX ObjectName. This was first - * introduced in Qpid JMX API 1.2 and so if present in the absence of the ServerInformation MBean - * indicates that version. If it is not present then a null value will be returned upon inspection and - * Qpid JMX API 1.1 can be assumed. - */ - int QPID_JMX_API_MAJOR_VERSION = 2; - int QPID_JMX_API_MINOR_VERSION = 8; - - - /** - * Attribute to represent the major version number for the management API. - * @return The major management version number. - * @since Qpid JMX API 1.3 - */ - @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. - * @since Qpid JMX API 1.3 - */ - @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 - * @since Qpid JMX API 1.3 - */ - @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 - * @since Qpid JMX API 1.3 - */ - @MBeanAttribute(name="ProductVersion", - description = "The product version string") - String getProductVersion() throws IOException; - - /** - * Resets all message and data statistics for the broker. - * - * @since Qpid JMX API 2.2 - */ - @MBeanOperation(name="resetStatistics", - description="Resets all message and data statistics for the broker", - impact= MBeanOperationInfo.ACTION) - void resetStatistics() throws Exception; - - /** - * Peak rate of messages delivered per second for the virtual host. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="PeakMessageDeliveryRate", description=TYPE + " Peak Message Delivery Rate") - double getPeakMessageDeliveryRate(); - - /** - * Peak rate of bytes delivered per second for the broker. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="PeakDataDeliveryRate", description=TYPE + " Peak Data Delivery Rate") - double getPeakDataDeliveryRate(); - - /** - * Rate of messages delivered per second for the broker. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="MessageDeliveryRate", description=TYPE + " Message Delivery Rate") - double getMessageDeliveryRate(); - - /** - * Rate of bytes delivered per second for the broker. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="DataDeliveryRate", description=TYPE + " Data Delivery Rate") - double getDataDeliveryRate(); - - /** - * Total count of messages delivered for the broker. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="TotalMessagesDelivered", description=TYPE + " Total Messages Delivered") - long getTotalMessagesDelivered(); - - /** - * Total count of bytes for the broker. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="TotalDataDelivered", description=TYPE + " Total Data Delivered") - long getTotalDataDelivered(); - - /** - * Peak rate of messages received per second for the broker. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="PeakMessageReceiptRate", description=TYPE + " Peak Message Receipt Rate") - double getPeakMessageReceiptRate(); - - /** - * Peak rate of bytes received per second for the broker. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="PeakDataReceiptRate", description=TYPE + " Peak Data Receipt Rate") - double getPeakDataReceiptRate(); - - /** - * Rate of messages received per second for the broker. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="MessageReceiptRate", description=TYPE + " Message Receipt Rate") - double getMessageReceiptRate(); - - /** - * Rate of bytes received per second for the broker. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="DataReceiptRate", description=TYPE + " Data Receipt Rate") - double getDataReceiptRate(); - - /** - * Total count of messages received for the broker. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="TotalMessagesReceived", description=TYPE + " Total Messages Received") - long getTotalMessagesReceived(); - - /** - * Total count of bytes received for the broker. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="TotalDataReceived", description=TYPE + " Total Data Received") - long getTotalDataReceived(); - - /** - * Is statistics collection enabled for this connection. - * - * @since Qpid JMX API 2.2 - */ - @MBeanAttribute(name="StatisticsEnabled", description=TYPE + " Statistics Enabled") - boolean isStatisticsEnabled(); -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java deleted file mode 100644 index 657f9f90e4..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java +++ /dev/null @@ -1,129 +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.management.common.mbeans; - -import org.apache.qpid.management.common.mbeans.annotations.MBeanAttribute; -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperation; -import org.apache.qpid.management.common.mbeans.annotations.MBeanOperationParameter; - -import javax.management.MBeanOperationInfo; -import javax.management.openmbean.TabularData; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public interface UserManagement -{ - - String TYPE = "UserManagement"; - - //TabularType and contained CompositeType key/description information. - //For compatibility reasons, DONT MODIFY the existing key values if expanding the set. - String USERNAME = "Username"; - String RIGHTS_READ_ONLY = "read"; // item deprecated - String RIGHTS_READ_WRITE = "write"; // item deprecated - String RIGHTS_ADMIN = "admin"; // item deprecated - - List<String> COMPOSITE_ITEM_NAMES = Collections.unmodifiableList(Arrays.asList(USERNAME, RIGHTS_READ_ONLY, RIGHTS_READ_WRITE, RIGHTS_ADMIN)); - List<String> COMPOSITE_ITEM_DESCRIPTIONS = Collections.unmodifiableList( - Arrays.asList("Broker Login username", - "Item no longer used", - "Item no longer used", - "Item no longer used")); - - List<String> TABULAR_UNIQUE_INDEX = Collections.unmodifiableList(Arrays.asList(USERNAME)); - - //********** Operations *****************// - /** - * Set password for a given user. - * - * @since Qpid JMX API 1.7 - * - * @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")String password); - - /** - * Create users with given details. - * - * @since Qpid JMX API 2.3 / 1.12 - * - * @param username The username to create - * @param password The password for the user - * - * @return true if the user was created successfully, or false otherwise - */ - @MBeanOperation(name = "createUser", description = "Create a new user.", - impact = MBeanOperationInfo.ACTION) - boolean createUser(@MBeanOperationParameter(name = "username", description = "Username")String username, - @MBeanOperationParameter(name = "password", description = "Password")String password); - - /** - * 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 user data - * - * Since Qpid JMX API 2.3 / 1.12 this operation reloads only the password data. - * Since Qpid JMX API 1.2 but prior to 2.3 / 1.12 this operation reloads the password and authorisation files. - * Prior to 1.2, only the authorisation file was reloaded. - * - * @return The result of the operation - */ - @MBeanOperation(name = "reloadData", description = "Reload the authentication and authorisation files from disk.", - impact = MBeanOperationInfo.ACTION) - boolean reloadData(); - - /** - * View users returns all the users that are currently available to the system. - * - * Since Qpid JMX API 2.3 / 1.12 the items that corresponded to read, write and admin flags - * are deprecated and always return false. - * - * @return a table of users data (Username, read, write, admin) - */ - @MBeanOperation(name = "viewUsers", description = "All users that are currently available to the system.", - impact = MBeanOperationInfo.INFO) - TabularData viewUsers(); - - /** - * The type of the underlying authentication provider being managed. - * - * @since Qpid JMX API 2.6 - */ - @MBeanAttribute(name="AuthenticationProviderType", description="The type of the underlying authentication provider being managed.") - String getAuthenticationProviderType(); -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanAttribute.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanAttribute.java deleted file mode 100644 index 14e7211049..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/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.management.common.mbeans.annotations; - -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/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanConstructor.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanConstructor.java deleted file mode 100644 index 3131969813..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/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.management.common.mbeans.annotations; - -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/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanDescription.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanDescription.java deleted file mode 100644 index d70c7dd8f3..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/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.management.common.mbeans.annotations; - -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/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanOperation.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanOperation.java deleted file mode 100644 index 99b7c283d8..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanOperation.java +++ /dev/null @@ -1,42 +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.management.common.mbeans.annotations; - -import javax.management.MBeanOperationInfo; -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 operations. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Inherited -public @interface MBeanOperation -{ - String name(); - String description(); - int impact() default MBeanOperationInfo.INFO; -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanOperationParameter.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/MBeanOperationParameter.java deleted file mode 100644 index 25f2d09608..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/annotations/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.management.common.mbeans.annotations; - -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/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/CRAMMD5HashedSaslClientFactory.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/CRAMMD5HashedSaslClientFactory.java deleted file mode 100644 index ec819ae65f..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/CRAMMD5HashedSaslClientFactory.java +++ /dev/null @@ -1,59 +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.management.common.sasl; - -import javax.security.auth.callback.CallbackHandler; -import javax.security.sasl.Sasl; -import javax.security.sasl.SaslClient; -import javax.security.sasl.SaslClientFactory; -import javax.security.sasl.SaslException; -import java.util.Map; - -public class CRAMMD5HashedSaslClientFactory implements SaslClientFactory -{ - /** The name of this mechanism */ - public static final String MECHANISM = "CRAM-MD5-HASHED"; - - public SaslClient createSaslClient(String[] mechanisms, String authorizationId, String protocol, - String serverName, Map<String, ?> props, CallbackHandler cbh) - throws SaslException - { - for (int i = 0; i < mechanisms.length; i++) - { - if (mechanisms[i].equals(MECHANISM)) - { - if (cbh == null) - { - throw new SaslException("CallbackHandler must not be null"); - } - - String[] mechs = {"CRAM-MD5"}; - return Sasl.createSaslClient(mechs, authorizationId, protocol, serverName, props, cbh); - } - } - return null; - } - - public String[] getMechanismNames(Map props) - { - return new String[]{MECHANISM}; - } -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/ClientSaslFactory.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/ClientSaslFactory.java deleted file mode 100644 index 263c2962ea..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/ClientSaslFactory.java +++ /dev/null @@ -1,53 +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.management.common.sasl; - -import javax.security.auth.callback.CallbackHandler; -import javax.security.sasl.SaslClient; -import javax.security.sasl.SaslClientFactory; -import javax.security.sasl.SaslException; -import java.util.Map; - -public class ClientSaslFactory implements SaslClientFactory -{ - public SaslClient createSaslClient(String[] mechs, String authorizationId, String protocol, - String serverName, Map props, CallbackHandler cbh) - throws SaslException - { - for (int i = 0; i < mechs.length; i++) - { - if (mechs[i].equals("PLAIN")) - { - return new PlainSaslClient(authorizationId, cbh); - } - } - return null; - } - - /** - * Simple-minded implementation that ignores props - */ - public String[] getMechanismNames(Map props) - { - return new String[]{"PLAIN"}; - } - -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/Constants.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/Constants.java deleted file mode 100644 index 31010baf8b..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/Constants.java +++ /dev/null @@ -1,33 +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.management.common.sasl; - -public class Constants -{ - - public final static String MECH_CRAMMD5 = "CRAM-MD5"; - public final static String MECH_PLAIN = "PLAIN"; - public final static String SASL_CRAMMD5 = "SASL/CRAM-MD5"; - public final static String SASL_PLAIN = "SASL/PLAIN"; - -} - diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/JCAProvider.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/JCAProvider.java deleted file mode 100644 index cb2007dd50..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/JCAProvider.java +++ /dev/null @@ -1,55 +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.management.common.sasl; - -import javax.security.sasl.SaslClientFactory; -import java.security.Provider; -import java.util.Map; - -public class JCAProvider extends Provider -{ - private static final long serialVersionUID = 1L; - - /** - * Creates the security provider with a map from SASL mechanisms to implementing factories. - * - * @param providerMap The map from SASL mechanims to implementing factory classes. - */ - public JCAProvider(Map<String, Class<? extends SaslClientFactory>> providerMap) - { - super("AMQSASLProvider", 1.0, "A JCA provider that registers all " - + "AMQ SASL providers that want to be registered"); - register(providerMap); - } - - /** - * Registers client factory classes for a map of mechanism names to client factory classes. - * - * @param providerMap The map from SASL mechanims to implementing factory classes. - */ - private void register(Map<String, Class<? extends SaslClientFactory>> providerMap) - { - for (Map.Entry<String, Class<? extends SaslClientFactory>> me : providerMap.entrySet()) - { - put("SaslClientFactory." + me.getKey(), me.getValue().getName()); - } - } -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/PlainSaslClient.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/PlainSaslClient.java deleted file mode 100644 index bee89fcc66..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/PlainSaslClient.java +++ /dev/null @@ -1,212 +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.management.common.sasl; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.NameCallback; -import javax.security.auth.callback.PasswordCallback; -import javax.security.auth.callback.UnsupportedCallbackException; -import javax.security.sasl.Sasl; -import javax.security.sasl.SaslClient; -import javax.security.sasl.SaslException; - -public class PlainSaslClient implements SaslClient -{ - - private boolean completed; - private CallbackHandler cbh; - private String authorizationID; - private String authenticationID; - private byte password[]; - private static byte SEPARATOR = 0; - - public PlainSaslClient(String authorizationID, CallbackHandler cbh) throws SaslException - { - completed = false; - this.cbh = cbh; - Object[] userInfo = getUserInfo(); - this.authorizationID = authorizationID; - this.authenticationID = (String) userInfo[0]; - this.password = (byte[]) userInfo[1]; - if (authenticationID == null || password == null) - { - throw new SaslException("PLAIN: authenticationID and password must be specified"); - } - } - - public byte[] evaluateChallenge(byte[] challenge) throws SaslException - { - if (completed) - { - throw new IllegalStateException("PLAIN: authentication already " + - "completed"); - } - completed = true; - try - { - byte authzid[] = - authorizationID == null ? null : authorizationID.getBytes("UTF8"); - byte authnid[] = authenticationID.getBytes("UTF8"); - byte response[] = - new byte[ - password.length + - authnid.length + - 2 + // SEPARATOR - (authzid != null ? authzid.length : 0) - ]; - int size = 0; - if (authzid != null) { - System.arraycopy(authzid, 0, response, 0, authzid.length); - size = authzid.length; - } - response[size++] = SEPARATOR; - System.arraycopy(authnid, 0, response, size, authnid.length); - size += authnid.length; - response[size++] = SEPARATOR; - System.arraycopy(password, 0, response, size, password.length); - clearPassword(); - return response; - } catch (UnsupportedEncodingException e) { - throw new SaslException("PLAIN: Cannot get UTF-8 encoding of ids", - e); - } - } - - public String getMechanismName() - { - return "PLAIN"; - } - - public boolean hasInitialResponse() - { - return true; - } - - public boolean isComplete() - { - return completed; - } - - public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException - { - if (completed) { - throw new IllegalStateException("PLAIN: this mechanism supports " + - "neither integrity nor privacy"); - } else { - throw new IllegalStateException("PLAIN: authentication not " + - "completed"); - } - } - - public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException - { - if (completed) - { - throw new IllegalStateException("PLAIN: this mechanism supports " + - "neither integrity nor privacy"); - } - else - { - throw new IllegalStateException("PLAIN: authentication not " + - "completed"); - } - } - - public Object getNegotiatedProperty(String propName) - { - if (completed) - { - if (propName.equals(Sasl.QOP)) - { - return "auth"; - } - else - { - return null; - } - } - else - { - throw new IllegalStateException("PLAIN: authentication not " + - "completed"); - } - } - - private void clearPassword() - { - if (password != null) - { - for (int i = 0 ; i < password.length ; i++) - { - password[i] = 0; - } - password = null; - } - } - - public void dispose() throws SaslException - { - clearPassword(); - } - - protected void finalize() throws Throwable - { - clearPassword(); - super.finalize(); - } - - private Object[] getUserInfo() throws SaslException - { - try - { - final String userPrompt = "PLAIN authentication id: "; - final String pwPrompt = "PLAIN password: "; - NameCallback nameCb = new NameCallback(userPrompt); - PasswordCallback passwordCb = new PasswordCallback(pwPrompt, false); - cbh.handle(new Callback[] { nameCb, passwordCb }); - String userid = nameCb.getName(); - char pwchars[] = passwordCb.getPassword(); - byte pwbytes[]; - if (pwchars != null) - { - pwbytes = (new String(pwchars)).getBytes("UTF8"); - passwordCb.clearPassword(); - } - else - { - pwbytes = null; - } - return (new Object[] { userid, pwbytes }); - } - catch (IOException e) - { - throw new SaslException("Cannot get password", e); - } - catch (UnsupportedCallbackException e) - { - throw new SaslException("Cannot get userid/password", e); - } - } -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/SaslProvider.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/SaslProvider.java deleted file mode 100644 index 1eb44e35df..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/SaslProvider.java +++ /dev/null @@ -1,35 +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.management.common.sasl; - -import java.security.Provider; - -public class SaslProvider extends Provider -{ - private static final long serialVersionUID = -6978096016899676466L; - - public SaslProvider() - { - super("SaslClientFactory", 1.0, "SASL PLAIN CLIENT MECHANISM"); - put("SaslClientFactory.PLAIN", "ClientSaslFactory"); - } - -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UserPasswordCallbackHandler.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UserPasswordCallbackHandler.java deleted file mode 100644 index 3778e39f62..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UserPasswordCallbackHandler.java +++ /dev/null @@ -1,79 +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.management.common.sasl; - -import java.io.IOException; - -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.NameCallback; -import javax.security.auth.callback.PasswordCallback; -import javax.security.auth.callback.UnsupportedCallbackException; - -public class UserPasswordCallbackHandler implements CallbackHandler -{ - private String user; - private char[] pwchars; - - public UserPasswordCallbackHandler(String user, String password) - { - this.user = user; - this.pwchars = password.toCharArray(); - } - - public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException - { - for (int i = 0; i < callbacks.length; i++) - { - if (callbacks[i] instanceof NameCallback) - { - NameCallback ncb = (NameCallback) callbacks[i]; - ncb.setName(user); - } - else if (callbacks[i] instanceof PasswordCallback) - { - PasswordCallback pcb = (PasswordCallback) callbacks[i]; - pcb.setPassword(pwchars); - } - else - { - throw new UnsupportedCallbackException(callbacks[i]); - } - } - } - - private void clearPassword() - { - if (pwchars != null) - { - for (int i = 0 ; i < pwchars.length ; i++) - { - pwchars[i] = 0; - } - pwchars = null; - } - } - - protected void finalize() throws Throwable - { - clearPassword(); - super.finalize(); - } -} diff --git a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UsernameHashedPasswordCallbackHandler.java b/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UsernameHashedPasswordCallbackHandler.java deleted file mode 100644 index 5f12fa9dfc..0000000000 --- a/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UsernameHashedPasswordCallbackHandler.java +++ /dev/null @@ -1,109 +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.management.common.sasl; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.NameCallback; -import javax.security.auth.callback.PasswordCallback; -import javax.security.auth.callback.UnsupportedCallbackException; - - -public class UsernameHashedPasswordCallbackHandler implements CallbackHandler -{ - private String user; - private char[] pwchars; - - public UsernameHashedPasswordCallbackHandler(String user, String password) throws Exception - { - this.user = user; - this.pwchars = getHash(password); - } - - public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException - { - for (int i = 0; i < callbacks.length; i++) - { - if (callbacks[i] instanceof NameCallback) - { - NameCallback ncb = (NameCallback) callbacks[i]; - ncb.setName(user); - } - else if (callbacks[i] instanceof PasswordCallback) - { - PasswordCallback pcb = (PasswordCallback) callbacks[i]; - pcb.setPassword(pwchars); - } - else - { - throw new UnsupportedCallbackException(callbacks[i]); - } - } - } - - - private void clearPassword() - { - if (pwchars != null) - { - for (int i = 0 ; i < pwchars.length ; i++) - { - pwchars[i] = 0; - } - pwchars = null; - } - } - - protected void finalize() throws Throwable - { - clearPassword(); - super.finalize(); - } - - public static char[] getHash(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException - { - byte[] data = text.getBytes("utf-8"); - - MessageDigest md = MessageDigest.getInstance("MD5"); - - for (byte b : data) - { - md.update(b); - } - - byte[] digest = md.digest(); - - char[] hash = new char[digest.length ]; - - int index = 0; - for (byte b : digest) - { - hash[index++] = (char) b; - } - - return hash; - } -} |
