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 12:06:57 UTC

svn commit: r582189 - /geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/

Author: jdillon
Date: Fri Oct  5 03:06:55 2007
New Revision: 582189

URL: http://svn.apache.org/viewvc?rev=582189&view=rev
Log:
Finish config -> paramter changes, drop the req adapter simple translate

Removed:
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentRequirementAdapter.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java
Modified:
    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/ComponentSetDescriptorAdapter.java

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=582189&r1=582188&r2=582189&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 03:06:55 2007
@@ -25,8 +25,11 @@
 import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 import org.apache.geronimo.gshell.descriptor.CommandDescriptor;
+import org.apache.geronimo.gshell.descriptor.CommandParameter;
 import org.apache.geronimo.gshell.descriptor.CommandRequirement;
 import org.codehaus.plexus.component.repository.ComponentDescriptor;
+import org.codehaus.plexus.component.repository.ComponentRequirement;
+import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
 
 /**
  * ???
@@ -79,19 +82,45 @@
 
         setInstantiationStrategy("per-lookup");
 
-        if (command.hasConfiguration()) {
-            setConfiguration(new PlexusConfigurationAdapter(command.getConfiguration()));
+        if (command.hasParameters()) {
+            XmlPlexusConfiguration root = new XmlPlexusConfiguration("configuration");
+
+            for (CommandParameter param : command.getParameters()) {
+                XmlPlexusConfiguration child = new XmlPlexusConfiguration(param.getName());
+
+                child.setValue(param.getValue());
+
+                root.addChild(child);
+            }
+            
+            setConfiguration(root);
         }
 
         if (command.hasRequirements()) {
             for (CommandRequirement requirement : command.getRequirements()) {
-                this.addRequirement(new ComponentRequirementAdapter(requirement));
+                addRequirement(translate(requirement));
             }
         }
 
         //
         // TODO: What to do about depencencies?  Or are they just on the set level?
         //
+    }
+
+    private ComponentRequirement translate(final CommandRequirement source) {
+        assert source != null;
+
+        ComponentRequirement requirement = new ComponentRequirement();
+
+        requirement.setRole(source.getType());
+
+        requirement.setRoleHint(source.getId());
+
+        requirement.setFieldName(source.getName());
+
+        requirement.setFieldMappingType(null);
+
+        return requirement;
     }
 
     public String toString() {

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentSetDescriptorAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentSetDescriptorAdapter.java?rev=582189&r1=582188&r2=582189&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentSetDescriptorAdapter.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentSetDescriptorAdapter.java Fri Oct  5 03:06:55 2007
@@ -59,7 +59,7 @@
         }
 
         //
-        // FIXME: Need to figure out dependencies
+        // TODO: Need to figure out dependencies
         //
         
         setDependencies(null);