You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/06/05 14:02:03 UTC

svn commit: r663562 - in /geronimo/gshell/trunk: gshell-assembly/src/main/underlay/etc/ gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/

Author: jdillon
Date: Thu Jun  5 05:02:02 2008
New Revision: 663562

URL: http://svn.apache.org/viewvc?rev=663562&view=rev
Log:
Tidy up plexus descriptor muck a wee bitskie

Added:
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/ComponentDescriptorSupport.java
      - copied, changed from r663545, geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandContainerDescriptor.java
Modified:
    geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-log4j.properties
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandContainerDescriptor.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandDescriptor.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/PluginDescriptor.java

Modified: geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-log4j.properties
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-log4j.properties?rev=663562&r1=663561&r2=663562&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-log4j.properties (original)
+++ geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-log4j.properties Thu Jun  5 05:02:02 2008
@@ -46,6 +46,7 @@
 log4j.logger.org.apache.geronimo.gshell.artifact.GShellArtifactMetadataSource=DEBUG
 log4j.logger.org.apache.geronimo.gshell.artifact.monitor.ProgressSpinnerMonitor=INFO
 log4j.logger.org.apache.geronimo.gshell.application.ApplicationSecurityManager=DEBUG
+log4j.logger.org.apache.geronimo.gshell.model.interpolate.InterpolatorSupport=DEBUG
 
 #log4j.logger.org.apache.geronimo.gshell.plugin=INFO
 log4j.logger.org.apache.geronimo.gshell.console=INFO

Modified: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandContainerDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandContainerDescriptor.java?rev=663562&r1=663561&r2=663562&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandContainerDescriptor.java (original)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandContainerDescriptor.java Thu Jun  5 05:02:02 2008
@@ -24,7 +24,6 @@
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 import org.apache.geronimo.gshell.model.command.Command;
 import org.apache.geronimo.gshell.plugin.DefaultCommandContainer;
-import org.codehaus.plexus.component.repository.ComponentDescriptor;
 import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
 
 /**
@@ -33,7 +32,7 @@
  * @version $Rev$ $Date$
  */
 public class CommandContainerDescriptor
-    extends ComponentDescriptor
+    extends ComponentDescriptorSupport
 {
     private final Command command;
 
@@ -42,22 +41,15 @@
 
         this.command = command;
 
-        setRole(CommandContainer.class.getName());
-
+        setRole(CommandContainer.class);
         setRoleHint(command.getId());
-
-        setImplementation(DefaultCommandContainer.class.getName());
-
+        setImplementation(DefaultCommandContainer.class);
         setVersion(command.getVersion());
-
         setIsolatedRealm(false);
-
         setInstantiationStrategy("singleton");
 
         XmlPlexusConfiguration config = new XmlPlexusConfiguration("configuration");
-
         config.addChild(new XmlPlexusConfiguration("commandId", command.getId()));
-
         setConfiguration(config);
     }
 

Modified: 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=663562&r1=663561&r2=663562&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandDescriptor.java (original)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandDescriptor.java Thu Jun  5 05:02:02 2008
@@ -24,7 +24,6 @@
 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;
 
@@ -34,7 +33,7 @@
  * @version $Rev$ $Date$
  */
 public class CommandDescriptor
-    extends ComponentDescriptor
+    extends ComponentDescriptorSupport
 {
     private final Command command;
 
@@ -44,44 +43,18 @@
         this.command = command;
 
         setDescription(command.getDescription());
-
-        setAlias(null);
-
-        setRole(org.apache.geronimo.gshell.command.Command.class.getName());
-
+        setRole(org.apache.geronimo.gshell.command.Command.class);
         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);
+                root.addChild(new XmlPlexusConfiguration(param.getName(), param.getValue()));
             }
 
             setConfiguration(root);
@@ -104,11 +77,8 @@
         ComponentRequirement requirement = new ComponentRequirement();
 
         requirement.setRole(source.getType());
-
         requirement.setRoleHint(source.getId());
-
         requirement.setFieldName(source.getName());
-
         requirement.setFieldMappingType(null);
 
         return requirement;

Copied: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/ComponentDescriptorSupport.java (from r663545, geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandContainerDescriptor.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/ComponentDescriptorSupport.java?p2=geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/ComponentDescriptorSupport.java&p1=geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandContainerDescriptor.java&r1=663545&r2=663562&rev=663562&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandContainerDescriptor.java (original)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/ComponentDescriptorSupport.java Thu Jun  5 05:02:02 2008
@@ -19,52 +19,30 @@
 
 package org.apache.geronimo.gshell.plugin.descriptor;
 
-import org.apache.geronimo.gshell.command.CommandContainer;
 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.plugin.DefaultCommandContainer;
 import org.codehaus.plexus.component.repository.ComponentDescriptor;
-import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
 
 /**
  * ???
  *
  * @version $Rev$ $Date$
  */
-public class CommandContainerDescriptor
+public class ComponentDescriptorSupport
     extends ComponentDescriptor
 {
-    private final Command command;
+    public void setRole(final Class type) {
+        assert type != null;
 
-    public CommandContainerDescriptor(final Command command) {
-        assert command != null;
-
-        this.command = command;
-
-        setRole(CommandContainer.class.getName());
-
-        setRoleHint(command.getId());
-
-        setImplementation(DefaultCommandContainer.class.getName());
-
-        setVersion(command.getVersion());
-
-        setIsolatedRealm(false);
-
-        setInstantiationStrategy("singleton");
-
-        XmlPlexusConfiguration config = new XmlPlexusConfiguration("configuration");
-
-        config.addChild(new XmlPlexusConfiguration("commandId", command.getId()));
-
-        setConfiguration(config);
+        super.setRole(type.getName());
     }
 
-    public Command getCommand() {
-        return command;
+    public void setImplementation(final Class type) {
+        assert type != null;
+        
+        super.setImplementation(type.getName());
     }
-    
+
     public String toString() {
         return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
     }

Modified: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/PluginDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/PluginDescriptor.java?rev=663562&r1=663561&r2=663562&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/PluginDescriptor.java (original)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/PluginDescriptor.java Thu Jun  5 05:02:02 2008
@@ -42,7 +42,6 @@
         this.plugin = plugin;
 
         setId(plugin.getId());
-
         setIsolatedRealm(false);
 
         for (Command command : plugin.commands()) {
@@ -53,21 +52,15 @@
     private void addCommand(final Command command) {
         assert command != null;
 
-        ComponentDescriptor descriptor;
-
-        descriptor = new CommandContainerDescriptor(command);
-        descriptor.setSource(getSource());
-        addComponentDescriptor(descriptor);
-
-        descriptor = new CommandDescriptor(command);
-        descriptor.setSource(getSource());
-        addComponentDescriptor(descriptor);
+        addComponentDescriptor(new CommandContainerDescriptor(command));
+        addComponentDescriptor(new CommandDescriptor(command));
     }
 
     public void addComponentDescriptor(final ComponentDescriptor descriptor) {
         assert descriptor != null;
 
         descriptor.setComponentSetDescriptor(this);
+        descriptor.setSource(getSource());
 
         super.addComponentDescriptor(descriptor);
     }