geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r663545 - in /geronimo/gshell/trunk: gshell-api/src/main/java/org/apache/geronimo/gshell/command/ gshell-assembly/src/main/underlay/etc/ gshell-core/src/main/java/org/apache/geronimo/gshell/registry/ gshell-plugin/src/main/java/org/apache/g...
Date Thu, 05 Jun 2008 11:50:36 GMT
Author: jdillon
Date: Thu Jun  5 04:50:35 2008
New Revision: 663545

URL: http://svn.apache.org/viewvc?rev=663545&view=rev
Log:
Added CommandContainer

Added:
    geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java
      - copied, changed from r662817, geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/Command.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/DefaultCommandContainer.java
  (with props)
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandContainerDescriptor.java
      - copied, changed from r662817, geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandDescriptor.java
Modified:
    geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
    geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf
    geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-log4j.properties
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/PlexusCommandWrapper.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/PluginDescriptor.java

Copied: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java
(from r662817, geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/Command.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java?p2=geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java&p1=geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/Command.java&r1=662817&r2=663545&rev=663545&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/Command.java
(original)
+++ geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java
Thu Jun  5 04:50:35 2008
@@ -20,36 +20,13 @@
 package org.apache.geronimo.gshell.command;
 
 /**
- * Provides the basic interface for commands.
- *
+ * ???
+ * 
  * @version $Rev$ $Date$
  */
-public interface Command
+public interface CommandContainer
 {
-    /** Standard command success status code. */
-    Result SUCCESS = Result.SUCCESS;
-
-    /** Standard command failure status code. */
-    Result FAILURE = Result.FAILURE;
-
-    @Deprecated
-    String getId();
-
-    @Deprecated
-    String getDescription();
-
-    /**
-     * Execute the commands behavior.
-     */
+    // TODO: Change to ShellContext, let the container build its own CommandContext
+    
     Object execute(CommandContext context, Object... args) throws Exception;
-
-    //
-    // Result
-    //
-
-    enum Result
-    {
-        SUCCESS,
-        FAILURE
-    }
-}
+}
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml?rev=663545&r1=663544&r2=663545&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml Thu Jun  5
04:50:35 2008
@@ -27,18 +27,12 @@
     <version>1.0-alpha-2-SNAPSHOT</version>
 
     <localRepository>
-        <!-- 
-        FIXME: Update the interpolation muck to auto-resolve relative paths to ${gshell.home}
-        -->
         <directory>${gshell.home}/repository</directory>
     </localRepository>
 
     <remoteRepositories>
         <remoteRepository>
             <id>cache</id>
-            <!-- 
-            FIXME: Allow a normal file path to be used here and auto-converted to a URI
-            -->
             <location>file:${user.home}/.m2/repository</location>
         </remoteRepository>
         
@@ -76,7 +70,6 @@
                 <artifactId>gshell-repository</artifactId>
             </dependency>
 
-            <!--
             <dependency>
                 <artifactId>gshell-bsf</artifactId>
             </dependency>
@@ -84,7 +77,19 @@
             <dependency>
                 <artifactId>gshell-vfs</artifactId>
             </dependency>
-            -->
+        </dependencyGroup>
+
+        <dependencyGroup>
+            <groupId>org.apache.geronimo.gshell.remote</groupId>
+            <version>1.0-alpha-2-SNAPSHOT</version>
+
+            <dependency>
+                <artifactId>gshell-remote-client</artifactId>
+            </dependency>
+
+            <dependency>
+                <artifactId>gshell-remote-server</artifactId>
+            </dependency>
         </dependencyGroup>
     </dependencyGroups>
 
@@ -189,7 +194,6 @@
                 </nodes>
             </group>
 
-            <!--
             <group>
                 <name>bsf</name>
                 <nodes>
@@ -229,7 +233,6 @@
                     </alias>
                 </nodes>
             </group>
-            -->
         </nodes>
     </layout>
 

Modified: geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf?rev=663545&r1=663544&r2=663545&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf (original)
+++ geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/gsh-classworlds.conf Thu Jun
 5 04:50:35 2008
@@ -21,6 +21,10 @@
 ## $Rev$ $Date$
 ##
 
+##
+## FIXME: Drop this file, or hide it as a resource
+##
+
 main is org.apache.geronimo.gshell.cli.Main from gshell
 
 [gshell]

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=663545&r1=663544&r2=663545&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 04:50:35 2008
@@ -21,6 +21,10 @@
 ## $Rev$ $Date$
 ##
 
+##
+## TODO: Change to XML configuration?
+##
+
 log4j.rootCategory=${gshell.log.console.level}, CONSOLE, FILE
 
 log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
@@ -39,6 +43,9 @@
 
 log4j.logger.org.apache.geronimo.gshell.CommandLineBuilder=INFO
 log4j.logger.org.apache.geronimo.gshell.parser.CommandLineParser=INFO
+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.plugin=INFO
 log4j.logger.org.apache.geronimo.gshell.console=INFO

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/PlexusCommandWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/PlexusCommandWrapper.java?rev=663545&r1=663544&r2=663545&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/PlexusCommandWrapper.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/registry/PlexusCommandWrapper.java
Thu Jun  5 04:50:35 2008
@@ -20,6 +20,7 @@
 package org.apache.geronimo.gshell.registry;
 
 import org.apache.geronimo.gshell.command.CommandContext;
+import org.apache.geronimo.gshell.command.CommandContainer;
 import org.apache.geronimo.gshell.model.command.Command;
 import org.apache.geronimo.gshell.plexus.GShellPlexusContainer;
 import org.slf4j.Logger;
@@ -58,10 +59,7 @@
     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());
+        CommandContainer command = container.lookupComponent(CommandContainer.class, descriptor.getId());
 
         return command.execute(context, args);
     }

Added: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/DefaultCommandContainer.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/DefaultCommandContainer.java?rev=663545&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/DefaultCommandContainer.java
(added)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/DefaultCommandContainer.java
Thu Jun  5 04:50:35 2008
@@ -0,0 +1,79 @@
+/*
+ * 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;
+
+import org.apache.geronimo.gshell.command.CommandContainer;
+import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.command.CommandContext;
+import org.apache.geronimo.gshell.plexus.GShellPlexusContainer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.codehaus.plexus.component.annotations.Configuration;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.context.ContextException;
+import org.codehaus.plexus.PlexusConstants;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+@Component(role=CommandContainer.class)
+public class DefaultCommandContainer
+    implements CommandContainer, Contextualizable
+{
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private GShellPlexusContainer container;
+
+    @Configuration("")
+    private String commandId;
+
+    // Contextualizable
+    
+    public void contextualize(final Context context) throws ContextException {
+        assert context != null;
+
+        container = (GShellPlexusContainer) context.get(PlexusConstants.PLEXUS_KEY);
+        assert container != null;
+        log.debug("Container: {}", container);
+    }
+
+    // CommandContainer
+
+    public Object execute(final CommandContext context, final Object... args) throws Exception
{
+        assert context != null;
+        assert args != null;
+
+        log.trace("Executing; context={}, args={}", context, args);
+
+        assert container != null;
+        
+        Command command = container.lookupComponent(Command.class, commandId);
+
+        Object result = command.execute(context, args);
+
+        log.trace("Result: {}", result);
+
+        return result;
+    }
+}
\ No newline at end of file

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

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

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

Copied: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandContainerDescriptor.java
(from r662817, 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/CommandContainerDescriptor.java?p2=geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandContainerDescriptor.java&p1=geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/plugin/descriptor/CommandDescriptor.java&r1=662817&r2=663545&rev=663545&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/CommandContainerDescriptor.java
Thu Jun  5 04:50:35 2008
@@ -19,101 +19,52 @@
 
 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.model.command.Parameter;
-import org.apache.geronimo.gshell.model.command.Requirement;
+import org.apache.geronimo.gshell.plugin.DefaultCommandContainer;
 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
+public class CommandContainerDescriptor
     extends ComponentDescriptor
 {
     private final Command command;
 
-    public CommandDescriptor(final Command command) {
+    public CommandContainerDescriptor(final Command command) {
         assert command != null;
 
         this.command = command;
 
-        setDescription(command.getDescription());
-
-        setAlias(null);
-
-        setRole(org.apache.geronimo.gshell.command.Command.class.getName());
+        setRole(CommandContainer.class.getName());
 
         setRoleHint(command.getId());
 
-        setImplementation(command.getImplementation());
+        setImplementation(DefaultCommandContainer.class.getName());
 
         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());
+        setInstantiationStrategy("singleton");
 
-                child.setValue(param.getValue());
+        XmlPlexusConfiguration config = new XmlPlexusConfiguration("configuration");
 
-                root.addChild(child);
-            }
+        config.addChild(new XmlPlexusConfiguration("commandId", command.getId()));
 
-            setConfiguration(root);
-        }
-
-        if (command.hasRequirements()) {
-            for (Requirement requirement : command.getRequirements()) {
-                addRequirement(translate(requirement));
-            }
-        }
+        setConfiguration(config);
     }
 
     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);
     }

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=663545&r1=663544&r2=663545&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 04:50:35 2008
@@ -24,6 +24,7 @@
 import org.apache.geronimo.gshell.model.command.Command;
 import org.apache.geronimo.gshell.model.plugin.Plugin;
 import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
+import org.codehaus.plexus.component.repository.ComponentDescriptor;
 
 /**
  * Descriptor for a GShell plugin's plexus component set.
@@ -51,14 +52,26 @@
 
     private void addCommand(final Command command) {
         assert command != null;
-        
-        CommandDescriptor descriptor = new CommandDescriptor(command);
-        descriptor.setComponentSetDescriptor(this);
+
+        ComponentDescriptor descriptor;
+
+        descriptor = new CommandContainerDescriptor(command);
         descriptor.setSource(getSource());
+        addComponentDescriptor(descriptor);
 
+        descriptor = new CommandDescriptor(command);
+        descriptor.setSource(getSource());
         addComponentDescriptor(descriptor);
     }
 
+    public void addComponentDescriptor(final ComponentDescriptor descriptor) {
+        assert descriptor != null;
+
+        descriptor.setComponentSetDescriptor(this);
+
+        super.addComponentDescriptor(descriptor);
+    }
+
     public Plugin getPlugin() {
         return plugin;
     }



Mime
View raw message