User: chirino
Date: 01/08/31 20:51:05
Modified: src/main/org/jboss/system ServiceConfigurator.java
Log:
Added suppport for org.w3c.dom.Element type mbean attributes.
The first child Element of the <attribute ...> is used
to set the value of the attribute.
Revision Changes Path
1.2 +31 -8 jboss/src/main/org/jboss/system/ServiceConfigurator.java
Index: ServiceConfigurator.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/system/ServiceConfigurator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServiceConfigurator.java 2001/08/29 23:08:21 1.1
+++ ServiceConfigurator.java 2001/09/01 03:51:05 1.2
@@ -42,13 +42,20 @@
*
*
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>`
-* @version $Revision: 1.1 $
+* @author <a href="mailto:[EMAIL PROTECTED]">Hiram Chirino</a>`
+* @version $Revision: 1.2 $
*
* <p><b>20010830 marc fleury:</b>
* <ul>
* initial import
* <li>
* </ul>
+* <p><b>20010831 hiram chirino:</b>
+* <ul>
+* <li> Added suppport for org.w3c.dom.Element type mbean attributes.
+* The first child Element of the <attribute ...> is used
+* to set the value of the attribute.
+* </ul>
*/
public class ServiceConfigurator
@@ -183,11 +190,30 @@
typeClass =
(Class)primitives.get(typeName);
} else {
typeClass =
Class.forName(typeName);
+ }
+
+ Object value = null;
+
+ // HRC: Is the attribute type a
org.w3c.dom.Element??
+ if( typeClass.equals(Element.class) )
{
+ // Then we can pass the first
child Element of this
+ // attributeElement
+ NodeList nl =
attributeElement.getChildNodes();
+ for(int i=0; i <
nl.getLength(); i++) {
+ org.w3c.dom.Node n =
nl.item(i);
+ if( n.getNodeType() ==
n.ELEMENT_NODE ) {
+ value =
(Element)n;
+ break;
+ }
+ }
}
- PropertyEditor editor =
PropertyEditorManager.findEditor(typeClass);
- editor.setAsText(attributeValue);
- Object value = editor.getValue();
+ if( value == null ) {
+ PropertyEditor editor =
PropertyEditorManager.findEditor(typeClass);
+
editor.setAsText(attributeValue);
+ value = editor.getValue();
+ }
+
log.debug(attributeName + " set to " +
attributeValue + " in " + objectName);
server.setAttribute(objectName, new
Attribute(attributeName, value));
@@ -290,7 +316,4 @@
return false;
}
-}
-
-
-
+}
\ No newline at end of file
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development