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 2007/10/05 11:05:50 UTC

svn commit: r582146 - in /geronimo/sandbox/gshell/trunk: gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/ gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/...

Author: jdillon
Date: Fri Oct  5 02:05:48 2007
New Revision: 582146

URL: http://svn.apache.org/viewvc?rev=582146&view=rev
Log:
Rename CommandConfiguration to CommandParameter, drop CommandConfigurationException

Added:
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandParameter.java   (contents, props changed)
      - copied, changed from r582051, geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfiguration.java
Removed:
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfiguration.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfigurationException.java
Modified:
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentDescriptorAdapter.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java
    geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorExtractor.java
    geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorGleaner.java

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java?rev=582146&r1=582145&r2=582146&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java Fri Oct  5 02:05:48 2007
@@ -45,7 +45,7 @@
 
     private String version;
 
-    private CommandConfiguration configuration;
+    private List<CommandParameter> parameters;
 
     private List<CommandRequirement> requirements;
 
@@ -95,18 +95,28 @@
         this.version = version;
     }
 
-    public CommandConfiguration getConfiguration() {
-        return configuration;
+    public List<CommandParameter> getParameters() {
+        return parameters;
     }
 
-    public void setConfiguration(final CommandConfiguration configuration) {
-        this.configuration = configuration;
+    public void setParameters(final List<CommandParameter> parameters) {
+        this.parameters = parameters;
     }
 
-    public boolean hasConfiguration() {
-        return configuration != null;
+    public void addParameter(final CommandParameter parameter) {
+        assert parameter != null;
+
+        if (parameters == null) {
+            parameters = new ArrayList<CommandParameter>();
+        }
+
+        parameters.add(parameter);
     }
-    
+
+    public boolean hasParameters() {
+        return parameters != null;
+    }
+
     public List<CommandRequirement> getRequirements() {
         return requirements;
     }

Copied: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandParameter.java (from r582051, geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfiguration.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandParameter.java?p2=geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandParameter.java&p1=geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfiguration.java&r1=582051&r2=582146&rev=582146&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandConfiguration.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandParameter.java Fri Oct  5 02:05:48 2007
@@ -26,23 +26,20 @@
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 
 /**
- * Describes arbitrary configuration for a command.
+ * Describes a comand parameter.
  *
  * @version $Rev$ $Date$
  */
-@XStreamAlias("configuration")
-public class CommandConfiguration
+@XStreamAlias("parameter")
+public class CommandParameter
 {
     private String name;
 
     private String value;
 
-    private Map<String,String> attributes;
-
-    private Map<String,CommandConfiguration> children;
-
-    public CommandConfiguration(final String name) {
+    public CommandParameter(final String name, final String value) {
         this.name = name;
+        this.value = value;
     }
 
     public String toString() {
@@ -57,71 +54,11 @@
         this.name = name;
     }
 
-    public String getValue() throws CommandConfigurationException {
+    public String getValue() {
         return value;
     }
 
-    public String getValue(final String defaultValue) {
-        try {
-            return getValue();
-        }
-        catch (CommandConfigurationException e) {
-            return defaultValue;
-        }
-    }
-
     public void setValue(final String value) {
         this.value = value;
     }
-
-    public Map<String, String> getAttributes() {
-        return attributes;
-    }
-
-    /*
-    String[] getAttributeNames();
-
-    String getAttribute(String paramName) throws CommandConfigurationException;
-
-    String getAttribute(String name, String defaultValue);
-
-    CommandConfiguration getChild(String child);
-
-    CommandConfiguration getChild(int i);
-
-    CommandConfiguration getChild(String child, boolean createChild);
-
-    CommandConfiguration[] getChildren();
-
-    CommandConfiguration[] getChildren(String name);
-
-
-    int getChildCount();
-    */
-
-    public void addChild(final CommandConfiguration configuration) {
-        assert configuration != null;
-
-        //
-        // TODO:
-        //
-    }
-
-    public void setAttributes(final Map<String, String> attributes) {
-        this.attributes = attributes;
-    }
-
-    // TODO: getAttribute()
-
-    public Map<String,CommandConfiguration> getChildren() {
-        return children;
-    }
-
-    public void setChildren(final Map<String,CommandConfiguration> children) {
-        this.children = children;
-    }
-
-    // TODO: getChild()
-
-    // TODO: addChild()
 }

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandParameter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandParameter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandParameter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java?rev=582146&r1=582145&r2=582146&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java Fri Oct  5 02:05:48 2007
@@ -112,7 +112,7 @@
                 CommandSetDescriptor.class,
                 CommandDescriptor.class,
                 CommandRequirement.class,
-                CommandConfiguration.class,
+                CommandParameter.class,
                 CommandDependency.class);
 
         return xs;

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentDescriptorAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentDescriptorAdapter.java?rev=582146&r1=582145&r2=582146&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentDescriptorAdapter.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentDescriptorAdapter.java Fri Oct  5 02:05:48 2007
@@ -24,7 +24,6 @@
 import org.apache.geronimo.gshell.command.Command;
 import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
-import org.apache.geronimo.gshell.descriptor.CommandConfiguration;
 import org.apache.geronimo.gshell.descriptor.CommandDescriptor;
 import org.apache.geronimo.gshell.descriptor.CommandRequirement;
 import org.codehaus.plexus.component.repository.ComponentDescriptor;

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java?rev=582146&r1=582145&r2=582146&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java Fri Oct  5 02:05:48 2007
@@ -21,7 +21,7 @@
 
 import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
-import org.apache.geronimo.gshell.descriptor.CommandConfiguration;
+import org.apache.geronimo.gshell.descriptor.CommandParameter;
 import org.apache.geronimo.gshell.descriptor.CommandConfigurationException;
 import org.codehaus.plexus.configuration.PlexusConfiguration;
 import org.codehaus.plexus.configuration.PlexusConfigurationException;
@@ -34,20 +34,20 @@
 public class PlexusConfigurationAdapter
     implements PlexusConfiguration
 {
-    private final CommandConfiguration configuration;
+    private final CommandParameter parameter;
 
-    public PlexusConfigurationAdapter(final CommandConfiguration configuration) {
-        assert configuration != null;
+    public PlexusConfigurationAdapter(final CommandParameter parameter) {
+        assert parameter != null;
 
-        this.configuration = configuration;
+        this.parameter = parameter;
     }
 
     public String toString() {
         return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
     }
 
-    public CommandConfiguration getConfiguration() {
-        return configuration;
+    public CommandParameter getConfiguration() {
+        return parameter;
     }
 
     //
@@ -55,12 +55,12 @@
     //
 
     public String getName() {
-        return configuration.getName();
+        return parameter.getName();
     }
 
     public String getValue() throws PlexusConfigurationException {
         try {
-            return configuration.getValue();
+            return parameter.getValue();
         }
         catch (CommandConfigurationException e) {
             throw new PlexusConfigurationException(e.getMessage(), e);
@@ -68,7 +68,7 @@
     }
 
     public String getValue(final String defaultValue) {
-        return configuration.getValue(defaultValue);
+        return parameter.getValue(defaultValue);
     }
 
     //

Modified: geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorExtractor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorExtractor.java?rev=582146&r1=582145&r2=582146&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorExtractor.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorExtractor.java Fri Oct  5 02:05:48 2007
@@ -41,7 +41,7 @@
     public static enum Scope
     {
         COMPILE,
-        TEST;
+        TEST; // ';' Here to keep QDox from being a bitch
     }
 
     private final Logger log = LoggerFactory.getLogger(getClass());

Modified: geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorGleaner.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorGleaner.java?rev=582146&r1=582145&r2=582146&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorGleaner.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorGleaner.java Fri Oct  5 02:05:48 2007
@@ -26,7 +26,7 @@
 import org.apache.geronimo.gshell.command.annotation.CommandComponent;
 import org.apache.geronimo.gshell.command.annotation.Parameter;
 import org.apache.geronimo.gshell.command.annotation.Requirement;
-import org.apache.geronimo.gshell.descriptor.CommandConfiguration;
+import org.apache.geronimo.gshell.descriptor.CommandParameter;
 import org.apache.geronimo.gshell.descriptor.CommandDescriptor;
 import org.apache.geronimo.gshell.descriptor.CommandRequirement;
 import org.slf4j.Logger;
@@ -118,10 +118,10 @@
                     command.addRequirement(requirement);
                 }
 
-                CommandConfiguration config = findConfiguration(field);
+                CommandParameter parameter = findParameter(field);
 
-                if (config != null) {
-                    command.getConfiguration().addChild(config);
+                if (parameter != null) {
+                    command.addParameter(parameter);
                 }
             }
 
@@ -190,7 +190,7 @@
         return requirement;
     }
 
-    private CommandConfiguration findConfiguration(final Field field) {
+    private CommandParameter findParameter(final Field field) {
         assert field != null;
 
         Parameter anno = field.getAnnotation(Parameter.class);
@@ -207,14 +207,8 @@
         
         name = deHump(name);
 
-        CommandConfiguration config = new CommandConfiguration(name);
-
         String value = filterEmptyAsNull(anno.value());
 
-        if (value != null) {
-            config.setValue(value);
-        }
-
-        return config;
+        return new CommandParameter(name, value);
     }
 }