You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/10/22 14:02:47 UTC

svn commit: r707050 - /geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/config/PluginParser.java

Author: jdillon
Date: Wed Oct 22 05:02:46 2008
New Revision: 707050

URL: http://svn.apache.org/viewvc?rev=707050&view=rev
Log:
Don't rely on the schema to provide a default, as it doesn't seem to when validation is disabled

Modified:
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/config/PluginParser.java

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/config/PluginParser.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/config/PluginParser.java?rev=707050&r1=707049&r2=707050&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/config/PluginParser.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/config/PluginParser.java Wed Oct 22 05:02:46 2008
@@ -40,6 +40,7 @@
 import org.springframework.util.StringUtils;
 import org.springframework.util.xml.DomUtils;
 import org.w3c.dom.Element;
+import org.w3c.dom.Attr;
 
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
@@ -133,7 +134,7 @@
 
         public static CommandType parse(final String text) {
             assert text != null;
-
+            
             return valueOf(text.toUpperCase());
         }
 
@@ -419,12 +420,23 @@
             return commands;
         }
 
+        private CommandType parseCommandType(final Element element) {
+            assert element != null;
+
+            Attr attr = element.getAttributeNode(TYPE);
+            if (attr == null) {
+                return CommandType.STATEFUL;
+            }
+
+            return CommandType.parse(attr.getValue());
+        }
+
         private BeanDefinitionBuilder parseCommand(final Element element) {
             assert element != null;
 
             log.trace("Parse command; element; {}", element);
 
-            CommandType type = CommandType.parse(element.getAttribute(TYPE));
+            CommandType type = parseCommandType(element);
             BeanDefinitionBuilder command = BeanDefinitionBuilder.childBeanDefinition(type.getTemplateName());
             parseAndApplyDescription(element, command);