geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r719952 - in /geronimo/gshell/trunk: gshell-application/src/main/java/org/apache/geronimo/gshell/application/ gshell-application/src/main/java/org/apache/geronimo/gshell/application/model/ gshell-assembly/ gshell-assembly/src/main/underlay/...
Date Sun, 23 Nov 2008 06:07:02 GMT
Author: jdillon
Date: Sat Nov 22 22:07:00 2008
New Revision: 719952

URL: http://svn.apache.org/viewvc?rev=719952&view=rev
Log:
Adding ArtifactResolver abstraction to allow ivy,maven,mercury,whatever to be used to resolve artifacts

Added:
    geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ArtifactResolverImpl.java   (with props)
    geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/resources/
    geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/resources/META-INF/
    geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/resources/META-INF/gshell/
    geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/resources/META-INF/gshell/components.xml   (with props)
    geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactResolverImpl.java   (with props)
    geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/resources/META-INF/gshell/
      - copied from r719823, geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/resources/META-INF/spring/
    geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/resources/META-INF/gshell/components.xml
      - copied unchanged from r719824, geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/resources/META-INF/spring/components.xml
    geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/java/org/apache/geronimo/gshell/artifact/mercury/ArtifactResolverImpl.java   (with props)
    geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/resources/META-INF/
    geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/resources/META-INF/gshell/
    geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/resources/META-INF/gshell/components.xml   (with props)
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactFilter.java   (contents, props changed)
      - copied, changed from r719823, geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactResolver.java
Removed:
    geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/resources/META-INF/spring/
Modified:
    geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/Application.java
    geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/model/ApplicationModel.java
    geronimo/gshell/trunk/gshell-assembly/pom.xml
    geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
    geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/InstallPluginAction.java
    geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/pom.xml
    geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/pom.xml
    geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/pom.xml
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/Artifact.java
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactResolver.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/pom.xml
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationArtifactFilter.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationImpl.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/resources/META-INF/gshell/components.xml
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/pom.xml
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginArtifactFilter.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/gshell/components.xml

Modified: geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/Application.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/Application.java?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/Application.java (original)
+++ geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/Application.java Sat Nov 22 22:07:00 2008
@@ -22,6 +22,7 @@
 import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.application.model.ApplicationModel;
+import org.apache.geronimo.gshell.artifact.Artifact;
 
 import java.io.File;
 import java.net.InetAddress;
@@ -34,6 +35,8 @@
 public interface Application
 {
     String getId();
+
+    Artifact getArtifact();
     
     IO getIo();
 

Modified: geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/model/ApplicationModel.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/model/ApplicationModel.java?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/model/ApplicationModel.java (original)
+++ geronimo/gshell/trunk/gshell-application/src/main/java/org/apache/geronimo/gshell/application/model/ApplicationModel.java Sat Nov 22 22:07:00 2008
@@ -91,6 +91,16 @@
         this.name = name;
     }
 
+    public Artifact getArtifact() {
+        Artifact artifact = new Artifact();
+
+        artifact.setGroup(getGroupId());
+        artifact.setName(getArtifactId());
+        artifact.setVersion(getVersion());
+
+        return artifact;
+    }
+
     public String getDescription() {
         return description;
     }

Modified: geronimo/gshell/trunk/gshell-assembly/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/pom.xml?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/pom.xml Sat Nov 22 22:07:00 2008
@@ -43,13 +43,18 @@
             <groupId>org.apache.geronimo.gshell</groupId>
             <artifactId>gshell-bootstrap</artifactId>
         </dependency>
-        
+
         <dependency>
             <groupId>org.apache.geronimo.gshell</groupId>
             <artifactId>gshell-cli</artifactId>
         </dependency>
 
         <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-artifact-ivy</artifactId>
+        </dependency>
+        
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
         </dependency>

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=719952&r1=719951&r2=719952&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 Sat Nov 22 22:07:00 2008
@@ -42,14 +42,14 @@
             <list>
                 <bean class="org.apache.geronimo.gshell.artifact.Artifact">
                     <property name="group" value="org.apache.geronimo.gshell.wisdom"/>
-                    <property name="artifact" value="gshell-wisdom-core"/>
+                    <property name="name" value="gshell-wisdom-core"/>
                     <property name="version" value="1.0-alpha-2-SNAPSHOT"/>
                 </bean>
                 
                 <!--
                 <bean class="org.apache.geronimo.gshell.artifact.Artifact">
                     <property name="group" value="org.apache.geronimo.gshell.support"/>
-                    <property name="artifact" value="gshell-vfs-truezip"/>
+                    <property name="name" value="gshell-vfs-truezip"/>
                     <property name="version" value="1.0-alpha-2-SNAPSHOT"/>
                 </bean>
                 -->
@@ -60,45 +60,45 @@
             <list>
                 <bean class="org.apache.geronimo.gshell.artifact.Artifact">
                     <property name="group" value="org.apache.geronimo.gshell.commands"/>
-                    <property name="artifact" value="gshell-builtins"/>
+                    <property name="name" value="gshell-builtins"/>
                     <property name="version" value="1.0-alpha-2-SNAPSHOT"/>
                 </bean>
 
                 <bean class="org.apache.geronimo.gshell.artifact.Artifact">
                     <property name="group" value="org.apache.geronimo.gshell.commands"/>
-                    <property name="artifact" value="gshell-vfs"/>
+                    <property name="name" value="gshell-vfs"/>
                     <property name="version" value="1.0-alpha-2-SNAPSHOT"/>
                 </bean>
 
                 <bean class="org.apache.geronimo.gshell.artifact.Artifact">
                     <property name="group" value="org.apache.geronimo.gshell.commands"/>
-                    <property name="artifact" value="gshell-admin"/>
+                    <property name="name" value="gshell-admin"/>
                     <property name="version" value="1.0-alpha-2-SNAPSHOT"/>
                 </bean>
 
                 <!--
                 <bean class="org.apache.geronimo.gshell.artifact.Artifact">
                     <property name="group" value="org.apache.geronimo.gshell.commands"/>
-                    <property name="artifact" value="gshell-optional"/>
+                    <property name="name" value="gshell-optional"/>
                     <property name="version" value="1.0-alpha-2-SNAPSHOT"/>
                 </bean>
 
                 <bean class="org.apache.geronimo.gshell.artifact.Artifact">
                     <property name="group" value="org.apache.geronimo.gshell.commands"/>
-                    <property name="artifact" value="gshell-log4j"/>
+                    <property name="name" value="gshell-log4j"/>
                     <property name="version" value="1.0-alpha-2-SNAPSHOT"/>
                 </bean>
 
                 <bean class="org.apache.geronimo.gshell.artifact.Artifact">
                     <property name="group" value="org.apache.geronimo.gshell.commands"/>
-                    <property name="artifact" value="gshell-bsf"/>
+                    <property name="name" value="gshell-bsf"/>
                     <property name="version" value="1.0-alpha-2-SNAPSHOT"/>
                 </bean>
                 -->
 
                 <bean class="org.apache.geronimo.gshell.artifact.Artifact">
                     <property name="group" value="org.apache.geronimo.gshell.commands"/>
-                    <property name="artifact" value="gshell-ssh"/>
+                    <property name="name" value="gshell-ssh"/>
                     <property name="version" value="1.0-alpha-2-SNAPSHOT"/>
                 </bean>
             </list>

Modified: geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/InstallPluginAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/InstallPluginAction.java?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/InstallPluginAction.java (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-admin/src/main/java/org/apache/geronimo/gshell/commands/admin/InstallPluginAction.java Sat Nov 22 22:07:00 2008
@@ -60,7 +60,7 @@
 
         Artifact artifact = new Artifact();
         artifact.setGroup(groupId);
-        artifact.setArtifact(artifactId);
+        artifact.setName(artifactId);
         artifact.setVersion(version);
 
         io.info("Loading plugin: {}", artifact.getId());

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/pom.xml?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/pom.xml Sat Nov 22 22:07:00 2008
@@ -51,7 +51,12 @@
             <groupId>org.apache.geronimo.gshell.support</groupId>
             <artifactId>gshell-spring</artifactId>
         </dependency>
-        
+
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-artifact</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>org.apache.ivy</groupId>
             <artifactId>ivy</artifactId>

Added: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ArtifactResolverImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ArtifactResolverImpl.java?rev=719952&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ArtifactResolverImpl.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ArtifactResolverImpl.java Sat Nov 22 22:07:00 2008
@@ -0,0 +1,134 @@
+/*
+ * 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.artifact.ivy;
+
+import org.apache.geronimo.gshell.artifact.ArtifactResolver;
+import org.apache.geronimo.gshell.artifact.Artifact;
+import org.apache.ivy.Ivy;
+import org.apache.ivy.util.filter.Filter;
+import org.apache.ivy.core.resolve.ResolveOptions;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
+import org.apache.ivy.core.module.descriptor.Configuration;
+import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.LinkedHashSet;
+
+/**
+ * <a href="http://ant.apache.org/ivy">Apache Ivy</a> based {@link ArtifactResolver}.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ArtifactResolverImpl
+    implements ArtifactResolver
+{
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private final Ivy ivy;
+
+    public ArtifactResolverImpl(final Ivy ivy) {
+        assert ivy != null;
+
+        this.ivy = ivy;
+    }
+
+    public Result resolve(final Request request) throws Failure {
+        assert request != null;
+
+        ResolveOptions options = new ResolveOptions();
+        options.setOutputReport(true);
+        options.setTransitive(true);
+
+        if (request.filter != null) {
+            options.setArtifactFilter(new Filter() {
+                public boolean accept(final Object obj) {
+                    if (!(obj instanceof org.apache.ivy.core.module.descriptor.Artifact)) {
+                        return false;
+                    }
+
+                    Artifact artifact = createArtifact((org.apache.ivy.core.module.descriptor.Artifact)obj);
+                    return request.filter.accept(artifact);
+                }
+            });
+        }
+
+        ModuleDescriptor md = createModuleDescriptor(request);
+
+        Result result = new Result();
+
+        try {
+            ResolveReport resolveReport = ivy.resolve(md, options);
+
+            result.artifacts = new LinkedHashSet<Artifact>();
+
+            for (ArtifactDownloadReport downloadReport : resolveReport.getAllArtifactsReports()) {
+                Artifact resolved = createArtifact(downloadReport.getArtifact());
+                resolved.setFile(downloadReport.getLocalFile());
+                result.artifacts.add(resolved);
+
+                log.debug("    {}", resolved.getId());
+            }
+        }
+        catch (Exception e) {
+            throw new Failure(e);
+        }
+
+        return result;
+    }
+
+    private Artifact createArtifact(final org.apache.ivy.core.module.descriptor.Artifact source) {
+        assert source != null;
+
+        ModuleRevisionId sourceId = source.getModuleRevisionId();
+
+        Artifact artifact = new Artifact();
+        artifact.setGroup(sourceId.getOrganisation());
+        artifact.setName(source.getName());
+        artifact.setVersion(sourceId.getRevision());
+        artifact.setType(source.getType());
+
+        return artifact;
+    }
+
+    private ModuleDescriptor createModuleDescriptor(final Request request) {
+        assert request != null;
+
+        ModuleRevisionId id = ModuleRevisionId.newInstance(request.artifact.getGroup(), request.artifact.getName(), request.artifact.getVersion());
+        DefaultModuleDescriptor md = new DefaultModuleDescriptor(id, "integration", null, true);
+        md.addConfiguration(new Configuration("default"));
+        md.setLastModified(System.currentTimeMillis());
+
+        if (request.artifacts != null) {
+            for (Artifact artifact : request.artifacts) {
+                ModuleRevisionId depId = ModuleRevisionId.newInstance(artifact.getGroup(), artifact.getName(), artifact.getVersion());
+                DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, depId, false, false, true);
+                dd.addDependencyConfiguration("default", "default");
+                md.addDependency(dd);
+            }
+        }
+
+        return md;
+    }
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ArtifactResolverImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ArtifactResolverImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ArtifactResolverImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/resources/META-INF/gshell/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/resources/META-INF/gshell/components.xml?rev=719952&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/resources/META-INF/gshell/components.xml (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/resources/META-INF/gshell/components.xml Sat Nov 22 22:07:00 2008
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!-- $Rev$ $Date$ -->
+        
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
+       default-autowire="no"
+       default-dependency-check="none"
+       default-init-method="init"
+       default-destroy-method="destroy">
+
+    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+    <bean id="ivy" class="org.apache.geronimo.gshell.artifact.ivy.IvyFactoryBean" lazy-init="true">
+        <property name="settingsUrl" value="file:${gshell.home}/etc/ivysettings.xml"/>
+    </bean>
+    
+    <bean id="artifactResolver" class="org.apache.geronimo.gshell.artifact.ivy.ArtifactResolverImpl" lazy-init="true">
+        <constructor-arg ref="ivy"/>
+    </bean>
+
+</beans>
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/resources/META-INF/gshell/components.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/resources/META-INF/gshell/components.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/resources/META-INF/gshell/components.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/pom.xml?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/pom.xml Sat Nov 22 22:07:00 2008
@@ -70,6 +70,11 @@
 
         <dependency>
             <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-artifact</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
             <artifactId>gshell-plexus</artifactId>
         </dependency>
         
@@ -82,7 +87,7 @@
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-project</artifactId>
-            <version>2.1.0-SNAPSHOT</version>
+            <version>2.1.0-M2-SNAPSHOT</version>
             <exclusions>
                 <exclusion>
                     <groupId>org.apache.maven</groupId>

Added: geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactResolverImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactResolverImpl.java?rev=719952&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactResolverImpl.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactResolverImpl.java Sat Nov 22 22:07:00 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.artifact.maven;
+
+import org.apache.geronimo.gshell.artifact.ArtifactResolver;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class ArtifactResolverImpl
+    implements ArtifactResolver
+{
+    public Result resolve(final Request request) throws Failure {
+        assert request != null;
+        
+        return null;
+    }
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactResolverImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactResolverImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactResolverImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/pom.xml?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/pom.xml Sat Nov 22 22:07:00 2008
@@ -42,6 +42,17 @@
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-artifact</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven.mercury</groupId>
+            <artifactId>mercury-md-sat</artifactId>
+            <version>1.0.0-alpha-2-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 
 </project>
\ No newline at end of file

Added: geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/java/org/apache/geronimo/gshell/artifact/mercury/ArtifactResolverImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/java/org/apache/geronimo/gshell/artifact/mercury/ArtifactResolverImpl.java?rev=719952&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/java/org/apache/geronimo/gshell/artifact/mercury/ArtifactResolverImpl.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/java/org/apache/geronimo/gshell/artifact/mercury/ArtifactResolverImpl.java Sat Nov 22 22:07:00 2008
@@ -0,0 +1,38 @@
+/*
+ * 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.artifact.mercury;
+
+import org.apache.geronimo.gshell.artifact.ArtifactResolver;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class ArtifactResolverImpl
+    implements ArtifactResolver
+{
+    public Result resolve(final Request request) throws Failure {
+        assert request != null;
+
+
+        return null;
+    }
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/java/org/apache/geronimo/gshell/artifact/mercury/ArtifactResolverImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/java/org/apache/geronimo/gshell/artifact/mercury/ArtifactResolverImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/java/org/apache/geronimo/gshell/artifact/mercury/ArtifactResolverImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/resources/META-INF/gshell/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/resources/META-INF/gshell/components.xml?rev=719952&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/resources/META-INF/gshell/components.xml (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/resources/META-INF/gshell/components.xml Sat Nov 22 22:07:00 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!-- $Rev$ $Date$ -->
+        
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="artifactManager" class="org.apache.geronimo.gshell.artifact.maven.ArtifactManagerFactory"/>
+    
+</beans>
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/resources/META-INF/gshell/components.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/resources/META-INF/gshell/components.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-mercury/src/main/resources/META-INF/gshell/components.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/Artifact.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/Artifact.java?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/Artifact.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/Artifact.java Sat Nov 22 22:07:00 2008
@@ -28,7 +28,7 @@
  * @version $Rev$ $Date$
  */
 public class Artifact
-    implements Serializable
+    implements Serializable, Cloneable
 {
     private static final long serialVersionUID = 1;
     
@@ -36,7 +36,7 @@
 
     private String group;
 
-    private String artifact;
+    private String name;
 
     private String classifier;
 
@@ -58,12 +58,12 @@
         this.group = group;
     }
 
-    public String getArtifact() {
-        return artifact;
+    public String getName() {
+        return name;
     }
 
-    public void setArtifact(final String artifact) {
-        this.artifact = artifact;
+    public void setName(final String name) {
+        this.name = name;
     }
 
     public String getClassifier() {
@@ -102,6 +102,21 @@
     }
 
     public String getId() {
-        return getGroup() + ":" + getArtifact() + ":" + getVersion() + ":" + getType();
+        if (getClassifier() != null) {
+            return getGroup() + ":" + getName() + ":" + getClassifier() + ":" + getVersion() + ":" + getType();
+        }
+        else {
+            return getGroup() + ":" + getName() + ":" + getVersion() + ":" + getType();
+        }
+    }
+
+    @Override
+    protected Object clone() {
+        try {
+            return super.clone();
+        }
+        catch (CloneNotSupportedException e) {
+            throw new InternalError();
+        }
     }
 }

Copied: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactFilter.java (from r719823, geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactResolver.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactFilter.java?p2=geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactFilter.java&p1=geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactResolver.java&r1=719823&r2=719952&rev=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactResolver.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactFilter.java Sat Nov 22 22:07:00 2008
@@ -24,7 +24,7 @@
  *
  * @version $Rev$ $Date$
  */
-public interface ArtifactResolver
+public interface ArtifactFilter
 {
-    
+    boolean accept(Artifact artifact);
 }
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactFilter.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactFilter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactResolver.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactResolver.java?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactResolver.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactResolver.java Sat Nov 22 22:07:00 2008
@@ -19,6 +19,8 @@
 
 package org.apache.geronimo.gshell.artifact;
 
+import java.util.Collection;
+
 /**
  * ???
  *
@@ -26,5 +28,53 @@
  */
 public interface ArtifactResolver
 {
-    
+    Result resolve(Request request) throws Failure;
+
+    //
+    // Request
+    //
+
+    class Request
+    {
+        public ArtifactFilter filter;
+
+        public Artifact artifact;
+
+        public Collection<Artifact> artifacts;
+    }
+
+    //
+    // Result
+    //
+
+    class Result
+    {
+        public Collection<Artifact> artifacts;
+    }
+
+    //
+    // Failure
+    //
+
+    class Failure
+        extends Exception
+    {
+        private static final long serialVersionUID = 1;
+
+        public Failure(final String msg) {
+            super(msg);
+        }
+
+        public Failure(final String msg, final Throwable cause) {
+            super(msg, cause);
+        }
+
+        public Failure(final Throwable cause) {
+            super(cause);
+        }
+
+        public Failure() {
+            super();
+        }
+    }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/pom.xml?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/pom.xml Sat Nov 22 22:07:00 2008
@@ -55,11 +55,6 @@
 
         <dependency>
             <groupId>org.apache.geronimo.gshell.support</groupId>
-            <artifactId>gshell-artifact-ivy</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.geronimo.gshell.support</groupId>
             <artifactId>gshell-chronos</artifactId>
         </dependency>
 

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationArtifactFilter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationArtifactFilter.java?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationArtifactFilter.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationArtifactFilter.java Sat Nov 22 22:07:00 2008
@@ -19,8 +19,8 @@
 
 package org.apache.geronimo.gshell.wisdom.application;
 
-import org.apache.ivy.core.module.descriptor.Artifact;
-import org.apache.ivy.util.filter.Filter;
+import org.apache.geronimo.gshell.artifact.ArtifactFilter;
+import org.apache.geronimo.gshell.artifact.Artifact;
 
 import java.util.Arrays;
 import java.util.HashSet;
@@ -32,7 +32,7 @@
  * @version $Rev$ $Date$
  */
 public class ApplicationArtifactFilter
-    implements Filter
+    implements ArtifactFilter
 {
     private static final String[] EXCLUDES = {
         "gshell-artifact",
@@ -70,12 +70,9 @@
 
     }
 
-    public boolean accept(final Object target) {
-        if (!(target instanceof Artifact)) {
-            return false;
-        }
+    public boolean accept(final Artifact artifact) {
+        assert artifact != null;
 
-        Artifact artifact = (Artifact)target;
         String name = artifact.getName();
 
         return !excludes.contains(name);

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationImpl.java?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationImpl.java Sat Nov 22 22:07:00 2008
@@ -25,6 +25,7 @@
 import org.apache.geronimo.gshell.application.model.ApplicationModel;
 import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.io.IO;
+import org.apache.geronimo.gshell.artifact.Artifact;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -62,6 +63,10 @@
         return config.getModel().getId();
     }
 
+    public Artifact getArtifact() {
+        return config.getModel().getArtifact();
+    }
+
     public IO getIo() {
         return config.getIo();
     }

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java Sat Nov 22 22:07:00 2008
@@ -22,11 +22,11 @@
 import org.apache.geronimo.gshell.application.Application;
 import org.apache.geronimo.gshell.application.ApplicationConfiguration;
 import org.apache.geronimo.gshell.application.ApplicationManager;
-import org.apache.geronimo.gshell.wisdom.application.ApplicationSecurityManager;
 import org.apache.geronimo.gshell.application.ClassPath;
 import org.apache.geronimo.gshell.application.model.ApplicationModel;
-import org.apache.geronimo.gshell.artifact.Artifact;
 import org.apache.geronimo.gshell.application.plugin.PluginManager;
+import org.apache.geronimo.gshell.artifact.Artifact;
+import org.apache.geronimo.gshell.artifact.ArtifactResolver;
 import org.apache.geronimo.gshell.chronos.StopWatch;
 import org.apache.geronimo.gshell.event.EventPublisher;
 import org.apache.geronimo.gshell.shell.Shell;
@@ -34,15 +34,6 @@
 import org.apache.geronimo.gshell.shell.ShellContextHolder;
 import org.apache.geronimo.gshell.spring.BeanContainer;
 import org.apache.geronimo.gshell.spring.BeanContainerAware;
-import org.apache.ivy.Ivy;
-import org.apache.ivy.core.module.descriptor.Configuration;
-import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
-import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
-import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.report.ArtifactDownloadReport;
-import org.apache.ivy.core.report.ResolveReport;
-import org.apache.ivy.core.resolve.ResolveOptions;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -52,9 +43,7 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.net.URL;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.Collection;
 
 /**
  * Default implementation of the {@link ApplicationManager} component.
@@ -68,15 +57,20 @@
 
     private final EventPublisher eventPublisher;
 
+    private ArtifactResolver artifactResolver;
+
     private BeanContainer container;
 
     private BeanContainer applicationContainer;
 
     private Application application;
 
-    public ApplicationManagerImpl(final EventPublisher eventPublisher) {
+    public ApplicationManagerImpl(final EventPublisher eventPublisher, final ArtifactResolver artifactResolver) {
         assert eventPublisher != null;
         this.eventPublisher = eventPublisher;
+
+        assert artifactResolver != null;
+        this.artifactResolver = artifactResolver;
     }
 
     public void setBeanContainer(final BeanContainer container) {
@@ -147,7 +141,7 @@
         ClassPath classPath = cache.get();
 
         if (classPath == null) {
-            Set<Artifact> artifacts = resolveArtifacts(model);
+            Collection<Artifact> artifacts = resolveArtifacts(model);
             classPath = new ClassPathImpl(artifacts);
             cache.set(classPath);
         }
@@ -163,72 +157,20 @@
         return classPath;
     }
 
-    private Set<Artifact> resolveArtifacts(final ApplicationModel model) throws Exception {
+    private Collection<Artifact> resolveArtifacts(final ApplicationModel model) throws Exception {
         assert model != null;
 
         log.debug("Resolving application artifacts");
 
-        Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
-
-        ResolveOptions options = new ResolveOptions();
-        options.setOutputReport(true);
-        options.setTransitive(true);
-        options.setArtifactFilter(new ApplicationArtifactFilter());
+        ArtifactResolver.Request request = new ArtifactResolver.Request();
 
-        ModuleDescriptor md = createApplicationModuleDescriptor(model);
+        request.filter = new ApplicationArtifactFilter();
+        request.artifact = model.getArtifact();
+        request.artifacts = model.getDependencies();
 
-        StopWatch watch = new StopWatch(true);
-
-        Ivy ivy = container.getBean("ivy", Ivy.class);
-        
-        ResolveReport resolveReport = ivy.resolve(md, options);
-
-        log.debug("Resolve completed in: {}", watch);
-
-        if (resolveReport.hasError()) {
-            log.error("Report has errors:");
-            // noinspection unchecked
-            List<String> problems = resolveReport.getAllProblemMessages();
-            for (String problem : problems) {
-                log.error("    {}", problem);
-            }
-        }
-
-        log.debug("Application artifacts:");
-        for (ArtifactDownloadReport downloadReport : resolveReport.getAllArtifactsReports()) {
-            org.apache.ivy.core.module.descriptor.Artifact downloadedArtifact = downloadReport.getArtifact();
-            ModuleRevisionId id = downloadedArtifact.getModuleRevisionId();
-
-            Artifact resolved = new Artifact();
-            resolved.setGroup(id.getOrganisation());
-            resolved.setArtifact(id.getName());
-            resolved.setVersion(id.getRevision());
-            resolved.setType(downloadedArtifact.getType());
-            resolved.setFile(downloadReport.getLocalFile());
-            artifacts.add(resolved);
-
-            log.debug("    {}", resolved.getId());
-        }
-
-        return artifacts;
-    }
-
-    private ModuleDescriptor createApplicationModuleDescriptor(final ApplicationModel model) {
-        assert model != null;
-
-        ModuleRevisionId appId = ModuleRevisionId.newInstance("gshell.application-" + model.getGroupId(), model.getArtifactId(), model.getVersion());
-        DefaultModuleDescriptor md = new DefaultModuleDescriptor(appId, "integration", null, true);
-        md.addConfiguration(new Configuration("default"));
-        md.setLastModified(System.currentTimeMillis());
-
-        for (Artifact dep : model.getDependencies()) {
-            ModuleRevisionId depId = ModuleRevisionId.newInstance(dep.getGroup(), dep.getArtifact(), dep.getVersion());
-            DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, depId, /* force */ false, /* changing*/ false, /* transitive */ true);
-            dd.addDependencyConfiguration("default", "default");
-            md.addDependency(dd);
-        }
+        ArtifactResolver.Result result = artifactResolver.resolve(request);
 
-        return md;
+        return result.artifacts;
     }
 
     //

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/resources/META-INF/gshell/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/resources/META-INF/gshell/components.xml?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/resources/META-INF/gshell/components.xml (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/resources/META-INF/gshell/components.xml Sat Nov 22 22:07:00 2008
@@ -28,16 +28,11 @@
        default-init-method="init"
        default-destroy-method="destroy">
 
-    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
-
-    <bean id="ivy" class="org.apache.geronimo.gshell.artifact.ivy.IvyFactoryBean" lazy-init="true">
-        <property name="settingsUrl" value="file:${gshell.home}/etc/ivysettings.xml"/>
-    </bean>
-    
     <bean id="eventManager" class="org.apache.geronimo.gshell.event.EventManagerImpl"/>
 
     <bean id="applicationManager" class="org.apache.geronimo.gshell.wisdom.application.ApplicationManagerImpl">
         <constructor-arg ref="eventManager"/>
+        <constructor-arg ref="artifactResolver"/>
     </bean>
 
     <bean id="application" class="org.apache.geronimo.gshell.wisdom.application.ApplicationFactoryBean" lazy-init="true">

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/pom.xml?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/pom.xml Sat Nov 22 22:07:00 2008
@@ -85,6 +85,12 @@
             <classifier>tests</classifier>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-artifact-ivy</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
 </project>

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginArtifactFilter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginArtifactFilter.java?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginArtifactFilter.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginArtifactFilter.java Sat Nov 22 22:07:00 2008
@@ -21,7 +21,7 @@
 
 import org.apache.geronimo.gshell.application.Application;
 import org.apache.geronimo.gshell.wisdom.application.ApplicationArtifactFilter;
-import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.geronimo.gshell.artifact.Artifact;
 
 import java.util.HashSet;
 import java.util.Set;
@@ -40,18 +40,18 @@
         assert application != null;
 
         // Filter out application artifacts, need to use gid:aid to make sure we don't clober anything which has the same artifactId, but different groupId
-        for (org.apache.geronimo.gshell.artifact.Artifact artifact : application.getClassPath().getArtifacts()) {
-            String id = artifact.getGroup() + ":" + artifact.getArtifact();
+        for (Artifact artifact : application.getClassPath().getArtifacts()) {
+            String id = artifact.getGroup() + ":" + artifact.getName();
             excludes.add(id);
         }
     }
 
-    public boolean accept(final Object target) {
-        if (super.accept(target)) {
-            Artifact artifact = (Artifact)target;
-            String id = artifact.getModuleRevisionId().getOrganisation() + ":" + artifact.getName();
-            return !excludes.contains(id);
+    @Override
+    public boolean accept(final Artifact artifact) {
+        if (super.accept(artifact)) {
+            return !excludes.contains(artifact.getId());
         }
+
         return false;
     }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java Sat Nov 22 22:07:00 2008
@@ -23,6 +23,7 @@
 import org.apache.geronimo.gshell.application.ApplicationManager;
 import org.apache.geronimo.gshell.application.ClassPath;
 import org.apache.geronimo.gshell.artifact.Artifact;
+import org.apache.geronimo.gshell.artifact.ArtifactResolver;
 import org.apache.geronimo.gshell.application.plugin.Plugin;
 import org.apache.geronimo.gshell.application.plugin.PluginManager;
 import org.apache.geronimo.gshell.chronos.StopWatch;
@@ -34,23 +35,13 @@
 import org.apache.geronimo.gshell.wisdom.application.ApplicationConfiguredEvent;
 import org.apache.geronimo.gshell.wisdom.application.ClassPathCache;
 import org.apache.geronimo.gshell.wisdom.application.ClassPathImpl;
-import org.apache.ivy.Ivy;
-import org.apache.ivy.core.module.descriptor.Configuration;
-import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
-import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
-import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.report.ArtifactDownloadReport;
-import org.apache.ivy.core.report.ResolveReport;
-import org.apache.ivy.core.resolve.ResolveOptions;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.net.URL;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 /**
  * Default implementation of the {@link PluginManager} component.
@@ -66,16 +57,21 @@
 
     private final EventManager eventManager;
 
+    private ArtifactResolver artifactResolver;
+
     private BeanContainer container;
 
     private Set<Plugin> plugins = new LinkedHashSet<Plugin>();
 
-    public PluginManagerImpl(final ApplicationManager applicationManager, final EventManager eventManager) {
+    public PluginManagerImpl(final ApplicationManager applicationManager, final EventManager eventManager, final ArtifactResolver artifactResolver) {
         assert applicationManager != null;
         this.applicationManager = applicationManager;
 
         assert eventManager != null;
         this.eventManager = eventManager;
+
+        assert artifactResolver != null;
+        this.artifactResolver = artifactResolver;
     }
 
     public void setBeanContainer(final BeanContainer container) {
@@ -160,11 +156,11 @@
         assert artifact != null;
 
         // FIXME: Get basedir from application
-        ClassPathCache cache = new ClassPathCache(new File(new File(System.getProperty("gshell.home")), "var/" + artifact.getGroup() + "/" + artifact.getArtifact() + "/classpath.ser"));
+        ClassPathCache cache = new ClassPathCache(new File(new File(System.getProperty("gshell.home")), "var/" + artifact.getGroup() + "/" + artifact.getName() + "/classpath.ser"));
         ClassPath classPath = cache.get();
 
         if (classPath == null) {
-            Set<Artifact> artifacts = resolveArtifacts(application, artifact);
+            Collection<Artifact> artifacts = resolveArtifacts(application, artifact);
             classPath = new ClassPathImpl(artifacts);
             cache.set(classPath);
         }
@@ -185,70 +181,20 @@
         loadPlugin(applicationManager.getApplication(), artifact);
     }
 
-    private Set<Artifact> resolveArtifacts(final Application application, final Artifact artifact) throws Exception {
+    private Collection<Artifact> resolveArtifacts(final Application application, final Artifact artifact) throws Exception {
         assert application != null;
         assert artifact != null;
 
         log.debug("Resolving plugin artifacts");
 
-        Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
-
-        ResolveOptions options = new ResolveOptions();
-        options.setOutputReport(true);
-        options.setTransitive(true);
-        options.setArtifactFilter(new PluginArtifactFilter(application));
-
-        ModuleDescriptor md = createPluginModuleDescriptor(artifact);
-
-        StopWatch watch = new StopWatch(true);
-
-        Ivy ivy = container.getBean("ivy", Ivy.class);
-        
-        ResolveReport resolveReport = ivy.resolve(md, options);
-
-        log.debug("Resolve completed in: {}", watch);
+        ArtifactResolver.Request request = new ArtifactResolver.Request();
 
-        if (resolveReport.hasError()) {
-            log.error("Report has errors:");
-            // noinspection unchecked
-            List<String> problems = resolveReport.getAllProblemMessages();
-            for (String problem : problems) {
-                log.error("    {}", problem);
-            }
-        }
-
-        log.debug("Plugin artifacts:");
-        for (ArtifactDownloadReport downloadReport : resolveReport.getAllArtifactsReports()) {
-            org.apache.ivy.core.module.descriptor.Artifact downloadedArtifact = downloadReport.getArtifact();
-            ModuleRevisionId id = downloadedArtifact.getModuleRevisionId();
-
-            Artifact resolved = new Artifact();
-            resolved.setGroup(id.getOrganisation());
-            resolved.setArtifact(id.getName());
-            resolved.setVersion(id.getRevision());
-            resolved.setType(downloadedArtifact.getType());
-            resolved.setFile(downloadReport.getLocalFile());
-            artifacts.add(resolved);
-            
-            log.debug("    {}", resolved.getId());
-        }
-
-        return artifacts;
-    }
-
-    private ModuleDescriptor createPluginModuleDescriptor(final Artifact artifact) {
-        assert artifact != null;
+        request.filter = new PluginArtifactFilter(application);
+        request.artifact = application.getArtifact();
+        request.artifacts = Collections.singletonList(artifact);
 
-        ModuleRevisionId pluginId = ModuleRevisionId.newInstance("gshell.plugin-" + artifact.getGroup(), artifact.getArtifact(), artifact.getVersion());
-        DefaultModuleDescriptor md = new DefaultModuleDescriptor(pluginId, "integration", null, true);
-        md.addConfiguration(new Configuration("default"));
-        md.setLastModified(System.currentTimeMillis());
-
-        ModuleRevisionId depId = ModuleRevisionId.newInstance(artifact.getGroup(), artifact.getArtifact(), artifact.getVersion());
-        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, depId, /* force */ false, /* changing*/ false, /* transitive */ true);
-        dd.addDependencyConfiguration("default", "default");
-        md.addDependency(dd);
+        ArtifactResolver.Result result = artifactResolver.resolve(request);
 
-        return md;
+        return result.artifacts;
     }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/gshell/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/gshell/components.xml?rev=719952&r1=719951&r2=719952&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/gshell/components.xml (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/gshell/components.xml Sat Nov 22 22:07:00 2008
@@ -162,6 +162,7 @@
     <bean id="pluginManager" class="org.apache.geronimo.gshell.wisdom.plugin.PluginManagerImpl">
         <constructor-arg ref="applicationManager"/>
         <constructor-arg ref="eventManager"/>
+        <constructor-arg ref="artifactResolver"/>
     </bean>
 
     <bean id="pluginMetaMapper" class="org.apache.geronimo.gshell.wisdom.plugin.PluginMetaMapper">



Mime
View raw message