User: salborini
Date: 00/11/24 11:00:07
Modified: src/main/org/jboss/metadata ConfigurationMetaData.java
MetaData.java
Log:
Forgot the getOptionalChild part
Revision Changes Path
1.7 +4 -4 jboss/src/main/org/jboss/metadata/ConfigurationMetaData.java
Index: ConfigurationMetaData.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/metadata/ConfigurationMetaData.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ConfigurationMetaData.java 2000/11/24 18:51:41 1.6
+++ ConfigurationMetaData.java 2000/11/24 19:00:06 1.7
@@ -15,7 +15,7 @@
*
* @see <related>
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
public class ConfigurationMetaData extends MetaData {
@@ -125,13 +125,13 @@
// We save the Elements for them to use later
// configuration for container invoker
- containerInvokerConf = getOptionalChild(element, "container-invoker-conf");
+ containerInvokerConf = getOptionalChild(element, "container-invoker-conf",
containerInvokerConf);
// configuration for instance pool
- containerPoolConf = getOptionalChild(element, "container-pool-conf");
+ containerPoolConf = getOptionalChild(element, "container-pool-conf",
containerPoolConf);
// configuration for instance cache
- containerCacheConf = getOptionalChild(element, "container-cache-conf");
+ containerCacheConf = getOptionalChild(element, "container-cache-conf",
containerCacheConf);
}
1.11 +26 -3 jboss/src/main/org/jboss/metadata/MetaData.java
Index: MetaData.java
===================================================================
RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/metadata/MetaData.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- MetaData.java 2000/11/24 18:51:41 1.10
+++ MetaData.java 2000/11/24 19:00:06 1.11
@@ -22,7 +22,7 @@
*
* @see <related>
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.11 $
*/
public abstract class MetaData implements XmlLoadable {
// Constants -----------------------------------------------------
@@ -72,10 +72,33 @@
}
+ /**
+ * Gets the child of the specified element having the
+ * specified name. If the child with this name doesn't exist
+ * then null is returned instead.
+ *
+ * @param element the parent element
+ * @param tagName the name of the desired child
+ * @return either the named child or null
+ */
public static Element getOptionalChild(Element element, String tagName) throws
DeploymentException {
+ return getOptionalChild(element, tagName, null);
+ }
+ /**
+ * Gets the child of the specified element having the
+ * specified name. If the child with this name doesn't exist
+ * then the supplied default element is returned instead.
+ *
+ * @param element the parent element
+ * @param tagName the name of the desired child
+ * @param defaultElement the element to return if the child
+ * doesn't exist
+ * @return either the named child or the supplied default
+ */
+ public static Element getOptionalChild(Element element, String tagName,
Element defaultElement) throws DeploymentException {
Iterator goodChildren = getChildrenByTagName(element, tagName);
-
+
if (goodChildren != null && goodChildren.hasNext()) {
Element child = (Element)goodChildren.next();
if (goodChildren.hasNext()) {
@@ -83,7 +106,7 @@
}
return child;
} else {
- return null;
+ return defaultElement;
}
}