geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r659528 - in /geronimo/gshell/trunk: gshell-assembly/ gshell-assembly/src/main/underlay/etc/ gshell-commands/gshell-bsf/src/main/resources/ gshell-commands/gshell-builtins/src/main/resources/ gshell-commands/gshell-optional/src/main/resourc...
Date Fri, 23 May 2008 13:03:34 GMT
Author: jdillon
Date: Fri May 23 06:03:34 2008
New Revision: 659528

URL: http://svn.apache.org/viewvc?rev=659528&view=rev
Log:
Add repository/resolve command

Added:
    geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java
      - copied, changed from r659500, geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/SleepCommand.java
Removed:
    geronimo/gshell/trunk/gshell-commands/gshell-bsf/src/main/resources/
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/
    geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/resources/
    geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/resources/
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/resources/
Modified:
    geronimo/gshell/trunk/gshell-assembly/pom.xml
    geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
    geronimo/gshell/trunk/gshell-commands/gshell-repository/pom.xml

Modified: geronimo/gshell/trunk/gshell-assembly/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/pom.xml?rev=659528&r1=659527&r2=659528&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/pom.xml Fri May 23 06:03:34 2008
@@ -66,6 +66,12 @@
 
         <dependency>
             <groupId>org.apache.geronimo.gshell.commands</groupId>
+            <artifactId>gshell-repository</artifactId>
+        </dependency>
+
+        <!--
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.commands</groupId>
             <artifactId>gshell-bsf</artifactId>
         </dependency>
 
@@ -94,6 +100,7 @@
             <groupId>org.apache.geronimo.gshell.remote</groupId>
             <artifactId>gshell-remote-server</artifactId>
         </dependency>
+        -->
 
         <dependency>
             <groupId>org.slf4j</groupId>

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=659528&r1=659527&r2=659528&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 Fri May 23
06:03:34 2008
@@ -57,6 +57,10 @@
                 <artifactId>gshell-optional</artifactId>
             </dependency>
 
+            <dependency>
+                <artifactId>gshell-repository</artifactId>
+            </dependency>
+
             <!--
             <dependency>
                 <artifactId>gshell-bsf</artifactId>
@@ -156,6 +160,16 @@
                 </nodes>
             </group>
 
+            <group>
+                <name>repository</name>
+                <nodes>
+                    <command>
+                        <name>resolve</name>
+                        <id>gshell-repository:resolve</id>
+                    </command>
+                </nodes>
+            </group>
+
             <!--
             <group>
                 <name>bsf</name>

Modified: geronimo/gshell/trunk/gshell-commands/gshell-repository/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-repository/pom.xml?rev=659528&r1=659527&r2=659528&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-repository/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-repository/pom.xml Fri May 23 06:03:34 2008
@@ -37,4 +37,11 @@
         Provides commands to opperate on the repository.
     </description>
 
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-artifact</artifactId>
+        </dependency>
+    </dependencies>
+    
 </project>

Copied: geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java
(from r659500, geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/SleepCommand.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java?p2=geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java&p1=geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/SleepCommand.java&r1=659500&r2=659528&rev=659528&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/SleepCommand.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java
Fri May 23 06:03:34 2008
@@ -17,36 +17,78 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.commands.optional;
+package org.apache.geronimo.gshell.commands.repository;
 
-import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.artifact.ArtifactManager;
+import org.apache.geronimo.gshell.clp.Option;
 import org.apache.geronimo.gshell.command.CommandSupport;
 import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.command.annotation.Requirement;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+
+import java.util.Collections;
 
 /**
- * Sleep... zzzZ
+ * Resolve repository artifacts.
  *
  * @version $Rev$ $Date$
  */
-@CommandComponent(id="gshell-optional:sleep", description="Sleep for a bit then wake up")
-public class SleepCommand
+@CommandComponent(id="gshell-repository:resolve", description="Resolve repository artifacts")
+public class ResolveCommand
     extends CommandSupport
 {
-    @Argument(description="Time in milliseconds", required=true)
-    private int time = -1;
+    @Requirement
+    private ArtifactManager artifactManager;
+
+    //
+    // TODO: Consider using <g>:<a>:<v>:<t> notation instead of this?
+    //
     
+    @Option(name="-g", aliases={"--groupId"}, argumentRequired=true, metaVar="GROUP-ID",
required=true, description="Specify the artifact's groupId")
+    private String groupId;
+
+    @Option(name="-a", aliases={"--artifactId"}, argumentRequired=true, metaVar="ARTIFACT-ID",
required=true, description="Specify the artifact's artifactId")
+    private String artifactId;
+
+    @Option(name="-v", aliases={"--version"}, argumentRequired=true, metaVar="VERSION", required=true,
description="Specify the artifact's version")
+    private String version;
+
+    @Option(name="-t", aliases={"--type"}, argumentRequired=true, metaVar="TYPE", description="Specify
the artifact's type")
+    private String type = "jar";
+
+    @Option(name="-s", aliases={"--scope"}, argumentRequired=true, metaVar="SCOPE", description="Specify
the resolution scope")
+    private String scope;
+
     protected Object doExecute() throws Exception {
-        log.info("Sleeping for " + time);
+        assert artifactManager != null;
 
-        try {
-            Thread.sleep(time);
-        }
-        catch (InterruptedException ignore) {
-            log.debug("Sleep was interrupted... :-(");
+        ArtifactFactory factory = artifactManager.getArtifactFactory();
+
+        ArtifactResolutionRequest request = new ArtifactResolutionRequest();
+
+        Artifact originating = factory.createArtifact("dummy", "dummy", "dummy", null, "jar");
+        request.setArtifact(originating);
+
+        if (scope != null) {
+            request.setFilter(new ScopeArtifactFilter(scope));
         }
 
-        log.info("Awake now");
+        Artifact artifact = factory.createArtifact(groupId, artifactId, version, scope, type);
+
+        io.info("Resolving artifact: {}", artifact);
+        
+        request.setArtifactDependencies(Collections.singleton(artifact));
+
+        ArtifactResolutionResult result = artifactManager.resolve(request);
+
+        //
+        // TODO: Do something with the result?
+        //
 
         return SUCCESS;
     }
-}
+}
\ No newline at end of file



Mime
View raw message