geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r659612 - 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/descriptor/ gshell-core/src/main/java/org/apache/geroni...
Date Fri, 23 May 2008 18:06:35 GMT
Author: jdillon
Date: Fri May 23 11:06:34 2008
New Revision: 659612

URL: http://svn.apache.org/viewvc?rev=659612&view=rev
Log:
Move the commands.xml descriptor bits to gshell-model

Added:
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java
  (contents, props changed)
      - copied, changed from r659511, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java
  (contents, props changed)
      - copied, changed from r659511, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSetMarshaller.java
      - copied, changed from r659500, 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/command/Parameter.java
  (contents, props changed)
      - copied, changed from r659500, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandParameter.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java
  (contents, props changed)
      - copied, changed from r659500, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandRequirement.java
    geronimo/gshell/trunk/gshell-model/src/test/java/org/apache/geronimo/gshell/model/command/
Removed:
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/
    geronimo/gshell/trunk/gshell-core/src/test/java/org/apache/geronimo/gshell/descriptor/
    geronimo/gshell/trunk/gshell-core/src/test/resources/org/apache/geronimo/gshell/layout/
Modified:
    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-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/plugin/CommandCollector.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoverer.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/ComponentDescriptorAdapter.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/ComponentSetDescriptorAdapter.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.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/common/ModelRoot.java

Modified: 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/CommandDescriptorExtractor.java?rev=659612&r1=659611&r2=659612&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/CommandDescriptorExtractor.java
Fri May 23 11:06:34 2008
@@ -27,7 +27,7 @@
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.geronimo.gshell.descriptor.CommandDescriptor;
+import org.apache.geronimo.gshell.model.command.Command;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.DirectoryScanner;
@@ -35,7 +35,7 @@
 import org.slf4j.LoggerFactory;
 
 /**
- * Extracts {@link CommandDescriptor} instances from class files.
+ * Extracts {@link org.apache.geronimo.gshell.model.command.Command} instances from class
files.
  *
  * @version $Id$
  */
@@ -51,7 +51,7 @@
 
     private CommandDescriptorGleaner gleaner = new CommandDescriptorGleaner();
 
-    public List<CommandDescriptor> extract(final MavenProject project, final Scope
scope) throws Exception {
+    public List<Command> extract(final MavenProject project, final Scope scope) throws
Exception {
         assert project != null;
         assert scope != null;
 
@@ -117,11 +117,11 @@
         return new URLClassLoader(urls, getClass().getClassLoader());
     }
 
-    private List<CommandDescriptor> extract(final File classesDir, final ClassLoader
cl) throws Exception {
+    private List<Command> extract(final File classesDir, final ClassLoader cl) throws
Exception {
         assert classesDir != null;
         assert cl != null;
 
-        List<CommandDescriptor> descriptors = new ArrayList<CommandDescriptor>();
+        List<Command> descriptors = new ArrayList<Command>();
 
         DirectoryScanner scanner = new DirectoryScanner();
         scanner.setBasedir(classesDir);
@@ -142,7 +142,7 @@
 
                 log.debug("Gleaning from: {}", type);
 
-                CommandDescriptor command = gleaner.glean(type);
+                Command command = gleaner.glean(type);
                 
                 if (command != null) {
                     descriptors.add(command);

Modified: 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/CommandDescriptorGleaner.java?rev=659612&r1=659611&r2=659612&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/CommandDescriptorGleaner.java
Fri May 23 11:06:34 2008
@@ -27,11 +27,9 @@
 import java.util.Map;
 
 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.CommandParameter;
-import org.apache.geronimo.gshell.descriptor.CommandDescriptor;
-import org.apache.geronimo.gshell.descriptor.CommandRequirement;
+import org.apache.geronimo.gshell.model.command.Parameter;
+import org.apache.geronimo.gshell.model.command.Command;
+import org.apache.geronimo.gshell.model.command.Requirement;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -80,7 +78,7 @@
         return buff.toString().trim().toLowerCase();
     }
 
-    public CommandDescriptor glean(final Class clazz) throws Exception {
+    public Command glean(final Class clazz) throws Exception {
         assert clazz != null;
 
         // Cast to <?> so that we don't have to cast below
@@ -99,7 +97,7 @@
 
         log.debug("Creating descriptor for: {}", type);
 
-        CommandDescriptor command = new CommandDescriptor();
+        Command command = new Command();
 
         //
         // TODO: Set the source...
@@ -115,13 +113,13 @@
 
         for (Class t : getClasses(type)) {
             for (Field field : t.getDeclaredFields()) {
-                CommandRequirement requirement = findRequirement(field);
+                Requirement requirement = findRequirement(field);
 
                 if (requirement != null) {
                     command.addRequirement(requirement);
                 }
 
-                CommandParameter parameter = findParameter(field);
+                Parameter parameter = findParameter(field);
 
                 if (parameter != null) {
                     command.addParameter(parameter);
@@ -156,10 +154,10 @@
         return classes;
     }
 
-    private CommandRequirement findRequirement(final Field field) {
+    private Requirement findRequirement(final Field field) {
         assert field != null;
 
-        Requirement anno = field.getAnnotation(Requirement.class);
+        org.apache.geronimo.gshell.command.annotation.Requirement anno = field.getAnnotation(org.apache.geronimo.gshell.command.annotation.Requirement.class);
 
         if (anno == null) {
             return null;
@@ -167,7 +165,7 @@
 
         Class<?> type = field.getType();
 
-        CommandRequirement requirement = new CommandRequirement();
+        Requirement requirement = new Requirement();
 
         if (isRequirementListType(type)) {
             requirement.setCollection(true);
@@ -193,10 +191,10 @@
         return requirement;
     }
 
-    private CommandParameter findParameter(final Field field) {
+    private Parameter findParameter(final Field field) {
         assert field != null;
 
-        Parameter anno = field.getAnnotation(Parameter.class);
+        org.apache.geronimo.gshell.command.annotation.Parameter anno = field.getAnnotation(org.apache.geronimo.gshell.command.annotation.Parameter.class);
 
         if (anno == null) {
             return null;
@@ -212,6 +210,6 @@
 
         String value = filterEmptyAsNull(anno.value());
 
-        return new CommandParameter(name, value);
+        return new Parameter(name, value);
     }
 }
\ No newline at end of file

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=659612&r1=659611&r2=659612&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
Fri May 23 11:06:34 2008
@@ -25,8 +25,9 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.geronimo.gshell.descriptor.CommandDescriptor;
-import org.apache.geronimo.gshell.descriptor.CommandSetDescriptor;
+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.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -89,12 +90,12 @@
         assert scope != null;
         assert outputFile != null;
 
-        List<CommandDescriptor> descriptors = new ArrayList<CommandDescriptor>();
+        List<Command> descriptors = new ArrayList<Command>();
 
         CommandDescriptorExtractor extractor = new CommandDescriptorExtractor();
 
         try {
-            List<CommandDescriptor> list = extractor.extract(project, scope);
+            List<Command> list = extractor.extract(project, scope);
 
             if (list != null && !list.isEmpty()) {
                 descriptors.addAll(list);
@@ -110,7 +111,7 @@
         else {
             getLog().info("Discovered " + descriptors.size() + " command descriptors(s)");
 
-            CommandSetDescriptor commands = new CommandSetDescriptor(project.getId()); //
.getArtifactId());
+            CommandSet commands = new CommandSet(project.getId()); // .getArtifactId());
             commands.setCommands(descriptors);
 
             try {
@@ -122,7 +123,7 @@
         }
     }
 
-    private void writeDescriptor(final CommandSetDescriptor commands, final File outputFile)
throws Exception {
+    private void writeDescriptor(final CommandSet commands, final File outputFile) throws
Exception {
         assert commands != null;
         assert outputFile != null;
 
@@ -130,8 +131,10 @@
 
         BufferedWriter output = new BufferedWriter(new FileWriter(outputFile));
 
+        CommandSetMarshaller marshaller = new CommandSetMarshaller();
+
         try {
-            CommandSetDescriptor.toXML(commands, output);
+            marshaller.marshal(commands, output);
             output.flush();
         }
         finally {

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java?rev=659612&r1=659611&r2=659612&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandCollector.java
Fri May 23 11:06:34 2008
@@ -19,8 +19,8 @@
 
 package org.apache.geronimo.gshell.plugin;
 
-import org.apache.geronimo.gshell.descriptor.CommandDescriptor;
-import org.apache.geronimo.gshell.descriptor.CommandSetDescriptor;
+import org.apache.geronimo.gshell.model.command.Command;
+import org.apache.geronimo.gshell.model.command.CommandSet;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.discovery.ComponentDiscoveryEvent;
 import org.codehaus.plexus.component.discovery.ComponentDiscoveryListener;
@@ -46,7 +46,7 @@
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    private Map<String,CommandDescriptor> descriptors = new HashMap<String,CommandDescriptor>();
+    private Map<String, Command> descriptors = new HashMap<String, Command>();
 
     public CommandCollector() {
         log.trace("Created: {}", this);
@@ -64,9 +64,9 @@
         ComponentSetDescriptor components = event.getComponentSetDescriptor();
 
         if (components instanceof ComponentSetDescriptorAdapter) {
-            CommandSetDescriptor commands = ((ComponentSetDescriptorAdapter)components).getCommands();
+            CommandSet commands = ((ComponentSetDescriptorAdapter)components).getCommands();
 
-            for (CommandDescriptor descriptor : commands.getCommands()) {
+            for (Command descriptor : commands.getCommands()) {
                 log.debug("Found: {}", descriptor);
 
                 descriptors.put(descriptor.getId(), descriptor);
@@ -74,7 +74,7 @@
         }
     }
 
-    public CommandDescriptor getCommandDescriptor(final String id) {
+    public Command getCommandDescriptor(final String id) {
         assert id != null;
 
         log.debug("Lookup descriptor for ID: {}", id);

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoverer.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoverer.java?rev=659612&r1=659611&r2=659612&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoverer.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/CommandDiscoverer.java
Fri May 23 11:06:34 2008
@@ -20,7 +20,8 @@
 package org.apache.geronimo.gshell.plugin;
 
 import com.thoughtworks.xstream.XStreamException;
-import org.apache.geronimo.gshell.descriptor.CommandSetDescriptor;
+import org.apache.geronimo.gshell.model.command.CommandSet;
+import org.apache.geronimo.gshell.model.command.CommandSetMarshaller;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.discovery.AbstractComponentDiscoverer;
 import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
@@ -53,8 +54,9 @@
 
         log.debug("Loading descriptors from: {}", source);
 
+        CommandSetMarshaller marshaller = new CommandSetMarshaller();
         try {
-            CommandSetDescriptor commands = CommandSetDescriptor.fromXML(reader);
+            CommandSet commands = marshaller.unmarshal(reader);
 
             log.debug("Loaded command set: {}", commands.getId());
 

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/ComponentDescriptorAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/ComponentDescriptorAdapter.java?rev=659612&r1=659611&r2=659612&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/ComponentDescriptorAdapter.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/ComponentDescriptorAdapter.java
Fri May 23 11:06:34 2008
@@ -19,12 +19,11 @@
 
 package org.apache.geronimo.gshell.plugin;
 
-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.CommandDescriptor;
-import org.apache.geronimo.gshell.descriptor.CommandParameter;
-import org.apache.geronimo.gshell.descriptor.CommandRequirement;
+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;
@@ -39,9 +38,9 @@
 public class ComponentDescriptorAdapter
     extends ComponentDescriptor
 {
-    private final CommandDescriptor command;
+    private final Command command;
 
-    public ComponentDescriptorAdapter(final CommandDescriptor command) {
+    public ComponentDescriptorAdapter(final Command command) {
         assert command != null;
 
         this.command = command;
@@ -56,7 +55,7 @@
 
         setAlias(null);
 
-        setRole(Command.class.getName());
+        setRole(org.apache.geronimo.gshell.command.Command.class.getName());
 
         setRoleHint(command.getId());
 
@@ -85,7 +84,7 @@
         if (command.hasParameters()) {
             XmlPlexusConfiguration root = new XmlPlexusConfiguration("configuration");
 
-            for (CommandParameter param : command.getParameters()) {
+            for (Parameter param : command.getParameters()) {
                 XmlPlexusConfiguration child = new XmlPlexusConfiguration(param.getName());
 
                 child.setValue(param.getValue());
@@ -97,7 +96,7 @@
         }
 
         if (command.hasRequirements()) {
-            for (CommandRequirement requirement : command.getRequirements()) {
+            for (Requirement requirement : command.getRequirements()) {
                 addRequirement(translate(requirement));
             }
         }
@@ -107,7 +106,7 @@
         //
     }
 
-    private ComponentRequirement translate(final CommandRequirement source) {
+    private ComponentRequirement translate(final Requirement source) {
         assert source != null;
 
         ComponentRequirement requirement = new ComponentRequirement();
@@ -127,7 +126,7 @@
         return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
     }
     
-    public CommandDescriptor getCommand() {
+    public Command getCommand() {
         return command;
     }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/ComponentSetDescriptorAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/ComponentSetDescriptorAdapter.java?rev=659612&r1=659611&r2=659612&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/ComponentSetDescriptorAdapter.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/ComponentSetDescriptorAdapter.java
Fri May 23 11:06:34 2008
@@ -21,8 +21,8 @@
 
 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.CommandSetDescriptor;
+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.codehaus.plexus.component.repository.ComponentSetDescriptor;
 
@@ -34,9 +34,9 @@
 public class ComponentSetDescriptorAdapter
     extends ComponentSetDescriptor
 {
-    private final CommandSetDescriptor commands;
+    private final CommandSet commands;
 
-    public ComponentSetDescriptorAdapter(final CommandSetDescriptor commands) {
+    public ComponentSetDescriptorAdapter(final CommandSet commands) {
         assert commands != null;
 
         this.commands = commands;
@@ -46,7 +46,7 @@
         setIsolatedRealm(false);
 
         if (!commands.isEmpty()) {
-            for (CommandDescriptor command : commands.getCommands()) {
+            for (Command command : commands.getCommands()) {
                 ComponentDescriptor component = new ComponentDescriptorAdapter(command);
                 
                 addComponentDescriptor(component);
@@ -69,7 +69,7 @@
         return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
     }
 
-    public CommandSetDescriptor getCommands() {
+    public CommandSet getCommands() {
         return commands;
     }
 }

Modified: geronimo/gshell/trunk/gshell-core/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/plugin/PlexusCommandWrapper.java?rev=659612&r1=659611&r2=659612&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/PlexusCommandWrapper.java
Fri May 23 11:06:34 2008
@@ -19,9 +19,8 @@
 
 package org.apache.geronimo.gshell.plugin;
 
-import org.apache.geronimo.gshell.command.Command;
 import org.apache.geronimo.gshell.command.CommandContext;
-import org.apache.geronimo.gshell.descriptor.CommandDescriptor;
+import org.apache.geronimo.gshell.model.command.Command;
 import org.codehaus.plexus.PlexusContainer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -34,15 +33,15 @@
  * @version $Rev: 581061 $ $Date: 2007-10-01 22:18:31 +0200 (Mon, 01 Oct 2007) $
  */
 public class PlexusCommandWrapper
-    implements Command
+    implements org.apache.geronimo.gshell.command.Command
 {
     private Logger log = LoggerFactory.getLogger(getClass());
 
-    private CommandDescriptor descriptor;
+    private Command descriptor;
 
     private PlexusContainer container;
 
-    public PlexusCommandWrapper(final PlexusContainer container, final CommandDescriptor
descriptor) {
+    public PlexusCommandWrapper(final PlexusContainer container, final Command descriptor)
{
         this.container = container;
         this.descriptor = descriptor;
     }
@@ -63,7 +62,7 @@
 
         PlexusContainer childContainer = container.createChildContainer(realmId, container.getContainerRealm());
 
-        Command command = (Command) childContainer.lookup(Command.class, descriptor.getId());
+        org.apache.geronimo.gshell.command.Command command = (org.apache.geronimo.gshell.command.Command)
childContainer.lookup(org.apache.geronimo.gshell.command.Command.class, descriptor.getId());
 
         Object result;
 

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=659612&r1=659611&r2=659612&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
Fri May 23 11:06:34 2008
@@ -19,8 +19,7 @@
 
 package org.apache.geronimo.gshell.registry;
 
-import org.apache.geronimo.gshell.command.Command;
-import org.apache.geronimo.gshell.descriptor.CommandDescriptor;
+import org.apache.geronimo.gshell.model.command.Command;
 import org.apache.geronimo.gshell.plugin.CommandCollector;
 import org.apache.geronimo.gshell.plugin.PlexusCommandWrapper;
 import org.codehaus.plexus.PlexusConstants;
@@ -56,7 +55,7 @@
     @Requirement
     private CommandCollector collector;
     
-    private Map<String, Command> commands = new HashMap<String, Command>();
+    private Map<String, org.apache.geronimo.gshell.command.Command> commands = new
HashMap<String, org.apache.geronimo.gshell.command.Command>();
 
     public void contextualize(Context context) throws ContextException {
         assert context != null;
@@ -71,7 +70,7 @@
         log.debug("Collector: {}", collector);
     }
 
-    public void register(final Command command) throws DuplicateRegistrationException {
+    public void register(final org.apache.geronimo.gshell.command.Command command) throws
DuplicateRegistrationException {
         assert command != null;
 
         String id = command.getId();
@@ -88,7 +87,7 @@
         assert id != null;
         
         if (!commands.containsKey(id)) {
-            CommandDescriptor descriptor = collector.getCommandDescriptor(id);
+            Command descriptor = collector.getCommandDescriptor(id);
 
             if (descriptor == null) {
                 throw new NotRegisteredException(id);
@@ -100,7 +99,7 @@
         }
     }
 
-    public void unregister(final Command command) throws RegistryException {
+    public void unregister(final org.apache.geronimo.gshell.command.Command command) throws
RegistryException {
         assert command != null;
 
         String id = command.getId();
@@ -111,7 +110,7 @@
         log.debug("Unregistered: {}", id);
     }
 
-    public Command lookup(final String id) throws RegistryException {
+    public org.apache.geronimo.gshell.command.Command lookup(final String id) throws RegistryException
{
         assert id != null;
 
         ensureRegistered(id);
@@ -119,7 +118,7 @@
         return commands.get(id);
     }
 
-    public Collection<Command> commands() {
+    public Collection<org.apache.geronimo.gshell.command.Command> commands() {
         return Collections.unmodifiableCollection(commands.values());
     }
 }
\ No newline at end of file

Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java
(from r659511, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java&r1=659511&r2=659612&rev=659612&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandDescriptor.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java
Fri May 23 11:06:34 2008
@@ -17,11 +17,10 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.descriptor;
+package org.apache.geronimo.gshell.model.command;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
-import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+import org.apache.geronimo.gshell.model.common.ModelElement;
 
 import java.net.URI;
 import java.util.ArrayList;
@@ -33,7 +32,8 @@
  * @version $Rev$ $Date$
  */
 @XStreamAlias("command")
-public class CommandDescriptor
+public class Command
+    extends ModelElement
 {
     private URI source;
 
@@ -45,15 +45,13 @@
 
     private String version;
 
-    private List<CommandParameter> parameters;
+    //
+    // FIXME: Make collection accessors null-safe
+    //
+    
+    private List<Parameter> parameters;
 
-    private List<CommandRequirement> requirements;
-
-    private List<CommandDependency> dependencies;
-
-    public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
-    }
+    private List<Requirement> requirements;
 
     public URI getSource() {
         return source;
@@ -95,19 +93,19 @@
         this.version = version;
     }
 
-    public List<CommandParameter> getParameters() {
+    public List<Parameter> getParameters() {
         return parameters;
     }
 
-    public void setParameters(final List<CommandParameter> parameters) {
+    public void setParameters(final List<Parameter> parameters) {
         this.parameters = parameters;
     }
 
-    public void addParameter(final CommandParameter parameter) {
+    public void addParameter(final Parameter parameter) {
         assert parameter != null;
 
         if (parameters == null) {
-            parameters = new ArrayList<CommandParameter>();
+            parameters = new ArrayList<Parameter>();
         }
 
         parameters.add(parameter);
@@ -117,19 +115,19 @@
         return parameters != null;
     }
 
-    public List<CommandRequirement> getRequirements() {
+    public List<Requirement> getRequirements() {
         return requirements;
     }
 
-    public void setRequirements(final List<CommandRequirement> requirements) {
+    public void setRequirements(final List<Requirement> requirements) {
         this.requirements = requirements;
     }
 
-    public void addRequirement(final CommandRequirement requirement) {
+    public void addRequirement(final Requirement requirement) {
         assert requirement != null;
 
         if (requirements == null) {
-            requirements = new ArrayList<CommandRequirement>();
+            requirements = new ArrayList<Requirement>();
         }
 
         requirements.add(requirement);
@@ -138,26 +136,4 @@
     public boolean hasRequirements() {
         return requirements != null;
     }
-
-    public List<CommandDependency> getDependencies() {
-        return dependencies;
-    }
-
-    public void setDependencies(final List<CommandDependency> dependencies) {
-        this.dependencies = dependencies;
-    }
-
-    public void addDependency(final CommandDependency dependency) {
-        assert dependency != null;
-
-        if (dependencies == null) {
-            dependencies = new ArrayList<CommandDependency>();
-        }
-
-        dependencies.add(dependency);
-    }
-
-    public boolean hasDependencies() {
-        return dependencies != null;
-    }
 }
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Command.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java
(from r659511, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java&r1=659511&r2=659612&rev=659612&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandSetDescriptor.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java
Fri May 23 11:06:34 2008
@@ -17,17 +17,12 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.descriptor;
+package org.apache.geronimo.gshell.model.command;
 
-import com.thoughtworks.xstream.XStream;
-import com.thoughtworks.xstream.annotations.Annotations;
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-import com.thoughtworks.xstream.io.xml.DomDriver;
 import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 
-import java.io.Reader;
-import java.io.Writer;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -36,19 +31,23 @@
  *
  * @version $Rev$ $Date$
  */
+// FIXME: Use consistent case for XML tags
 @XStreamAlias("command-set")
-public class CommandSetDescriptor
+public class CommandSet
 {
     private String id;
 
     private String description;
 
-    private List<CommandDescriptor> commands;
+    //
+    // FIXME: Make collection accessors null-safe
+    //
 
-    public CommandSetDescriptor() {
-    }
+    private List<Command> commands;
 
-    public CommandSetDescriptor(final String id) {
+    public CommandSet() {}
+
+    public CommandSet(final String id) {
         this.id = id;
     }
 
@@ -72,26 +71,26 @@
         this.description = description;
     }
 
-    public List<CommandDescriptor> getCommands() {
+    public List<Command> getCommands() {
         return commands;
     }
 
-    public void setCommands(final List<CommandDescriptor> commands) {
+    public void setCommands(final List<Command> commands) {
         this.commands = commands;
     }
 
-    public void addCommand(final CommandDescriptor command) {
+    public void addCommand(final Command command) {
         assert command != null;
 
         if (commands == null) {
-            commands = new ArrayList<CommandDescriptor>();
+            commands = new ArrayList<Command>();
         }
 
         commands.add(command);
     }
 
     public int size() {
-        List<CommandDescriptor> list = getCommands();
+        List<Command> list = getCommands();
 
         if (list != null) {
             return list.size();
@@ -103,40 +102,4 @@
     public boolean isEmpty() {
         return size() == 0;
     }
-
-    //
-    // XML Conversion
-    //
-
-    private static XStream createXStream() {
-        XStream xs = new XStream(new DomDriver());
-
-        Annotations.configureAliases(xs,
-                CommandSetDescriptor.class,
-                CommandDescriptor.class,
-                CommandRequirement.class,
-                CommandParameter.class,
-                CommandDependency.class);
-
-        return xs;
-    }
-
-    public static CommandSetDescriptor fromXML(final Reader input) {
-        assert input != null;
-
-        return (CommandSetDescriptor) createXStream().fromXML(input);
-    }
-
-    public static String toXML(final CommandSetDescriptor commands) {
-        assert commands != null;
-
-        return createXStream().toXML(commands);
-    }
-
-    public static void toXML(final CommandSetDescriptor commands, final Writer writer) {
-        assert commands != null;
-        assert writer != null;
-
-        createXStream().toXML(commands, writer);
-    }
 }
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSetMarshaller.java
(from r659500, 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/command/CommandSetMarshaller.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/CommandSetMarshaller.java&p1=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationMarshaller.java&r1=659500&r2=659612&rev=659612&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/command/CommandSetMarshaller.java
Fri May 23 11:06:34 2008
@@ -17,30 +17,24 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.model.application;
+package org.apache.geronimo.gshell.model.command;
 
 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;
+
+//
+// FIXME: Remove this guy, once we have the Plugin descriptor hooked up.
+//
 
 /**
- * Marshaller for {@link Application} models.
+ * Marshaller for {@link CommandSet} models.
  *
  * @version $Rev$ $Date$
  */
-public class ApplicationMarshaller
-    extends MarshallerSupport<Application>
+@Deprecated
+public class CommandSetMarshaller
+    extends MarshallerSupport<CommandSet>
 {
-    public ApplicationMarshaller() {
-        super(Application.class);
-    }
-
-    @Override
-    protected void configure(final XStream xs) {
-        super.configure(xs);
-
-        // Need to provide some additional configuration to tell XStream about the Layout's
node sub-classes
-        configureAnnotations(xs, CommandNode.class, AliasNode.class);
+    public CommandSetMarshaller() {
+        super(CommandSet.class);
     }
 }
\ No newline at end of file

Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java
(from r659500, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandParameter.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandParameter.java&r1=659500&r2=659612&rev=659612&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandParameter.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java
Fri May 23 11:06:34 2008
@@ -17,11 +17,10 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.descriptor;
+package org.apache.geronimo.gshell.model.command;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
-import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+import org.apache.geronimo.gshell.model.common.ModelElement;
 
 /**
  * Describes a comand parameter.
@@ -29,21 +28,18 @@
  * @version $Rev$ $Date$
  */
 @XStreamAlias("parameter")
-public class CommandParameter
+public class Parameter
+    extends ModelElement
 {
     private String name;
 
     private String value;
 
-    public CommandParameter(final String name, final String value) {
+    public Parameter(final String name, final String value) {
         this.name = name;
         this.value = value;
     }
 
-    public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
-    }
-
     public String getName() {
         return name;
     }

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Parameter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java
(from r659500, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandRequirement.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java?p2=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandRequirement.java&r1=659500&r2=659612&rev=659612&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/descriptor/CommandRequirement.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java
Fri May 23 11:06:34 2008
@@ -17,11 +17,10 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.descriptor;
+package org.apache.geronimo.gshell.model.command;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
-import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+import org.apache.geronimo.gshell.model.common.ModelElement;
 
 /**
  * Describes a required component of a command.
@@ -29,7 +28,8 @@
  * @version $Rev$ $Date$
  */
 @XStreamAlias("requirement")
-public class CommandRequirement
+public class Requirement
+    extends ModelElement
 {
     private String name;
 
@@ -39,10 +39,6 @@
 
     private Boolean collection;
 
-    public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
-    }
-
     public String getName() {
         return name;
     }

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/command/Requirement.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ModelRoot.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ModelRoot.java?rev=659612&r1=659611&r2=659612&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ModelRoot.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/ModelRoot.java
Fri May 23 11:06:34 2008
@@ -19,6 +19,8 @@
 
 package org.apache.geronimo.gshell.model.common;
 
+import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
+
 /**
  * Base class for root model elements.
  *
@@ -27,5 +29,14 @@
 public abstract class ModelRoot
     extends ModelElement
 {
-    // Version?
+    @XStreamAsAttribute
+    private String version;
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(final String version) {
+        this.version = version;
+    }
 }
\ No newline at end of file



Mime
View raw message