djencks 2004/06/25 00:24:21
Modified: modules/kernel/src/java/org/apache/geronimo/gbean/jmx
GBeanMBean.java GBeanMBeanOperation.java
Log:
fix for GERONIMO-255
Revision Changes Path
1.27 +24 -17
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java
Index: GBeanMBean.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- GBeanMBean.java 15 Jun 2004 03:00:37 -0000 1.26
+++ GBeanMBean.java 25 Jun 2004 07:24:20 -0000 1.27
@@ -218,17 +218,21 @@
}
// operations
- Set operationsSet = new HashSet();
+ Map operationsMap = new HashMap();
for (Iterator iterator = gbeanInfo.getOperations().iterator();
iterator.hasNext();) {
GOperationInfo operationInfo = (GOperationInfo) iterator.next();
- operationsSet.add(new GBeanMBeanOperation(this, operationInfo));
- }
- addManagedObjectOperations(operationsSet);
- operations = (GBeanMBeanOperation[]) operationsSet.toArray(new
GBeanMBeanOperation[gbeanInfo.getOperations().size()]);
- for (int i = 0; i < operations.length; i++) {
- GBeanMBeanOperation operation = operations[i];
+ GBeanMBeanOperation operation = new GBeanMBeanOperation(this,
operationInfo);
GOperationSignature signature = new
GOperationSignature(operation.getName(), operation.getParameterTypes());
- operationIndex.put(signature, new Integer(i));
+ operationsMap.put(signature, operation);
+ }
+ addManagedObjectOperations(operationsMap);
+ operations = new GBeanMBeanOperation[operationsMap.size()];
+ int opCounter = 0;
+ for (Iterator iterator = operationsMap.entrySet().iterator();
iterator.hasNext();) {
+ Map.Entry entry = (Map.Entry)iterator.next();
+ operations[opCounter] = (GBeanMBeanOperation) entry.getValue();
+ operationIndex.put(entry.getKey(), new Integer(opCounter));
+ opCounter++;
}
// add notification type from the ManagedObject interface
@@ -619,7 +623,7 @@
* @param index the index of the attribute
* @return the attribute value
* @throws ReflectionException if a problem occurs while getting the
value
- * @thorws IndexOutOfBoundsException if the index is invalid
+ * @throws IndexOutOfBoundsException if the index is invalid
*/
public Object getAttribute(int index) throws ReflectionException {
GBeanMBeanAttribute attribute = attributes[index];
@@ -627,7 +631,7 @@
}
/**
- * Gets an attirubte's value by name. This get style is less efficient
becuse the attribute must
+ * Gets an attribute's value by name. This get style is less efficient
becuse the attribute must
* first be looked up in a HashMap.
*
* @param attributeName the name of the attribute to retrieve
@@ -650,7 +654,7 @@
* @param index the index of the attribute
* @param value the new value of attribute value
* @throws ReflectionException if a problem occurs while setting the
value
- * @thorws IndexOutOfBoundsException if the index is invalid
+ * @throws IndexOutOfBoundsException if the index is invalid
*/
public void setAttribute(int index, Object value) throws
ReflectionException, IndexOutOfBoundsException {
GBeanMBeanAttribute attribute = attributes[index];
@@ -658,7 +662,7 @@
}
/**
- * Sets an attirubte's value by name. This set style is less efficient
becuse the attribute must
+ * Sets an attribute's value by name. This set style is less efficient
becuse the attribute must
* first be looked up in a HashMap.
*
* @param attributeName the name of the attribute to retrieve
@@ -911,8 +915,9 @@
null));
}
- private void addManagedObjectOperations(Set operationsSet) {
- operationsSet.add(new GBeanMBeanOperation(this,
+ private void addManagedObjectOperations(Map operationsMap) {
+ operationsMap.put(new GOperationSignature("start",
Collections.EMPTY_LIST),
+ new GBeanMBeanOperation(this,
"start",
Collections.EMPTY_LIST,
Void.TYPE,
@@ -923,7 +928,8 @@
}
}));
- operationsSet.add(new GBeanMBeanOperation(this,
+ operationsMap.put(new GOperationSignature("startRecursive",
Collections.EMPTY_LIST),
+ new GBeanMBeanOperation(this,
"startRecursive",
Collections.EMPTY_LIST,
Void.TYPE,
@@ -934,7 +940,8 @@
}
}));
- operationsSet.add(new GBeanMBeanOperation(this,
+ operationsMap.put(new GOperationSignature("stop",
Collections.EMPTY_LIST),
+ new GBeanMBeanOperation(this,
"stop",
Collections.EMPTY_LIST,
Void.TYPE,
1.13 +4 -2
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBeanOperation.java
Index: GBeanMBeanOperation.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBeanOperation.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- GBeanMBeanOperation.java 3 Jun 2004 07:24:19 -0000 1.12
+++ GBeanMBeanOperation.java 25 Jun 2004 07:24:20 -0000 1.13
@@ -17,11 +17,12 @@
package org.apache.geronimo.gbean.jmx;
-import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+
import javax.management.MBeanOperationInfo;
import javax.management.MBeanParameterInfo;
import javax.management.ReflectionException;
@@ -145,4 +146,5 @@
throw new ReflectionException(new
InvocationTargetException(throwable));
}
}
+
}