dain 2004/01/16 15:31:21
Modified: modules/deployment/src/test/org/apache/geronimo/deployment
MockGBean.java
modules/kernel/src/java/org/apache/geronimo/gbean
GAttributeInfo.java GBeanInfo.java
GBeanInfoFactory.java GEndpointInfo.java
GNotificationInfo.java GOperationInfo.java
modules/kernel/src/java/org/apache/geronimo/gbean/jmx
GBeanMBean.java GBeanMBeanAttribute.java
GBeanMBeanOperation.java
modules/kernel/src/java/org/apache/geronimo/kernel/jmx
MBeanOperationSignature.java
modules/kernel/src/test/org/apache/geronimo/kernel
MockGBean.java
modules/web/src/java/org/apache/geronimo/web
AbstractWebAccessLog.java
AbstractWebApplication.java
AbstractWebConnector.java AbstractWebContainer.java
modules/web/src/java/org/apache/geronimo/web/jetty
JettyWebAccessLog.java JettyWebApplication.java
JettyWebConnector.java JettyWebContainer.java
Added: modules/kernel/src/java/org/apache/geronimo/gbean
DynamicGAttributeInfo.java DynamicGBean.java
DynamicGBeanDelegate.java
Removed: modules/kernel/src/java/org/apache/geronimo/gbean
GParameterInfo.java
Log:
Added dynamic attriute support to GBeans
Simplified the G*Info objects
Dropped description strings from the G*Info object
Revision Changes Path
1.2 +4 -4
incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/MockGBean.java
Index: MockGBean.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/MockGBean.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MockGBean.java 16 Jan 2004 03:48:42 -0000 1.1
+++ MockGBean.java 16 Jan 2004 23:31:21 -0000 1.2
@@ -81,12 +81,12 @@
}
static {
- GBeanInfoFactory infoFactory = new GBeanInfoFactory("MockGBean",
"test description", MockGBean.class.getName());
+ GBeanInfoFactory infoFactory = new GBeanInfoFactory("MockGBean",
MockGBean.class.getName());
infoFactory.addAttribute(new GAttributeInfo("Name", true));
infoFactory.addAttribute(new GAttributeInfo("Value", true));
- infoFactory.addOperation(new GOperationInfo("checkResource", new
String[]{"name"}, new String[]{"java.lang.String"}));
+ infoFactory.addOperation(new GOperationInfo("checkResource", new
String[]{"java.lang.String"}));
infoFactory.addOperation(new GOperationInfo("checkEndpoint"));
- infoFactory.addOperation(new GOperationInfo("doSomething", new
String[]{"name"}, new String[]{"java.lang.String"}));
+ infoFactory.addOperation(new GOperationInfo("doSomething", new
String[]{"java.lang.String"}));
infoFactory.addEndpoint(new GEndpointInfo("MockEndpoint",
MockEndpoint.class.getName()));
infoFactory.setConstructor(new
GConstructorInfo(Collections.singletonList("Name"),
Collections.singletonList(String.class)));
GBEAN_INFO = infoFactory.getBeanInfo();
1.3 +9 -21
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GAttributeInfo.java
Index: GAttributeInfo.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GAttributeInfo.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GAttributeInfo.java 14 Jan 2004 22:16:37 -0000 1.2
+++ GAttributeInfo.java 16 Jan 2004 23:31:21 -0000 1.3
@@ -74,11 +74,6 @@
private final boolean persistent;
/**
- * A user displayable descrption of this attribute.
- */
- private final String description;
-
- /**
* Is this attribute readable?
*/
private final Boolean readable;
@@ -101,25 +96,24 @@
private final String setterName;
public GAttributeInfo(String name) {
- this(name, false, null, null, null, null, null);
+ this(name, false, null, null, null, null);
}
- public GAttributeInfo(String name, boolean persistent) {
- this(name, persistent, null, null, null, null, null);
+ public GAttributeInfo(String name, String getterName, String setterName)
{
+ this(name, false, new Boolean(getterName != null), new
Boolean(setterName != null), getterName, setterName);
}
- public GAttributeInfo(String name, boolean persistent, String
description) {
- this(name, persistent, description, null, null, null, null);
+ public GAttributeInfo(String name, boolean persistent) {
+ this(name, persistent, null, null, null, null);
}
- public GAttributeInfo(String name, boolean persistent, String
description, Boolean readable, Boolean writable) {
- this(name, persistent, description, readable, writable, null, null);
+ public GAttributeInfo(String name, boolean persistent, String
getterName, String setterName) {
+ this(name, persistent, new Boolean(getterName != null), new
Boolean(setterName != null), getterName, setterName);
}
- public GAttributeInfo(String name, boolean persistent, String
description, Boolean readable, Boolean writable, String getterName, String
setterName) {
+ public GAttributeInfo(String name, boolean persistent, Boolean readable,
Boolean writable, String getterName, String setterName) {
this.name = name;
this.persistent = persistent;
- this.description = description;
this.readable = readable;
this.writable = writable;
this.getterName = getterName;
@@ -134,11 +128,6 @@
return persistent;
}
- public String getDescription() {
- return description;
- }
-
-
public Boolean isReadable() {
return readable;
}
@@ -158,7 +147,6 @@
public String toString() {
return "[GAttributeInfo: name=" + name +
" persistent=" + persistent +
- " description=" + description +
" readable=" + readable +
" writable=" + writable +
" getterName=" + getterName +
1.4 +4 -10
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfo.java
Index: GBeanInfo.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfo.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- GBeanInfo.java 14 Jan 2004 22:16:37 -0000 1.3
+++ GBeanInfo.java 16 Jan 2004 23:31:21 -0000 1.4
@@ -99,7 +99,6 @@
}
private final String name;
- private final String description;
private final String className;
private final Set attributes;
private final GConstructorInfo constructor;
@@ -108,12 +107,11 @@
private final Set endpoints;
public GBeanInfo(String className, Set attributes, GConstructorInfo
constructor, Set operations, Set endpoints, Set notifications) {
- this(className, null, className, attributes, constructor,
operations, endpoints, notifications);
+ this(className, className, attributes, constructor, operations,
endpoints, notifications);
}
- public GBeanInfo(String name, String description, String className, Set
attributes, GConstructorInfo constructor, Set operations, Set endpoints, Set
notifications) {
+ public GBeanInfo(String name, String className, Set attributes,
GConstructorInfo constructor, Set operations, Set endpoints, Set notifications)
{
this.name = name;
- this.description = description;
this.className = className;
this.attributes = Collections.unmodifiableSet(attributes);
if (constructor != null) {
@@ -131,10 +129,6 @@
return name;
}
- public String getDescription() {
- return description;
- }
-
public String getClassName() {
return className;
}
@@ -171,7 +165,7 @@
}
public String toString() {
- StringBuffer result = new StringBuffer("[GBeanInfo:
id=").append(super.toString()).append(" name=").append(name).append("
description=").append(description);
+ StringBuffer result = new StringBuffer("[GBeanInfo:
id=").append(super.toString()).append(" name=").append(name);
for (Iterator iterator = attributes.iterator(); iterator.hasNext();)
{
GAttributeInfo geronimoAttributeInfo = (GAttributeInfo)
iterator.next();
result.append("\n attribute: ").append(geronimoAttributeInfo);
1.4 +15 -16
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoFactory.java
Index: GBeanInfoFactory.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanInfoFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- GBeanInfoFactory.java 16 Jan 2004 02:17:39 -0000 1.3
+++ GBeanInfoFactory.java 16 Jan 2004 23:31:21 -0000 1.4
@@ -68,7 +68,6 @@
*/
public class GBeanInfoFactory {
private final String name;
- private final String description;
private final String className;
private final Set attributes = new HashSet();
private GConstructorInfo constructor;
@@ -76,15 +75,23 @@
private final Set endpoints = new HashSet();
private final Set notifications = new HashSet();
- public GBeanInfoFactory(String name, String description, String
className) {
+ public GBeanInfoFactory(String name) {
+ this(name, name);
+ }
+
+ public GBeanInfoFactory(String name, String className) {
this.name = name;
- this.description = description;
this.className = className;
}
- public GBeanInfoFactory(String name, String description, String
className, GBeanInfo source) {
- this(name, description, className);
- assert source != null;
+ public GBeanInfoFactory(String className, GBeanInfo source) {
+ this(className, className, source);
+ }
+
+ public GBeanInfoFactory(String name, String className, GBeanInfo source)
{
+ assert name != null && className != null && source != null;
+ this.name = name;
+ this.className = className;
attributes.addAll(source.getAttributeSet());
operations.addAll(source.getOperationsSet());
endpoints.addAll(source.getEndpointsSet());
@@ -93,14 +100,6 @@
constructor = source.getConstructor();
}
- public GBeanInfoFactory(String className) {
- this(className, null, className);
- }
-
- public GBeanInfoFactory(String className, GBeanInfo source) {
- this(className, null, className, source);
- }
-
public void addAttribute(GAttributeInfo info) {
attributes.add(info);
}
@@ -122,6 +121,6 @@
}
public GBeanInfo getBeanInfo() {
- return new GBeanInfo(name, description, className, attributes,
constructor, operations, endpoints, notifications);
+ return new GBeanInfo(name, className, attributes, constructor,
operations, endpoints, notifications);
}
}
1.2 +4 -15
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GEndpointInfo.java
Index: GEndpointInfo.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GEndpointInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GEndpointInfo.java 12 Jan 2004 01:38:55 -0000 1.1
+++ GEndpointInfo.java 16 Jan 2004 23:31:21 -0000 1.2
@@ -80,24 +80,18 @@
*/
private final String setterName;
- /**
- * A user displayable descrption of this endpoint.
- */
- private final String description;
-
public GEndpointInfo() {
- this(null, null, null, null);
+ this(null, null, null);
}
public GEndpointInfo(String name, String type) {
- this(name, type, null, null);
+ this(name, type, null);
}
- public GEndpointInfo(String name, String type, String setterName, String
description) {
+ public GEndpointInfo(String name, String type, String setterName) {
this.name = name;
this.type = type;
this.setterName = setterName;
- this.description = description;
}
public String getName() {
@@ -112,15 +106,10 @@
return setterName;
}
- public String getDescription() {
- return description;
- }
-
public String toString() {
return "[GEndpointInfo: name=" + name +
" type=" + type +
" setterName=" + setterName +
- " description=" + description +
"]";
}
}
1.3 +2 -9
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GNotificationInfo.java
Index: GNotificationInfo.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GNotificationInfo.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GNotificationInfo.java 14 Jan 2004 22:16:37 -0000 1.2
+++ GNotificationInfo.java 16 Jan 2004 23:31:21 -0000 1.3
@@ -66,12 +66,10 @@
*/
public final class GNotificationInfo implements Serializable {
private final String name;
- private final String description;
private final Set notificationTypes;
- public GNotificationInfo(String name, String description, Set
notificationTypes) {
+ public GNotificationInfo(String name, Set notificationTypes) {
this.name = name;
- this.description = description;
this.notificationTypes =
Collections.unmodifiableSet(notificationTypes);
}
@@ -79,10 +77,6 @@
return name;
}
- public String getDescription() {
- return description;
- }
-
public Set getNotificationTypes() {
return notificationTypes;
}
@@ -90,7 +84,6 @@
public String toString() {
return "[GNotificationInfo:" +
" name=" + name +
- " description=" + description +
" notificationTypes=" + notificationTypes +
"]";
}
1.3 +8 -36
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GOperationInfo.java
Index: GOperationInfo.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/GOperationInfo.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GOperationInfo.java 14 Jan 2004 22:16:37 -0000 1.2
+++ GOperationInfo.java 16 Jan 2004 23:31:21 -0000 1.3
@@ -57,8 +57,8 @@
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
/**
@@ -78,60 +78,32 @@
private final List parameters;
/**
- * A user displayable description of this method.
- */
- private final String description;
-
- /**
* Target method name.
*/
private final String methodName;
public GOperationInfo(String name) {
- this(name, name, Collections.EMPTY_LIST, null);
- }
-
- public GOperationInfo(String name, String[] paramNames, String[]
paramTypes) {
- this(name, name, buildParams(paramNames, paramTypes), null);
+ this(name, name, Collections.EMPTY_LIST);
}
- private static List buildParams(String[] paramNames, String[]
paramTypes) {
- List params = new ArrayList(paramNames.length);
- for (int i = 0; i < paramNames.length; i++) {
- GParameterInfo info = new GParameterInfo(paramNames[i],
paramTypes[i], null);
- params.add(info);
- }
- return params;
+ public GOperationInfo(String name, String[] paramTypes) {
+ this(name, name, Arrays.asList(paramTypes));
}
public GOperationInfo(String name, List parameters) {
- this(name, name, parameters, null);
+ this(name, name, parameters);
}
public GOperationInfo(String name, String methodName, List parameters) {
- this(name, methodName, parameters, null);
- }
-
- public GOperationInfo(String name, String methodName, List parameters,
String description) {
this.name = name;
this.methodName = methodName;
- List p = new ArrayList(parameters.size());
- for (Iterator iterator = parameters.iterator(); iterator.hasNext();)
{
- GParameterInfo parameter = (GParameterInfo) iterator.next();
- p.add(parameter);
- }
- this.parameters = Collections.unmodifiableList(p);
- this.description = description;
+ this.parameters = Collections.unmodifiableList(new
ArrayList(parameters));
}
public String getName() {
return name;
}
- public String getDescription() {
- return description;
- }
-
public String getMethodName() {
return methodName;
}
@@ -141,6 +113,6 @@
}
public String toString() {
- return "[GOperationInfo: name=" + name + " description=" +
description + "]";
+ return "[GOperationInfo: name=" + name + " parameters=" + parameters
+ "]";
}
}
1.1
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/DynamicGAttributeInfo.java
Index: DynamicGAttributeInfo.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.gbean;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/01/16 23:31:21 $
*/
public class DynamicGAttributeInfo extends GAttributeInfo {
public DynamicGAttributeInfo(String name) {
this(name, false, true, true);
}
public DynamicGAttributeInfo(String name, boolean persistent) {
this(name, persistent, true, true);
}
public DynamicGAttributeInfo(String name, boolean persistent, boolean
readable, boolean writable) {
super(name, persistent, new Boolean(readable), new Boolean(writable),
null, null);
}
}
1.1
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/DynamicGBean.java
Index: DynamicGBean.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.gbean;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/01/16 23:31:21 $
*/
public interface DynamicGBean {
Object getAttribute(String name) throws Exception;
void setAttribute(String name, Object value) throws Exception;
Object invoke(String name, Object[] arguments, String[] types) throws
Exception;
}
1.1
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/DynamicGBeanDelegate.java
Index: DynamicGBeanDelegate.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.gbean;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import org.apache.geronimo.kernel.jmx.MBeanOperationSignature;
import net.sf.cglib.reflect.FastClass;
import net.sf.cglib.reflect.FastMethod;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/01/16 23:31:21 $
*/
public class DynamicGBeanDelegate implements DynamicGBean {
protected final Map getters = new HashMap();
protected final Map setters = new HashMap();
protected final Map operations = new HashMap();
public void addAll(Object target) {
Class targetClass = target.getClass();
Method[] methods = targetClass.getMethods();
for (int i = 0; i < methods.length; i++) {
Method method = methods[i];
if (isGetter(method)) {
addGetter(target, method);
} else if (isSetter(method)) {
addSetter(target, method);
} else {
addOperation(target, method);
}
}
}
public void addGetter(Object target, Method method) {
String name = method.getName();
if (name.startsWith("get")) {
addGetter(method.getName().substring(3), target, method);
} else if (name.startsWith("is")) {
addGetter(method.getName().substring(2), target, method);
} else {
throw new IllegalArgumentException("Method method name must start
with 'get' or 'is' " + method);
}
}
public void addGetter(String name, Object target, Method method) {
if (method.getParameterTypes().length == 0 && method.getReturnType()
!= Void.TYPE) {
throw new IllegalArgumentException("Method must take no
parameters and return a value " + method);
}
getters.put(name, new Operation(target, method));
}
public void addSetter(Object target, Method method) {
if (!method.getName().startsWith("set")) {
throw new IllegalArgumentException("Method method name must start
with 'set' " + method);
}
addGetter(method.getName().substring(3), target, method);
}
public void addSetter(String name, Object target, Method method) {
if (method.getParameterTypes().length == 1 && method.getReturnType()
== Void.TYPE) {
throw new IllegalArgumentException("Method must take one
parameter and not return anything " + method);
}
getters.put(method.getName().substring(3), new Operation(target,
method));
}
public void addOperation(Object target, Method method) {
Class[] parameters = method.getParameterTypes();
String[] types = new String[parameters.length];
for (int i = 0; i < parameters.length; i++) {
types[i] = parameters[i].getName();
}
MBeanOperationSignature key = new
MBeanOperationSignature(method.getName(), types);
operations.put(key, new Operation(target, method));
}
private boolean isGetter(Method method) {
String name = method.getName();
return (name.startsWith("get") || name.startsWith("is")) &&
method.getParameterTypes().length == 0
&& method.getReturnType() != Void.TYPE;
}
private boolean isSetter(Method method) {
return method.getName().startsWith("set") &&
method.getParameterTypes().length == 1 &&
method.getReturnType() == Void.TYPE;
}
public Object getAttribute(String name) throws Exception {
Operation operation = (Operation) getters.get(name);
if (operation == null) {
throw new IllegalArgumentException("Unknown attribute " + name);
}
return operation.invoke(null);
}
public void setAttribute(String name, Object value) throws Exception {
Operation operation = (Operation) setters.get(name);
if (operation == null) {
throw new IllegalArgumentException("Unknown attribute " + name);
}
operation.invoke(new Object[] {value});
}
public Object invoke(String name, Object[] arguments, String[] types)
throws Exception {
Operation operation = (Operation) operations.get(new
MBeanOperationSignature(name, types));
if (operation == null) {
throw new IllegalArgumentException("Unknown attribute " + name);
}
return operation.invoke(arguments);
}
protected static class Operation {
private final Object target;
private final FastMethod method;
public Operation(Object target, Method method) {
this.target = target;
this.method =
FastClass.create(target.getClass()).getMethod(method);
}
public Object invoke(Object[] arguments) throws Exception {
try {
return method.invoke(target, arguments);
} catch (InvocationTargetException e) {
Throwable targetException = e.getTargetException();
if (targetException instanceof Exception) {
throw (Exception) targetException;
} else if (targetException instanceof Error) {
throw (Error) targetException;
}
throw e;
}
}
}
}
1.2 +2 -13
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GBeanMBean.java 14 Jan 2004 22:16:38 -0000 1.1
+++ GBeanMBean.java 16 Jan 2004 23:31:21 -0000 1.2
@@ -145,7 +145,6 @@
private final GBeanInfo gbeanInfo;
private final MBeanInfo mbeanInfo;
private final String name;
- private final String description;
private final Class type;
private boolean offline = true;
@@ -162,7 +161,6 @@
}
name = beanInfo.getName();
- description = beanInfo.getDescription();
// attributes
Map constructorTypes =
gbeanInfo.getConstructor().getAttributeTypeMap();
@@ -203,7 +201,7 @@
mbeanInfo = new MBeanInfo(
beanInfo.getClassName(),
- description,
+ null,
mbeanAttrs,
new MBeanConstructorInfo[0],
mbeanOps,
@@ -519,7 +517,6 @@
addAttribute(new GBeanMBeanAttribute(
this,
"state",
- "J2EE Management State",
Integer.TYPE,
new MethodInvoker() {
public Object invoke(Object target, Object[] arguments)
throws Exception {
@@ -531,7 +528,6 @@
addAttribute(new GBeanMBeanAttribute(
this,
"objectName",
- "JMX Object Name",
String.class,
new MethodInvoker() {
public Object invoke(Object target, Object[] arguments)
throws Exception {
@@ -543,7 +539,6 @@
addAttribute(new GBeanMBeanAttribute(
this,
"startTime",
- "Time the MBean started",
Long.TYPE,
new MethodInvoker() {
public Object invoke(Object target, Object[] arguments)
throws Exception {
@@ -555,7 +550,6 @@
addAttribute(new GBeanMBeanAttribute(
this,
"stateManageable",
- "Is this MBean state manageable?",
Boolean.TYPE,
new MethodInvoker() {
public Object invoke(Object target, Object[] arguments)
throws Exception {
@@ -567,7 +561,6 @@
addAttribute(new GBeanMBeanAttribute(
this,
"statisticsProvider",
- "Does this MBean provide statistics?",
Boolean.TYPE,
new MethodInvoker() {
public Object invoke(Object target, Object[] arguments)
throws Exception {
@@ -580,7 +573,6 @@
addAttribute(new GBeanMBeanAttribute(
this,
"eventProvider",
- "Does this MBean provide events?",
Boolean.TYPE,
new MethodInvoker() {
public Object invoke(Object target, Object[] arguments)
throws Exception {
@@ -592,7 +584,6 @@
addOperation(new GBeanMBeanOperation(
this,
"start",
- "Starts the MBean",
Collections.EMPTY_LIST,
Void.TYPE,
new MethodInvoker() {
@@ -605,7 +596,6 @@
addOperation(new GBeanMBeanOperation(
this,
"startRecursive",
- "Starts the MBean and then starts all the dependent MBeans",
Collections.EMPTY_LIST,
Void.TYPE,
new MethodInvoker() {
@@ -618,7 +608,6 @@
addOperation(new GBeanMBeanOperation(
this,
"stop",
- "Stops the MBean",
Collections.EMPTY_LIST,
Void.TYPE,
new MethodInvoker() {
1.3 +113 -83
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBeanAttribute.java
Index: GBeanMBeanAttribute.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBeanAttribute.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GBeanMBeanAttribute.java 16 Jan 2004 19:59:44 -0000 1.2
+++ GBeanMBeanAttribute.java 16 Jan 2004 23:31:21 -0000 1.3
@@ -62,10 +62,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.DynamicGAttributeInfo;
+import org.apache.geronimo.gbean.DynamicGBean;
import org.apache.geronimo.gbean.GAttributeInfo;
import org.apache.geronimo.gbean.InvalidConfigurationException;
-import org.apache.geronimo.gbean.jmx.FastMethodInvoker;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
/**
*
@@ -74,7 +74,7 @@
*/
public class GBeanMBeanAttribute {
private static final Log log =
LogFactory.getLog(GBeanMBeanAttribute.class);
- private final GBeanMBean gMBean;
+ private final GBeanMBean gmbean;
private final String name;
private final Class type;
private final boolean readable;
@@ -87,9 +87,8 @@
private Object persistentValue;
- public GBeanMBeanAttribute(GBeanMBean gMBean, String name, String
description, Class type, MethodInvoker getInvoker, MethodInvoker setInvoker) {
-
- this.gMBean = gMBean;
+ public GBeanMBeanAttribute(GBeanMBean gmbean, String name, Class type,
MethodInvoker getInvoker, MethodInvoker setInvoker) {
+ this.gmbean = gmbean;
this.name = name;
this.type = type;
this.readable = (getInvoker != null);
@@ -98,7 +97,7 @@
this.setInvoker = setInvoker;
this.isConstructorArg = false;
this.persistent = false;
- mbeanAttributeInfo = new MBeanAttributeInfo(name, type.getName(),
description, readable, writable, type == Boolean.TYPE);
+ mbeanAttributeInfo = new MBeanAttributeInfo(name, type.getName(),
null, readable, writable, type == Boolean.TYPE);
}
public GBeanMBeanAttribute(GBeanMBean gMBean, GAttributeInfo
attributeInfo, Class constructorType) throws InvalidConfigurationException {
@@ -109,91 +108,122 @@
" name=" + attributeInfo.getName() +
" targetClass=" + gMBean.getType().getName());
}
- this.gMBean = gMBean;
+ this.gmbean = gMBean;
this.name = attributeInfo.getName();
this.persistent = attributeInfo.isPersistent();
this.isConstructorArg = (constructorType != null);
+ boolean isIs;
// If attribute is persistent or not tagged as unreadable, search
for a getter method
- Method getterMethod = null;
- if (attributeInfo.isPersistent() || attributeInfo.isReadable() !=
Boolean.FALSE) {
- getterMethod = searchForGetter(gMBean, attributeInfo);
- }
- if (getterMethod != null) {
- getInvoker = new FastMethodInvoker(getterMethod);
-
- // this attribute is readable as long as it was not explicitly
tagged as unreadable
- readable = attributeInfo.isReadable() != Boolean.FALSE;
+ if (attributeInfo instanceof DynamicGAttributeInfo) {
+ type = Object.class;
+ readable = attributeInfo.isReadable().booleanValue();
+ if (readable) {
+ getInvoker = new MethodInvoker() {
+ public Object invoke(Object target, Object[] arguments)
throws Exception {
+ DynamicGBean dynamicGBean = (DynamicGBean)
GBeanMBeanAttribute.this.gmbean.getTarget();
+ return dynamicGBean.getAttribute(name);
+ }
+ };
+ } else {
+ getInvoker = null;
+ }
+ writable = attributeInfo.isWritable().booleanValue();
+ if (writable) {
+ setInvoker = new MethodInvoker() {
+ public Object invoke(Object target, Object[] arguments)
throws Exception {
+ DynamicGBean dynamicGBean = (DynamicGBean)
GBeanMBeanAttribute.this.gmbean.getTarget();
+ dynamicGBean.setAttribute(name, arguments[0]);
+ return null;
+ }
+ };
+ } else {
+ setInvoker = null;
+ }
+ isIs = false;
} else {
- getInvoker = null;
- readable = false;
- }
+ Method getterMethod = null;
+ if (attributeInfo.isPersistent() || attributeInfo.isReadable()
!= Boolean.FALSE) {
+ getterMethod = searchForGetter(gMBean, attributeInfo);
+ }
+ if (getterMethod != null) {
+ getInvoker = new FastMethodInvoker(getterMethod);
- // If attribute is persistent or not tagged as unwritable, search
for a setter method
- Method setterMethod = null;
- if (attributeInfo.isPersistent() || attributeInfo.isWritable() !=
Boolean.FALSE) {
- setterMethod = searchForSetter(gMBean, attributeInfo);
- }
- if (setterMethod != null) {
- setInvoker = new FastMethodInvoker(setterMethod);
+ // this attribute is readable as long as it was not
explicitly tagged as unreadable
+ readable = attributeInfo.isReadable() != Boolean.FALSE;
+ } else {
+ getInvoker = null;
+ readable = false;
+ }
- // this attribute is writable as long as it was not explicitly
tagged as unwritable
- writable = attributeInfo.isWritable() != Boolean.FALSE;
- } else {
- setInvoker = null;
- writable = false;
- }
+ // If attribute is persistent or not tagged as unwritable,
search for a setter method
+ Method setterMethod = null;
+ if (attributeInfo.isPersistent() || attributeInfo.isWritable()
!= Boolean.FALSE) {
+ setterMethod = searchForSetter(gMBean, attributeInfo);
+ }
+ if (setterMethod != null) {
+ setInvoker = new FastMethodInvoker(setterMethod);
- // getter and setter types are consistent
- if (getInvoker != null && setInvoker != null &&
- getterMethod.getReturnType() !=
setterMethod.getParameterTypes()[0]) {
- throw new InvalidConfigurationException("Getter and setter
methods do not have the same types:" +
- " name=" + attributeInfo.getName() +
- " geterMethod=" + getterMethod.getName() +
- " seterMethod=" + setterMethod.getName() +
- " targetClass=" + gMBean.getType().getName());
- }
+ // this attribute is writable as long as it was not
explicitly tagged as unwritable
+ writable = attributeInfo.isWritable() != Boolean.FALSE;
+ isIs = setterMethod.getName().startsWith("is");
+ } else {
+ setInvoker = null;
+ writable = false;
+ isIs = false;
+ }
- // getter and constructor types are consistent
- if (constructorType != null && getterMethod != null &&
- constructorType != getterMethod.getReturnType()) {
- throw new InvalidConfigurationException("Constructor argument
and getter method do not have the same type:" +
- " name=" + attributeInfo.getName() +
- " constructorType=" + constructorType.getName() +
- " getterMethod=" + getterMethod.getName() +
- " targetClass=" + gMBean.getType().getName());
- }
+ // getter and setter types are consistent
+ if (getInvoker != null && setInvoker != null &&
+ getterMethod.getReturnType() !=
setterMethod.getParameterTypes()[0]) {
+ throw new InvalidConfigurationException("Getter and setter
methods do not have the same types:" +
+ " name=" + attributeInfo.getName() +
+ " geterMethod=" + getterMethod.getName() +
+ " seterMethod=" + setterMethod.getName() +
+ " targetClass=" + gMBean.getType().getName());
+ }
- // setter and constructor types are consistent
- if (constructorType != null && setterMethod != null &&
- constructorType != setterMethod.getParameterTypes()[0]) {
- throw new InvalidConfigurationException("Constructor argument
and setter method do not have the same type:" +
- " name=" + attributeInfo.getName() +
- " constructorType=" + constructorType.getName() +
- " setterMethod=" + setterMethod.getName() +
- " targetClass=" + gMBean.getType().getName());
- }
+ // getter and constructor types are consistent
+ if (constructorType != null && getterMethod != null &&
+ constructorType != getterMethod.getReturnType()) {
+ throw new InvalidConfigurationException("Constructor
argument and getter method do not have the same type:" +
+ " name=" + attributeInfo.getName() +
+ " constructorType=" + constructorType.getName() +
+ " getterMethod=" + getterMethod.getName() +
+ " targetClass=" + gMBean.getType().getName());
+ }
- // set the attribute type
- if (constructorType != null) {
- type = constructorType;
- } else if (getterMethod != null) {
- type = getterMethod.getReturnType();
- } else if (setterMethod != null) {
- type = setterMethod.getParameterTypes()[0];
- } else {
- // neither getter/setter/or constructor argument
- type = null;
+ // setter and constructor types are consistent
+ if (constructorType != null && setterMethod != null &&
+ constructorType != setterMethod.getParameterTypes()[0]) {
+ throw new InvalidConfigurationException("Constructor
argument and setter method do not have the same type:" +
+ " name=" + attributeInfo.getName() +
+ " constructorType=" + constructorType.getName() +
+ " setterMethod=" + setterMethod.getName() +
+ " targetClass=" + gMBean.getType().getName());
+ }
+
+ // set the attribute type
+ if (constructorType != null) {
+ type = constructorType;
+ } else if (getterMethod != null) {
+ type = getterMethod.getReturnType();
+ } else if (setterMethod != null) {
+ type = setterMethod.getParameterTypes()[0];
+ } else {
+ // neither getter/setter/or constructor argument
+ type = Object.class;
+ }
}
mbeanAttributeInfo = new MBeanAttributeInfo(
attributeInfo.getName(),
type.getName(),
- attributeInfo.getDescription(),
+ null,
readable,
writable,
- writable ? setterMethod.getName().startsWith("is") : false);
+ isIs);
}
public String getName() {
@@ -224,8 +254,8 @@
if (persistent && !isConstructorArg && setInvoker != null) {
ClassLoader oldClassLoader =
Thread.currentThread().getContextClassLoader();
try {
-
Thread.currentThread().setContextClassLoader(gMBean.getClassLoader());
- setInvoker.invoke(gMBean.getTarget(), new
Object[]{persistentValue});
+
Thread.currentThread().setContextClassLoader(gmbean.getClassLoader());
+ setInvoker.invoke(gmbean.getTarget(), new
Object[]{persistentValue});
} catch (Throwable throwable) {
throw new ReflectionException(new
InvocationTargetException(throwable));
} finally {
@@ -238,8 +268,8 @@
if (persistent && getInvoker != null) {
ClassLoader oldClassLoader =
Thread.currentThread().getContextClassLoader();
try {
-
Thread.currentThread().setContextClassLoader(gMBean.getClassLoader());
- persistentValue = getInvoker.invoke(gMBean.getTarget(),
null);
+
Thread.currentThread().setContextClassLoader(gmbean.getClassLoader());
+ persistentValue = getInvoker.invoke(gmbean.getTarget(),
null);
} catch (Throwable throwable) {
log.error("Could not get the current value of persistent
attribute while going offline. The " +
"persistent attribute will not reflect the current
state attribute: name=" + name, throwable);
@@ -250,7 +280,7 @@
}
public Object getValue() throws ReflectionException {
- if (gMBean.isOffline()) {
+ if (gmbean.isOffline()) {
if (persistent) {
return persistentValue;
} else {
@@ -266,8 +296,8 @@
}
ClassLoader oldClassLoader =
Thread.currentThread().getContextClassLoader();
try {
-
Thread.currentThread().setContextClassLoader(gMBean.getClassLoader());
- Object value = getInvoker.invoke(gMBean.getTarget(), null);
+
Thread.currentThread().setContextClassLoader(gmbean.getClassLoader());
+ Object value = getInvoker.invoke(gmbean.getTarget(), null);
return value;
} catch (Throwable throwable) {
throw new ReflectionException(new
InvocationTargetException(throwable));
@@ -278,7 +308,7 @@
}
public void setValue(Object value) throws ReflectionException {
- if (gMBean.isOffline()) {
+ if (gmbean.isOffline()) {
if (persistent) {
this.persistentValue = value;
} else {
@@ -294,8 +324,8 @@
}
ClassLoader oldClassLoader =
Thread.currentThread().getContextClassLoader();
try {
-
Thread.currentThread().setContextClassLoader(gMBean.getClassLoader());
- setInvoker.invoke(gMBean.getTarget(), new Object[]{value});
+
Thread.currentThread().setContextClassLoader(gmbean.getClassLoader());
+ setInvoker.invoke(gmbean.getTarget(), new Object[]{value});
} catch (Throwable throwable) {
throw new ReflectionException(new
InvocationTargetException(throwable));
} finally {
1.2 +19 -26
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GBeanMBeanOperation.java 14 Jan 2004 22:16:38 -0000 1.1
+++ GBeanMBeanOperation.java 16 Jan 2004 23:31:21 -0000 1.2
@@ -57,20 +57,16 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
+import java.util.ArrayList;
import javax.management.MBeanException;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanParameterInfo;
import javax.management.ReflectionException;
import org.apache.geronimo.gbean.GOperationInfo;
-import org.apache.geronimo.gbean.GParameterInfo;
import org.apache.geronimo.gbean.InvalidConfigurationException;
-import org.apache.geronimo.gbean.jmx.FastMethodInvoker;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
/**
*
@@ -84,24 +80,23 @@
private final MBeanOperationInfo mbeanOperationInfo;
private final MethodInvoker methodInvoker;
- public GBeanMBeanOperation(GBeanMBean gMBean, String name, String
description, List parameterTypes, Class returnType, MethodInvoker
methodInvoker) {
+ public GBeanMBeanOperation(GBeanMBean gMBean, String name, List
parameterTypes, Class returnType, MethodInvoker methodInvoker) {
this.gMBean = gMBean;
this.name = name;
- this.parameterTypes = parameterTypes;
+ this.parameterTypes = Collections.unmodifiableList(new
ArrayList(parameterTypes));
this.methodInvoker = methodInvoker;
MBeanParameterInfo[] signature = new
MBeanParameterInfo[parameterTypes.size()];
for (int i = 0; i < signature.length; i++) {
- Class parameterType = (Class) parameterTypes.get(i);
signature[i] = new MBeanParameterInfo(
"arg" + i,
- parameterType.getName(),
+ (String) parameterTypes.get(i),
null);
}
mbeanOperationInfo = new MBeanOperationInfo(
name,
- description,
+ null,
signature,
returnType.getName(),
MBeanOperationInfo.UNKNOWN
@@ -112,26 +107,25 @@
public GBeanMBeanOperation(GBeanMBean gMBean, GOperationInfo
operationInfo) throws InvalidConfigurationException {
this.gMBean = gMBean;
this.name = operationInfo.getName();
- ClassLoader classLoader = gMBean.getClassLoader();
// get an array of the parameter classes
- List parameterList = operationInfo.getParameterList();
- parameterTypes = new ArrayList(parameterList.size());
- for (Iterator iterator = parameterList.iterator();
iterator.hasNext();) {
- GParameterInfo parameterInfo = (GParameterInfo) iterator.next();
+ this.parameterTypes = Collections.unmodifiableList(new
ArrayList(operationInfo.getParameterList()));
+ Class[] types = new Class[parameterTypes.size()];
+ ClassLoader classLoader = gMBean.getClassLoader();
+ for (int i = 0; i < types.length; i++) {
+ String type = (String) parameterTypes.get(i);
try {
-
parameterTypes.add(classLoader.loadClass(parameterInfo.getType()));
+ types[i] =
classLoader.loadClass((String)parameterTypes.get(i));
} catch (ClassNotFoundException e) {
throw new InvalidConfigurationException("Could not load
operation parameter class:" +
" name=" + operationInfo.getName() +
- " class=" + parameterInfo.getType());
+ " class=" + type);
}
}
// get a method invoker for the operation
Class returnType;
try {
- Class[] types = (Class[]) parameterTypes.toArray(new
Class[parameterTypes.size()]);
Method javaMethod =
gMBean.getType().getMethod(operationInfo.getMethodName(), types);
returnType = javaMethod.getReturnType();
methodInvoker = new FastMethodInvoker(javaMethod);
@@ -142,18 +136,17 @@
" targetClass=" + gMBean.getType().getName());
}
- MBeanParameterInfo[] signature = new
MBeanParameterInfo[parameterList.size()];
+ MBeanParameterInfo[] signature = new
MBeanParameterInfo[parameterTypes.size()];
for (int i = 0; i < signature.length; i++) {
- GParameterInfo parameterInfo = (GParameterInfo)
parameterList.get(i);
signature[i] = new MBeanParameterInfo(
- parameterInfo.getName(),
- parameterInfo.getType(),
- parameterInfo.getDescription());
+ "arg" + i,
+ (String) parameterTypes.get(i),
+ null);
}
mbeanOperationInfo = new MBeanOperationInfo(
operationInfo.getName(),
- operationInfo.getDescription(),
+ null,
signature,
returnType.getName(),
MBeanOperationInfo.UNKNOWN
@@ -165,7 +158,7 @@
}
public List getParameterTypes() {
- return Collections.unmodifiableList(parameterTypes);
+ return parameterTypes;
}
public MBeanOperationInfo getMbeanOperationInfo() {
1.3 +7 -13
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/MBeanOperationSignature.java
Index: MBeanOperationSignature.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/MBeanOperationSignature.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MBeanOperationSignature.java 4 Jan 2004 23:42:58 -0000 1.2
+++ MBeanOperationSignature.java 16 Jan 2004 23:31:21 -0000 1.3
@@ -102,16 +102,7 @@
if (argumentTypes != null) {
this.argumentTypes = new String[argumentTypes.size()];
for (int i = 0; i < argumentTypes.size(); i++) {
- Object type = argumentTypes.get(i);
- if(type instanceof String) {
- this.argumentTypes[i] = (String) type;
- } else if (type instanceof Class) {
- this.argumentTypes[i] = ((Class)type).getName();
- } else {
- throw new IllegalArgumentException("Parameter is not
instance of String or Class:" +
- " index=" + i +
- " value=" + type);
- }
+ this.argumentTypes[i] = (String) argumentTypes.get(i);
}
} else {
this.argumentTypes = NO_TYPES;
@@ -154,10 +145,13 @@
}
public String toString() {
- StringBuffer buffer = new StringBuffer(name);
+ StringBuffer buffer = new StringBuffer(name).append("(");
for (int i = 0; i < argumentTypes.length; i++) {
+ if(i > 0) {
+ buffer.append(", ");
+ }
buffer.append(argumentTypes[i]);
}
- return buffer.toString();
+ return buffer.append(")").toString();
}
}
1.4 +4 -4
incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java
Index: MockGBean.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MockGBean.java 15 Jan 2004 00:45:55 -0000 1.3
+++ MockGBean.java 16 Jan 2004 23:31:21 -0000 1.4
@@ -81,12 +81,12 @@
}
static {
- GBeanInfoFactory infoFactory = new GBeanInfoFactory("MockGBean",
"test description", MockGBean.class.getName());
+ GBeanInfoFactory infoFactory = new GBeanInfoFactory("MockGBean",
MockGBean.class.getName());
infoFactory.addAttribute(new GAttributeInfo("Name", true));
infoFactory.addAttribute(new GAttributeInfo("Value", true));
- infoFactory.addOperation(new GOperationInfo("checkResource", new
String[]{"name"}, new String[]{"java.lang.String"}));
+ infoFactory.addOperation(new GOperationInfo("checkResource", new
String[]{"java.lang.String"}));
infoFactory.addOperation(new GOperationInfo("checkEndpoint"));
- infoFactory.addOperation(new GOperationInfo("doSomething", new
String[]{"name"}, new String[]{"java.lang.String"}));
+ infoFactory.addOperation(new GOperationInfo("doSomething", new
String[]{"java.lang.String"}));
infoFactory.addEndpoint(new GEndpointInfo("MockEndpoint",
MockEndpoint.class.getName()));
infoFactory.setConstructor(new
GConstructorInfo(Collections.singletonList("Name"),
Collections.singletonList(String.class)));
GBEAN_INFO = infoFactory.getBeanInfo();
1.5 +11 -11
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebAccessLog.java
Index: AbstractWebAccessLog.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebAccessLog.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractWebAccessLog.java 16 Jan 2004 23:10:14 -0000 1.4
+++ AbstractWebAccessLog.java 16 Jan 2004 23:31:21 -0000 1.5
@@ -297,16 +297,16 @@
static {
GBeanInfoFactory infoFactory = new
GBeanInfoFactory(AbstractWebAccessLog.class.getName());
- infoFactory.addAttribute(new
GAttributeInfo("LogImplementationClass", true, "class of log implementation. I
think this is speculative"));
- infoFactory.addAttribute(new GAttributeInfo("LogLocation", true,
"URI indicating where to put the log"));
- infoFactory.addAttribute(new GAttributeInfo("LogPattern", true,
"NCSA log pattern spec"));
- infoFactory.addAttribute(new GAttributeInfo("LogRetentionDays",
true, "Number of days to retain logs"));
- infoFactory.addAttribute(new
GAttributeInfo("LogRolloverIntervalHrs", true, "Hours between log rollovers"));
- infoFactory.addAttribute(new GAttributeInfo("LogPrefix", true, "file
name prefix for log files"));
- infoFactory.addAttribute(new GAttributeInfo("LogSuffix", true, "file
name suffix for log files"));
- infoFactory.addAttribute(new GAttributeInfo("LogDateFormat", true,
"Date format to use in logs, following java.text.DateFormat (??)"));
- infoFactory.addAttribute(new GAttributeInfo("ResolveHostNames",
true, "Should host names be resolved"));
- infoFactory.addAttribute(new GAttributeInfo("Append", true, "Should
logs be appended or overwritten (? rolled over)"));
+ infoFactory.addAttribute(new
GAttributeInfo("LogImplementationClass", true));
+ infoFactory.addAttribute(new GAttributeInfo("LogLocation", true));
+ infoFactory.addAttribute(new GAttributeInfo("LogPattern", true));
+ infoFactory.addAttribute(new GAttributeInfo("LogRetentionDays",
true));
+ infoFactory.addAttribute(new
GAttributeInfo("LogRolloverIntervalHrs", true));
+ infoFactory.addAttribute(new GAttributeInfo("LogPrefix", true));
+ infoFactory.addAttribute(new GAttributeInfo("LogSuffix", true));
+ infoFactory.addAttribute(new GAttributeInfo("LogDateFormat", true));
+ infoFactory.addAttribute(new GAttributeInfo("ResolveHostNames",
true));
+ infoFactory.addAttribute(new GAttributeInfo("Append", true));
infoFactory.setConstructor(new GConstructorInfo(
Arrays.asList(new Object[] {"LogImplementationClass",
"LogLocation", "LogPattern", "LogRetentionDays", "LogRolloverIntervalHrs",
"LogPrefix",
"LogSuffix", "LogDateFormat", "ResolveHostNames", "Append"}),
1.15 +9 -9
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebApplication.java
Index: AbstractWebApplication.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebApplication.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- AbstractWebApplication.java 16 Jan 2004 23:10:14 -0000 1.14
+++ AbstractWebApplication.java 16 Jan 2004 23:31:21 -0000 1.15
@@ -282,14 +282,14 @@
static {
GBeanInfoFactory infoFactory = new
GBeanInfoFactory(AbstractWebApplication.class.getName());
- infoFactory.addAttribute(new GAttributeInfo("URI", true, "URI of
this web application", Boolean.TRUE, Boolean.FALSE));
- infoFactory.addAttribute(new GAttributeInfo("ParentClassLoader",
true, "Parent ClassLoader for this web application", Boolean.TRUE,
Boolean.FALSE));
- infoFactory.addAttribute(new GAttributeInfo("ContextPath", true,
"Context path for this web application", Boolean.TRUE, Boolean.FALSE));
- infoFactory.addAttribute(new GAttributeInfo("DeploymentDescriptor",
true, "Deployment descriptor of this web application as a String",
Boolean.TRUE, Boolean.FALSE));
- infoFactory.addAttribute(new GAttributeInfo("GeronimoWebAppDoc",
true, "Geronimo deployment descriptor of this web application as a POJO",
Boolean.TRUE, Boolean.FALSE));
- infoFactory.addAttribute(new
GAttributeInfo("Java2ClassloadingCompliance", true, "Does this web application
follow Java2 class loading semantics or the servlet spec", Boolean.TRUE,
Boolean.FALSE));
- infoFactory.addAttribute(new GAttributeInfo("ComponentContext",
true, "Read only jndi context for this web application", Boolean.TRUE,
Boolean.FALSE));
- infoFactory.addAttribute(new GAttributeInfo("Servlets", false,
"Array of servlet names in this web application", Boolean.TRUE, Boolean.FALSE));
+ infoFactory.addAttribute(new GAttributeInfo("URI", true));
+ infoFactory.addAttribute(new GAttributeInfo("ParentClassLoader",
true));
+ infoFactory.addAttribute(new GAttributeInfo("ContextPath", true));
+ infoFactory.addAttribute(new GAttributeInfo("DeploymentDescriptor",
true));
+ infoFactory.addAttribute(new GAttributeInfo("GeronimoWebAppDoc",
true));
+ infoFactory.addAttribute(new
GAttributeInfo("Java2ClassloadingCompliance", true));
+ infoFactory.addAttribute(new GAttributeInfo("ComponentContext",
true));
+ infoFactory.addAttribute(new GAttributeInfo("Servlets", false));
infoFactory.addEndpoint(new GEndpointInfo("TransactionManager",
TransactionManager.class.getName()));
infoFactory.addEndpoint(new
GEndpointInfo("TrackedConnectionAssociator",
TrackedConnectionAssociator.class.getName()));
infoFactory.setConstructor(new GConstructorInfo(
1.8 +7 -7
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebConnector.java
Index: AbstractWebConnector.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebConnector.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AbstractWebConnector.java 16 Jan 2004 23:00:19 -0000 1.7
+++ AbstractWebConnector.java 16 Jan 2004 23:31:21 -0000 1.8
@@ -148,12 +148,12 @@
static {
GBeanInfoFactory infoFactory = new
GBeanInfoFactory(AbstractWebConnector.class.getName());
- infoFactory.addAttribute(new GAttributeInfo("Port", true, "port to
listen on"));
- infoFactory.addAttribute(new GAttributeInfo("Protocol", true,
"Protocol (hhtp, https, ftp etc) to use"));
- infoFactory.addAttribute(new GAttributeInfo("Interface", true,
"Interface to listen on"));
- infoFactory.addAttribute(new GAttributeInfo("MaxConnections", true,
"Maximum number of connections"));
- infoFactory.addAttribute(new GAttributeInfo("MaxIdleTime", true,
"Maximum idle time (ms??) a connection can be idle before being closed"));
- infoFactory.addAttribute(new GAttributeInfo("Contexts", true,
"Contexts that must be registered in the web container before this connector
will start accepting connections"));
+ infoFactory.addAttribute(new GAttributeInfo("Port", true));
+ infoFactory.addAttribute(new GAttributeInfo("Protocol", true));
+ infoFactory.addAttribute(new GAttributeInfo("Interface", true));
+ infoFactory.addAttribute(new GAttributeInfo("MaxConnections", true));
+ infoFactory.addAttribute(new GAttributeInfo("MaxIdleTime", true));
+ infoFactory.addAttribute(new GAttributeInfo("Contexts", true));
infoFactory.setConstructor(new GConstructorInfo(
Arrays.asList(new Object[] {"Protocol", "Interface", "Port",
"MaxConnections", "MaxIdleTime", "Contexts"}),
Arrays.asList(new Object[] {String.class, String.class,
Integer.TYPE, Integer.TYPE, Integer.TYPE, String[].class})
1.28 +3 -3
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebContainer.java
Index: AbstractWebContainer.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebContainer.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- AbstractWebContainer.java 16 Jan 2004 02:19:23 -0000 1.27
+++ AbstractWebContainer.java 16 Jan 2004 23:31:21 -0000 1.28
@@ -294,8 +294,8 @@
static {
GBeanInfoFactory infoFactory = new
GBeanInfoFactory(AbstractWebContainer.class.getName());
- infoFactory.addAttribute(new GAttributeInfo("DefaultWebXmlURI",
true, "Location of web.xml defaults"));
- infoFactory.addAttribute(new GAttributeInfo("DefaultWebXmlDoc",
true, "Parsed web defaults xml document"));
+ infoFactory.addAttribute(new GAttributeInfo("DefaultWebXmlURI",
true));
+ infoFactory.addAttribute(new GAttributeInfo("DefaultWebXmlDoc",
true));
infoFactory.setConstructor(new GConstructorInfo(Arrays.asList(new
Object[] {"DefaultWebXmlURI", "DefaultWebXmlDoc"}),
Arrays.asList(new Object[] {URI.class, Document.class})));
GBEAN_INFO = infoFactory.getBeanInfo();
1.5 +5 -5
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebAccessLog.java
Index: JettyWebAccessLog.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebAccessLog.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JettyWebAccessLog.java 16 Jan 2004 23:10:14 -0000 1.4
+++ JettyWebAccessLog.java 16 Jan 2004 23:31:21 -0000 1.5
@@ -256,10 +256,10 @@
}
static {
- GBeanInfoFactory infoFactory = new GBeanInfoFactory("Jetty Web
Access Log", "Wrapped Jetty access log", JettyWebAccessLog.class.getName(),
AbstractWebAccessLog.getGBeanInfo());
- infoFactory.addAttribute(new GAttributeInfo("Buffering", true,
"Should log buffer"));
- infoFactory.addOperation(new GOperationInfo("registerLog", new
String[]{"Jetty Server"}, new String[]{Server.class.getName()}));
- infoFactory.addOperation(new GOperationInfo("unregisterLog", new
String[]{"Jetty Server"}, new String[]{Server.class.getName()}));
+ GBeanInfoFactory infoFactory = new GBeanInfoFactory("Jetty Web
Access Log", JettyWebAccessLog.class.getName(),
AbstractWebAccessLog.getGBeanInfo());
+ infoFactory.addAttribute(new GAttributeInfo("Buffering", true));
+ infoFactory.addOperation(new GOperationInfo("registerLog", new
String[]{Server.class.getName()}));
+ infoFactory.addOperation(new GOperationInfo("unregisterLog", new
String[]{Server.class.getName()}));
infoFactory.setConstructor(new GConstructorInfo(
Arrays.asList(new Object[]{"LogImplementationClass",
"LogLocation", "LogPattern",
"LogRetentionDays",
"LogRolloverIntervalHrs", "LogPrefix",
1.12 +2 -2
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebApplication.java
Index: JettyWebApplication.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebApplication.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- JettyWebApplication.java 16 Jan 2004 23:10:14 -0000 1.11
+++ JettyWebApplication.java 16 Jan 2004 23:31:21 -0000 1.12
@@ -131,7 +131,7 @@
}
static {
- GBeanInfoFactory infoFactory = new GBeanInfoFactory("Jetty Web
Application", "Wrapped Jetty application", JettyWebApplication.class.getName(),
AbstractWebApplication.getGBeanInfo());
+ GBeanInfoFactory infoFactory = new GBeanInfoFactory("Jetty Web
Application", JettyWebApplication.class.getName(),
AbstractWebApplication.getGBeanInfo());
infoFactory.addOperation(new GOperationInfo("getJettyContext",
Collections.EMPTY_LIST));
GBEAN_INFO = infoFactory.getBeanInfo();
}
1.9 +2 -2
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebConnector.java
Index: JettyWebConnector.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebConnector.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- JettyWebConnector.java 16 Jan 2004 23:00:19 -0000 1.8
+++ JettyWebConnector.java 16 Jan 2004 23:31:21 -0000 1.9
@@ -242,7 +242,7 @@
}
static {
- GBeanInfoFactory infoFactory = new GBeanInfoFactory("Jetty Web
Connector", "Wrapped Jetty listener", JettyWebConnector.class.getName(),
AbstractWebConnector.getGBeanInfo());
+ GBeanInfoFactory infoFactory = new GBeanInfoFactory("Jetty Web
Connector", JettyWebConnector.class.getName(),
AbstractWebConnector.getGBeanInfo());
infoFactory.addOperation(new GOperationInfo("getListener",
Collections.EMPTY_LIST));
GBEAN_INFO = infoFactory.getBeanInfo();
}
1.13 +2 -2
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebContainer.java
Index: JettyWebContainer.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebContainer.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- JettyWebContainer.java 16 Jan 2004 23:00:19 -0000 1.12
+++ JettyWebContainer.java 16 Jan 2004 23:31:21 -0000 1.13
@@ -219,7 +219,7 @@
}
static {
- GBeanInfoFactory infoFactory = new GBeanInfoFactory("Jetty Web
Container", "Geronimo integrated Jetty Server",
JettyWebContainer.class.getName(), AbstractWebContainer.getGBeanInfo());
+ GBeanInfoFactory infoFactory = new GBeanInfoFactory("Jetty Web
Container", JettyWebContainer.class.getName(),
AbstractWebContainer.getGBeanInfo());
infoFactory.addEndpoint(new GEndpointInfo("WebApplications",
JettyWebApplication.class.getName()));
infoFactory.addEndpoint(new GEndpointInfo("WebConnectors",
JettyWebConnector.class.getName()));
infoFactory.addEndpoint(new GEndpointInfo("WebAccessLogs",
JettyWebAccessLog.class.getName()));