Index: src/main/org/jboss/mx/interceptor/StandardMBeanInfoInterceptor.java
===================================================================
RCS file: src/main/org/jboss/mx/interceptor/StandardMBeanInfoInterceptor.java
diff -N src/main/org/jboss/mx/interceptor/StandardMBeanInfoInterceptor.java
--- src/main/org/jboss/mx/interceptor/StandardMBeanInfoInterceptor.java 29 Oct 2005 05:03:34 -0000 1.7.4.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,64 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.mx.interceptor;
-
-import javax.management.MBeanInfo;
-
-import org.jboss.mx.metadata.MBeanInfoConversion;
-import org.jboss.mx.server.Invocation;
-
-/**
- *
- * @author Juha Lindfors.
- * @version $Revision: 1.7.4.2 $
- */
-public class StandardMBeanInfoInterceptor extends AbstractInterceptor
-{
- // cached info
- MBeanInfo standardInfo = null;
-
- public StandardMBeanInfoInterceptor()
- {
- // FIXME: xxx
- super("Standard MBeanInfo Interceptor for XXX");
- }
-
- public Object invoke(Invocation invocation) throws Throwable
- {
-
- MBeanInfo info = null;
-
- try
- {
- info = (MBeanInfo)super.invoke(invocation);
- }
- finally
- {
- if (standardInfo == null)
- {
- standardInfo = MBeanInfoConversion.stripAttributeOperations(MBeanInfoConversion.toModelMBeanInfo(info), false);
- }
- }
- return standardInfo;
- }
-}
-
Index: src/main/org/jboss/mx/metadata/MBeanInfoConversion.java
===================================================================
RCS file: /cvsroot/jboss/jmx/src/main/org/jboss/mx/metadata/Attic/MBeanInfoConversion.java,v
retrieving revision 1.10.4.1
diff -u -r1.10.4.1 MBeanInfoConversion.java
--- src/main/org/jboss/mx/metadata/MBeanInfoConversion.java 29 Oct 2005 05:03:36 -0000 1.10.4.1
+++ src/main/org/jboss/mx/metadata/MBeanInfoConversion.java 3 Feb 2006 22:51:40 -0000
@@ -48,6 +48,7 @@
* ModelMBeanOperationInfos that are referred to in ModelMBeanAttributeInfos.
*
* @author Juha Lindfors.
+ * @author Fabiano C. de Oliveira
* @version $Revision: 1.10.4.1 $
*/
public class MBeanInfoConversion
@@ -86,7 +87,6 @@
// create attributes
MBeanAttributeInfo[] attributes = info.getAttributes();
ModelMBeanAttributeInfo[] mmbAttributes = new ModelMBeanAttributeInfo[attributes.length];
- List accessorOperations = new ArrayList();
for (int i = 0; i < attributes.length; ++i)
{
@@ -132,23 +132,11 @@
getterDescriptor.setField(DESCRIPTOR_TYPE, OPERATION_DESCRIPTOR);
getterDescriptor.setField(ROLE, ROLE_GETTER);
- // create the new management operation
- ModelMBeanOperationInfo opInfo = new ModelMBeanOperationInfo(
- getterOperationName,
- "Read accessor operation for '" + attributes[i].getName() + "' attribute.",
- new MBeanParameterInfo[0], // void signature
- attributes[i].getType(), // return type
- MBeanOperationInfo.INFO, // impact
- getterDescriptor
- );
-
// modify the attributes descriptor to map the read operation
// to the above created management operation
Descriptor attrDescriptor = mmbAttributes[i].getDescriptor();
attrDescriptor.setField(GET_METHOD, getterOperationName);
mmbAttributes[i].setDescriptor(attrDescriptor);
-
- accessorOperations.add(opInfo);
}
// figure out the setter
@@ -162,34 +150,18 @@
setterDescriptor.setField(DESCRIPTOR_TYPE, OPERATION_DESCRIPTOR);
setterDescriptor.setField(ROLE, ROLE_SETTER);
- // create the new management operation
- ModelMBeanOperationInfo opInfo = new ModelMBeanOperationInfo(
- setterOperationName,
- "Write accessor operation for '" + attributes[i].getName() + "' attribute.",
-
- new MBeanParameterInfo[] {
- new MBeanParameterInfo("value", attributes[i].getType(), "Attribute's value.")
- },
-
- Void.TYPE.getName(),
- MBeanOperationInfo.ACTION,
- setterDescriptor
- );
-
// modify the attributes descriptor to map the read operation
// to the above created management operation
Descriptor attrDescriptor = mmbAttributes[i].getDescriptor();
attrDescriptor.setField(SET_METHOD, setterOperationName);
mmbAttributes[i].setDescriptor(attrDescriptor);
-
- accessorOperations.add(opInfo);
}
}
}
// deal with the basic manaement operations (non-getter and setter types)
MBeanOperationInfo[] operations = info.getOperations();
- ModelMBeanOperationInfo[] mmbOperations = new ModelMBeanOperationInfo[operations.length + accessorOperations.size()];
+ ModelMBeanOperationInfo[] mmbOperations = new ModelMBeanOperationInfo[operations.length];
for (int i = 0; i < operations.length; ++i)
{
@@ -202,9 +174,6 @@
);
}
- for (int i = operations.length; i < mmbOperations.length; ++i)
- mmbOperations[i] = (ModelMBeanOperationInfo)accessorOperations.get(i - operations.length);
-
// the constructors...
MBeanConstructorInfo[] constructors = info.getConstructors();
ModelMBeanConstructorInfo[] mmbConstructors = new ModelMBeanConstructorInfo[constructors.length];
@@ -239,67 +208,4 @@
return new ModelMBeanInfoSupport(info.getClassName(), info.getDescription(),
mmbAttributes, mmbConstructors, mmbOperations, mmbNotifications);
}
-
- /**
- * Returns a ModelMBeanInfoSupport where ModelMBeanOperationInfos that are
- * referred to by ModelMBeanAttributeInfo getMethod or setMethod descriptor
- * fields are stripped out. If the stripAllRoles parameter is true
- * then all the referred-to operations will be stripped. Otherwise only
- * referred-to operations with a role of "getter" or "setter" will be stripped.
- */
- // why mbeanexception?
- public static ModelMBeanInfoSupport stripAttributeOperations(ModelMBeanInfo info, boolean stripAllRoles) throws MBeanException
- {
- HashMap opsMap = new HashMap();
- ModelMBeanOperationInfo[] operations = (ModelMBeanOperationInfo[]) info.getOperations();
-
- for (int i = 0; i < operations.length; i++)
- {
- opsMap.put(MethodMapper.operationSignature(operations[i]), operations[i]);
- }
-
- ModelMBeanAttributeInfo[] attributes = (ModelMBeanAttributeInfo[]) info.getAttributes();
-
- for (int i = 0; i < attributes.length; i++)
- {
- if (attributes[i].isReadable() && (attributes[i].getDescriptor().getFieldValue("getMethod") != null))
- {
- String key = MethodMapper.getterSignature(attributes[i]);
- ModelMBeanOperationInfo opinfo = (ModelMBeanOperationInfo) opsMap.get(key);
- String role = (String) opinfo.getDescriptor().getFieldValue("role");
- if ("getter".equals(role) || stripAllRoles)
- {
- opsMap.remove(key);
- }
- }
-
- if (attributes[i].isWritable() && (attributes[i].getDescriptor().getFieldValue("setMethod") != null))
- {
- String key = MethodMapper.setterSignature(attributes[i]);
- ModelMBeanOperationInfo opinfo = (ModelMBeanOperationInfo) opsMap.get(key);
-
- String role = (String) opinfo.getDescriptor().getFieldValue("role");
- if ("setter".equals(role) || stripAllRoles)
- {
- opsMap.remove(key);
- }
- }
- }
-
- operations = new ModelMBeanOperationInfo[opsMap.size()];
- int position = 0;
- for (Iterator iterator = opsMap.values().iterator(); iterator.hasNext(); position++)
- {
- operations[position] = (ModelMBeanOperationInfo) iterator.next();
- }
-
- return new ModelMBeanInfoSupport(
- info.getClassName(), info.getDescription(),
- (ModelMBeanAttributeInfo[]) info.getAttributes(),
- (ModelMBeanConstructorInfo[]) info.getConstructors(),
- operations,
- (ModelMBeanNotificationInfo[]) info.getNotifications(),
- info.getMBeanDescriptor()
- );
- }
}
Index: src/main/org/jboss/mx/modelmbean/XMBean.java
===================================================================
RCS file: /cvsroot/jboss/jmx/src/main/org/jboss/mx/modelmbean/Attic/XMBean.java,v
retrieving revision 1.28.2.4
diff -u -r1.28.2.4 XMBean.java
--- src/main/org/jboss/mx/modelmbean/XMBean.java 29 Oct 2005 05:03:36 -0000 1.28.2.4
+++ src/main/org/jboss/mx/modelmbean/XMBean.java 3 Feb 2006 22:51:40 -0000
@@ -53,7 +53,6 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.jboss.mx.interceptor.StandardMBeanInfoInterceptor;
import org.jboss.mx.metadata.MBeanInfoConversion;
import org.jboss.mx.metadata.MetaDataBuilder;
import org.jboss.mx.metadata.StandardMetaData;
@@ -65,6 +64,7 @@
* @author Juha Lindfors.
* @author Matt Munz
* @author Dimitris Andreadis
+ * @author Fabiano C. de Oliveira
* @version $Revision: 1.28.2.4 $
*/
public class XMBean
@@ -399,12 +399,6 @@
super.configureInterceptorStack(info, server, name);
- if (resourceType.equals(STANDARD_MBEAN))
- {
- List interceptors = getMBeanInfoCtx.getInterceptors();
- interceptors.add(0, new StandardMBeanInfoInterceptor());
- getMBeanInfoCtx.setInterceptors(interceptors);
- }
}
// NotificationBroadcaster overrides -----------------------------