geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r662685 - in /geronimo/gshell/trunk: gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/ gshell-core/src/main/java/org/apache/geronimo/gshell/registry/ gshell-model/src/main/java/org/apache/geronim...
Date Tue, 03 Jun 2008 07:58:49 GMT
Author: jdillon
Date: Tue Jun  3 00:58:48 2008
New Revision: 662685

URL: http://svn.apache.org/viewvc?rev=662685&view=rev
Log:
Finish up removing the old CommandSet model muck, using new Plugin bits now

Added:
    geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandExtractor.java   (contents, props changed)
      - copied, changed from r662630, geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorExtractor.java
    geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandGleaner.java   (contents, props changed)
      - copied, changed from r662630, geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorGleaner.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/PlexusCommandWrapper.java
      - copied, changed from r662630, geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandDescriptor.java   (with props)
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/PluginDescriptor.java   (contents, props changed)
      - copied, changed from r662630, geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/ComponentSetDescriptorAdapter.java
Removed:
    geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorExtractor.java
    geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorGleaner.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSetMarshaller.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/CommandContainer.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoverer.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/ComponentDescriptorAdapter.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/ComponentSetDescriptorAdapter.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/DefaultPluginManager.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PluginContainer.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PluginContext.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PluginManager.java
Modified:
    geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/DescriptorMojo.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Model.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationMarshaller.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java
    geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java
    geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/plugin/plugin1.xml
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/ApplicationConfiguration.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PluginCollector.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PluginDiscoverer.java

Copied: geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandExtractor.java (from r662630, geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorExtractor.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandExtractor.java?p2=geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandExtractor.java&p1=geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorExtractor.java&r1=662630&r2=662685&rev=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorExtractor.java (original)
+++ geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandExtractor.java Tue Jun  3 00:58:48 2008
@@ -35,11 +35,11 @@
 import org.slf4j.LoggerFactory;
 
 /**
- * Extracts {@link org.apache.geronimo.gshell.model.command.Command} instances from class files.
+ * Extracts {@link Command} instances from class files.
  *
  * @version $Id$
  */
-public class CommandDescriptorExtractor
+public class CommandExtractor
 {
     public static enum Scope
     {
@@ -49,7 +49,7 @@
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    private CommandDescriptorGleaner gleaner = new CommandDescriptorGleaner();
+    private CommandGleaner gleaner = new CommandGleaner();
 
     public List<Command> extract(final MavenProject project, final Scope scope) throws Exception {
         assert project != null;

Propchange: geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandExtractor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandGleaner.java (from r662630, geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorGleaner.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandGleaner.java?p2=geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandGleaner.java&p1=geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorGleaner.java&r1=662630&r2=662685&rev=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandDescriptorGleaner.java (original)
+++ geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandGleaner.java Tue Jun  3 00:58:48 2008
@@ -34,11 +34,11 @@
 import org.slf4j.LoggerFactory;
 
 /**
- * ????
+ * Gleans off command elements from annotations.
  *
  * @version $Id$
  */
-public class CommandDescriptorGleaner
+public class CommandGleaner
 {
     private static final String EMPTY_STRING = "";
 

Propchange: geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandGleaner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandGleaner.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandGleaner.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/DescriptorMojo.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/DescriptorMojo.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/DescriptorMojo.java (original)
+++ geronimo/gshell/trunk/gshell-buildsupport/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/DescriptorMojo.java Tue Jun  3 00:58:48 2008
@@ -26,8 +26,8 @@
 import java.util.List;
 
 import org.apache.geronimo.gshell.model.command.Command;
-import org.apache.geronimo.gshell.model.command.CommandSet;
-import org.apache.geronimo.gshell.model.command.CommandSetMarshaller;
+import org.apache.geronimo.gshell.model.plugin.PluginMarshaller;
+import org.apache.geronimo.gshell.model.plugin.Plugin;
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -35,10 +35,10 @@
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
 
-import org.apache.geronimo.gshell.maven.gshell.CommandDescriptorExtractor.Scope;
+import org.apache.geronimo.gshell.maven.gshell.CommandExtractor.Scope;
 
 /**
- * Generates a GShell <tt>commands.xml</tt> descriptor.
+ * Generates a GShell <tt>plugin.xml</tt> descriptor.
  *
  * @goal descriptor
  * @phase process-classes
@@ -55,14 +55,16 @@
      * @parameter expression="${project.build.outputDirectory}"
      * @required
      */
+    @SuppressWarnings({"UnusedDeclaration"})
     private File outputDirectory;
 
     /**
      * The filename of the descriptor.
      *
-     * @parameter expression="META-INF/gshell/commands.xml"
+     * @parameter expression="META-INF/gshell/plugin.xml"
      * @required
      */
+    @SuppressWarnings({"UnusedDeclaration"})
     private String fileName;
 
     /**
@@ -70,6 +72,7 @@
      * @readonly
      * @required
      */
+    @SuppressWarnings({"UnusedDeclaration"})
     private MavenProject project;
 
     public void execute() throws MojoExecutionException {
@@ -90,32 +93,40 @@
         assert scope != null;
         assert outputFile != null;
 
-        List<Command> descriptors = new ArrayList<Command>();
+        List<Command> commands = new ArrayList<Command>();
 
-        CommandDescriptorExtractor extractor = new CommandDescriptorExtractor();
+        CommandExtractor extractor = new CommandExtractor();
 
         try {
             List<Command> list = extractor.extract(project, scope);
 
             if (list != null && !list.isEmpty()) {
-                descriptors.addAll(list);
+                commands.addAll(list);
             }
         }
         catch (Exception e) {
             throw new MojoExecutionException("Failed to extract descriptors", e);
         }
 
-        if (descriptors.size() == 0) {
+        if (commands.size() == 0) {
             getLog().debug("No commands found");
         }
         else {
-            getLog().info("Discovered " + descriptors.size() + " command descriptors(s)");
+            getLog().info("Discovered " + commands.size() + " commands");
 
-            CommandSet commands = new CommandSet(project.getId()); // .getArtifactId());
-            commands.setCommands(descriptors);
+            Plugin plugin = new Plugin();
+            
+            plugin.setGroupId(project.getGroupId());
+            plugin.setArtifactId(project.getArtifactId());
+            plugin.setVersion(project.getVersion());
+            plugin.setDescription(project.getDescription());
 
+            for (Command command : commands) {
+                plugin.add(command);
+            }
+            
             try {
-                writeDescriptor(commands, outputFile);
+                writeDescriptor(plugin, outputFile);
             }
             catch (Exception e) {
                 throw new MojoExecutionException("Failed to write descriptor: " + outputFile, e);
@@ -123,18 +134,18 @@
         }
     }
 
-    private void writeDescriptor(final CommandSet commands, final File outputFile) throws Exception {
-        assert commands != null;
+    private void writeDescriptor(final Plugin plugin, final File outputFile) throws Exception {
+        assert plugin != null;
         assert outputFile != null;
 
         FileUtils.forceMkdir(outputFile.getParentFile());
 
         BufferedWriter output = new BufferedWriter(new FileWriter(outputFile));
 
-        CommandSetMarshaller marshaller = new CommandSetMarshaller();
+        PluginMarshaller marshaller = new PluginMarshaller();
 
         try {
-            marshaller.marshal(commands, output);
+            marshaller.marshal(plugin, output);
             output.flush();
         }
         finally {

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/DefaultCommandRegistry.java Tue Jun  3 00:58:48 2008
@@ -21,8 +21,7 @@
 
 import org.apache.geronimo.gshell.model.command.Command;
 import org.apache.geronimo.gshell.plexus.GShellPlexusContainer;
-import org.apache.geronimo.gshell.plugin.CommandCollector;
-import org.apache.geronimo.gshell.plugin.PlexusCommandWrapper;
+import org.apache.geronimo.gshell.plugin.PluginCollector;
 import org.codehaus.plexus.PlexusConstants;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
@@ -53,7 +52,7 @@
     private GShellPlexusContainer container;
 
     @Requirement
-    private CommandCollector collector;
+    private PluginCollector collector;
     
     private Map<String, org.apache.geronimo.gshell.command.Command> commands = new HashMap<String, org.apache.geronimo.gshell.command.Command>();
 
@@ -87,15 +86,15 @@
         assert id != null;
         
         if (!commands.containsKey(id)) {
-            Command descriptor = collector.getCommandDescriptor(id);
+            Command command = collector.getCommand(id);
 
-            if (descriptor == null) {
+            if (command == null) {
                 throw new NotRegisteredException(id);
             }
 
             log.debug("Registering command id: {}", id);
             
-            register(new PlexusCommandWrapper(container, descriptor));
+            register(new PlexusCommandWrapper(container, command));
         }
     }
 

Copied: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/PlexusCommandWrapper.java (from r662630, geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/PlexusCommandWrapper.java?p2=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/PlexusCommandWrapper.java&p1=geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java&r1=662630&r2=662685&rev=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/PlexusCommandWrapper.java Tue Jun  3 00:58:48 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.plugin;
+package org.apache.geronimo.gshell.registry;
 
 import org.apache.geronimo.gshell.command.CommandContext;
 import org.apache.geronimo.gshell.model.command.Command;
@@ -58,6 +58,8 @@
     public Object execute(final CommandContext context, final Object... args) throws Exception {
         assert context != null;
 
+        log.trace("Executing w/context={}, args={}", context, args);
+        
         org.apache.geronimo.gshell.command.Command command =
             container.lookupComponent(org.apache.geronimo.gshell.command.Command.class, descriptor.getId());
 

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Model.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Model.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Model.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Model.java Tue Jun  3 00:58:48 2008
@@ -19,8 +19,6 @@
 
 package org.apache.geronimo.gshell.model;
 
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
 import org.apache.geronimo.gshell.model.marshal.Marshaller;
 
 /**
@@ -33,9 +31,11 @@
 {
     private transient Marshaller marshaller;
 
+    /*
     @XStreamAlias("version")
     @XStreamAsAttribute
     private String modelVersion;
+    */
 
     public Marshaller getMarshaller() {
     	if (marshaller == null) {
@@ -49,6 +49,7 @@
         this.marshaller = marshaller;
     }
 
+    /*
     public String getModelVersion() {
         return modelVersion;
     }
@@ -56,4 +57,5 @@
     public void setModelVersion(final String modelVersion) {
         this.modelVersion = modelVersion;
     }
+    */
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationMarshaller.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationMarshaller.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationMarshaller.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationMarshaller.java Tue Jun  3 00:58:48 2008
@@ -19,10 +19,10 @@
 
 package org.apache.geronimo.gshell.model.application;
 
-import org.apache.geronimo.gshell.model.marshal.MarshallerSupport;
-import org.apache.geronimo.gshell.model.layout.CommandNode;
-import org.apache.geronimo.gshell.model.layout.AliasNode;
 import com.thoughtworks.xstream.XStream;
+import org.apache.geronimo.gshell.model.layout.AliasNode;
+import org.apache.geronimo.gshell.model.layout.CommandNode;
+import org.apache.geronimo.gshell.model.marshal.MarshallerSupport;
 
 /**
  * Marshaller for {@link Application} models.

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java Tue Jun  3 00:58:48 2008
@@ -20,12 +20,11 @@
 package org.apache.geronimo.gshell.model.application;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-
 import org.apache.geronimo.gshell.model.Element;
 import org.codehaus.plexus.util.StringUtils;
 
-import java.util.Properties;
 import java.io.File;
+import java.util.Properties;
 
 /**
  * Branding configuration element.

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java Tue Jun  3 00:58:48 2008
@@ -20,10 +20,8 @@
 package org.apache.geronimo.gshell.model.command;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-
 import org.apache.geronimo.gshell.model.Element;
 
-import java.net.URI;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -36,8 +34,6 @@
 public class Command
     extends Element
 {
-    private URI source;
-
     private String id;
 
     private String implementation;
@@ -50,14 +46,6 @@
 
     private List<Requirement> requirements;
 
-    public URI getSource() {
-        return source;
-    }
-
-    public void setSource(final URI source) {
-        this.source = source;
-    }
-
     public String getId() {
         return id;
     }

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java Tue Jun  3 00:58:48 2008
@@ -20,7 +20,6 @@
 package org.apache.geronimo.gshell.model.command;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-
 import org.apache.geronimo.gshell.model.Element;
 
 /**

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java Tue Jun  3 00:58:48 2008
@@ -20,7 +20,6 @@
 package org.apache.geronimo.gshell.model.command;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-
 import org.apache.geronimo.gshell.model.Element;
 
 /**

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DependencyGroup.java Tue Jun  3 00:58:48 2008
@@ -22,8 +22,8 @@
 import com.thoughtworks.xstream.annotations.XStreamAlias;
 import com.thoughtworks.xstream.annotations.XStreamImplicit;
 
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Groups dependency elements to allow artifact configuration to be shared.

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/DescriptorSupport.java Tue Jun  3 00:58:48 2008
@@ -19,10 +19,10 @@
 
 package org.apache.geronimo.gshell.model.common;
 
-import java.util.Properties;
-
 import org.apache.geronimo.gshell.model.Model;
 
+import java.util.Properties;
+
 /**
  * Support for descriptor models.
  *

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/LocalRepository.java Tue Jun  3 00:58:48 2008
@@ -20,11 +20,10 @@
 package org.apache.geronimo.gshell.model.common;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
+import org.apache.geronimo.gshell.model.Element;
 
 import java.io.File;
 
-import org.apache.geronimo.gshell.model.Element;
-
 /**
  * Local repository configuration.
  *

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/RemoteRepository.java Tue Jun  3 00:58:48 2008
@@ -20,12 +20,11 @@
 package org.apache.geronimo.gshell.model.common;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
+import org.apache.geronimo.gshell.model.Element;
 
 import java.net.URI;
 import java.net.URISyntaxException;
 
-import org.apache.geronimo.gshell.model.Element;
-
 /**
  * Remote repository configuration.
  *

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java Tue Jun  3 00:58:48 2008
@@ -22,8 +22,8 @@
 import org.apache.geronimo.gshell.model.Model;
 
 import java.io.InputStream;
-import java.io.Reader;
 import java.io.OutputStream;
+import java.io.Reader;
 import java.io.Writer;
 
 /**

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java Tue Jun  3 00:58:48 2008
@@ -22,19 +22,18 @@
 import com.thoughtworks.xstream.XStream;
 import com.thoughtworks.xstream.io.xml.DomDriver;
 import com.thoughtworks.xstream.io.xml.XppDriver;
+import org.apache.geronimo.gshell.model.Model;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.io.Reader;
 import java.io.StringReader;
-import java.io.OutputStream;
 import java.io.Writer;
 import java.net.URL;
 
-import org.apache.geronimo.gshell.model.Model;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 /**
  * Support for model {@link Marshaller} implementations.
  *

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/plugin/Plugin.java Tue Jun  3 00:58:48 2008
@@ -21,8 +21,6 @@
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
 import org.apache.geronimo.gshell.model.command.Command;
-import org.apache.geronimo.gshell.model.common.Dependency;
-import org.apache.geronimo.gshell.model.common.DependencyGroup;
 import org.apache.geronimo.gshell.model.common.DescriptorSupport;
 import org.apache.geronimo.gshell.model.layout.Layout;
 
@@ -38,59 +36,29 @@
 public class Plugin
     extends DescriptorSupport
 {
-    //
-    // FIXME: Might not really need these here, since we are using the pom.xml information to load dependencies/plugins
-    //
-    
-    private List<Dependency> dependencies;
-
-    private List<DependencyGroup> dependencyGroups;
-
     private List<Command> commands;
 
     private Layout layout;
 
-    public List<DependencyGroup> dependencyGroups() {
-        if (dependencyGroups == null) {
-            dependencyGroups = new ArrayList<DependencyGroup>();
+    public List<Command> commands() {
+        if (commands == null) {
+            commands = new ArrayList<Command>();
         }
-
-        return dependencyGroups;
+        
+        return commands;
     }
 
-    public void add(final DependencyGroup group) {
-        assert group != null;
-
-        dependencyGroups().add(group);
+    public void add(final Command command) {
+        assert command != null;
+        
+        commands().add(command);
     }
 
-    public List<Dependency> dependencies() {
-        if (dependencies == null) {
-            dependencies = new ArrayList<Dependency>();
-        }
-
-        return dependencies;
+    public Layout getLayout() {
+        return layout;
     }
 
-    public List<Dependency> dependencies(boolean includeGroups) {
-        if (!includeGroups) {
-            return dependencies();
-        }
-
-        List<Dependency> list = new ArrayList<Dependency>();
-
-        list.addAll(dependencies());
-
-        for (DependencyGroup group : dependencyGroups()) {
-            list.addAll(group.dependencies());
-        }
-
-        return list;
-    }
-
-    public void add(final Dependency dependency) {
-        assert dependency != null;
-
-        dependencies().add(dependency);
+    public void setLayout(final Layout layout) {
+        this.layout = layout;
     }
-}
\ No newline at end of file
+}

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/Settings.java Tue Jun  3 00:58:48 2008
@@ -20,13 +20,12 @@
 package org.apache.geronimo.gshell.model.settings;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-
 import org.apache.geronimo.gshell.model.Model;
 import org.apache.geronimo.gshell.model.common.RemoteRepository;
 
-import java.util.Properties;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
 
 /**
  * User settings model root element.

Modified: geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java (original)
+++ geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/plugin/PluginMarshallerTest.java Tue Jun  3 00:58:48 2008
@@ -50,26 +50,6 @@
         props.setProperty("a", "b");
         root.setProperties(props);
 
-        Dependency d1 = new Dependency();
-        d1.setGroupId("a");
-        d1.setArtifactId("b");
-        d1.setVersion("c");
-        root.add(d1);
-
-        DependencyGroup g1 = new DependencyGroup();
-        g1.setGroupId("d");
-        g1.setVersion("e");
-        root.add(g1);
-
-        Dependency d2 = new Dependency();
-        d2.setArtifactId("f");
-        g1.add(d2);
-
-        Dependency d3 = new Dependency();
-        d3.setArtifactId("g");
-        d3.setClassifier("h");
-        g1.add(d3);
-
         String xml = marshaller.marshal(root);
         assertNotNull(xml);
 

Modified: geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/plugin/plugin1.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/plugin/plugin1.xml?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/plugin/plugin1.xml (original)
+++ geronimo/gshell/trunk/gshell-model/src/test/resources/org/apache/geronimo/gshell/model/plugin/plugin1.xml Tue Jun  3 00:58:48 2008
@@ -30,26 +30,4 @@
     <properties>
         <property name="a" value="b"/>
     </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>a</groupId>
-            <artifactId>b</artifactId>
-            <version>c</version>
-        </dependency>
-    </dependencies>
-
-    <dependencyGroups>
-        <dependencyGroup>
-            <groupId>d</groupId>
-            <version>e</version>
-            <dependency>
-                <artifactId>f</artifactId>
-            </dependency>
-            <dependency>
-                <artifactId>g</artifactId>
-                <classifier>h</classifier>
-            </dependency>
-        </dependencyGroup>
-    </dependencyGroups>
 </plugin>
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/ApplicationConfiguration.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/ApplicationConfiguration.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/ApplicationConfiguration.java (original)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/ApplicationConfiguration.java Tue Jun  3 00:58:48 2008
@@ -19,7 +19,6 @@
 
 package org.apache.geronimo.gshell.application;
 
-import org.apache.geronimo.gshell.application.DefaultEnvironment;
 import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 import org.apache.geronimo.gshell.io.IO;

Modified: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java (original)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java Tue Jun  3 00:58:48 2008
@@ -29,8 +29,8 @@
 import org.apache.geronimo.gshell.model.interpolate.InterpolatorSupport;
 import org.apache.geronimo.gshell.model.settings.Settings;
 import org.apache.geronimo.gshell.plexus.GShellPlexusContainer;
-import org.apache.geronimo.gshell.plugin.CommandCollector;
-import org.apache.geronimo.gshell.plugin.CommandDiscoverer;
+import org.apache.geronimo.gshell.plugin.PluginCollector;
+import org.apache.geronimo.gshell.plugin.PluginDiscoverer;
 import org.apache.geronimo.gshell.settings.SettingsManager;
 import org.apache.geronimo.gshell.shell.Environment;
 import org.apache.geronimo.gshell.shell.Shell;
@@ -56,9 +56,9 @@
 
 import java.io.File;
 import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
-import java.lang.reflect.InvocationTargetException;
 import java.net.URL;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
@@ -209,12 +209,8 @@
         config.setName(application.getId());
         config.setClassWorld(world);
         config.setRealm(realm);
-        
-        // FIXME: For now use the old Command* bits to get things working, then refactor to use the new Plugin* bits
-        config.addComponentDiscoverer(new CommandDiscoverer());
-        config.addComponentDiscoveryListener(new CommandCollector());
-        // config.addComponentDiscoverer(new PluginDiscoverer());
-        // config.addComponentDiscoveryListener(new PluginCollector());
+        config.addComponentDiscoverer(new PluginDiscoverer());
+        config.addComponentDiscoveryListener(new PluginCollector());
 
         GShellPlexusContainer child = parentContainer.createChild(config);
 

Modified: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PluginCollector.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PluginCollector.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PluginCollector.java (original)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PluginCollector.java Tue Jun  3 00:58:48 2008
@@ -19,14 +19,23 @@
 
 package org.apache.geronimo.gshell.plugin;
 
+import org.apache.geronimo.gshell.model.command.Command;
+import org.apache.geronimo.gshell.model.plugin.Plugin;
+import org.apache.geronimo.gshell.plugin.descriptor.PluginDescriptor;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.discovery.ComponentDiscoveryEvent;
 import org.codehaus.plexus.component.discovery.ComponentDiscoveryListener;
+import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
- * ???
+ * Collects discovered GShell plugins and makes them available for registry lookups.
  *
  * @version $Rev$ $Date$
  */
@@ -36,6 +45,10 @@
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
+    private final List<PluginDescriptor> descriptors = new ArrayList<PluginDescriptor>();
+
+    private final Map<String,Command> commands = new LinkedHashMap<String,Command>();
+
     public String getId() {
         return getClass().getSimpleName();
     }
@@ -43,6 +56,43 @@
     public void componentDiscovered(final ComponentDiscoveryEvent event) {
         assert event != null;
 
-        // TODO: Track plugin component set descriptors
+        log.trace("Component discovered: {}", event);
+
+        ComponentSetDescriptor descriptor = event.getComponentSetDescriptor();
+
+        if (descriptor instanceof PluginDescriptor) {
+            collect((PluginDescriptor)descriptor);
+        }
+    }
+
+    private void collect(final PluginDescriptor descriptor) {
+        assert descriptor != null;
+
+        Plugin plugin = descriptor.getPlugin();
+
+        log.trace("Collecting plugin components for: {}", plugin.getId());
+
+        for (Command command : plugin.commands()) {
+            log.debug("Found command: {}", command.getId());
+            log.trace("Command model: {}", command);
+            
+            commands.put(command.getId(), command);
+        }
+
+        descriptors.add(descriptor);
+    }
+
+    public List<PluginDescriptor> getDescriptors() {
+        return descriptors;
+    }
+
+    public Map<String, Command> getCommands() {
+        return commands;
+    }
+
+    public Command getCommand(final String id) {
+        assert id != null;
+
+        return commands.get(id);
     }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PluginDiscoverer.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PluginDiscoverer.java?rev=662685&r1=662684&r2=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PluginDiscoverer.java (original)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/PluginDiscoverer.java Tue Jun  3 00:58:48 2008
@@ -21,9 +21,10 @@
 
 import org.apache.geronimo.gshell.model.plugin.Plugin;
 import org.apache.geronimo.gshell.model.plugin.PluginMarshaller;
+import org.apache.geronimo.gshell.plugin.descriptor.PluginDescriptor;
+import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.discovery.AbstractComponentDiscoverer;
 import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
-import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.configuration.PlexusConfigurationException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -31,7 +32,7 @@
 import java.io.Reader;
 
 /**
- * ???
+ * Handles the discovery of GShell plugins from <tt>plugin.xml</tt> models.
  *
  * @version $Rev$ $Date$
  */
@@ -55,12 +56,16 @@
         assert reader != null;
         assert source != null;
 
-        log.debug("Discovered plugin: {}", source);
+        log.trace("Loading plugin model from: {}", source);
 
         Plugin plugin = marshaller.unmarshal(reader);
 
-        // TODO: Build plexus component set descriptor
-
-        return null;
+        log.debug("Discovered plugin: {}", plugin.getId());
+        log.trace("Plugin model: {}", plugin);
+        
+        PluginDescriptor descriptor = new PluginDescriptor(plugin);
+        descriptor.setSource(source);
+        
+        return descriptor;
     }
 }
\ No newline at end of file

Added: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandDescriptor.java?rev=662685&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandDescriptor.java (added)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandDescriptor.java Tue Jun  3 00:58:48 2008
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.gshell.plugin.descriptor;
+
+import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+import org.apache.geronimo.gshell.model.command.Command;
+import org.apache.geronimo.gshell.model.command.Parameter;
+import org.apache.geronimo.gshell.model.command.Requirement;
+import org.codehaus.plexus.component.repository.ComponentDescriptor;
+import org.codehaus.plexus.component.repository.ComponentRequirement;
+import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
+
+/**
+ * Descriptor for a GShell command's plexus component.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CommandDescriptor
+    extends ComponentDescriptor
+{
+    private final Command command;
+
+    public CommandDescriptor(final Command command) {
+        assert command != null;
+
+        this.command = command;
+
+        setDescription(command.getDescription());
+
+        setAlias(null);
+
+        setRole(org.apache.geronimo.gshell.command.Command.class.getName());
+
+        setRoleHint(command.getId());
+
+        setImplementation(command.getImplementation());
+
+        setVersion(command.getVersion());
+
+        setComponentType(null);
+
+        setLifecycleHandler(null);
+
+        setComponentProfile(null);
+
+        setComponentFactory(null);
+
+        setComponentComposer(null);
+
+        setComponentConfigurator(null);
+
+        setRealmId(null);
+
+        setIsolatedRealm(false);
+
+        setInstantiationStrategy("per-lookup");
+
+        if (command.hasParameters()) {
+            XmlPlexusConfiguration root = new XmlPlexusConfiguration("configuration");
+
+            for (Parameter param : command.getParameters()) {
+                XmlPlexusConfiguration child = new XmlPlexusConfiguration(param.getName());
+
+                child.setValue(param.getValue());
+
+                root.addChild(child);
+            }
+
+            setConfiguration(root);
+        }
+
+        if (command.hasRequirements()) {
+            for (Requirement requirement : command.getRequirements()) {
+                addRequirement(translate(requirement));
+            }
+        }
+    }
+
+    public Command getCommand() {
+        return command;
+    }
+
+    private ComponentRequirement translate(final Requirement 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() {
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+    }
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Copied: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/PluginDescriptor.java (from r662630, geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/ComponentSetDescriptorAdapter.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/PluginDescriptor.java?p2=geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/PluginDescriptor.java&p1=geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/ComponentSetDescriptorAdapter.java&r1=662630&r2=662685&rev=662685&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/ComponentSetDescriptorAdapter.java (original)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/PluginDescriptor.java Tue Jun  3 00:58:48 2008
@@ -17,59 +17,53 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.plugin;
+package org.apache.geronimo.gshell.plugin.descriptor;
 
 import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 import org.apache.geronimo.gshell.model.command.Command;
-import org.apache.geronimo.gshell.model.command.CommandSet;
-import org.codehaus.plexus.component.repository.ComponentDescriptor;
+import org.apache.geronimo.gshell.model.plugin.Plugin;
 import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
 
 /**
- * ???
+ * Descriptor for a GShell plugin's plexus component set.
  *
  * @version $Rev$ $Date$
  */
-public class ComponentSetDescriptorAdapter
+public class PluginDescriptor
     extends ComponentSetDescriptor
 {
-    private final CommandSet commands;
+    private final Plugin plugin;
 
-    public ComponentSetDescriptorAdapter(final CommandSet commands) {
-        assert commands != null;
+    public PluginDescriptor(final Plugin plugin) {
+        assert plugin != null;
 
-        this.commands = commands;
+        this.plugin = plugin;
 
-        setId(commands.getId());
+        setId(plugin.getId());
 
         setIsolatedRealm(false);
 
-        if (!commands.isEmpty()) {
-            for (Command command : commands.getCommands()) {
-                ComponentDescriptor component = new ComponentDescriptorAdapter(command);
-                
-                addComponentDescriptor(component);
-
-                //
-                // TODO: Should we attach our selves?
-                //
-                // component.setComponentSetDescriptor(this);
-            }
+        for (Command command : plugin.commands()) {
+            addCommand(command);
         }
+    }
 
-        //
-        // TODO: Need to figure out dependencies
-        //
+    private void addCommand(final Command command) {
+        assert command != null;
         
-        setDependencies(null);
+        CommandDescriptor descriptor = new CommandDescriptor(command);
+        descriptor.setComponentSetDescriptor(this);
+        descriptor.setSource(getSource());
+
+        addComponentDescriptor(descriptor);
     }
 
-    public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+    public Plugin getPlugin() {
+        return plugin;
     }
 
-    public CommandSet getCommands() {
-        return commands;
+    public String toString() {
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
     }
-}
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/PluginDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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



Mime
View raw message