geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r699241 - in /geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src: main/java/org/apache/geronimo/gshell/wisdom/config/PluginParser.java test/resources/org/apache/geronimo/gshell/wisdom/config/PluginParserTest-context.xml
Date Fri, 26 Sep 2008 09:22:04 GMT
Author: jdillon
Date: Fri Sep 26 02:22:04 2008
New Revision: 699241

URL: http://svn.apache.org/viewvc?rev=699241&view=rev
Log:
Hooked up parsing of description

Modified:
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/config/PluginParser.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/test/resources/org/apache/geronimo/gshell/wisdom/config/PluginParserTest-context.xml

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=699241&r1=699240&r2=699241&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
Fri Sep 26 02:22:04 2008
@@ -50,6 +50,8 @@
     extends AbstractBeanDefinitionParser
 {
     private static final String ID = "id";
+
+    private static final String DESCRIPTION = "description";
     
     private static final String ACTION = "action";
 
@@ -194,6 +196,25 @@
             return parser.parseBeanDefinitionElement(element);
         }
 
+        private void parseAndApplyDescription(final Element element, final BeanDefinition
def) {
+            assert element != null;
+            assert def != null;
+
+            Element desc = getChildElement(element, DESCRIPTION);
+            if (desc != null) {
+                if (def instanceof AbstractBeanDefinition) {
+                    ((AbstractBeanDefinition)def).setDescription(desc.getTextContent());
+                }
+            }
+        }
+
+        private void parseAndApplyDescription(final Element element, final BeanDefinitionBuilder
builder) {
+            assert element != null;
+            assert builder != null;
+
+            parseAndApplyDescription(element, builder.getRawBeanDefinition());
+        }
+        
         private BeanDefinitionHolder register(final BeanDefinitionHolder holder) {
             assert holder != null;
 
@@ -246,6 +267,8 @@
             BeanDefinitionBuilder plugin = BeanDefinitionBuilder.rootBeanDefinition(PluginImpl.class);
             plugin.addPropertyValue(ID, element.getAttribute(NAME));
 
+            parseAndApplyDescription(element, plugin);
+
             return plugin;
         }
 
@@ -284,6 +307,7 @@
             BeanDefinitionBuilder bundle = BeanDefinitionBuilder.rootBeanDefinition(CommandBundle.class);
             bundle.addPropertyValue(ID, element.getAttribute(NAME));
             bundle.setLazyInit(true);
+            parseAndApplyDescription(element, bundle);
 
             List commands = parseCommands(element);
             List aliases = parseAliases(element);
@@ -292,7 +316,7 @@
             commands.addAll(aliases);
 
             bundle.addPropertyValue(COMMANDS, commands);
-            
+
             return bundle;
         }
 
@@ -325,6 +349,7 @@
 
             CommandType type = CommandType.parse(element.getAttribute(TYPE));
             BeanDefinitionBuilder command = BeanDefinitionBuilder.childBeanDefinition(type.getTemplateName());
+            parseAndApplyDescription(element, command);
 
             // TODO: Currently name is pulled from the documentor, need to change that
             // command.addPropertyValue("name", element.getAttribute("name"));
@@ -411,6 +436,8 @@
             alias.addConstructorArgValue(element.getAttribute(NAME));
             alias.addConstructorArgValue(element.getAttribute(TARGET));
 
+            parseAndApplyDescription(element, alias);
+
             return alias;
         }
 

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/test/resources/org/apache/geronimo/gshell/wisdom/config/PluginParserTest-context.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/test/resources/org/apache/geronimo/gshell/wisdom/config/PluginParserTest-context.xml?rev=699241&r1=699240&r2=699241&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/test/resources/org/apache/geronimo/gshell/wisdom/config/PluginParserTest-context.xml
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/test/resources/org/apache/geronimo/gshell/wisdom/config/PluginParserTest-context.xml
Fri Sep 26 02:22:04 2008
@@ -28,8 +28,20 @@
             http://gshell.org/schema/wisdom-gshell http://gshell.org/schema/wisdom-gshell/wisdom-gshell.xsd">
 
     <gshell:plugin name="test-plugin">
+        <description>
+            This is a test plugin.
+        </description>
+        
         <gshell:command-bundle name="test">
+            <description>
+                This is a test bundle.
+            </description>
+
             <gshell:command name="a">
+                <description>
+                    This is a test command.
+                </description>
+
                 <gshell:action class="org.apache.geronimo.gshell.wisdom.config.DummyAction"/>
             </gshell:command>
 
@@ -43,6 +55,10 @@
             
             <gshell:command name="d">
                 <gshell:action class="org.apache.geronimo.gshell.wisdom.config.DummyAction">
+                    <description>
+                        This is a test action.
+                    </description>
+                    
                     <property name="text" value="b"/>
                 </gshell:action>
             </gshell:command>
@@ -55,6 +71,12 @@
             </gshell:command>
 
             <gshell:alias name="foo" target="bar"/>
+
+            <gshell:alias name="bar" target="foo">
+                <description>
+                    This is a test alias.
+                </description>
+            </gshell:alias>
         </gshell:command-bundle>
     </gshell:plugin>
 



Mime
View raw message