From: David J. <d_j...@us...> - 2002-04-27 04:15:55
|
User: d_jencks Date: 02/04/26 21:15:53 Modified: src/main/org/jboss/resource/connectionmanager RARDeployment.java Log: Added shorter property syntax Revision Changes Path 1.5 +23 -27 jbosscx/src/main/org/jboss/resource/connectionmanager/RARDeployment.java Index: RARDeployment.java =================================================================== RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/connectionmanager/RARDeployment.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- RARDeployment.java 23 Apr 2002 04:44:59 -0000 1.4 +++ RARDeployment.java 27 Apr 2002 04:15:53 -0000 1.5 @@ -392,6 +392,8 @@ * properties tag. * It should be supplied by xslt from ra.xml merged with an user * configuration xml file. + * An alternative format has a config-property element with attributes for + * name and type and the value as content. * * @return the ManagedConnectionFactoryProperties value. * @jmx:managed-attribute @@ -717,10 +719,27 @@ Element prop = (Element)props.item(i); if (prop.getTagName().equals("config-property")) { - String name = MetaData.getElementContent(MetaData.getUniqueChild(prop, "config-property-name")); - String type = MetaData.getElementContent(MetaData.getUniqueChild(prop, "config-property-type")); - String value = MetaData.getElementContent(MetaData.getUniqueChild(prop, "config-property-value")); - if (value == null) + String name = null; + String type = null; + String value = null; + //Support for more friendly config style + //<config-property name="" type=""></config-property> + if (prop.hasAttribute("name")) + { + name = prop.getAttribute("name"); + type = prop.getAttribute("type"); + value = MetaData.getElementContent(prop); + } // end of if () + else + { + name = MetaData.getElementContent( + MetaData.getUniqueChild(prop, "config-property-name")); + type = MetaData.getElementContent( + MetaData.getUniqueChild(prop, "config-property-type")); + value = MetaData.getElementContent( + MetaData.getUniqueChild(prop, "config-property-value")); + } // end of else + if (name == null || type == null || value == null) { log.warn("Not setting config property '" + name + "'"); continue; @@ -761,29 +780,6 @@ } Object v = pe.getValue(); setManagedConnectionFactoryAttribute(name, clazz, v); - /* - try - { - setter = mcfClass.getMethod("set" + name, new Class[]{clazz}); - } - catch (NoSuchMethodException nsme) - { - log.warn("The class '" + mcfClass.toString() + "' has no " + - "setter for config property '" + name + "'"); - continue; - } - try - { - setter.invoke(mcf, new Object[]{v}); - if( log.isDebugEnabled() ) - log.debug("set property " + name + " to value " + value); - } - catch (Exception e) - { - log.warn("Unable to invoke setter method '" + setter + "' " + - "on object '" + mcf + "'", e); - } - */ } // end of if () } // end of if () } //end of for |