geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r661654 - in /geronimo/gshell/trunk: gshell-loader/src/main/java/org/apache/geronimo/gshell/application/ gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/ gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshel...
Date Fri, 30 May 2008 11:25:18 GMT
Author: jdillon
Date: Fri May 30 04:25:17 2008
New Revision: 661654

URL: http://svn.apache.org/viewvc?rev=661654&view=rev
Log:
Force gshell-artifact to resolve artifacts only based on the remote repositories configured
for the application

Added:
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactRepositoryManager.java
      - copied, changed from r661572, geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactRepositoryManager.java
      - copied, changed from r661572, geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/GShellArtifactMetadataSource.java
  (with props)
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/GShellArtifactResolver.java
  (with props)
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/plexus/
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/plexus/plexus.xml
  (with props)
Modified:
    geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
    geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ResolutionException.java
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/TransferListenerSupport.java

Modified: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java?rev=661654&r1=661653&r2=661654&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
(original)
+++ geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
Fri May 30 04:25:17 2008
@@ -142,12 +142,12 @@
 
         if (localRepository != null) {
             // FIXME: Need to root the local repo's directory to user.home if its relative
for now util ${user.home} expansion is supported
-            artifactManager.setLocalRepository(localRepository.getDirectoryFile());
+            artifactManager.getRepositoryManager().setLocalRepository(localRepository.getDirectoryFile());
         }
 
         // Setup remote repositories
         for (RemoteRepository repo : application.remoteRepositories()) {
-            artifactManager.addRemoteRepository(repo.getId(), repo.getLocationUri());
+            artifactManager.getRepositoryManager().addRemoteRepository(repo.getId(), repo.getLocationUri());
         }
     }
 

Modified: geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java?rev=661654&r1=661653&r2=661654&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
(original)
+++ geronimo/gshell/trunk/gshell-loader/src/main/java/org/apache/geronimo/gshell/settings/DefaultSettingsManager.java
Fri May 30 04:25:17 2008
@@ -74,7 +74,7 @@
 
         // Setup remote repositories
         for (RemoteRepository repo : settings.remoteRepositories()) {
-            artifactManager.addRemoteRepository(repo.getId(), repo.getLocationUri());
+            artifactManager.getRepositoryManager().addRemoteRepository(repo.getId(), repo.getLocationUri());
         }
         
         // TODO: apply other artifact related settings (proxy, auth, whatever)

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java?rev=661654&r1=661653&r2=661654&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java
Fri May 30 04:25:17 2008
@@ -20,15 +20,10 @@
 package org.apache.geronimo.gshell.artifact;
 
 import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.wagon.events.TransferListener;
 
-import java.io.File;
-import java.net.URI;
-import java.util.List;
-
 /**
  * Provides a facade over the artifact + repository subsystem.
  *
@@ -36,17 +31,7 @@
  */
 public interface ArtifactManager
 {
-    ArtifactRepository getLocalRepository();
-
-    void setLocalRepository(ArtifactRepository repository) throws InvalidRepositoryException;
-
-    void setLocalRepository(File dir) throws InvalidRepositoryException;
-
-    List<ArtifactRepository> getRemoteRepositories();
-
-    void addRemoteRepository(ArtifactRepository repository) throws InvalidRepositoryException;
-
-    void addRemoteRepository(String id, URI location) throws InvalidRepositoryException;
+    ArtifactRepositoryManager getRepositoryManager();
 
     ArtifactFactory getArtifactFactory();
 

Copied: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactRepositoryManager.java
(from r661572, geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactRepositoryManager.java?p2=geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactRepositoryManager.java&p1=geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java&r1=661572&r2=661654&rev=661654&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactRepositoryManager.java
Fri May 30 04:25:17 2008
@@ -19,11 +19,7 @@
 
 package org.apache.geronimo.gshell.artifact;
 
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
-import org.apache.maven.wagon.events.TransferListener;
 
 import java.io.File;
 import java.net.URI;
@@ -34,7 +30,7 @@
  *
  * @version $Rev$ $Date$
  */
-public interface ArtifactManager
+public interface ArtifactRepositoryManager
 {
     ArtifactRepository getLocalRepository();
 
@@ -48,9 +44,5 @@
 
     void addRemoteRepository(String id, URI location) throws InvalidRepositoryException;
 
-    ArtifactFactory getArtifactFactory();
-
-    void setDownloadMonitor(TransferListener listener);
-
-    ArtifactResolutionResult resolve(ArtifactResolutionRequest request) throws ResolutionException;
+    List<ArtifactRepository> selectRemoteRepositories(List<ArtifactRepository>
repositories);
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java?rev=661654&r1=661653&r2=661654&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
Fri May 30 04:25:17 2008
@@ -22,9 +22,6 @@
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.manager.WagonManager;
 import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
 import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
@@ -34,11 +31,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * Default implementation of the {@link ArtifactManager} component.
  *
@@ -54,76 +46,19 @@
     private ArtifactFactory artifactFactory;
 
     @Requirement
-    private ArtifactRepositoryFactory repositoryFactory;
+    private ArtifactRepositoryManager repositoryManager;
 
     @Requirement
     private ArtifactResolver artifactResolver;
 
-    @Requirement
+    @Requirement(hint="gshell")
     private ArtifactMetadataSource artifactMetadataSource;
 
     @Requirement
     private WagonManager wagonManager;
 
-    private ArtifactRepository localRepository;
-
-    private List<ArtifactRepository> remoteRepositories = new ArrayList<ArtifactRepository>();
-
-    public ArtifactRepository getLocalRepository() {
-        return localRepository;
-    }
-
-    public void setLocalRepository(final ArtifactRepository repository) throws InvalidRepositoryException
{
-        assert repository != null;
-
-        localRepository = repository;
-
-        log.debug("Using local repository: {}", repository);
-    }
-
-    public void setLocalRepository(final File dir) throws InvalidRepositoryException {
-        assert dir != null;
-
-        try {
-            ArtifactRepository repo = repositoryFactory.createLocalRepository(dir);
-            setLocalRepository(repo);
-        }
-        catch (Exception e) {
-            throw new InvalidRepositoryException(e);
-        }
-    }
-
-    public List<ArtifactRepository> getRemoteRepositories() {
-        return remoteRepositories;
-    }
-
-    public void addRemoteRepository(final ArtifactRepository repository) throws InvalidRepositoryException
{
-        assert repository != null;
-
-        remoteRepositories.add(repository);
-
-        log.debug("Added remote repository: {}", repository);
-    }
-
-    public void addRemoteRepository(final String id, final URI location) throws InvalidRepositoryException
{
-        assert id != null;
-        assert location != null;
-
-        try {
-            ArtifactRepository repo = repositoryFactory.createArtifactRepository(
-                id,
-                location.toURL().toExternalForm(),
-                ArtifactRepositoryFactory.DEFAULT_LAYOUT_ID,
-
-                // FIXME: Expose more configuration to user API
-                new ArtifactRepositoryPolicy(),  // snapshots
-                new ArtifactRepositoryPolicy()); // releases
-            
-            addRemoteRepository(repo);
-        }
-        catch (Exception e) {
-            throw new InvalidRepositoryException(e);
-        }
+    public ArtifactRepositoryManager getRepositoryManager() {
+        return repositoryManager;
     }
 
     public ArtifactFactory getArtifactFactory() {
@@ -144,11 +79,11 @@
         // Automatically fill in some missing bits
 
         if (request.getLocalRepository() == null) {
-            request.setLocalRepository(localRepository);
+            request.setLocalRepository(repositoryManager.getLocalRepository());
         }
 
         if (request.getRemoteRepostories() == null) {
-            request.setRemoteRepostories(remoteRepositories);
+            request.setRemoteRepostories(repositoryManager.getRemoteRepositories());
         }
 
         if (request.getMetadataSource() == null) {

Copied: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactRepositoryManager.java
(from r661572, geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactRepositoryManager.java?p2=geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactRepositoryManager.java&p1=geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java&r1=661572&r2=661654&rev=661654&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactRepositoryManager.java
Fri May 30 04:25:17 2008
@@ -19,16 +19,9 @@
 
 package org.apache.geronimo.gshell.artifact;
 
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.manager.WagonManager;
-import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
-import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
-import org.apache.maven.wagon.events.TransferListener;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.slf4j.Logger;
@@ -40,31 +33,19 @@
 import java.util.List;
 
 /**
- * Default implementation of the {@link ArtifactManager} component.
+ * Default implementation of the {@link ArtifactRepositoryManager} component.
  *
  * @version $Rev$ $Date$
  */
-@Component(role=ArtifactManager.class)
-public class DefaultArtifactManager
-    implements ArtifactManager
+@Component(role=ArtifactRepositoryManager.class)
+public class DefaultArtifactRepositoryManager
+    implements ArtifactRepositoryManager
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
     @Requirement
-    private ArtifactFactory artifactFactory;
-
-    @Requirement
     private ArtifactRepositoryFactory repositoryFactory;
 
-    @Requirement
-    private ArtifactResolver artifactResolver;
-
-    @Requirement
-    private ArtifactMetadataSource artifactMetadataSource;
-
-    @Requirement
-    private WagonManager wagonManager;
-
     private ArtifactRepository localRepository;
 
     private List<ArtifactRepository> remoteRepositories = new ArrayList<ArtifactRepository>();
@@ -101,8 +82,13 @@
         assert repository != null;
 
         remoteRepositories.add(repository);
+    }
 
-        log.debug("Added remote repository: {}", repository);
+    public List<ArtifactRepository> selectRemoteRepositories(final List<ArtifactRepository>
repositories) {
+        assert repositories != null;
+
+        // For now just ignore the given repositories, eventually may want to apply some
configurable allow/deny logic
+        return getRemoteRepositories();
     }
 
     public void addRemoteRepository(final String id, final URI location) throws InvalidRepositoryException
{
@@ -118,60 +104,11 @@
                 // FIXME: Expose more configuration to user API
                 new ArtifactRepositoryPolicy(),  // snapshots
                 new ArtifactRepositoryPolicy()); // releases
-            
+
             addRemoteRepository(repo);
         }
         catch (Exception e) {
             throw new InvalidRepositoryException(e);
         }
     }
-
-    public ArtifactFactory getArtifactFactory() {
-        return artifactFactory;
-    }
-
-    public void setDownloadMonitor(final TransferListener listener) {
-        assert listener != null;
-
-        wagonManager.setDownloadMonitor(listener);
-
-        log.debug("Using download monitor: {}", listener);
-    }
-    
-    public ArtifactResolutionResult resolve(final ArtifactResolutionRequest request) throws
ResolutionException {
-        assert request != null;
-
-        // Automatically fill in some missing bits
-
-        if (request.getLocalRepository() == null) {
-            request.setLocalRepository(localRepository);
-        }
-
-        if (request.getRemoteRepostories() == null) {
-            request.setRemoteRepostories(remoteRepositories);
-        }
-
-        if (request.getMetadataSource() == null) {
-            request.setMetadataSource(artifactMetadataSource);
-        }
-
-        log.debug("Resolving request: {}", request);
-
-        ArtifactResolutionResult result = artifactResolver.resolve(request);
-
-        return validateResolutionResult(request, result);
-    }
-
-    private ArtifactResolutionResult validateResolutionResult(final ArtifactResolutionRequest
request, final ArtifactResolutionResult result) throws ResolutionException {
-        assert request != null;
-        assert result != null;
-
-        log.debug("Validating result: {}", result);
-
-        if (/* TODO: detect failure */ false) {
-            throw new ResolutionException(request, result);
-        }
-
-        return result;
-    }
 }
\ No newline at end of file

Added: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/GShellArtifactMetadataSource.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/GShellArtifactMetadataSource.java?rev=661654&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/GShellArtifactMetadataSource.java
(added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/GShellArtifactMetadataSource.java
Fri May 30 04:25:17 2008
@@ -0,0 +1,81 @@
+/*
+ * 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;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.metadata.ResolutionGroup;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+/**
+ * Custom {@link ArtifactMetadataSource} for GShell.
+ *
+ * @version $Rev$ $Date$
+ */
+@Component(role=ArtifactMetadataSource.class, hint="gshell")
+public class GShellArtifactMetadataSource
+    implements ArtifactMetadataSource
+{
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Requirement(hint="maven")
+    private ArtifactMetadataSource delegate;
+
+    @Requirement
+    private ArtifactRepositoryManager repositoryManager;
+
+    public ResolutionGroup retrieve(final Artifact artifact, final ArtifactRepository localRepository,
final List<ArtifactRepository> remoteRepositories)
+        throws ArtifactMetadataRetrievalException
+    {
+        assert delegate != null;
+        assert repositoryManager != null;
+
+        log.trace("Retrieving metadata; artifact={}, local={}, remote={}", new Object[] {
artifact, localRepository, remoteRepositories });
+
+        ResolutionGroup result = delegate.retrieve(artifact, localRepository, repositoryManager.selectRemoteRepositories(remoteRepositories));
+
+        log.trace("Resolution group; pom={}, artifacts={}, repositories={}", new Object[]
{ result.getPomArtifact(), result.getArtifacts(), result.getResolutionRepositories() });
+
+        return new ResolutionGroup(result.getPomArtifact(), result.getArtifacts(), repositoryManager.selectRemoteRepositories(result.getResolutionRepositories()));
+    }
+
+    public List<ArtifactVersion> retrieveAvailableVersions(final Artifact artifact,
final ArtifactRepository localRepository, final List<ArtifactRepository> remoteRepositories)
+        throws ArtifactMetadataRetrievalException
+    {
+        assert delegate != null;
+        assert repositoryManager != null;
+
+        log.trace("Retrieving available versions; artifact={}, local={}, remote={}", new
Object[] { artifact, localRepository, remoteRepositories });
+
+        List<ArtifactVersion> versions = delegate.retrieveAvailableVersions(artifact,
localRepository, repositoryManager.selectRemoteRepositories(remoteRepositories));
+
+        log.trace("Available versions: {}", versions);
+        
+        return versions;
+    }
+}

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

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

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

Added: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/GShellArtifactResolver.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/GShellArtifactResolver.java?rev=661654&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/GShellArtifactResolver.java
(added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/GShellArtifactResolver.java
Fri May 30 04:25:17 2008
@@ -0,0 +1,135 @@
+/*
+ * 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;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.ResolutionListener;
+import org.apache.maven.artifact.resolver.conflict.ConflictResolver;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Custom {@link ArtifactResolver} for GShell.
+ *
+ * @version $Rev$ $Date$
+ */
+@Component(role=ArtifactResolver.class, hint="gshell")
+public class GShellArtifactResolver
+    implements ArtifactResolver
+{
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Requirement(hint="delegate")
+    private ArtifactResolver delegate;
+
+    @Requirement
+    private ArtifactRepositoryManager repositoryManager;
+
+    //
+    // ArtifactResolver
+    //
+
+    public void resolve(Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository) throws ArtifactResolutionException, ArtifactNotFoundException
{
+        assert delegate != null;
+        assert repositoryManager != null;
+
+        delegate.resolve(artifact, repositoryManager.selectRemoteRepositories(remoteRepositories),
localRepository);
+    }
+
+    public ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts, Artifact
originatingArtifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository
localRepository, ArtifactMetadataSource source) throws ArtifactResolutionException, ArtifactNotFoundException
{
+        assert delegate != null;
+        assert repositoryManager != null;
+        
+        return delegate.resolveTransitively(artifacts, originatingArtifact, repositoryManager.selectRemoteRepositories(remoteRepositories),
localRepository, source);
+    }
+
+    public ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts, Artifact
originatingArtifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository
localRepository, ArtifactMetadataSource source, List<ResolutionListener> listeners)
throws ArtifactResolutionException, ArtifactNotFoundException {
+        assert delegate != null;
+        assert repositoryManager != null;
+        
+        return delegate.resolveTransitively(artifacts, originatingArtifact, repositoryManager.selectRemoteRepositories(remoteRepositories),
localRepository, source, listeners);
+    }
+
+    public ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts, Artifact
originatingArtifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source, ArtifactFilter filter) throws ArtifactResolutionException,
ArtifactNotFoundException {
+        assert delegate != null;
+        assert repositoryManager != null;
+        
+        return delegate.resolveTransitively(artifacts, originatingArtifact, localRepository,
repositoryManager.selectRemoteRepositories(remoteRepositories), source, filter);
+    }
+
+    public ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts, Artifact
originatingArtifact, Map managedVersions, ArtifactRepository localRepository, List<ArtifactRepository>
remoteRepositories, ArtifactMetadataSource source) throws ArtifactResolutionException, ArtifactNotFoundException
{
+        assert delegate != null;
+        assert repositoryManager != null;
+        
+        return delegate.resolveTransitively(artifacts, originatingArtifact, managedVersions,
localRepository, repositoryManager.selectRemoteRepositories(remoteRepositories), source);
+    }
+
+    public ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts, Artifact
originatingArtifact, Map managedVersions, ArtifactRepository localRepository, List<ArtifactRepository>
remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter) throws ArtifactResolutionException,
ArtifactNotFoundException {
+        assert delegate != null;
+        assert repositoryManager != null;
+        
+        return delegate.resolveTransitively(artifacts, originatingArtifact, managedVersions,
localRepository, repositoryManager.selectRemoteRepositories(remoteRepositories), source, filter);
+    }
+
+    public ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts, Artifact
originatingArtifact, Map managedVersions, ArtifactRepository localRepository, List<ArtifactRepository>
remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener>
listeners) throws ArtifactResolutionException, ArtifactNotFoundException {
+        assert delegate != null;
+        assert repositoryManager != null;
+        
+        return delegate.resolveTransitively(artifacts, originatingArtifact, managedVersions,
localRepository, repositoryManager.selectRemoteRepositories(remoteRepositories), source, filter,
listeners);
+    }
+
+    public ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts, Artifact
originatingArtifact, Map managedVersions, ArtifactRepository localRepository, List<ArtifactRepository>
remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener>
listeners, List<ConflictResolver> conflictResolvers) throws ArtifactResolutionException,
ArtifactNotFoundException {
+        assert delegate != null;
+        assert repositoryManager != null;
+        
+        return delegate.resolveTransitively(artifacts, originatingArtifact, managedVersions,
localRepository, repositoryManager.selectRemoteRepositories(remoteRepositories), source, filter,
listeners, conflictResolvers);
+    }
+
+    public void resolveAlways(Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository) throws ArtifactResolutionException, ArtifactNotFoundException
{
+        assert delegate != null;
+        assert repositoryManager != null;
+        
+        delegate.resolveAlways(artifact, repositoryManager.selectRemoteRepositories(remoteRepositories),
localRepository);
+    }
+
+    public ArtifactResolutionResult resolve(ArtifactResolutionRequest request) {
+        assert request != null;
+        assert delegate != null;
+        assert repositoryManager != null;
+        
+        request.setRemoteRepostories(repositoryManager.selectRemoteRepositories(request.getRemoteRepostories()));
+
+        return delegate.resolve(request);
+    }
+}
\ No newline at end of file

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

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

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

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ResolutionException.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ResolutionException.java?rev=661654&r1=661653&r2=661654&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ResolutionException.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ResolutionException.java
Fri May 30 04:25:17 2008
@@ -19,8 +19,8 @@
 
 package org.apache.geronimo.gshell.artifact;
 
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 
 /**
  * Thrown to indicate that an artifact resolution request has failed.

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/TransferListenerSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/TransferListenerSupport.java?rev=661654&r1=661653&r2=661654&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/TransferListenerSupport.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/monitor/TransferListenerSupport.java
Fri May 30 04:25:17 2008
@@ -19,8 +19,8 @@
 
 package org.apache.geronimo.gshell.artifact.monitor;
 
-import org.apache.maven.wagon.events.TransferListener;
 import org.apache.maven.wagon.events.TransferEvent;
+import org.apache.maven.wagon.events.TransferListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Added: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/plexus/plexus.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/plexus/plexus.xml?rev=661654&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/plexus/plexus.xml
(added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/plexus/plexus.xml
Fri May 30 04:25:17 2008
@@ -0,0 +1,72 @@
+<?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$ -->
+
+<plexus>
+    <components>
+        <!--
+        Force our custom GShellArtifactResolver to be the default, and re-assign the default
implementation as a delegate.
+        -->
+
+        <component>
+            <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
+            <role-hint>default</role-hint>
+            <implementation>org.apache.geronimo.gshell.artifact.GShellArtifactResolver</implementation>
+            <isolated-realm>false</isolated-realm>
+            <requirements>
+                <requirement>
+                    <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
+                    <role-hint>delegate</role-hint>
+                    <field-name>delegate</field-name>
+                </requirement>
+                <requirement>
+                    <role>org.apache.geronimo.gshell.artifact.ArtifactRepositoryManager</role>
+                    <field-name>repositoryManager</field-name>
+                </requirement>
+            </requirements>
+        </component>
+
+        <component>
+            <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
+            <role-hint>delegate</role-hint>
+            <implementation>org.apache.maven.artifact.resolver.DefaultArtifactResolver</implementation>
+            <isolated-realm>false</isolated-realm>
+            <requirements>
+                <requirement>
+                    <role>org.apache.maven.artifact.manager.WagonManager</role>
+                    <field-name>wagonManager</field-name>
+                </requirement>
+                <requirement>
+                    <role>org.apache.maven.artifact.transform.ArtifactTransformationManager</role>
+                    <field-name>transformationManager</field-name>
+                </requirement>
+                <requirement>
+                    <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
+                    <field-name>artifactFactory</field-name>
+                </requirement>
+                <requirement>
+                    <role>org.apache.maven.artifact.resolver.ArtifactCollector</role>
+                    <field-name>artifactCollector</field-name>
+                </requirement>
+            </requirements>
+        </component>
+    </components>
+</plexus>
\ No newline at end of file

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

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

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



Mime
View raw message