diff options
| author | Keith Wall <kwall@apache.org> | 2011-12-16 12:51:56 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2011-12-16 12:51:56 +0000 |
| commit | 0701049e4b2f306caf7575b86a37b3b0cc245f2a (patch) | |
| tree | 0a34b64b3089190e530278cbd12ab428008c1842 /java/broker | |
| parent | 104b8b28c6e04770480d97917125ebe024d2138e (diff) | |
| download | qpid-python-0701049e4b2f306caf7575b86a37b3b0cc245f2a.tar.gz | |
QPID-3682: Shutdown Plugin Improvements
Various improvements to shutdown plugin:
1) Give the ShutdownPlugin instance a name to allow it to be permission via ACL METHOD rules.
2) Refactored to extend DefaultManagedObject.
3) Added method/parameter annotations to improve usability from the UI.
4) Fix date format parsing pattern used by the plugin
Applied patch from Andrew MacBean <andymacbean@gmail.com> and myself.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1215112 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker')
3 files changed, 33 insertions, 34 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/AMQManagedObject.java b/java/broker/src/main/java/org/apache/qpid/server/management/AMQManagedObject.java index c4ffcd26bf..6c9d6e39de 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/management/AMQManagedObject.java +++ b/java/broker/src/main/java/org/apache/qpid/server/management/AMQManagedObject.java @@ -52,8 +52,6 @@ public abstract class AMQManagedObject extends DefaultManagedObject */ protected long _notificationSequenceNumber = 0; - protected MBeanInfo _mbeanInfo; - protected LogActor _logActor; protected AMQManagedObject(Class<?> managementInterface, String typeName) @@ -63,27 +61,8 @@ public abstract class AMQManagedObject extends DefaultManagedObject // CurrentActor will be defined as these objects are created during // broker startup. _logActor = new ManagementActor(CurrentActor.get().getRootMessageLogger()); - buildMBeanInfo(); - } - - @Override - public MBeanInfo getMBeanInfo() - { - return _mbeanInfo; - } - - private void buildMBeanInfo() throws NotCompliantMBeanException - { - _mbeanInfo = new MBeanInfo(this.getClass().getName(), - MBeanIntrospector.getMBeanDescription(this.getClass()), - MBeanIntrospector.getMBeanAttributesInfo(getManagementInterface()), - MBeanIntrospector.getMBeanConstructorsInfo(this.getClass()), - MBeanIntrospector.getMBeanOperationsInfo(getManagementInterface()), - this.getNotificationInfo()); } - - // notification broadcaster implementation public void addNotificationListener(NotificationListener listener, @@ -99,8 +78,5 @@ public abstract class AMQManagedObject extends DefaultManagedObject _broadcaster.removeNotificationListener(listener); } - public MBeanNotificationInfo[] getNotificationInfo() - { - return null; - } + } diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/DefaultManagedObject.java b/java/broker/src/main/java/org/apache/qpid/server/management/DefaultManagedObject.java index e44b8c41cb..0c3a5fc571 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/management/DefaultManagedObject.java +++ b/java/broker/src/main/java/org/apache/qpid/server/management/DefaultManagedObject.java @@ -21,6 +21,8 @@ package org.apache.qpid.server.management; import javax.management.JMException; +import javax.management.MBeanInfo; +import javax.management.MBeanNotificationInfo; import javax.management.MalformedObjectNameException; import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; @@ -28,7 +30,6 @@ import javax.management.StandardMBean; import org.apache.log4j.Logger; import org.apache.qpid.server.registry.ApplicationRegistry; -import org.apache.qpid.server.registry.IApplicationRegistry; /** * Provides implementation of the boilerplate ManagedObject interface. Most managed objects should find it useful @@ -37,11 +38,13 @@ import org.apache.qpid.server.registry.IApplicationRegistry; */ public abstract class DefaultManagedObject extends StandardMBean implements ManagedObject { - private static final Logger LOGGER = Logger.getLogger(ApplicationRegistry.class); + private static final Logger LOGGER = Logger.getLogger(DefaultManagedObject.class); - private Class<?> _managementInterface; + private final Class<?> _managementInterface; - private String _typeName; + private final String _typeName; + + private final MBeanInfo _mbeanInfo; private ManagedObjectRegistry _registry; @@ -51,6 +54,13 @@ public abstract class DefaultManagedObject extends StandardMBean implements Mana super(managementInterface); _managementInterface = managementInterface; _typeName = typeName; + _mbeanInfo = buildMBeanInfo(); + } + + @Override + public MBeanInfo getMBeanInfo() + { + return _mbeanInfo; } public String getType() @@ -98,7 +108,6 @@ public abstract class DefaultManagedObject extends StandardMBean implements Mana return getObjectInstanceName() + "[" + getType() + "]"; } - /** * Created the ObjectName as per the JMX Specs * @return ObjectName @@ -161,4 +170,18 @@ public abstract class DefaultManagedObject extends StandardMBean implements Mana return ""; } + private MBeanInfo buildMBeanInfo() throws NotCompliantMBeanException + { + return new MBeanInfo(this.getClass().getName(), + MBeanIntrospector.getMBeanDescription(this.getClass()), + MBeanIntrospector.getMBeanAttributesInfo(getManagementInterface()), + MBeanIntrospector.getMBeanConstructorsInfo(this.getClass()), + MBeanIntrospector.getMBeanOperationsInfo(getManagementInterface()), + this.getNotificationInfo()); + } + + public MBeanNotificationInfo[] getNotificationInfo() + { + return null; + } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java b/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java index c07074f69c..7eb1b54693 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java +++ b/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java @@ -250,14 +250,14 @@ public abstract class ApplicationRegistry implements IApplicationRegistry try { + initialiseManagedObjectRegistry(); + configure(); _qmfService = new QMFService(getConfigStore(), this); CurrentActor.get().message(BrokerMessages.STARTUP(QpidProperties.getReleaseVersion(), QpidProperties.getBuildVersion())); - initialiseManagedObjectRegistry(); - _virtualHostRegistry = new VirtualHostRegistry(this); _securityManager = new SecurityManager(_configuration, _pluginManager); @@ -471,12 +471,12 @@ public abstract class ApplicationRegistry implements IApplicationRegistry close(_authenticationManager); - close(_managedObjectRegistry); - close(_qmfService); close(_pluginManager); + close(_managedObjectRegistry); + CurrentActor.get().message(BrokerMessages.STOPPED()); } |
