"Keith L. Musser" <[EMAIL PROTECTED]> wrote:
> I've noticed the same issue and agree with your proposal.
Cool. Here is a patch that makes everything in jboss.xml truly optional.
Is there a better place to submit this kind of thing?
Toby.
-----Begin patch------
Index: main/org/jboss/metadata/ConfigurationMetaData.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/metadata/ConfigurationMetaData.java,v
retrieving revision 1.5
diff -r1.5 ConfigurationMetaData.java
35a36,37
>
> public static final String[] commitOptionStrings = { "A", "B", "C" };
96c98
< callLogging =
Boolean.valueOf(getElementContent(getOptionalChild(element,
"call-logging"))).booleanValue();
---
> callLogging =
>Boolean.valueOf(getElementContent(getOptionalChild(element, "call-logging"),
>String.valueOf(callLogging))).booleanValue();
99c101
< containerInvoker = getElementContent(getOptionalChild(element,
"container-invoker"));
---
> containerInvoker = getElementContent(getOptionalChild(element,
>"container-invoker"), containerInvoker);
102c104
< instancePool = getElementContent(getOptionalChild(element,
"instance-pool"));
---
> instancePool = getElementContent(getOptionalChild(element,
>"instance-pool"), instancePool);
105c107
< instanceCache = getElementContent(getOptionalChild(element,
"instance-cache"));
---
> instanceCache = getElementContent(getOptionalChild(element,
>"instance-cache"), instanceCache);
108c110
< persistenceManager = getElementContent(getOptionalChild(element,
"persistence-manager"));
---
> persistenceManager = getElementContent(getOptionalChild(element,
>"persistence-manager"), persistenceManager);
111c113
< transactionManager = getElementContent(getOptionalChild(element,
"transaction-manager"));
---
> transactionManager = getElementContent(getOptionalChild(element,
>"transaction-manager"), transactionManager);
114c116
< authenticationModule = getElementContent(getOptionalChild(element,
"authentication-module"));
---
> authenticationModule = getElementContent(getOptionalChild(element,
>"authentication-module"), authenticationModule);
117c119
< roleMappingManager = getElementContent(getOptionalChild(element,
"role-mapping-manager"));
---
> roleMappingManager = getElementContent(getOptionalChild(element,
>"role-mapping-manager"), roleMappingManager);
120c122
< String commit = getElementContent(getOptionalChild(element,
"commit-option"));
---
> String commit = getElementContent(getOptionalChild(element,
>"commit-option"), commitOptionToString(commitOption));
123,129c125
< if (commit.equals("A")) {
< commitOption = A_COMMIT_OPTION;
< } else if (commit.equals("B")) {
< commitOption = B_COMMIT_OPTION;
< } else if (commit.equals("C")) {
< commitOption = C_COMMIT_OPTION;
< } else throw new DeploymentException("Invalid commit option");
---
> commitOption = stringToCommitOption(commit);
136c132
< containerInvokerConf = getOptionalChild(element, "container-invoker-conf");
---
> containerInvokerConf = getOptionalChild(element, "container-invoker-conf",
>containerInvokerConf);
139c135
< containerPoolConf = getOptionalChild(element, "container-pool-conf");
---
> containerPoolConf = getOptionalChild(element, "container-pool-conf",
>containerPoolConf);
142c138
< containerCacheConf = getOptionalChild(element, "container-cache-conf");
---
> containerCacheConf = getOptionalChild(element, "container-cache-conf",
>containerCacheConf);
151c147,169
<
---
>
> private static String commitOptionToString(byte commitOption)
> throws DeploymentException {
>
> try {
> return commitOptionStrings[commitOption];
> } catch( ArrayIndexOutOfBoundsException e ) {
> throw new DeploymentException("Invalid commit option: " +
> commitOption);
> }
> }
>
> private static byte stringToCommitOption(String commitOption)
> throws DeploymentException {
>
> for( byte i=0; i<commitOptionStrings.length; ++i )
> if( commitOptionStrings[i].equals(commitOption) )
> return i;
>
> throw new DeploymentException("Invalid commit option: '" +
> commitOption + "'");
> }
>
Index: main/org/jboss/metadata/MetaData.java
===================================================================
RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/metadata/MetaData.java,v
retrieving revision 1.9
diff -r1.9 MetaData.java
73,74c73,82
<
<
---
>
> /**
> * 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
> */
76a85,100
> 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 {
>
86c110
< return null;
---
> return defaultElement;
91c115,120
< if (element == null) return null;
---
>
> return getElementContent(element, null);
> }
>
> public static String getElementContent(Element element, String defaultStr)
>throws DeploymentException {
> if (element == null) return defaultStr;
-----End patch-----
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]