costin 2002/11/12 22:27:22
Modified: modeler/src/java/org/apache/commons/modeler
BaseModelMBean.java
modeler/src/java/org/apache/commons/modeler/ant JmxSet.java
Log:
Other fixes to get it to run.
Revision Changes Path
1.8 +6 -1
jakarta-commons/modeler/src/java/org/apache/commons/modeler/BaseModelMBean.java
Index: BaseModelMBean.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/BaseModelMBean.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- BaseModelMBean.java 12 Nov 2002 22:48:40 -0000 1.7
+++ BaseModelMBean.java 13 Nov 2002 06:27:22 -0000 1.8
@@ -520,7 +520,9 @@
try {
// XXX Is it before or after ?
- Object oldValue=getAttribute( name );
+ Object oldValue=null;
+ if( getAttMap.get(name) != null )
+ oldValue=getAttribute( name );
sendAttributeChangeNotification(new Attribute( name, oldValue),
attribute);
} catch( Exception ex ) {
@@ -535,14 +537,17 @@
ModelMBeanAttributeInfo attrInfo = info.getAttribute(name);
if (attrInfo == null)
throw new AttributeNotFoundException("Cannot find attribute " +
name);
+
Descriptor attrDesc = attrInfo.getDescriptor();
if (attrDesc == null)
throw new AttributeNotFoundException("Cannot find attribute " +
name + " descriptor");
+
String setMethod = (String) attrDesc.getFieldValue("setMethod");
if (setMethod == null)
throw new AttributeNotFoundException("Cannot find attribute " +
name + " set method name");
String argType=attrInfo.getType();
+
Class signature[] = new Class[] { getAttributeClass( argType ) };
Object object = null;
1.2 +10 -1
jakarta-commons/modeler/src/java/org/apache/commons/modeler/ant/JmxSet.java
Index: JmxSet.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/ant/JmxSet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JmxSet.java 12 Nov 2002 22:46:09 -0000 1.1
+++ JmxSet.java 13 Nov 2002 06:27:22 -0000 1.2
@@ -55,6 +55,9 @@
package org.apache.commons.modeler.ant;
import org.apache.tools.ant.*;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
import javax.management.*;
import javax.management.MBeanServer;
import javax.management.ObjectName;
@@ -64,6 +67,8 @@
*
*/
public class JmxSet extends Task {
+ private static Log log = LogFactory.getLog(JmxSet.class);
+
String attribute;
String value;
String valueRef;
@@ -73,7 +78,6 @@
public JmxSet() {
-
}
public void setAttribute(String attribute) {
@@ -125,12 +129,17 @@
if( type==null) {// string is default
objValue=value;
} else if( "ObjectName".equals( type )) {
+ if( log.isTraceEnabled())
+ log.trace("Convert to ObjectName " + value);
objValue=new ObjectName( value );
} else if( "int".equals( type )) {
objValue=new Integer( value );
}
}
+ if( log.isDebugEnabled())
+ log.debug("Setting " + oname + " " + attribute + " " +
+ objValue );
server.setAttribute(oname, new Attribute(attribute, objValue));
} catch(Exception ex) {
--
To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@;jakarta.apache.org>