You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2009/04/13 15:19:32 UTC
svn commit: r764441 - in /qpid/branches/0.5-fix/qpid: ./
java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java
Author: ritchiem
Date: Mon Apr 13 13:19:32 2009
New Revision: 764441
URL: http://svn.apache.org/viewvc?rev=764441&view=rev
Log:
QPID-1568: make isInstanceOf and isRegistered read only methods. Fix code style issue with field name.
merged from trunk r747869
Modified:
qpid/branches/0.5-fix/qpid/ (props changed)
qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java
Propchange: qpid/branches/0.5-fix/qpid/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Apr 13 13:19:32 2009
@@ -1 +1 @@
-/qpid/trunk/qpid:742626,743015,743028-743029,743304,743306,743311,743357,744113,747363,747367,747369-747370,747376,747783,747868
+/qpid/trunk/qpid:742626,743015,743028-743029,743304,743306,743311,743357,744113,747363,747367,747369-747370,747376,747783,747868-747869
Modified: qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java?rev=764441&r1=764440&r2=764441&view=diff
==============================================================================
--- qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java (original)
+++ qpid/branches/0.5-fix/qpid/java/broker/src/main/java/org/apache/qpid/server/management/MBeanInvocationHandlerImpl.java Mon Apr 13 13:19:32 2009
@@ -53,7 +53,7 @@
public final static String READWRITE = "readwrite";
public final static String READONLY = "readonly";
private final static String DELEGATE = "JMImplementation:type=MBeanServerDelegate";
- private MBeanServer mbs;
+ private MBeanServer _mbs;
private static Properties _userRoles = new Properties();
public static MBeanServerForwarder newProxyInstance()
@@ -71,7 +71,7 @@
if (methodName.equals("getMBeanServer"))
{
- return mbs;
+ return _mbs;
}
if (methodName.equals("setMBeanServer"))
@@ -80,11 +80,11 @@
{
throw new IllegalArgumentException("Null MBeanServer");
}
- if (mbs != null)
+ if (_mbs != null)
{
throw new IllegalArgumentException("MBeanServer object already initialized");
}
- mbs = (MBeanServer) args[0];
+ _mbs = (MBeanServer) args[0];
return null;
}
@@ -95,12 +95,12 @@
// Allow operations performed locally on behalf of the connector server itself
if (subject == null)
{
- return method.invoke(mbs, args);
+ return method.invoke(_mbs, args);
}
if (args == null || DELEGATE.equals(args[0]))
{
- return method.invoke(mbs, args);
+ return method.invoke(_mbs, args);
}
// Restrict access to "createMBean" and "unregisterMBean" to any user
@@ -124,7 +124,7 @@
{
if (isAdmin(identity))
{
- return method.invoke(mbs, args);
+ return method.invoke(_mbs, args);
}
else
{
@@ -135,14 +135,14 @@
// Following users can perform any operation other than "createMBean" and "unregisterMBean"
if (isAllowedToModify(identity))
{
- return method.invoke(mbs, args);
+ return method.invoke(_mbs, args);
}
// These users can only call "getAttribute" on the MBeanServerDelegate MBean
// Here we can add other fine grained permissions like specific method for a particular mbean
if (isReadOnlyUser(identity) && isReadOnlyMethod(method, args))
{
- return method.invoke(mbs, args);
+ return method.invoke(_mbs, args);
}
throw new SecurityException("Access denied");
@@ -196,7 +196,10 @@
private boolean isReadOnlyMethod(Method method, Object[] args)
{
String methodName = method.getName();
- if (methodName.startsWith("query") || methodName.startsWith("get"))
+
+ //handle standard get/set/query and select 'is' methods from MBeanServer
+ if (methodName.startsWith("query") || methodName.startsWith("get")
+ ||methodName.startsWith("isInstanceOf") || methodName.startsWith("isRegistered"))
{
return true;
}
@@ -205,8 +208,11 @@
return false;
}
+ //handle invocation of other methods on mbeans
if ((args[0] instanceof ObjectName) && (methodName.equals("invoke")))
{
+
+ //get invoked method name
String mbeanMethod = (args.length > 1) ? (String) args[1] : null;
if (mbeanMethod == null)
{
@@ -215,7 +221,8 @@
try
{
- MBeanInfo mbeanInfo = mbs.getMBeanInfo((ObjectName) args[0]);
+ //check if the given method is tagged with an INFO impact attribute
+ MBeanInfo mbeanInfo = _mbs.getMBeanInfo((ObjectName) args[0]);
if (mbeanInfo != null)
{
MBeanOperationInfo[] opInfos = mbeanInfo.getOperations();
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org