archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joak...@apache.org
Subject svn commit: r582987 [2/3] - in /maven/archiva/trunk: archiva-base/archiva-consumers/archiva-consumer-api/ archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ archiva-base/archiva-consumers/archiva-core-...
Date Mon, 08 Oct 2007 22:07:50 GMT
Modified: maven/archiva/trunk/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearchTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearchTest.java?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearchTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearchTest.java Mon Oct  8 15:07:39 2007
@@ -19,7 +19,6 @@
  * under the License.
  */
 
-import org.apache.commons.lang.StringUtils;
 import org.apache.lucene.search.Hits;
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.search.Query;
@@ -29,7 +28,6 @@
 import org.apache.maven.archiva.indexer.MockConfiguration;
 import org.apache.maven.archiva.indexer.RepositoryContentIndex;
 import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
-import org.apache.maven.archiva.model.ArchivaRepository;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
 
@@ -62,10 +60,7 @@
 
         assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
 
-        String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" );
-
-        ArchivaRepository repository =
-            new ArchivaRepository( TEST_DEFAULT_REPO_ID, TEST_DEFAULT_REPOSITORY_NAME, repoUri );
+        ManagedRepositoryConfiguration repository = createRepository( TEST_DEFAULT_REPO_ID, TEST_DEFAULT_REPOSITORY_NAME, repoDir );
 
         File indexLocation = new File( "target/index-crossrepo-" + getName() + "/" );
 
@@ -167,5 +162,14 @@
         assertEquals( "Repository Hits", repoCount, results.getRepositories().size() );
 
         assertEquals( "Search Result Hits", hitCount, results.getHits().size() );
+    }
+    
+    protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
+    {
+        ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+        repo.setId( id );
+        repo.setName( name );
+        repo.setLocation( location.getAbsolutePath() );
+        return repo;
     }
 }

Modified: maven/archiva/trunk/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-model/src/main/mdo/archiva-base.xml?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-model/src/main/mdo/archiva-base.xml (original)
+++ maven/archiva/trunk/archiva-base/archiva-model/src/main/mdo/archiva-base.xml Mon Oct  8 15:07:39 2007
@@ -25,7 +25,7 @@
         This object is not serialized to the Database.
       </description>
       <fields>
-        <!-- Note: these are only managed repositories. This should be reviewed as to whether they are still needed -->
+        <!-- Note: these are only managed repositories. This should be reviewed as to whether they are still needed
         <field>
           <name>repositories</name>
           <version>1.0.0+</version>
@@ -34,6 +34,7 @@
             <multiplicity>*</multiplicity>
           </association>
         </field>
+         -->
         <field>
           <name>artifacts</name>
           <version>1.0.0+</version>
@@ -93,7 +94,7 @@
          |_| \_\___| .__/ \___/|___/_|\__\___/|_|   \__, |
                    |_|                              |___/
       -->
-
+    <!-- 
     <class stash.storable="true"
            jpox.table="REPOSITORIES"
            jpox.not-persisted-fields="modelEncoding">
@@ -205,6 +206,7 @@
         </codeSegment>
       </codeSegments>
     </class>
+     -->
 
     <!-- _______________________________________________________________
            _         _   _  __            _
@@ -2287,129 +2289,6 @@
           <version>1.0.0+</version>
           <code><![CDATA[
     private static final long serialVersionUID = -7113629916828442780L;
-          ]]></code>
-        </codeSegment>
-        <codeSegment>
-          <version>1.0.0+</version>
-          <code><![CDATA[
-    private transient long startTimestamp;
-    
-    public void triggerStart()
-    {
-        startTimestamp = System.currentTimeMillis();
-    }
-
-    public void triggerFinished()
-    {
-        long finished = System.currentTimeMillis();
-        setDuration( finished - startTimestamp );
-        setWhenGathered( new java.util.Date( finished ) );
-    }
-
-    public void increaseFileCount()
-    {
-        this.totalFileCount++;
-    }
-
-    public void increaseNewFileCount()
-    {
-        this.newFileCount++;
-    }
-
-    private transient java.util.List knownConsumers;
-    
-    private transient java.util.List invalidConsumers;
-    
-    public void setKnownConsumers( java.util.List consumers )
-    {
-        knownConsumers = consumers;
-    }
-    
-    public void setInvalidConsumers( java.util.List consumers )
-    {
-        invalidConsumers = consumers;
-    }
-
-    private static boolean isEmpty( java.util.Collection coll )
-    {
-        if ( coll == null )
-        {
-            return true;
-        }
-
-        return coll.isEmpty();
-    }
-
-    public String toDump( ArchivaRepository repo )
-    {
-        java.text.SimpleDateFormat df = new java.text.SimpleDateFormat();
-        StringBuffer buf = new StringBuffer();
-
-        buf.append( "\n.\\ Scan of " ).append( this.getRepositoryId() );
-        buf.append( " \\.__________________________________________" );
-
-        buf.append( "\n  Repository URL    : " ).append( repo.getUrl() );
-        buf.append( "\n  Repository Name   : " ).append( repo.getModel().getName() );
-        buf.append( "\n  Repository Layout : " ).append( repo.getModel().getLayoutName() );
-
-        buf.append( "\n  Known Consumers   : " );
-        if ( !isEmpty( knownConsumers ) )
-        {
-            buf.append( "(" ).append( knownConsumers.size() ).append( " configured)" );
-            for ( java.util.Iterator iter = knownConsumers.iterator(); iter.hasNext(); )
-            {
-                String id = (String) iter.next();
-                buf.append( "\n                      " ).append( id );
-            }
-        }
-        else
-        {
-            buf.append( "<none>" );
-        }
-
-        buf.append( "\n  Invalid Consumers : " );
-        if ( !isEmpty( invalidConsumers ) )
-        {
-            buf.append( "(" ).append( invalidConsumers.size() ).append( " configured)" );
-            for ( java.util.Iterator iter = invalidConsumers.iterator(); iter.hasNext(); )
-            {
-                String id = (String) iter.next();
-                buf.append( "\n                      " ).append( id );
-            }
-        }
-        else
-        {
-            buf.append( "<none>" );
-        }
-
-        buf.append( "\n  Duration          : " );
-        buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( this.getDuration() ) );
-        buf.append( "\n  When Gathered     : " );
-        if ( this.getWhenGathered() == null )
-        {
-            buf.append( "<null>" );
-        }
-        else
-        {
-            buf.append( df.format( this.getWhenGathered() ) );
-        }
-            
-        buf.append( "\n  Total File Count  : " ).append( this.getTotalFileCount() );
-        
-        long averageMsPerFile = 0;
-        
-        if ( this.totalFileCount != 0 )
-        {
-            averageMsPerFile = ( this.getDuration() / this.getTotalFileCount() );
-        }
-        
-        buf.append( "\n  Avg Time Per File : " );
-        buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( averageMsPerFile ) );
-        buf.append( "\n______________________________________________________________" );
-
-        return buf.toString();
-    }
-            
           ]]></code>
         </codeSegment>
       </codeSegments>

Modified: maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java Mon Oct  8 15:07:39 2007
@@ -28,15 +28,14 @@
 import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
 import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.maven.archiva.model.ArchivaRepository;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.ProjectReference;
+import org.apache.maven.archiva.model.RepositoryURL;
 import org.apache.maven.archiva.model.VersionedReference;
 import org.apache.maven.archiva.policies.DownloadPolicy;
 import org.apache.maven.archiva.policies.PostDownloadPolicy;
 import org.apache.maven.archiva.policies.PreDownloadPolicy;
 import org.apache.maven.archiva.policies.urlcache.UrlFailureCache;
-import org.apache.maven.archiva.repository.ArchivaConfigurationAdaptor;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
 import org.apache.maven.archiva.repository.layout.LayoutException;
@@ -132,7 +131,7 @@
      *         could not be) fetched.
      * @throws ProxyException if there was a problem fetching the artifact.
      */
-    public File fetchFromProxies( ArchivaRepository repository, ArtifactReference artifact )
+    public File fetchFromProxies( ManagedRepositoryConfiguration repository, ArtifactReference artifact )
         throws ProxyException
     {
         File localFile = toLocalFile( repository, artifact );
@@ -141,9 +140,9 @@
         requestProperties.setProperty( "version", artifact.getVersion() );
 
         List<ProxyConnector> connectors = getProxyConnectors( repository );
-        for( ProxyConnector connector: connectors )
+        for ( ProxyConnector connector : connectors )
         {
-            ArchivaRepository targetRepository = connector.getTargetRepository();
+            RemoteRepositoryConfiguration targetRepository = connector.getTargetRepository();
             String targetPath = getLayout( targetRepository ).toPath( artifact );
 
             File downloadedFile = transferFile( connector, targetRepository, targetPath, localFile, requestProperties );
@@ -163,7 +162,7 @@
      *
      * @return the (local) metadata file that was fetched/merged/updated, or null if no metadata file exists.
      */
-    public File fetchFromProxies( ArchivaRepository repository, VersionedReference metadata )
+    public File fetchFromProxies( ManagedRepositoryConfiguration repository, VersionedReference metadata )
         throws ProxyException
     {
         File localFile = toLocalFile( repository, metadata );
@@ -172,9 +171,9 @@
         boolean hasFetched = false;
 
         List<ProxyConnector> connectors = getProxyConnectors( repository );
-        for( ProxyConnector connector: connectors )
+        for ( ProxyConnector connector : connectors )
         {
-            ArchivaRepository targetRepository = connector.getTargetRepository();
+            RemoteRepositoryConfiguration targetRepository = connector.getTargetRepository();
             String targetPath = metadataTools.toPath( metadata );
 
             File localRepoFile = toLocalRepoFile( repository, targetRepository, targetPath );
@@ -226,7 +225,7 @@
      *
      * @return the (local) metadata file that was fetched/merged/updated, or null if no metadata file exists.
      */
-    public File fetchFromProxies( ArchivaRepository repository, ProjectReference metadata )
+    public File fetchFromProxies( ManagedRepositoryConfiguration repository, ProjectReference metadata )
         throws ProxyException
     {
         File localFile = toLocalFile( repository, metadata );
@@ -235,9 +234,9 @@
         boolean hasFetched = false;
 
         List<ProxyConnector> connectors = getProxyConnectors( repository );
-        for( ProxyConnector connector: connectors )
+        for ( ProxyConnector connector : connectors )
         {
-            ArchivaRepository targetRepository = connector.getTargetRepository();
+            RemoteRepositoryConfiguration targetRepository = connector.getTargetRepository();
             String targetPath = metadataTools.toPath( metadata );
 
             File localRepoFile = toLocalRepoFile( repository, targetRepository, targetPath );
@@ -284,16 +283,17 @@
         return null;
     }
 
-    private File toLocalRepoFile( ArchivaRepository repository, ArchivaRepository targetRepository, String targetPath )
+    private File toLocalRepoFile( ManagedRepositoryConfiguration repository,
+                                  RemoteRepositoryConfiguration targetRepository, String targetPath )
     {
         String repoPath = metadataTools.getRepositorySpecificName( targetRepository, targetPath );
-        return new File( repository.getUrl().getPath(), repoPath );
+        return new File( repository.getLocation(), repoPath );
     }
 
     /**
-     * Test if the provided ArchivaRepository has any proxies configured for it.
+     * Test if the provided ManagedRepositoryConfiguration has any proxies configured for it.
      */
-    public boolean hasProxies( ArchivaRepository repository )
+    public boolean hasProxies( ManagedRepositoryConfiguration repository )
     {
         synchronized ( this.proxyConnectorMap )
         {
@@ -301,26 +301,26 @@
         }
     }
 
-    private File toLocalFile( ArchivaRepository repository, ArtifactReference artifact )
+    private File toLocalFile( ManagedRepositoryConfiguration repository, ArtifactReference artifact )
         throws ProxyException
     {
         BidirectionalRepositoryLayout sourceLayout = getLayout( repository );
         String sourcePath = sourceLayout.toPath( artifact );
-        return new File( repository.getUrl().getPath(), sourcePath );
+        return new File( repository.getLocation(), sourcePath );
     }
 
-    private File toLocalFile( ArchivaRepository repository, ProjectReference metadata )
+    private File toLocalFile( ManagedRepositoryConfiguration repository, ProjectReference metadata )
         throws ProxyException
     {
         String sourcePath = metadataTools.toPath( metadata );
-        return new File( repository.getUrl().getPath(), sourcePath );
+        return new File( repository.getLocation(), sourcePath );
     }
 
-    private File toLocalFile( ArchivaRepository repository, VersionedReference metadata )
+    private File toLocalFile( ManagedRepositoryConfiguration repository, VersionedReference metadata )
         throws ProxyException
     {
         String sourcePath = metadataTools.toPath( metadata );
-        return new File( repository.getUrl().getPath(), sourcePath );
+        return new File( repository.getLocation(), sourcePath );
     }
 
     /**
@@ -331,17 +331,43 @@
      * @throws ProxyException if there was a problem obtaining the layout from the repository (usually due to a bad
      *                        configuration of the repository)
      */
-    private BidirectionalRepositoryLayout getLayout( ArchivaRepository repository )
+    private BidirectionalRepositoryLayout getLayout( ManagedRepositoryConfiguration repository )
         throws ProxyException
     {
         try
         {
-            return layoutFactory.getLayout( repository.getLayoutType() );
+            return layoutFactory.getLayout( repository.getLayout() );
         }
         catch ( LayoutException e )
         {
-            throw new ProxyException( "Unable to proxy due to bad repository layout definition [" + repository.getId()
-                + "] had a layout defined as [" + repository.getLayoutType() + "] : " + e.getMessage(), e );
+            throw new ProxyException(
+                                      "Unable to proxy due to bad managed repository layout definition ["
+                                          + repository.getId() + "] had a layout defined as [" + repository.getLayout()
+                                          + "] : " + e.getMessage(), e );
+        }
+    }
+    
+    /**
+     * Get the layout for the repository.
+     *
+     * @param repository the repository to get the layout from.
+     * @return the layout
+     * @throws ProxyException if there was a problem obtaining the layout from the repository (usually due to a bad
+     *                        configuration of the repository)
+     */
+    private BidirectionalRepositoryLayout getLayout( RemoteRepositoryConfiguration repository )
+        throws ProxyException
+    {
+        try
+        {
+            return layoutFactory.getLayout( repository.getLayout() );
+        }
+        catch ( LayoutException e )
+        {
+            throw new ProxyException(
+                                      "Unable to proxy due to bad remote repository layout definition ["
+                                          + repository.getId() + "] had a layout defined as [" + repository.getLayout()
+                                          + "] : " + e.getMessage(), e );
         }
     }
 
@@ -382,11 +408,11 @@
      * @return the local file that was downloaded, or null if not downloaded.
      * @throws ProxyException if transfer was unsuccessful.
      */
-    private File transferFile( ProxyConnector connector, ArchivaRepository remoteRepository, String remotePath,
-                               File localFile, Properties requestProperties )
+    private File transferFile( ProxyConnector connector, RemoteRepositoryConfiguration remoteRepository,
+                               String remotePath, File localFile, Properties requestProperties )
         throws ProxyException
     {
-        String url = remoteRepository.getUrl().toString() + remotePath;
+        String url = remoteRepository.getUrl() + remotePath;
         requestProperties.setProperty( "url", url );
 
         // Is a whitelist defined?
@@ -423,7 +449,8 @@
         Wagon wagon = null;
         try
         {
-            String protocol = remoteRepository.getUrl().getProtocol();
+            RepositoryURL repoUrl = new RepositoryURL( remoteRepository.getUrl() );
+            String protocol = repoUrl.getProtocol();
             wagon = (Wagon) wagons.get( protocol );
             if ( wagon == null )
             {
@@ -497,11 +524,11 @@
      * @param type             the type of checksum to transfer (example: ".md5" or ".sha1")
      * @throws ProxyException if copying the downloaded file into place did not succeed.
      */
-    private void transferChecksum( Wagon wagon, ArchivaRepository remoteRepository, String remotePath, File localFile,
-                                   String type )
+    private void transferChecksum( Wagon wagon, RemoteRepositoryConfiguration remoteRepository, String remotePath,
+                                   File localFile, String type )
         throws ProxyException
     {
-        String url = remoteRepository.getUrl().toString() + remotePath;
+        String url = remoteRepository.getUrl() + remotePath;
 
         // Transfer checksum does not use the policy. 
         if ( urlFailureCache.hasFailedBefore( url + type ) )
@@ -537,7 +564,8 @@
      * @throws ProxyException if there was a problem moving the downloaded file into place.
      * @throws WagonException if there was a problem tranfering the file.
      */
-    private File transferSimpleFile( Wagon wagon, ArchivaRepository remoteRepository, String remotePath, File localFile )
+    private File transferSimpleFile( Wagon wagon, RemoteRepositoryConfiguration remoteRepository, String remotePath,
+                                     File localFile )
         throws ProxyException, WagonException
     {
         assert ( remotePath != null );
@@ -612,9 +640,10 @@
      * @param localFile the local file (utilized by the {@link DownloadPolicy#applyPolicy(String,Properties,File)})
      * @return true if all of the policies passed, false if a policy failed.
      */
-    private boolean applyPolicies( Map<String, ? extends DownloadPolicy> policies, Map<String, String> settings, Properties request, File localFile )
+    private boolean applyPolicies( Map<String, ? extends DownloadPolicy> policies, Map<String, String> settings,
+                                   Properties request, File localFile )
     {
-        for( Entry<String, ? extends DownloadPolicy> entry: policies.entrySet() )
+        for ( Entry<String, ? extends DownloadPolicy> entry : policies.entrySet() )
         {
             String key = (String) entry.getKey();
             DownloadPolicy policy = entry.getValue();
@@ -674,7 +703,8 @@
      * @param remoteRepository the remote repository to connect to.
      * @return true if the connection was successful. false if not connected.
      */
-    private boolean connectToRepository( ProxyConnector connector, Wagon wagon, ArchivaRepository remoteRepository )
+    private boolean connectToRepository( ProxyConnector connector, Wagon wagon,
+                                         RemoteRepositoryConfiguration remoteRepository )
     {
         boolean connected = false;
 
@@ -691,7 +721,7 @@
             String password = remoteRepository.getPassword();
             if ( username != null && password != null )
             {
-                getLogger().info(
+                getLogger().debug(
                                   "Using username " + username + " to connect to remote repository "
                                       + remoteRepository.getUrl() );
                 authInfo = new AuthenticationInfo();
@@ -700,7 +730,7 @@
             }
             else
             {
-                getLogger().info( "No authentication for remote repository needed" );
+                getLogger().debug( "No authentication for remote repository needed" );
             }
 
             Repository wagonRepository = new Repository( remoteRepository.getId(), remoteRepository.getUrl().toString() );
@@ -742,7 +772,7 @@
             return false;
         }
 
-        for( String pattern: patterns )
+        for ( String pattern : patterns )
         {
             if ( SelectorUtils.matchPath( pattern, path, false ) )
             {
@@ -756,7 +786,7 @@
     /**
      * TODO: Ensure that list is correctly ordered based on configuration. See MRM-477
      */
-    public List<ProxyConnector> getProxyConnectors( ArchivaRepository repository )
+    public List<ProxyConnector> getProxyConnectors( ManagedRepositoryConfiguration repository )
     {
         synchronized ( this.proxyConnectorMap )
         {
@@ -765,6 +795,8 @@
             {
                 return Collections.EMPTY_LIST;
             }
+            
+            Collections.sort( ret, ProxyConnectorOrderComparator.getInstance() );
             return ret;
         }
     }
@@ -792,8 +824,9 @@
             ProxyConnectorOrderComparator proxyOrderSorter = new ProxyConnectorOrderComparator();
             this.proxyConnectorMap.clear();
 
-            List<ProxyConnectorConfiguration> proxyConfigs = archivaConfiguration.getConfiguration().getProxyConnectors();
-            for( ProxyConnectorConfiguration proxyConfig: proxyConfigs )
+            List<ProxyConnectorConfiguration> proxyConfigs = archivaConfiguration.getConfiguration()
+                .getProxyConnectors();
+            for ( ProxyConnectorConfiguration proxyConfig : proxyConfigs )
             {
                 String key = proxyConfig.getSourceRepoId();
 
@@ -831,23 +864,23 @@
 
                 // Add the connector.
                 connectors.add( connector );
-                
+
                 // Ensure the list is sorted.
                 Collections.sort( connectors, proxyOrderSorter );
 
                 // Set the key to the list of connectors.
                 this.proxyConnectorMap.put( key, connectors );
             }
-            
-            
+
         }
 
         synchronized ( this.networkProxyMap )
         {
             this.networkProxyMap.clear();
 
-            List<NetworkProxyConfiguration> networkProxies = archivaConfiguration.getConfiguration().getNetworkProxies();
-            for( NetworkProxyConfiguration networkProxyConfig: networkProxies )
+            List<NetworkProxyConfiguration> networkProxies = archivaConfiguration.getConfiguration()
+                .getNetworkProxies();
+            for ( NetworkProxyConfiguration networkProxyConfig : networkProxies )
             {
                 String key = networkProxyConfig.getId();
 
@@ -864,24 +897,14 @@
         }
     }
 
-    private ArchivaRepository getRemoteRepository( String repoId )
+    private RemoteRepositoryConfiguration getRemoteRepository( String repoId )
     {
-        RemoteRepositoryConfiguration repoConfig = archivaConfiguration.getConfiguration()
-            .findRemoteRepositoryById( repoId );
-
-        ArchivaRepository repo = new ArchivaRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getUrl() );
-        repo.getModel().setLayoutName( repoConfig.getLayout() );
-        repo.setUsername( repoConfig.getUsername() );
-        repo.setPassword( repoConfig.getPassword() );
-        return repo;
+        return archivaConfiguration.getConfiguration().findRemoteRepositoryById( repoId );
     }
 
-    private ArchivaRepository getManagedRepository( String repoId )
+    private ManagedRepositoryConfiguration getManagedRepository( String repoId )
     {
-        ManagedRepositoryConfiguration repoConfig = archivaConfiguration.getConfiguration()
-            .findManagedRepositoryById( repoId );
-
-        return ArchivaConfigurationAdaptor.toArchivaRepository( repoConfig );
+        return archivaConfiguration.getConfiguration().findManagedRepositoryById( repoId );
     }
 
     public void initialize()

Modified: maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java Mon Oct  8 15:07:39 2007
@@ -19,7 +19,8 @@
  * under the License.
  */
 
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.repository.connector.RepositoryConnector;
 
 import java.util.Iterator;
@@ -35,9 +36,9 @@
 public class ProxyConnector
     implements RepositoryConnector
 {
-    private ArchivaRepository sourceRepository;
+    private ManagedRepositoryConfiguration sourceRepository;
 
-    private ArchivaRepository targetRepository;
+    private RemoteRepositoryConfiguration targetRepository;
 
     private List<String> blacklist;
 
@@ -59,22 +60,22 @@
         this.blacklist = blacklist;
     }
 
-    public ArchivaRepository getSourceRepository()
+    public ManagedRepositoryConfiguration getSourceRepository()
     {
         return sourceRepository;
     }
 
-    public void setSourceRepository( ArchivaRepository sourceRepository )
+    public void setSourceRepository( ManagedRepositoryConfiguration sourceRepository )
     {
         this.sourceRepository = sourceRepository;
     }
 
-    public ArchivaRepository getTargetRepository()
+    public RemoteRepositoryConfiguration getTargetRepository()
     {
         return targetRepository;
     }
 
-    public void setTargetRepository( ArchivaRepository targetRepository )
+    public void setTargetRepository( RemoteRepositoryConfiguration targetRepository )
     {
         this.targetRepository = targetRepository;
     }

Modified: maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/RepositoryProxyConnectors.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/RepositoryProxyConnectors.java?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/RepositoryProxyConnectors.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/RepositoryProxyConnectors.java Mon Oct  8 15:07:39 2007
@@ -19,7 +19,7 @@
  * under the License.
  */
 
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.ProjectReference;
 import org.apache.maven.archiva.model.VersionedReference;
@@ -47,7 +47,7 @@
      * @return true if the fetch operation succeeded in obtaining content, false if no content was obtained.
      * @throws ProxyException if there was a problem fetching the content from the target repositories.
      */
-    public File fetchFromProxies( ArchivaRepository repository, ArtifactReference artifact )
+    public File fetchFromProxies( ManagedRepositoryConfiguration repository, ArtifactReference artifact )
         throws ProxyException;
     
     /**
@@ -62,7 +62,7 @@
      * @return true if the fetch operation succeeded in obtaining content, false if no content was obtained.
      * @throws ProxyException if there was a problem fetching the content from the target repositories.
      */
-    public File fetchFromProxies( ArchivaRepository repository, VersionedReference metadata )
+    public File fetchFromProxies( ManagedRepositoryConfiguration repository, VersionedReference metadata )
         throws ProxyException;
     
     /**
@@ -77,7 +77,7 @@
      * @return true if the fetch operation succeeded in obtaining content, false if no content was obtained.
      * @throws ProxyException if there was a problem fetching the content from the target repositories.
      */
-    public File fetchFromProxies( ArchivaRepository repository, ProjectReference metadata )
+    public File fetchFromProxies( ManagedRepositoryConfiguration repository, ProjectReference metadata )
         throws ProxyException;
 
     /**
@@ -86,7 +86,7 @@
      * @param repository the source repository to look for.
      * @return the List of {@link ProxyConnector} objects.
      */
-    public List<ProxyConnector> getProxyConnectors( ArchivaRepository repository );
+    public List<ProxyConnector> getProxyConnectors( ManagedRepositoryConfiguration repository );
 
     /**
      * Tests to see if the provided repository is a source repository for
@@ -96,5 +96,5 @@
      * @return true if there are proxy connectors that use the provided 
      *   repository as a source repository.
      */
-    public boolean hasProxies( ArchivaRepository repository );
+    public boolean hasProxies( ManagedRepositoryConfiguration repository );
 }

Modified: maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java Mon Oct  8 15:07:39 2007
@@ -20,14 +20,16 @@
  */
 
 import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.common.utils.PathUtil;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.model.ArchivaRepository;
 import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.policies.CachedFailuresPolicy;
+import org.apache.maven.archiva.policies.ChecksumPolicy;
+import org.apache.maven.archiva.policies.ReleasesPolicy;
+import org.apache.maven.archiva.policies.SnapshotsPolicy;
 import org.apache.maven.archiva.policies.urlcache.UrlFailureCache;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
@@ -93,11 +95,11 @@
 
     protected RepositoryProxyConnectors proxyHandler;
 
-    protected ArchivaRepository managedDefaultRepository;
+    protected ManagedRepositoryConfiguration managedDefaultRepository;
 
     protected File managedDefaultDir;
 
-    protected ArchivaRepository managedLegacyRepository;
+    protected ManagedRepositoryConfiguration managedLegacyRepository;
 
     protected File managedLegacyDir;
 
@@ -246,40 +248,25 @@
         return ref;
     }
 
-    protected ArchivaRepository createManagedLegacyRepository()
+    protected ManagedRepositoryConfiguration createManagedLegacyRepository()
     {
-        return createRepository( "src/test/repositories/legacy-managed", "testManagedLegacyRepo",
-                                 "Test Managed (Legacy) Repository", "legacy" );
+        return createRepository( "testManagedLegacyRepo", "Test Managed (Legacy) Repository",
+                                 "src/test/repositories/legacy-managed", "legacy" );
     }
 
-    protected ArchivaRepository createProxiedLegacyRepository()
+    protected ManagedRepositoryConfiguration createProxiedLegacyRepository()
     {
-        return createRepository( "src/test/repositories/legacy-proxied", "testProxiedLegacyRepo",
-                                 "Test Proxied (Legacy) Repository", "legacy" );
+        return createRepository( "testProxiedLegacyRepo", "Test Proxied (Legacy) Repository",
+                                 "src/test/repositories/legacy-proxied", "legacy" );
     }
 
-    protected ManagedRepositoryConfiguration createRepoConfig( ArchivaRepository repo )
+    protected ManagedRepositoryConfiguration createRepository( String id, String name, String path, String layout )
     {
-        return createRepoConfig( repo.getId(), repo.getName(), repo.getUrl().toString(), repo.getLayoutType() );
-    }
-
-    protected ManagedRepositoryConfiguration createRepoConfig( String id, String name, String path, String layout )
-    {
-        ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration();
-
-        repoConfig.setId( id );
-        repoConfig.setName( name );
-
-        repoConfig.setLocation( path );
-        repoConfig.setLayout( layout );
-
-        return repoConfig;
-    }
-
-    protected ArchivaRepository createRepository( String id, String name, String path, String layout )
-    {
-        ArchivaRepository repo = new ArchivaRepository( id, name, PathUtil.toUrl( path ) );
-        repo.getModel().setLayoutName( layout );
+        ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+        repo.setId( id );
+        repo.setName( name );
+        repo.setLocation( path );
+        repo.setLayout( layout );
 
         return repo;
     }
@@ -320,6 +307,12 @@
             }
         }
     }
+    
+    protected void saveConnector( String sourceRepoId, String targetRepoId )
+    {
+        saveConnector( sourceRepoId, targetRepoId, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED,
+                       SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+    }
 
     protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy,
                                   String snapshotPolicy, String cacheFailuresPolicy )
@@ -356,24 +349,33 @@
 
         repoConfig.setLocation( path );
 
+        int count = config.getConfiguration().getManagedRepositories().size();
         config.getConfiguration().addManagedRepository( repoConfig );
 
-        config.triggerChange( "repository", "" );
+        String prefix = "managedRepositories.managedRepository(" + count + ")";
+        config.triggerChange( prefix + ".id", repoConfig.getId() );
+        config.triggerChange( prefix + ".name", repoConfig.getName() );
+        config.triggerChange( prefix + ".location", repoConfig.getLocation() );
+        config.triggerChange( prefix + ".layout", repoConfig.getLayout() );
     }
 
-    protected void saveRemoteRepositoryConfig( String id, String name, String path, String layout )
+    protected void saveRemoteRepositoryConfig( String id, String name, String url, String layout )
     {
         RemoteRepositoryConfiguration repoConfig = new RemoteRepositoryConfiguration();
 
         repoConfig.setId( id );
         repoConfig.setName( name );
         repoConfig.setLayout( layout );
+        repoConfig.setUrl( url );
 
-        repoConfig.setUrl( path );
-
+        int count = config.getConfiguration().getRemoteRepositories().size();
         config.getConfiguration().addRemoteRepository( repoConfig );
 
-        config.triggerChange( "repository", "" );
+        String prefix = "remoteRepositories.remoteRepository(" + count + ")";
+        config.triggerChange( prefix + ".id", repoConfig.getId() );
+        config.triggerChange( prefix + ".name", repoConfig.getName() );
+        config.triggerChange( prefix + ".url", repoConfig.getUrl() );
+        config.triggerChange( prefix + ".layout", repoConfig.getLayout() );
     }
 
     protected File saveTargetedRepositoryConfig( String id, String originalPath, String targetPath, String layout )
@@ -388,6 +390,7 @@
         return repoLocation;
     }
 
+    @Override
     protected void setUp()
         throws Exception
     {
@@ -405,9 +408,9 @@
         managedDefaultRepository =
             createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository", repoPath, "default" );
 
-        managedDefaultDir = new File( managedDefaultRepository.getUrl().getPath() );
+        managedDefaultDir = new File( managedDefaultRepository.getLocation() );
 
-        ManagedRepositoryConfiguration repoConfig = createRepoConfig( managedDefaultRepository );
+        ManagedRepositoryConfiguration repoConfig = managedDefaultRepository;
 
         config.getConfiguration().addManagedRepository( repoConfig );
 
@@ -419,9 +422,9 @@
         managedLegacyRepository = createRepository( ID_LEGACY_MANAGED, "Legacy Managed Repository",
                                                     REPOPATH_LEGACY_MANAGED_TARGET, "legacy" );
 
-        managedLegacyDir = new File( managedLegacyRepository.getUrl().getPath() );
+        managedLegacyDir = new File( managedLegacyRepository.getLocation() );
 
-        repoConfig = createRepoConfig( managedLegacyRepository );
+        repoConfig = managedLegacyRepository;
 
         config.getConfiguration().addManagedRepository( repoConfig );
 
@@ -484,7 +487,7 @@
         {
             // This is just a warning.
             System.err.println(
-                "Skipping setup of testable managed repsoitory, source dir does not exist: " + sourceDir );
+                "[WARN] Skipping setup of testable managed repository, source dir does not exist: " + sourceDir );
             return;
         }
 

Modified: maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java Mon Oct  8 15:07:39 2007
@@ -44,7 +44,7 @@
         throws Exception
     {
         String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
-        File expectedFile = new File( managedDefaultDir, path );
+        File expectedFile = new File( managedDefaultDir.getAbsoluteFile(), path );
         ArtifactReference artifact = createArtifactReference( "default", path );
 
         expectedFile.delete();
@@ -78,7 +78,7 @@
         throws Exception
     {
         String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
-        File expectedFile = new File( managedDefaultDir, path );
+        File expectedFile = new File( managedDefaultDir.getAbsoluteFile(), path );
         ArtifactReference artifact = createArtifactReference( "default", path );
 
         expectedFile.delete();

Modified: maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java Mon Oct  8 15:07:39 2007
@@ -286,10 +286,8 @@
         wagonMockControl.replay();
 
         // Configure Connector (usually done within archiva.xml configuration)
-        saveConnector( ID_DEFAULT_MANAGED, "badproxied", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
-                       SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
-        saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
-                       SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+        saveConnector( ID_DEFAULT_MANAGED, "badproxied" );
+        saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2 );
 
         // Attempt the proxy fetch.
         File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
@@ -307,7 +305,7 @@
         String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
         setupTestableManagedRepository( path );
 
-        File expectedFile = new File( managedDefaultDir, path );
+        File expectedFile = new File( managedDefaultDir.getAbsoluteFile(), path );
         ArtifactReference artifact = createArtifactReference( "default", path );
 
         expectedFile.delete();
@@ -318,15 +316,14 @@
         saveRemoteRepositoryConfig( "badproxied2", "Bad Proxied 2", "test://dead.machine.com/repo/", "default" );
 
         // Configure Connector (usually done within archiva.xml configuration)
-        saveConnector( ID_DEFAULT_MANAGED, "badproxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
-                       SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
-        saveConnector( ID_DEFAULT_MANAGED, "badproxied2", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
-                       SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+        saveConnector( ID_DEFAULT_MANAGED, "badproxied1" );
+        saveConnector( ID_DEFAULT_MANAGED, "badproxied2" );
 
-        wagonMock.getIfNewer( path, new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" ), 0 );
+        File tmpFile = new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" );
+        wagonMock.getIfNewer( path, tmpFile, 0 );
         wagonMockControl.setThrowable( new TransferFailedException( "transfer failed" ) );
 
-        wagonMock.getIfNewer( path, new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" ), 0 );
+        wagonMock.getIfNewer( path, tmpFile, 0 );
         wagonMockControl.setThrowable( new TransferFailedException( "transfer failed" ) );
 
         wagonMockControl.replay();

Modified: maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/WagonDelegate.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/WagonDelegate.java?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/WagonDelegate.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/WagonDelegate.java Mon Oct  8 15:07:39 2007
@@ -61,7 +61,7 @@
     public boolean getIfNewer( String resourceName, File destination, long timestamp )
         throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
     {
-        getLogger().debug( ".getIfNewer(" + resourceName + ", " + destination + ", " + timestamp + ")" );
+        getLogger().info( ".getIfNewer(" + resourceName + ", " + destination + ", " + timestamp + ")" );
 
         boolean result = delegate.getIfNewer( resourceName, destination, timestamp );
         createIfMissing( destination );

Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java Mon Oct  8 15:07:39 2007
@@ -19,7 +19,8 @@
  * under the License.
  */
 
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 
 import java.util.List;
 
@@ -31,11 +32,11 @@
  */
 public interface RepositoryConnector
 {
-    public ArchivaRepository getSourceRepository();
+    public ManagedRepositoryConfiguration getSourceRepository();
 
-    public ArchivaRepository getTargetRepository();
+    public RemoteRepositoryConfiguration getTargetRepository();
 
-    public List getBlacklist();
+    public List<String> getBlacklist();
     
-    public List getWhitelist();
+    public List<String> getWhitelist();
 }

Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java Mon Oct  8 15:07:39 2007
@@ -24,8 +24,9 @@
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.FileTypes;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.ProjectReference;
@@ -116,7 +117,7 @@
      * @return the Set of available versions, based on the project reference.
      * @throws LayoutException
      */
-    public Set<String> gatherAvailableVersions( ArchivaRepository managedRepository, ProjectReference reference )
+    public Set<String> gatherAvailableVersions( ManagedRepositoryConfiguration managedRepository, ProjectReference reference )
         throws LayoutException, IOException
     {
         String path = toPath( reference );
@@ -127,7 +128,7 @@
             path = path.substring( 0, idx );
         }
 
-        File repoDir = new File( managedRepository.getUrl().getPath(), path );
+        File repoDir = new File( managedRepository.getLocation(), path );
 
         if ( !repoDir.exists() )
         {
@@ -169,7 +170,7 @@
         return foundVersions;
     }
 
-    private boolean hasArtifact( ArchivaRepository managedRepository, VersionedReference reference )
+    private boolean hasArtifact( ManagedRepositoryConfiguration managedRepository, VersionedReference reference )
         throws LayoutException
     {
         try
@@ -192,10 +193,10 @@
      * @throws IOException     if the versioned reference is invalid (example: doesn't exist, or isn't a directory)
      * @throws LayoutException
      */
-    public ArtifactReference getFirstArtifact( ArchivaRepository managedRepository, VersionedReference reference )
+    public ArtifactReference getFirstArtifact( ManagedRepositoryConfiguration managedRepository, VersionedReference reference )
         throws LayoutException, IOException
     {
-        BidirectionalRepositoryLayout layout = layoutFactory.getLayout( managedRepository.getLayoutType() );
+        BidirectionalRepositoryLayout layout = layoutFactory.getLayout( managedRepository.getLayout() );
         String path = toPath( reference );
 
         int idx = path.lastIndexOf( '/' );
@@ -204,7 +205,7 @@
             path = path.substring( 0, idx );
         }
 
-        File repoDir = new File( managedRepository.getUrl().getPath(), path );
+        File repoDir = new File( managedRepository.getLocation(), path );
 
         if ( !repoDir.exists() )
         {
@@ -227,7 +228,7 @@
                 continue;
             }
 
-            String relativePath = PathUtil.getRelative( managedRepository.getUrl().getPath(), repoFiles[i] );
+            String relativePath = PathUtil.getRelative( managedRepository.getLocation(), repoFiles[i] );
 
             if ( matchesArtifactPattern( relativePath ) )
             {
@@ -247,10 +248,10 @@
      * @return the Set of snapshot artifact versions found.
      * @throws LayoutException
      */
-    public Set<String> gatherSnapshotVersions( ArchivaRepository managedRepository, VersionedReference reference )
+    public Set<String> gatherSnapshotVersions( ManagedRepositoryConfiguration managedRepository, VersionedReference reference )
         throws LayoutException, IOException
     {
-        BidirectionalRepositoryLayout layout = layoutFactory.getLayout( managedRepository.getLayoutType() );
+        BidirectionalRepositoryLayout layout = layoutFactory.getLayout( managedRepository.getLayout() );
         String path = toPath( reference );
 
         int idx = path.lastIndexOf( '/' );
@@ -259,7 +260,7 @@
             path = path.substring( 0, idx );
         }
 
-        File repoDir = new File( managedRepository.getUrl().getPath(), path );
+        File repoDir = new File( managedRepository.getLocation(), path );
 
         if ( !repoDir.exists() )
         {
@@ -285,7 +286,7 @@
                 continue;
             }
 
-            String relativePath = PathUtil.getRelative( managedRepository.getUrl().getPath(), repoFiles[i] );
+            String relativePath = PathUtil.getRelative( managedRepository.getLocation(), repoFiles[i] );
 
             if ( matchesArtifactPattern( relativePath ) )
             {
@@ -490,7 +491,7 @@
      * @param path       the path to the metadata.xml file to adjust the name of.
      * @return the newly adjusted path reference to the repository specific metadata path.
      */
-    public String getRepositorySpecificName( ArchivaRepository repository, String path )
+    public String getRepositorySpecificName( RemoteRepositoryConfiguration repository, String path )
     {
         return getRepositorySpecificName( repository.getId(), path );
     }
@@ -528,11 +529,11 @@
         configuration.addChangeListener( this );
     }
 
-    public ArchivaRepositoryMetadata readProxyMetadata( ArchivaRepository managedRepository, ProjectReference reference,
+    public ArchivaRepositoryMetadata readProxyMetadata( ManagedRepositoryConfiguration managedRepository, ProjectReference reference,
                                                         String proxyId )
     {
         String metadataPath = getRepositorySpecificName( proxyId, toPath( reference ) );
-        File metadataFile = new File( managedRepository.getUrl().getPath(), metadataPath );
+        File metadataFile = new File( managedRepository.getLocation(), metadataPath );
 
         try
         {
@@ -547,11 +548,11 @@
         }
     }
 
-    public ArchivaRepositoryMetadata readProxyMetadata( ArchivaRepository managedRepository,
+    public ArchivaRepositoryMetadata readProxyMetadata( ManagedRepositoryConfiguration managedRepository,
                                                         VersionedReference reference, String proxyId )
     {
         String metadataPath = getRepositorySpecificName( proxyId, toPath( reference ) );
-        File metadataFile = new File( managedRepository.getUrl().getPath(), metadataPath );
+        File metadataFile = new File( managedRepository.getLocation(), metadataPath );
 
         try
         {
@@ -579,12 +580,12 @@
      * @throws RepositoryMetadataException
      * @throws IOException
      */
-    public void updateMetadata( ArchivaRepository managedRepository, ProjectReference reference )
+    public void updateMetadata( ManagedRepositoryConfiguration managedRepository, ProjectReference reference )
         throws LayoutException, RepositoryMetadataException, IOException
     {
         Comparator<String> comparator = VersionComparator.getInstance();
 
-        File metadataFile = new File( managedRepository.getUrl().getPath(), toPath( reference ) );
+        File metadataFile = new File( managedRepository.getLocation(), toPath( reference ) );
 
         ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();
         metadata.setGroupId( reference.getGroupId() );
@@ -660,11 +661,11 @@
      * @throws RepositoryMetadataException
      * @throws IOException
      */
-    public void updateMetadata( ArchivaRepository managedRepository, VersionedReference reference )
+    public void updateMetadata( ManagedRepositoryConfiguration managedRepository, VersionedReference reference )
         throws LayoutException, RepositoryMetadataException, IOException
     {
-        BidirectionalRepositoryLayout layout = layoutFactory.getLayout( managedRepository.getLayoutType() );
-        File metadataFile = new File( managedRepository.getUrl().getPath(), toPath( reference ) );
+        BidirectionalRepositoryLayout layout = layoutFactory.getLayout( managedRepository.getLayout() );
+        File metadataFile = new File( managedRepository.getLocation(), toPath( reference ) );
 
         ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();
         metadata.setGroupId( reference.getGroupId() );
@@ -730,7 +731,7 @@
                     throw new IOException( "Not snapshot artifact found to reference in " + reference );
                 }
 
-                File artifactFile = new File( managedRepository.getUrl().getPath(), layout.toPath( artifact ) );
+                File artifactFile = new File( managedRepository.getLocation(), layout.toPath( artifact ) );
 
                 if ( artifactFile.exists() )
                 {

Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolverFactory.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolverFactory.java?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolverFactory.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolverFactory.java Mon Oct  8 15:07:39 2007
@@ -23,15 +23,13 @@
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.model.ArchivaRepository;
-import org.apache.maven.archiva.repository.ArchivaConfigurationAdaptor;
 import org.apache.maven.archiva.repository.RepositoryException;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
 import org.apache.maven.archiva.repository.layout.LayoutException;
 import org.apache.maven.archiva.repository.project.resolvers.NopProjectResolver;
 import org.apache.maven.archiva.repository.project.resolvers.ProjectModelResolverStack;
-import org.apache.maven.archiva.repository.project.resolvers.RepositoryProjectResolver;
+import org.apache.maven.archiva.repository.project.resolvers.ManagedRepositoryProjectResolver;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
@@ -98,20 +96,20 @@
         archivaConfiguration.addChangeListener( this );
     }
 
-    private RepositoryProjectResolver toResolver( ArchivaRepository repo )
+    private ManagedRepositoryProjectResolver toResolver( ManagedRepositoryConfiguration repo )
         throws RepositoryException
     {
         try
         {
-            BidirectionalRepositoryLayout layout = layoutFactory.getLayout( repo.getLayoutType() );
+            BidirectionalRepositoryLayout layout = layoutFactory.getLayout( repo.getLayout() );
             ProjectModelReader reader = project400Reader;
 
-            if ( StringUtils.equals( "legacy", repo.getLayoutType() ) )
+            if ( StringUtils.equals( "legacy", repo.getLayout() ) )
             {
                 reader = project300Reader;
             }
 
-            RepositoryProjectResolver resolver = new RepositoryProjectResolver( repo, reader, layout );
+            ManagedRepositoryProjectResolver resolver = new ManagedRepositoryProjectResolver( repo, reader, layout );
             return resolver;
         }
         catch ( LayoutException e )
@@ -129,12 +127,11 @@
 
             List<ManagedRepositoryConfiguration> list =
                 archivaConfiguration.getConfiguration().getManagedRepositories();
-            for ( ManagedRepositoryConfiguration repositoryConfiguration : list )
+            for ( ManagedRepositoryConfiguration repo : list )
             {
-                ArchivaRepository repo = ArchivaConfigurationAdaptor.toArchivaRepository( repositoryConfiguration );
                 try
                 {
-                    RepositoryProjectResolver resolver = toResolver( repo );
+                    ManagedRepositoryProjectResolver resolver = toResolver( repo );
 
                     // Add filesystem based resolver.
                     this.currentResolverStack.addProjectModelResolver( resolver );

Copied: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/ManagedRepositoryProjectResolver.java (from r582882, maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/RepositoryProjectResolver.java)
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/ManagedRepositoryProjectResolver.java?p2=maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/ManagedRepositoryProjectResolver.java&p1=maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/RepositoryProjectResolver.java&r1=582882&r2=582987&rev=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/RepositoryProjectResolver.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/ManagedRepositoryProjectResolver.java Mon Oct  8 15:07:39 2007
@@ -19,9 +19,9 @@
  * under the License.
  */
 
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.ArchivaProjectModel;
-import org.apache.maven.archiva.model.ArchivaRepository;
 import org.apache.maven.archiva.model.VersionedReference;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
 import org.apache.maven.archiva.repository.project.ProjectModelException;
@@ -31,21 +31,21 @@
 import java.io.File;
 
 /**
- * Resolve Project from filesystem. 
+ * Resolve Project from managed repository. 
  *
  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
  */
-public class RepositoryProjectResolver
+public class ManagedRepositoryProjectResolver
     implements ProjectModelResolver, FilesystemBasedResolver
 {
-    private ArchivaRepository repository;
+    private ManagedRepositoryConfiguration repository;
 
     private ProjectModelReader reader;
 
     private BidirectionalRepositoryLayout layout;
 
-    public RepositoryProjectResolver( ArchivaRepository repository, ProjectModelReader reader,
+    public ManagedRepositoryProjectResolver( ManagedRepositoryConfiguration repository, ProjectModelReader reader,
                                       BidirectionalRepositoryLayout layout )
     {
         this.repository = repository;
@@ -60,7 +60,7 @@
             .getVersion(), "", "pom" );
 
         String path = layout.toPath( artifact );
-        File repoFile = new File( this.repository.getUrl().getPath(), path );
+        File repoFile = new File( this.repository.getLocation(), path );
 
         return reader.read( repoFile );
     }

Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java Mon Oct  8 15:07:39 2007
@@ -19,12 +19,12 @@
  * under the License.
  */
 
-import org.apache.commons.collections.Closure;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.maven.archiva.configuration.FileTypes;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
-import org.apache.maven.archiva.model.ArchivaRepository;
-import org.apache.maven.archiva.model.RepositoryContentStatistics;
 import org.apache.maven.archiva.repository.RepositoryException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.DirectoryWalker;
@@ -54,19 +54,20 @@
      */
     private RepositoryContentConsumers consumerUtil;
 
-    public RepositoryContentStatistics scan( ArchivaRepository repository, long changesSince )
+    public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository, long changesSince )
         throws RepositoryException
     {
-        List knownContentConsumers = consumerUtil.getSelectedKnownConsumers();
-        List invalidContentConsumers = consumerUtil.getSelectedInvalidConsumers();
-        List ignoredPatterns = filetypes.getFileTypePatterns( FileTypes.IGNORED );
+        List<KnownRepositoryContentConsumer> knownContentConsumers = consumerUtil.getSelectedKnownConsumers();
+        List<InvalidRepositoryContentConsumer> invalidContentConsumers = consumerUtil.getSelectedInvalidConsumers();
+        List<String> ignoredPatterns = filetypes.getFileTypePatterns( FileTypes.IGNORED );
 
         return scan( repository, knownContentConsumers, invalidContentConsumers, ignoredPatterns, changesSince );
     }
 
-    public RepositoryContentStatistics scan( ArchivaRepository repository, List knownContentConsumers,
-                                             List invalidContentConsumers, List ignoredContentPatterns,
-                                             long changesSince )
+    public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository,
+                                          List<KnownRepositoryContentConsumer> knownContentConsumers,
+                                          List<InvalidRepositoryContentConsumer> invalidContentConsumers,
+                                          List<String> ignoredContentPatterns, long changesSince )
         throws RepositoryException
     {
         if ( repository == null )
@@ -74,29 +75,24 @@
             throw new IllegalArgumentException( "Unable to operate on a null repository." );
         }
 
-        if ( !"file".equals( repository.getUrl().getProtocol() ) )
-        {
-            throw new UnsupportedOperationException( "Only filesystem repositories are supported." );
-        }
-
-        File repositoryBase = new File( repository.getUrl().getPath() );
+        File repositoryBase = new File( repository.getLocation() );
 
         if ( !repositoryBase.exists() )
         {
-            throw new UnsupportedOperationException(
-                "Unable to scan a repository, directory " + repositoryBase.getAbsolutePath() + " does not exist." );
+            throw new UnsupportedOperationException( "Unable to scan a repository, directory "
+                + repositoryBase.getAbsolutePath() + " does not exist." );
         }
 
         if ( !repositoryBase.isDirectory() )
         {
-            throw new UnsupportedOperationException(
-                "Unable to scan a repository, path " + repositoryBase.getAbsolutePath() + " is not a directory." );
+            throw new UnsupportedOperationException( "Unable to scan a repository, path "
+                + repositoryBase.getAbsolutePath() + " is not a directory." );
         }
 
         // Setup Includes / Excludes.
 
-        List allExcludes = new ArrayList();
-        List allIncludes = new ArrayList();
+        List<String> allExcludes = new ArrayList<String>();
+        List<String> allIncludes = new ArrayList<String>();
 
         if ( CollectionUtils.isNotEmpty( ignoredContentPatterns ) )
         {
@@ -115,8 +111,8 @@
         dirWalker.setExcludes( allExcludes );
 
         // Setup the Scan Instance
-        RepositoryScannerInstance scannerInstance =
-            new RepositoryScannerInstance( repository, knownContentConsumers, invalidContentConsumers, getLogger() );
+        RepositoryScannerInstance scannerInstance = new RepositoryScannerInstance( repository, knownContentConsumers,
+                                                                                   invalidContentConsumers, getLogger() );
         scannerInstance.setOnlyModifiedAfterTimestamp( changesSince );
 
         dirWalker.addDirectoryWalkListener( scannerInstance );
@@ -124,38 +120,21 @@
         // Execute scan.
         dirWalker.scan();
 
-        RepositoryContentStatistics stats = scannerInstance.getStatistics();
-
-        ConsumerIdClosure consumerIdList;
-
-        consumerIdList = new ConsumerIdClosure();
-        CollectionUtils.forAllDo( knownContentConsumers, consumerIdList );
-        stats.setKnownConsumers( consumerIdList.getList() );
+        RepositoryScanStatistics stats = scannerInstance.getStatistics();
 
-        consumerIdList = new ConsumerIdClosure();
-        CollectionUtils.forAllDo( invalidContentConsumers, consumerIdList );
-        stats.setInvalidConsumers( consumerIdList.getList() );
+        stats.setKnownConsumers( gatherIds( knownContentConsumers ) );
+        stats.setInvalidConsumers( gatherIds( invalidContentConsumers ) );
 
         return stats;
     }
 
-    class ConsumerIdClosure
-        implements Closure
+    private List<String> gatherIds( List<? extends RepositoryContentConsumer> consumers )
     {
-        private List list = new ArrayList();
-
-        public void execute( Object input )
-        {
-            if ( input instanceof RepositoryContentConsumer )
-            {
-                RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
-                list.add( consumer.getId() );
-            }
-        }
-
-        public List getList()
+        List<String> ids = new ArrayList<String>();
+        for ( RepositoryContentConsumer consumer : consumers )
         {
-            return list;
+            ids.add( consumer.getId() );
         }
+        return ids;
     }
 }

Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java?rev=582987&r1=582986&r2=582987&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java Mon Oct  8 15:07:39 2007
@@ -21,23 +21,17 @@
 
 import org.apache.commons.collections.Closure;
 import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.Predicate;
 import org.apache.commons.collections.functors.IfClosure;
-import org.apache.commons.collections.functors.OrPredicate;
 import org.apache.maven.archiva.common.utils.BaseFile;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
-import org.apache.maven.archiva.consumers.functors.PermanentConsumerPredicate;
-import org.apache.maven.archiva.model.ArchivaRepository;
 import org.apache.maven.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
 import org.apache.maven.archiva.repository.scanner.functors.ConsumerWantsFilePredicate;
 import org.apache.maven.archiva.repository.scanner.functors.TriggerBeginScanClosure;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -55,7 +49,6 @@
  */
 public class RepositoryContentConsumers
     extends AbstractLogEnabled
-    implements Initializable
 {
     /**
      * @plexus.requirement
@@ -72,122 +65,82 @@
      */
     private List<InvalidRepositoryContentConsumer> availableInvalidConsumers;
 
-    private Predicate selectedKnownPredicate;
-
-    private Predicate selectedInvalidPredicate;
-
-    class SelectedKnownRepoConsumersPredicate
-        implements Predicate
+    public List<String> getSelectedKnownConsumerIds()
     {
-        public boolean evaluate( Object object )
-        {
-            boolean satisfies = false;
-
-            if ( object instanceof KnownRepositoryContentConsumer )
-            {
-                KnownRepositoryContentConsumer known = (KnownRepositoryContentConsumer) object;
-                RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration()
-                    .getRepositoryScanning();
-
-                return scanning.getKnownContentConsumers().contains( known.getId() );
-            }
-
-            return satisfies;
-        }
+        RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
+        return scanning.getKnownContentConsumers();
     }
 
-    class SelectedInvalidRepoConsumersPredicate
-        implements Predicate
+    public List<String> getSelectedInvalidConsumerIds()
     {
-        public boolean evaluate( Object object )
-        {
-            boolean satisfies = false;
-
-            if ( object instanceof InvalidRepositoryContentConsumer )
-            {
-                InvalidRepositoryContentConsumer invalid = (InvalidRepositoryContentConsumer) object;
-                RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration()
-                    .getRepositoryScanning();
-
-                return scanning.getInvalidContentConsumers().contains( invalid.getId() );
-            }
-
-            return satisfies;
-        }
+        RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
+        return scanning.getInvalidContentConsumers();
     }
 
-    class RepoConsumerToMapClosure
-        implements Closure
+    public Map<String, KnownRepositoryContentConsumer> getSelectedKnownConsumersMap()
     {
-        private Map map = new HashMap();
+        Map<String, KnownRepositoryContentConsumer> consumerMap = new HashMap<String, KnownRepositoryContentConsumer>();
+
+        List<String> knownSelected = getSelectedKnownConsumerIds();
 
-        public void execute( Object input )
+        for ( KnownRepositoryContentConsumer consumer : availableKnownConsumers )
         {
-            if ( input instanceof RepositoryContentConsumer )
+            if ( knownSelected.contains( consumer.getId() ) || consumer.isPermanent() )
             {
-                RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
-                map.put( consumer.getId(), consumer );
+                consumerMap.put( consumer.getId(), consumer );
             }
         }
 
-        public Map getMap()
-        {
-            return map;
-        }
+        return consumerMap;
     }
 
-    public void initialize()
-        throws InitializationException
+    public Map<String, InvalidRepositoryContentConsumer> getSelectedInvalidConsumersMap()
     {
-        Predicate permanentConsumers = new PermanentConsumerPredicate();
+        Map<String, InvalidRepositoryContentConsumer> consumerMap = new HashMap<String, InvalidRepositoryContentConsumer>();
 
-        this.selectedKnownPredicate = new OrPredicate( permanentConsumers, new SelectedKnownRepoConsumersPredicate() );
-        this.selectedInvalidPredicate = new OrPredicate( permanentConsumers,
-                                                         new SelectedInvalidRepoConsumersPredicate() );
-    }
+        List<String> invalidSelected = getSelectedInvalidConsumerIds();
 
-    public List getSelectedKnownConsumerIds()
-    {
-        RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
-        return scanning.getKnownContentConsumers();
-    }
+        for ( InvalidRepositoryContentConsumer consumer : availableInvalidConsumers )
+        {
+            if ( invalidSelected.contains( consumer.getId() ) || consumer.isPermanent() )
+            {
+                consumerMap.put( consumer.getId(), consumer );
+            }
+        }
 
-    public List getSelectedInvalidConsumerIds()
-    {
-        RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
-        return scanning.getInvalidContentConsumers();
+        return consumerMap;
     }
 
-    public Map getSelectedKnownConsumersMap()
+    public List<KnownRepositoryContentConsumer> getSelectedKnownConsumers()
     {
-        RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure();
-        Closure ifclosure = IfClosure.getInstance( selectedKnownPredicate, consumerMapClosure );
-        CollectionUtils.forAllDo( availableKnownConsumers, ifclosure );
+        List<KnownRepositoryContentConsumer> ret = new ArrayList<KnownRepositoryContentConsumer>();
 
-        return consumerMapClosure.getMap();
-    }
+        List<String> knownSelected = getSelectedInvalidConsumerIds();
 
-    public Map getSelectedInvalidConsumersMap()
-    {
-        RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure();
-        Closure ifclosure = IfClosure.getInstance( selectedInvalidPredicate, consumerMapClosure );
-        CollectionUtils.forAllDo( availableInvalidConsumers, ifclosure );
+        for ( KnownRepositoryContentConsumer consumer : availableKnownConsumers )
+        {
+            if ( knownSelected.contains( consumer.getId() ) || consumer.isPermanent() )
+            {
+                ret.add( consumer );
+            }
+        }
 
-        return consumerMapClosure.getMap();
+        return ret;
     }
 
-    public List getSelectedKnownConsumers()
+    public List<InvalidRepositoryContentConsumer> getSelectedInvalidConsumers()
     {
-        List ret = new ArrayList();
-        ret.addAll( CollectionUtils.select( availableKnownConsumers, selectedKnownPredicate ) );
+        List<InvalidRepositoryContentConsumer> ret = new ArrayList<InvalidRepositoryContentConsumer>();
 
-        return ret;
-    }
+        List<String> invalidSelected = getSelectedInvalidConsumerIds();
 
-    public List getSelectedInvalidConsumers()
-    {
-        List ret = new ArrayList();
-        ret.addAll( CollectionUtils.select( availableInvalidConsumers, selectedInvalidPredicate ) );
+        for ( InvalidRepositoryContentConsumer consumer : availableInvalidConsumers )
+        {
+            if ( invalidSelected.contains( consumer.getId() ) || consumer.isPermanent() )
+            {
+                ret.add( consumer );
+            }
+        }
 
         return ret;
     }
@@ -212,7 +165,7 @@
         this.availableInvalidConsumers = availableInvalidConsumers;
     }
 
-    public void executeConsumers( ArchivaRepository repository, File localFile )
+    public void executeConsumers( ManagedRepositoryConfiguration repository, File localFile )
     {
         // Run the repository consumers
         try
@@ -224,7 +177,7 @@
 
             // yuck. In case you can't read this, it says
             // "process the file if the consumer has it in the includes list, and not in the excludes list"
-            BaseFile baseFile = new BaseFile( repository.getUrl().getPath(), localFile );
+            BaseFile baseFile = new BaseFile( repository.getLocation(), localFile );
             ConsumerWantsFilePredicate predicate = new ConsumerWantsFilePredicate();
             predicate.setBasefile( baseFile );
             ConsumerProcessFileClosure closure = new ConsumerProcessFileClosure( getLogger() );
@@ -242,10 +195,10 @@
         }
         finally
         {
-/* TODO: This is never called by the repository scanner instance, so not calling here either - but it probably should be?
-            CollectionUtils.forAllDo( availableKnownConsumers, triggerCompleteScan );
-            CollectionUtils.forAllDo( availableInvalidConsumers, triggerCompleteScan );
-*/
+            /* TODO: This is never called by the repository scanner instance, so not calling here either - but it probably should be?
+                        CollectionUtils.forAllDo( availableKnownConsumers, triggerCompleteScan );
+                        CollectionUtils.forAllDo( availableInvalidConsumers, triggerCompleteScan );
+            */
         }
     }
 

Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanStatistics.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanStatistics.java?rev=582987&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanStatistics.java (added)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanStatistics.java Mon Oct  8 15:07:39 2007
@@ -0,0 +1,144 @@
+package org.apache.maven.archiva.repository.scanner;
+
+/*
+ * 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.
+ */
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.model.RepositoryContentStatistics;
+
+import java.util.List;
+
+/**
+ * RepositoryScanStatistics - extension to the RepositoryContentStatistics model.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryScanStatistics
+    extends RepositoryContentStatistics
+{
+    private transient List<String> knownConsumers;
+
+    private transient List<String> invalidConsumers;
+
+    private transient long startTimestamp;
+
+    public void triggerStart()
+    {
+        startTimestamp = System.currentTimeMillis();
+    }
+
+    public void triggerFinished()
+    {
+        long finished = System.currentTimeMillis();
+        setDuration( finished - startTimestamp );
+        setWhenGathered( new java.util.Date( finished ) );
+    }
+
+    public void increaseFileCount()
+    {
+        long count = getTotalFileCount();
+        setTotalFileCount( ++count );
+    }
+
+    public void increaseNewFileCount()
+    {
+        long count = getNewFileCount();
+        setNewFileCount( ++count );
+    }
+
+    public void setKnownConsumers( List<String> consumers )
+    {
+        knownConsumers = consumers;
+    }
+
+    public void setInvalidConsumers( List<String> consumers )
+    {
+        invalidConsumers = consumers;
+    }
+
+    public String toDump( ManagedRepositoryConfiguration repo )
+    {
+        java.text.SimpleDateFormat df = new java.text.SimpleDateFormat();
+        StringBuffer buf = new StringBuffer();
+
+        buf.append( "\n.\\ Scan of " ).append( this.getRepositoryId() );
+        buf.append( " \\.__________________________________________" );
+
+        buf.append( "\n  Repository Dir    : " ).append( repo.getLocation() );
+        buf.append( "\n  Repository Name   : " ).append( repo.getName() );
+        buf.append( "\n  Repository Layout : " ).append( repo.getLayout() );
+
+        buf.append( "\n  Known Consumers   : " );
+        if ( CollectionUtils.isNotEmpty( knownConsumers ) )
+        {
+            buf.append( "(" ).append( knownConsumers.size() ).append( " configured)" );
+            for ( String id : knownConsumers )
+            {
+                buf.append( "\n                      " ).append( id );
+            }
+        }
+        else
+        {
+            buf.append( "<none>" );
+        }
+
+        buf.append( "\n  Invalid Consumers : " );
+        if ( CollectionUtils.isNotEmpty( invalidConsumers ) )
+        {
+            buf.append( "(" ).append( invalidConsumers.size() ).append( " configured)" );
+            for ( String id : invalidConsumers )
+            {
+                buf.append( "\n                      " ).append( id );
+            }
+        }
+        else
+        {
+            buf.append( "<none>" );
+        }
+
+        buf.append( "\n  Duration          : " );
+        buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( this.getDuration() ) );
+        buf.append( "\n  When Gathered     : " );
+        if ( this.getWhenGathered() == null )
+        {
+            buf.append( "<null>" );
+        }
+        else
+        {
+            buf.append( df.format( this.getWhenGathered() ) );
+        }
+
+        buf.append( "\n  Total File Count  : " ).append( this.getTotalFileCount() );
+
+        long averageMsPerFile = 0;
+
+        if ( getTotalFileCount() != 0 )
+        {
+            averageMsPerFile = ( this.getDuration() / this.getTotalFileCount() );
+        }
+
+        buf.append( "\n  Avg Time Per File : " );
+        buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( averageMsPerFile ) );
+        buf.append( "\n______________________________________________________________" );
+
+        return buf.toString();
+    }
+}

Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanStatistics.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanStatistics.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanStatistics.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message