archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r567269 [2/4] - in /maven/archiva/branches/MRM-462: archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ a...
Date Sat, 18 Aug 2007 13:37:48 GMT
Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java Sat Aug 18 06:37:43 2007
@@ -22,7 +22,6 @@
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
 import org.apache.maven.archiva.model.ArchivaRepository;
 import org.codehaus.plexus.digest.ChecksumFile;
 import org.codehaus.plexus.digest.Digester;
@@ -38,16 +37,16 @@
 import java.util.List;
 
 /**
- * ValidateChecksumConsumer - validate the provided checksum against the file it represents. 
+ * ValidateChecksumConsumer - validate the provided checksum against the file it represents.
  *
  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
- * 
  * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
- *                   role-hint="validate-checksum"
- *                   instantiation-strategy="per-lookup"
+ * role-hint="validate-checksum"
+ * instantiation-strategy="per-lookup"
  */
-public class ValidateChecksumConsumer extends AbstractMonitoredConsumer
+public class ValidateChecksumConsumer
+    extends AbstractMonitoredConsumer
     implements KnownRepositoryContentConsumer, Initializable
 {
     private static final String NOT_VALID_CHECKSUM = "checksum-not-valid";
@@ -99,13 +98,9 @@
         return false;
     }
 
-    public void beginScan( ArchivaRepository repository ) throws ConsumerException
+    public void beginScan( ArchivaRepository repository )
+        throws ConsumerException
     {
-        if ( !repository.isManaged() )
-        {
-            throw new ConsumerException( "Consumer requires managed repository." );
-        }
-
         this.repository = repository;
         this.repositoryDir = new File( repository.getUrl().getPath() );
     }
@@ -125,7 +120,8 @@
         return this.includes;
     }
 
-    public void processFile( String path ) throws ConsumerException
+    public void processFile( String path )
+        throws ConsumerException
     {
         File checksumFile = new File( this.repositoryDir, path );
         try
@@ -141,7 +137,8 @@
         }
         catch ( DigesterException e )
         {
-            triggerConsumerError( CHECKSUM_DIGESTER_FAILURE, "Digester failure during checksum validation on " + checksumFile );
+            triggerConsumerError( CHECKSUM_DIGESTER_FAILURE,
+                                  "Digester failure during checksum validation on " + checksumFile );
         }
         catch ( IOException e )
         {
@@ -149,7 +146,8 @@
         }
     }
 
-    public void initialize() throws InitializationException
+    public void initialize()
+        throws InitializationException
     {
         for ( Iterator itDigesters = digesterList.iterator(); itDigesters.hasNext(); )
         {

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java Sat Aug 18 06:37:43 2007
@@ -19,35 +19,31 @@
  * under the License.
  */
 
-import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader;
-import org.apache.maven.archiva.repository.metadata.RepositoryMetadataWriter;
-import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException;
-import org.apache.maven.archiva.repository.layout.FilenameParts;
-import org.apache.maven.archiva.repository.layout.LayoutException;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.commons.io.FileUtils;
 import org.apache.maven.archiva.common.utils.VersionComparator;
-import org.apache.maven.archiva.indexer.RepositoryIndexException;
-import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.commons.io.FileUtils;
+import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
+import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
+import org.apache.maven.archiva.repository.layout.FilenameParts;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException;
+import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader;
+import org.apache.maven.archiva.repository.metadata.RepositoryMetadataWriter;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.List;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
-import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 /**
  * M2 implementation for cleaning up the released snapshots.
  *
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
- * @version
  */
 public class CleanupReleasedSnapshotsRepositoryPurge
     extends AbstractRepositoryPurge
@@ -60,7 +56,7 @@
                                                     ArtifactDAO artifactDao )
     {
         super( repository, layout, artifactDao );
-        metadataReader = new RepositoryMetadataReader();        
+        metadataReader = new RepositoryMetadataReader();
     }
 
     public void process( String path )

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java Sat Aug 18 06:37:43 2007
@@ -19,37 +19,31 @@
 * under the License.
 */
 
-import org.apache.maven.archiva.repository.layout.FilenameParts;
-import org.apache.maven.archiva.repository.layout.LayoutException;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
 import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.indexer.RepositoryIndexException;
-import org.apache.maven.archiva.model.ArchivaRepository;
 import org.apache.maven.archiva.database.ArtifactDAO;
+import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
+import org.apache.maven.archiva.repository.layout.FilenameParts;
+import org.apache.maven.archiva.repository.layout.LayoutException;
 
-import java.util.Calendar;
-import java.util.GregorianCalendar;
 import java.io.File;
+import java.util.Calendar;
 
 /**
  * Purge repository for snapshots older than the specified days in the repository configuration.
  *
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
- * @version
  */
 public class DaysOldRepositoryPurge
     extends AbstractRepositoryPurge
-{       
-    private RepositoryConfiguration repoConfig;
+{
+    private int daysOlder;
 
-    public DaysOldRepositoryPurge( ArchivaRepository repository,
-                                   BidirectionalRepositoryLayout layout, ArtifactDAO artifactDao,
-                                   RepositoryConfiguration repoConfig)
+    public DaysOldRepositoryPurge( ArchivaRepository repository, BidirectionalRepositoryLayout layout,
+                                   ArtifactDAO artifactDao, int daysOlder )
     {
         super( repository, layout, artifactDao );
-        this.repoConfig = repoConfig;
+        this.daysOlder = daysOlder;
     }
 
     public void process( String path )
@@ -59,7 +53,7 @@
         {
             File artifactFile = new File( repository.getUrl().getPath(), path );
 
-            if( !artifactFile.exists() )
+            if ( !artifactFile.exists() )
             {
                 return;
             }
@@ -69,7 +63,7 @@
             if ( VersionUtil.isSnapshot( parts.version ) )
             {
                 Calendar olderThanThisDate = Calendar.getInstance();
-                olderThanThisDate.add( Calendar.DATE, ( -1 * repoConfig.getDaysOlder() ) );
+                olderThanThisDate.add( Calendar.DATE, ( -1 * daysOlder ) );
 
                 if ( artifactFile.lastModified() < olderThanThisDate.getTimeInMillis() )
                 {
@@ -86,5 +80,5 @@
             throw new RepositoryPurgeException( le.getMessage() );
         }
     }
-    
+
 }

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java Sat Aug 18 06:37:43 2007
@@ -19,26 +19,24 @@
  * under the License.
  */
 
-import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.maven.archiva.consumers.ConsumerException;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.FileTypes;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
+import org.apache.maven.archiva.consumers.ConsumerException;
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.maven.archiva.database.ArchivaDAO;
 import org.apache.maven.archiva.model.ArchivaRepository;
-import org.apache.maven.archiva.repository.layout.LayoutException;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.FileTypes;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-import org.apache.maven.archiva.database.ArchivaDAO;
-import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
-import org.apache.maven.archiva.indexer.RepositoryContentIndex;
-import org.codehaus.plexus.registry.RegistryListener;
-import org.codehaus.plexus.registry.Registry;
+import org.apache.maven.archiva.repository.layout.LayoutException;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import org.codehaus.plexus.registry.Registry;
+import org.codehaus.plexus.registry.RegistryListener;
 
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Consumer for removing old snapshots in the repository based on the criteria
@@ -83,8 +81,6 @@
      */
     private FileTypes filetypes;
 
-    private ArchivaRepository repository;
-
     private List includes = new ArrayList();
 
     private List propertyNameTriggers = new ArrayList();
@@ -93,6 +89,8 @@
 
     private RepositoryPurge cleanUp;
 
+    private boolean deleteReleasedSnapshots;
+
     public String getId()
     {
         return this.id;
@@ -121,15 +119,7 @@
     public void beginScan( ArchivaRepository repository )
         throws ConsumerException
     {
-        BidirectionalRepositoryLayout repositoryLayout = null;
-
-        if ( !repository.isManaged() )
-        {
-            throw new ConsumerException( "Consumer requires managed repository." );
-        }
-
-        this.repository = repository;
-
+        BidirectionalRepositoryLayout repositoryLayout;
         try
         {
             repositoryLayout = layoutFactory.getLayout( repository.getLayoutType() );
@@ -140,18 +130,23 @@
                 "Unable to initialize consumer due to unknown repository layout: " + e.getMessage(), e );
         }
 
-        RepositoryConfiguration repoConfig = configuration.getConfiguration().findRepositoryById( repository.getId() );
+        ManagedRepositoryConfiguration repoConfig =
+            configuration.getConfiguration().findManagedRepositoryById( repository.getId() );
+
         if ( repoConfig.getDaysOlder() != 0 )
         {
-            repoPurge = new DaysOldRepositoryPurge( repository, repositoryLayout, dao.getArtifactDAO(), repoConfig );
+            repoPurge = new DaysOldRepositoryPurge( repository, repositoryLayout, dao.getArtifactDAO(),
+                                                    repoConfig.getDaysOlder() );
         }
         else
         {
-            repoPurge =
-                new RetentionCountRepositoryPurge( repository, repositoryLayout, dao.getArtifactDAO(), repoConfig );
+            repoPurge = new RetentionCountRepositoryPurge( repository, repositoryLayout, dao.getArtifactDAO(),
+                                                           repoConfig.getRetentionCount() );
         }
 
         cleanUp = new CleanupReleasedSnapshotsRepositoryPurge( repository, repositoryLayout, dao.getArtifactDAO() );
+
+        deleteReleasedSnapshots = repoConfig.isDeleteReleasedSnapshots();
     }
 
     public void processFile( String path )
@@ -159,9 +154,7 @@
     {
         try
         {
-            RepositoryConfiguration repoConfig =
-                configuration.getConfiguration().findRepositoryById( repository.getId() );
-            if ( repoConfig.isDeleteReleasedSnapshots() )
+            if ( deleteReleasedSnapshots )
             {
                 cleanUp.process( path );
             }

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java Sat Aug 18 06:37:43 2007
@@ -19,49 +19,44 @@
 * under the License.
 */
 
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-import org.apache.maven.archiva.repository.layout.FilenameParts;
-import org.apache.maven.archiva.repository.layout.LayoutException;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
 import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.apache.maven.archiva.indexer.RepositoryIndexException;
-import org.apache.maven.archiva.model.ArchivaRepository;
 import org.apache.maven.archiva.database.ArtifactDAO;
+import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
+import org.apache.maven.archiva.repository.layout.FilenameParts;
+import org.apache.maven.archiva.repository.layout.LayoutException;
 
 import java.io.File;
-import java.util.List;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * Purge the repository by retention count. Retain only the specified number of snapshots.
  *
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
- * @version
  */
 public class RetentionCountRepositoryPurge
     extends AbstractRepositoryPurge
 {
-    private RepositoryConfiguration repoConfig;
+    private int retentionCount;
 
-    public RetentionCountRepositoryPurge( ArchivaRepository repository,
-                                          BidirectionalRepositoryLayout layout, ArtifactDAO artifactDao,
-                                          RepositoryConfiguration repoConfig )
+    public RetentionCountRepositoryPurge( ArchivaRepository repository, BidirectionalRepositoryLayout layout,
+                                          ArtifactDAO artifactDao, int retentionCount )
     {
         super( repository, layout, artifactDao );
-        this.repoConfig = repoConfig;
+        this.retentionCount = retentionCount;
     }
 
     public void process( String path )
         throws RepositoryPurgeException
     {
         try
-        {               
+        {
             File artifactFile = new File( repository.getUrl().getPath(), path );
 
-            if( !artifactFile.exists() )
+            if ( !artifactFile.exists() )
             {
                 return;
             }
@@ -69,7 +64,7 @@
             FilenameParts parts = getFilenameParts( path );
 
             if ( VersionUtil.isSnapshot( parts.version ) )
-            {                                 
+            {
                 File parentDir = artifactFile.getParentFile();
 
                 if ( parentDir.isDirectory() )
@@ -78,13 +73,13 @@
                     List uniqueVersionFilenames = getUniqueVersions( files );
                     Collections.sort( uniqueVersionFilenames );
 
-                    if ( uniqueVersionFilenames.size() > repoConfig.getRetentionCount() )
+                    if ( uniqueVersionFilenames.size() > retentionCount )
                     {
                         int count = uniqueVersionFilenames.size();
                         for ( Iterator iter = uniqueVersionFilenames.iterator(); iter.hasNext(); )
                         {
                             String filename = (String) iter.next();
-                            if ( count > repoConfig.getRetentionCount() )
+                            if ( count > retentionCount )
                             {
                                 File[] artifactFiles = getFiles( parentDir, filename );
                                 purge( artifactFiles );

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java Sat Aug 18 06:37:43 2007
@@ -19,46 +19,43 @@
 * under the License.
 */
 
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
-import org.codehaus.plexus.jdo.JdoFactory;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.common.utils.PathUtil;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.database.ArtifactDAO;
 import org.apache.maven.archiva.model.ArchivaRepository;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
-import org.apache.maven.archiva.repository.layout.LayoutException;
 import org.apache.maven.archiva.repository.layout.DefaultBidirectionalRepositoryLayout;
-import org.apache.maven.archiva.database.ArchivaDAO;
-import org.apache.maven.archiva.database.ArtifactDAO;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
+import org.codehaus.plexus.jdo.JdoFactory;
 import org.jpox.SchemaTool;
 
-import javax.jdo.PersistenceManagerFactory;
 import javax.jdo.PersistenceManager;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Properties;
+import javax.jdo.PersistenceManagerFactory;
+import java.io.File;
+import java.net.URL;
 import java.util.Iterator;
 import java.util.Map;
-import java.net.URL;
-import java.io.File;
+import java.util.Properties;
 
 /**
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
  */
-public class AbstractRepositoryPurgeTest
+public abstract class AbstractRepositoryPurgeTest
     extends PlexusTestCase
 {
     public static final String TEST_REPO_ID = "test-repo";
 
     public static final String TEST_REPO_NAME = "Test Repository";
 
-    public static final String TEST_REPO_URL = "file://" + getBasedir() + "/target/test-classes/test-repo/";
+    public static final String TEST_REPO_URL = getBasedir() + "/target/test-classes/test-repo/";
 
     public static final int TEST_RETENTION_COUNT = 2;
 
     public static final int TEST_DAYS_OLDER = 30;
 
-    private RepositoryConfiguration config;
+    private ManagedRepositoryConfiguration config;
 
     private ArchivaRepository repo;
 
@@ -136,17 +133,17 @@
         dao = (ArtifactDAO) lookup( ArtifactDAO.class.getName(), "jdo" );
     }
 
-    public RepositoryConfiguration getRepoConfiguration()
+    public ManagedRepositoryConfiguration getRepoConfiguration()
     {
         if ( config == null )
         {
-            config = new RepositoryConfiguration();
+            config = new ManagedRepositoryConfiguration();
         }
 
         config.setId( TEST_REPO_ID );
         config.setName( TEST_REPO_NAME );
         config.setDaysOlder( TEST_DAYS_OLDER );
-        config.setUrl( TEST_REPO_URL );
+        config.setLocation( TEST_REPO_URL );
         config.setReleases( true );
         config.setSnapshots( true );
         config.setRetentionCount( TEST_RETENTION_COUNT );
@@ -158,7 +155,7 @@
     {
         if ( repo == null )
         {
-            repo = new ArchivaRepository( TEST_REPO_ID, TEST_REPO_NAME, TEST_REPO_URL );
+            repo = new ArchivaRepository( TEST_REPO_ID, TEST_REPO_NAME, PathUtil.toUrl( TEST_REPO_URL ) );
         }
 
         return repo;

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java Sat Aug 18 06:37:43 2007
@@ -1,24 +1,9 @@
 package org.apache.maven.archiva.consumers.core.repository;
 
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
-import org.codehaus.plexus.jdo.JdoFactory;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-import org.apache.maven.archiva.model.ArchivaRepository;
-import org.apache.maven.archiva.model.ArchivaArtifactModel;
 import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.maven.archiva.database.ArchivaDAO;
-import org.apache.maven.archiva.database.jdo.JdoAccess;
-
-import javax.jdo.JDOFatalUserException;
-import javax.jdo.JDOHelper;
-import javax.jdo.spi.JDOImplHelper;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Date;
+
 import java.io.File;
+import java.util.Date;
 
 
 /**
@@ -35,7 +20,8 @@
     {
         super.setUp();
 
-        repoPurge = new DaysOldRepositoryPurge( getRepository(), getLayout(), dao, getRepoConfiguration() );
+        repoPurge =
+            new DaysOldRepositoryPurge( getRepository(), getLayout(), dao, getRepoConfiguration().getDaysOlder() );
     }
 
     private void setLastModified()
@@ -53,7 +39,7 @@
         throws Exception
     {
         populateDb();
-        
+
         setLastModified();
 
         repoPurge.process( PATH_TO_BY_DAYS_OLD_ARTIFACT );
@@ -97,8 +83,7 @@
         assertNotNull( savedArtifact );
 
         //POM
-        artifact =
-            dao.createArtifact( "org.apache.maven.plugins", "maven-install-plugin", "2.2-SNAPSHOT", "", "pom" );
+        artifact = dao.createArtifact( "org.apache.maven.plugins", "maven-install-plugin", "2.2-SNAPSHOT", "", "pom" );
         assertNotNull( artifact );
         artifact.getModel().setLastModified( new Date() );
         artifact.getModel().setOrigin( "test" );

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java Sat Aug 18 06:37:43 2007
@@ -44,7 +44,8 @@
     {
         super.setUp();
 
-        repoPurge = new RetentionCountRepositoryPurge( getRepository(), getLayout(), dao, getRepoConfiguration() );
+        repoPurge = new RetentionCountRepositoryPurge( getRepository(), getLayout(), dao,
+                                                       getRepoConfiguration().getRetentionCount() );
     }
 
     /**

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java Sat Aug 18 06:37:43 2007
@@ -49,10 +49,9 @@
  *
  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
- * 
  * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
- *                   role-hint="update-db-artifact"
- *                   instantiation-strategy="per-lookup"
+ * role-hint="update-db-artifact"
+ * instantiation-strategy="per-lookup"
  */
 public class ArtifactUpdateDatabaseConsumer
     extends AbstractMonitoredConsumer
@@ -140,11 +139,6 @@
     public void beginScan( ArchivaRepository repository )
         throws ConsumerException
     {
-        if ( !repository.isManaged() )
-        {
-            throw new ConsumerException( "Consumer requires managed repository." );
-        }
-
         this.repository = repository;
         this.repositoryDir = new File( repository.getUrl().getPath() );
 
@@ -180,7 +174,8 @@
             }
             catch ( DigesterException e )
             {
-                triggerConsumerWarning( CHECKSUM_CALCULATION, "Unable to calculate the MD5 checksum: " + e.getMessage() );
+                triggerConsumerWarning( CHECKSUM_CALCULATION,
+                                        "Unable to calculate the MD5 checksum: " + e.getMessage() );
             }
 
             try
@@ -189,8 +184,8 @@
             }
             catch ( DigesterException e )
             {
-                triggerConsumerWarning( CHECKSUM_CALCULATION, "Unable to calculate the SHA1 checksum: "
-                    + e.getMessage() );
+                triggerConsumerWarning( CHECKSUM_CALCULATION,
+                                        "Unable to calculate the SHA1 checksum: " + e.getMessage() );
             }
 
             artifact.getModel().setLastModified( new Date( artifactFile.lastModified() ) );
@@ -207,11 +202,11 @@
 
     /**
      * Get a Live Artifact from a Path.
-     * 
+     * <p/>
      * Will resolve the artifact details from the path, and then return a database live version
      * of that artifact.  Suitable for modification and saving (without the need to check for
      * existance in database prior to save.)
-     * 
+     *
      * @param path the path to work from.
      * @return the artifact that is suitable for database saving.
      */
@@ -231,8 +226,8 @@
         }
         catch ( LayoutException e )
         {
-            triggerConsumerError( TYPE_NOT_ARTIFACT, "Path " + path + " cannot be converted to artifact: "
-                + e.getMessage() );
+            triggerConsumerError( TYPE_NOT_ARTIFACT,
+                                  "Path " + path + " cannot be converted to artifact: " + e.getMessage() );
             return null;
         }
     }

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java Sat Aug 18 06:37:43 2007
@@ -20,8 +20,10 @@
  */
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.maven.archiva.configuration.AbstractRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
@@ -31,7 +33,6 @@
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.ArchivaProjectModel;
 import org.apache.maven.archiva.model.RepositoryProblem;
-import org.apache.maven.archiva.model.RepositoryURL;
 import org.apache.maven.archiva.reporting.artifact.CorruptArtifactReport;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
@@ -42,7 +43,6 @@
 import org.apache.maven.archiva.repository.project.ProjectModelFilter;
 import org.apache.maven.archiva.repository.project.ProjectModelReader;
 import org.apache.maven.archiva.repository.project.filters.EffectiveProjectModelFilter;
-import org.apache.maven.archiva.common.utils.VersionUtil;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -146,7 +146,7 @@
         }
 
         File artifactFile = toFile( artifact );
-        RepositoryConfiguration repo = getRepository( artifact );
+        AbstractRepositoryConfiguration repo = getRepository( artifact );
         ProjectModelReader reader = project400Reader;
 
         if ( StringUtils.equals( "legacy", repo.getLayout() ) )
@@ -223,15 +223,15 @@
         }
     }
 
-    private RepositoryConfiguration getRepository( ArchivaArtifact artifact )
+    private ManagedRepositoryConfiguration getRepository( ArchivaArtifact artifact )
     {
         String repoId = artifact.getModel().getRepositoryId();
-        return archivaConfiguration.getConfiguration().findRepositoryById( repoId );
+        return archivaConfiguration.getConfiguration().findManagedRepositoryById( repoId );
     }
 
     private File toFile( ArchivaArtifact artifact )
     {
-        RepositoryConfiguration repoConfig = getRepository( artifact );
+        ManagedRepositoryConfiguration repoConfig = getRepository( artifact );
 
         BidirectionalRepositoryLayout layout = null;
 
@@ -245,9 +245,7 @@
             return null;
         }
 
-        String path = layout.toPath( artifact );
-        RepositoryURL url = new RepositoryURL( repoConfig.getUrl() );
-        return new File( url.getPath(), path );
+        return new File( repoConfig.getLocation(), layout.toPath( artifact ) );
     }
 
     public String getDescription()

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArtifactConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArtifactConsumer.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArtifactConsumer.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArtifactConsumer.java Sat Aug 18 06:37:43 2007
@@ -22,7 +22,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
@@ -45,14 +45,13 @@
 import java.util.Map;
 
 /**
- * IndexArtifactConsumer 
+ * IndexArtifactConsumer
  *
  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
- * 
  * @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer"
- *                   role-hint="index-artifact"
- *                   instantiation-strategy="per-lookup"
+ * role-hint="index-artifact"
+ * instantiation-strategy="per-lookup"
  */
 public class IndexArtifactConsumer
     extends AbstractMonitoredConsumer
@@ -129,8 +128,8 @@
         String repoId = artifact.getModel().getRepositoryId();
         if ( StringUtils.isBlank( repoId ) )
         {
-            throw new IllegalStateException( "Unable to process artifact [" + artifact
-                + "] as it has no repository id associated with it." );
+            throw new IllegalStateException(
+                "Unable to process artifact [" + artifact + "] as it has no repository id associated with it." );
         }
 
         return getIndexedRepositoryDetails( repoId );
@@ -158,7 +157,7 @@
 
     public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
     {
-        if ( ConfigurationNames.isRepositories( propertyName ) )
+        if ( ConfigurationNames.isManagedRepositories( propertyName ) )
         {
             initRepositoryMap();
         }
@@ -182,14 +181,10 @@
         {
             this.repositoryMap.clear();
 
-            Iterator it = configuration.getConfiguration().getRepositories().iterator();
+            Iterator it = configuration.getConfiguration().getManagedRepositories().iterator();
             while ( it.hasNext() )
             {
-                RepositoryConfiguration repoconfig = (RepositoryConfiguration) it.next();
-                if ( !repoconfig.isManaged() )
-                {
-                    continue;
-                }
+                ManagedRepositoryConfiguration repoconfig = (ManagedRepositoryConfiguration) it.next();
 
                 ArchivaRepository repository = ArchivaConfigurationAdaptor.toArchivaRepository( repoconfig );
                 IndexedRepositoryDetails pnl = new IndexedRepositoryDetails();

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java Sat Aug 18 06:37:43 2007
@@ -45,14 +45,13 @@
 import java.util.List;
 
 /**
- * IndexContentConsumer - generic full file content indexing consumer. 
+ * IndexContentConsumer - generic full file content indexing consumer.
  *
  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
- * 
  * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
- *                   role-hint="index-content"
- *                   instantiation-strategy="per-lookup"
+ * role-hint="index-content"
+ * instantiation-strategy="per-lookup"
  */
 public class IndexContentConsumer
     extends AbstractMonitoredConsumer
@@ -132,11 +131,6 @@
     public void beginScan( ArchivaRepository repository )
         throws ConsumerException
     {
-        if ( !repository.isManaged() )
-        {
-            throw new ConsumerException( "Consumer requires managed repository." );
-        }
-
         this.repository = repository;
         this.repositoryDir = new File( repository.getUrl().getPath() );
         this.index = indexFactory.createFileContentIndex( repository );
@@ -147,8 +141,8 @@
         }
         catch ( LayoutException e )
         {
-            throw new ConsumerException( "Unable to initialize consumer due to unknown repository layout: "
-                + e.getMessage(), e );
+            throw new ConsumerException(
+                "Unable to initialize consumer due to unknown repository layout: " + e.getMessage(), e );
         }
     }
 

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndexFactory.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndexFactory.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndexFactory.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndexFactory.java Sat Aug 18 06:37:43 2007
@@ -21,7 +21,7 @@
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.indexer.RepositoryContentIndex;
 import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
 import org.apache.maven.archiva.indexer.bytecode.BytecodeHandlers;
@@ -36,7 +36,6 @@
  *
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * 
  * @plexus.component role="org.apache.maven.archiva.indexer.RepositoryContentIndexFactory" role-hint="lucene"
  */
 public class LuceneRepositoryContentIndexFactory
@@ -66,21 +65,17 @@
     }
 
     /**
-     * Obtain the index directory for the provided repository. 
-     * 
+     * Obtain the index directory for the provided repository.
+     *
      * @param repository the repository to obtain the index directory from.
-     * @param indexId the id of the index
+     * @param indexId    the id of the index
      * @return the directory to put the index into.
      */
     private File toIndexDir( ArchivaRepository repository, String indexId )
     {
-        if ( !repository.isManaged() )
-        {
-            throw new IllegalArgumentException( "Only supports managed repositories." );
-        }
-
         // Attempt to get the specified indexDir in the configuration first.
-        RepositoryConfiguration repoConfig = configuration.getConfiguration().findRepositoryById( repository.getId() );
+        ManagedRepositoryConfiguration repoConfig =
+            configuration.getConfiguration().findManagedRepositoryById( repository.getId() );
         File indexDir;
 
         if ( repoConfig == null )

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearch.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearch.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearch.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearch.java Sat Aug 18 06:37:43 2007
@@ -22,7 +22,6 @@
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.Predicate;
 import org.apache.commons.collections.Transformer;
-import org.apache.commons.collections.functors.AndPredicate;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.queryParser.MultiFieldQueryParser;
 import org.apache.lucene.queryParser.ParseException;
@@ -32,9 +31,7 @@
 import org.apache.lucene.search.Searchable;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-import org.apache.maven.archiva.configuration.functors.IndexedRepositoryPredicate;
-import org.apache.maven.archiva.configuration.functors.LocalRepositoryPredicate;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.indexer.RepositoryContentIndex;
 import org.apache.maven.archiva.indexer.bytecode.BytecodeHandlers;
 import org.apache.maven.archiva.indexer.filecontent.FileContentHandlers;
@@ -53,11 +50,10 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 
 /**
- * DefaultCrossRepositorySearch 
+ * DefaultCrossRepositorySearch
  *
  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
@@ -105,7 +101,7 @@
 
         try
         {
-            QueryParser parser = new MultiFieldQueryParser( new String[] { HashcodesKeys.MD5, HashcodesKeys.SHA1 },
+            QueryParser parser = new MultiFieldQueryParser( new String[]{HashcodesKeys.MD5, HashcodesKeys.SHA1},
                                                             new HashcodesHandlers().getAnalyzer() );
             LuceneQuery query = new LuceneQuery( parser.parse( checksum ) );
             SearchResults results = searchAll( query, limits, indexes );
@@ -256,7 +252,7 @@
             }
             catch ( IOException ie )
             {
-                getLogger().error( "Unable to close index searcher: " + ie.getMessage(), ie );    
+                getLogger().error( "Unable to close index searcher: " + ie.getMessage(), ie );
             }
         }
 
@@ -312,7 +308,7 @@
 
     public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
     {
-        if ( ConfigurationNames.isRepositories( propertyName ) )
+        if ( ConfigurationNames.isManagedRepositories( propertyName ) )
         {
             initRepositories();
         }
@@ -329,28 +325,14 @@
         {
             this.localIndexedRepositories.clear();
 
-            Predicate localIndexedRepos = AndPredicate.getInstance( LocalRepositoryPredicate.getInstance(),
-                                                                    IndexedRepositoryPredicate.getInstance() );
-
-            Collection repos = CollectionUtils.select( configuration.getConfiguration().getRepositories(),
-                                                       localIndexedRepos );
-            
-            Transformer toArchivaRepository = new Transformer()
+            List<ManagedRepositoryConfiguration> repos = configuration.getConfiguration().getManagedRepositories();
+            for ( ManagedRepositoryConfiguration repo : repos )
             {
-
-                public Object transform( Object input )
+                if ( repo.isIndexed() )
                 {
-                    if ( input instanceof RepositoryConfiguration )
-                    {
-                        return ArchivaConfigurationAdaptor.toArchivaRepository( (RepositoryConfiguration) input );
-                    }
-                    return input;
+                    localIndexedRepositories.add( ArchivaConfigurationAdaptor.toArchivaRepository( repo ) );
                 }
-            };
-
-            CollectionUtils.transform( repos, toArchivaRepository );
-
-            this.localIndexedRepositories.addAll( repos );
+            }
         }
     }
 

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/AbstractIndexerTestCase.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/AbstractIndexerTestCase.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/AbstractIndexerTestCase.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/AbstractIndexerTestCase.java Sat Aug 18 06:37:43 2007
@@ -23,7 +23,7 @@
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.indexer.lucene.LuceneIndexHandlers;
 import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentRecord;
 import org.apache.maven.archiva.model.ArchivaArtifact;
@@ -41,7 +41,7 @@
 import java.util.Map;
 
 /**
- * AbstractIndexerTestCase 
+ * AbstractIndexerTestCase
  *
  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
@@ -53,6 +53,10 @@
 
     protected LuceneIndexHandlers indexHandlers;
 
+    private static final String TEST_DEFAULT_REPOSITORY_NAME = "Test Default Repository";
+
+    private static final String TEST_DEFAULT_REPO_ID = "testDefaultRepo";
+
     public abstract String getIndexName();
 
     protected void assertRecord( LuceneRepositoryContentRecord expectedRecord, Document luceneDocument )
@@ -78,9 +82,9 @@
     {
         super.setUp();
 
-        RepositoryContentIndexFactory indexFactory = (RepositoryContentIndexFactory) lookup(
-                                                                                             RepositoryContentIndexFactory.class
-                                                                                                 .getName(), "lucene" );
+        RepositoryContentIndexFactory indexFactory =
+            (RepositoryContentIndexFactory) lookup( RepositoryContentIndexFactory.class
+                .getName(), "lucene" );
 
         ArchivaRepository repository = createTestIndex( getIndexName() );
 
@@ -90,7 +94,7 @@
     }
 
     private ArchivaRepository createTestIndex( String indexName )
-        throws Exception, IOException
+        throws Exception
     {
         File repoDir = new File( getBasedir(), "src/test/managed-repository" );
         File testIndexesDir = new File( getBasedir(), "target/test-indexes" );
@@ -104,16 +108,17 @@
 
         String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" );
 
-        ArchivaRepository repository = new ArchivaRepository( "testDefaultRepo", "Test Default Repository", repoUri );
+        ArchivaRepository repository =
+            new ArchivaRepository( TEST_DEFAULT_REPO_ID, TEST_DEFAULT_REPOSITORY_NAME, repoUri );
 
         File indexLocation = new File( testIndexesDir, "/index-" + indexName + "-" + getName() + "/" );
 
         MockConfiguration config = (MockConfiguration) lookup( ArchivaConfiguration.class.getName(), "mock" );
 
-        RepositoryConfiguration repoConfig = new RepositoryConfiguration();
-        repoConfig.setId( repository.getId() );
-        repoConfig.setName( repository.getModel().getName() );
-        repoConfig.setUrl( repository.getModel().getUrl() );
+        ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration();
+        repoConfig.setId( TEST_DEFAULT_REPO_ID );
+        repoConfig.setName( TEST_DEFAULT_REPOSITORY_NAME );
+        repoConfig.setLocation( repoDir.getAbsolutePath() );
         repoConfig.setIndexDir( indexLocation.getAbsolutePath() );
 
         if ( indexLocation.exists() )
@@ -121,7 +126,7 @@
             FileUtils.deleteDirectory( indexLocation );
         }
 
-        config.getConfiguration().addRepository( repoConfig );
+        config.getConfiguration().addManagedRepository( repoConfig );
         return repository;
     }
 
@@ -130,8 +135,8 @@
         Map dumps = new HashMap();
 
         // archiva-common-1.0.jar.txt
-        dumps.put( "archiva-common", createArchivaArtifact( "org.apache.maven.archiva", "archiva-common", "1.0", "",
-                                                            "jar" ) );
+        dumps.put( "archiva-common",
+                   createArchivaArtifact( "org.apache.maven.archiva", "archiva-common", "1.0", "", "jar" ) );
 
         // continuum-webapp-1.0.3-SNAPSHOT.war.txt
         dumps.put( "continuum-webapp", createArchivaArtifact( "org.apache.maven.continuum", "continuum-webapp",
@@ -198,8 +203,8 @@
         return dumpFile;
     }
 
-    private ArchivaArtifact createArchivaArtifact( String groupId, String artifactId, String version,
-                                                   String classifier, String type )
+    private ArchivaArtifact createArchivaArtifact( String groupId, String artifactId, String version, String classifier,
+                                                   String type )
     {
         ArchivaArtifact artifact = new ArchivaArtifact( groupId, artifactId, version, classifier, type );
         return artifact;

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearchTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearchTest.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearchTest.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearchTest.java Sat Aug 18 06:37:43 2007
@@ -25,7 +25,7 @@
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Searcher;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.indexer.MockConfiguration;
 import org.apache.maven.archiva.indexer.RepositoryContentIndex;
 import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
@@ -37,7 +37,7 @@
 import java.util.Map;
 
 /**
- * DefaultCrossRepositorySearchTest 
+ * DefaultCrossRepositorySearchTest
  *
  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
@@ -45,15 +45,18 @@
 public class DefaultCrossRepositorySearchTest
     extends PlexusTestCase
 {
+    private static final String TEST_DEFAULT_REPOSITORY_NAME = "Test Default Repository";
+
+    private static final String TEST_DEFAULT_REPO_ID = "testDefaultRepo";
 
     protected void setUp()
         throws Exception
     {
         super.setUp();
 
-        RepositoryContentIndexFactory indexFactory = (RepositoryContentIndexFactory) lookup(
-                                                                                             RepositoryContentIndexFactory.class
-                                                                                                 .getName(), "lucene" );
+        RepositoryContentIndexFactory indexFactory =
+            (RepositoryContentIndexFactory) lookup( RepositoryContentIndexFactory.class
+                .getName(), "lucene" );
 
         File repoDir = new File( getBasedir(), "src/test/managed-repository" );
 
@@ -61,16 +64,17 @@
 
         String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" );
 
-        ArchivaRepository repository = new ArchivaRepository( "testDefaultRepo", "Test Default Repository", repoUri );
+        ArchivaRepository repository =
+            new ArchivaRepository( TEST_DEFAULT_REPO_ID, TEST_DEFAULT_REPOSITORY_NAME, repoUri );
 
         File indexLocation = new File( "target/index-crossrepo-" + getName() + "/" );
 
         MockConfiguration config = (MockConfiguration) lookup( ArchivaConfiguration.class.getName(), "mock" );
 
-        RepositoryConfiguration repoConfig = new RepositoryConfiguration();
-        repoConfig.setId( repository.getId() );
-        repoConfig.setName( repository.getModel().getName() );
-        repoConfig.setUrl( repository.getModel().getUrl() );
+        ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration();
+        repoConfig.setId( TEST_DEFAULT_REPO_ID );
+        repoConfig.setName( TEST_DEFAULT_REPOSITORY_NAME );
+        repoConfig.setLocation( repoDir.getAbsolutePath() );
         repoConfig.setIndexDir( indexLocation.getAbsolutePath() );
         repoConfig.setIndexed( true );
 
@@ -79,7 +83,7 @@
             FileUtils.deleteDirectory( indexLocation );
         }
 
-        config.getConfiguration().addRepository( repoConfig );
+        config.getConfiguration().addManagedRepository( repoConfig );
 
         // Create the (empty) indexes.
         RepositoryContentIndex indexHashcode = indexFactory.createHashcodeIndex( repository );
@@ -115,7 +119,8 @@
     private CrossRepositorySearch lookupCrossRepositorySearch()
         throws Exception
     {
-        CrossRepositorySearch search = (CrossRepositorySearch) lookup( CrossRepositorySearch.class.getName(), "default" );
+        CrossRepositorySearch search =
+            (CrossRepositorySearch) lookup( CrossRepositorySearch.class.getName(), "default" );
         assertNotNull( "CrossRepositorySearch:default should not be null.", search );
         return search;
     }

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-model/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-model/pom.xml?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-model/pom.xml (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-model/pom.xml Sat Aug 18 06:37:43 2007
@@ -18,7 +18,8 @@
   ~ under the License.
   -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <parent>
     <groupId>org.apache.maven.archiva</groupId>
     <artifactId>archiva-base</artifactId>
@@ -89,7 +90,7 @@
         </executions>
       </plugin>
       <plugin>
-       <groupId>org.codehaus.mojo</groupId>
+        <groupId>org.codehaus.mojo</groupId>
         <artifactId>jpox-maven-plugin</artifactId>
         <version>1.1.6</version>
         <dependencies>
@@ -100,44 +101,44 @@
           </dependency>
         </dependencies>
         <executions>
-        <!-- TODO: put this into a profile!
-          <execution>
-            <id>create-ddl</id>
-            <phase>generate-test-resources</phase>
-            <goals>
-              <goal>schema-create</goal>
-            </goals>
-            <configuration>
-              <outputFile>${basedir}/target/classes/org/apache/maven/archiva/model/schema.ddl</outputFile>
-              <toolProperties>
-                <property>
-                  <name>javax.jdo.option.ConnectionDriverName</name>
-                  <value>org.apache.derby.jdbc.EmbeddedDriver</value>
-                </property>
-                <property>
-                  <name>javax.jdo.option.ConnectionURL</name>
-                  <value>jdbc:derby:target/jdo-schema-create;create=true</value>
-                </property>
-                <property>
-                  <name>javax.jdo.option.ConnectionUserName</name>
-                  <value>sa</value>
-                </property>
-                <property>
-                  <name>javax.jdo.option.ConnectionPassword</name>
-                  <value></value>
-                </property>
-                <property>
-                  <name>log4j.configuration</name>
-                  <value>${basedir}/src/test/resources/log4j.xml</value>
-                </property>
-                <property>
-                  <name>org.jpox.autoCreateTables</name>
-                  <value>true</value>
-                </property>
-              </toolProperties>
-            </configuration>
-          </execution>
-             -->
+          <!-- TODO: put this into a profile
+       <execution>
+         <id>create-ddl</id>
+         <phase>generate-test-resources</phase>
+         <goals>
+           <goal>schema-create</goal>
+         </goals>
+         <configuration>
+           <outputFile>${basedir}/target/classes/org/apache/maven/archiva/model/schema.ddl</outputFile>
+           <toolProperties>
+             <property>
+               <name>javax.jdo.option.ConnectionDriverName</name>
+               <value>org.apache.derby.jdbc.EmbeddedDriver</value>
+             </property>
+             <property>
+               <name>javax.jdo.option.ConnectionURL</name>
+               <value>jdbc:derby:target/jdo-schema-create;create=true</value>
+             </property>
+             <property>
+               <name>javax.jdo.option.ConnectionUserName</name>
+               <value>sa</value>
+             </property>
+             <property>
+               <name>javax.jdo.option.ConnectionPassword</name>
+               <value></value>
+             </property>
+             <property>
+               <name>log4j.configuration</name>
+               <value>${basedir}/src/test/resources/log4j.xml</value>
+             </property>
+             <property>
+               <name>org.jpox.autoCreateTables</name>
+               <value>true</value>
+             </property>
+           </toolProperties>
+         </configuration>
+       </execution>
+          -->
           <execution>
             <id>enhance</id>
             <goals>

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java Sat Aug 18 06:37:43 2007
@@ -20,7 +20,7 @@
  */
 
 /**
- * ArchivaRepository 
+ * ArchivaRepository
  *
  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
@@ -35,10 +35,10 @@
 
     /**
      * Construct a Repository.
-     * 
-     * @param id the unique identifier for this repository.
-     * @param name the name for this repository.
-     * @param url the base URL for this repository (this should point to the top level URL for the entire repository)
+     *
+     * @param id     the unique identifier for this repository.
+     * @param name   the name for this repository.
+     * @param url    the base URL for this repository (this should point to the top level URL for the entire repository)
      * @param layout the layout technique for this repository.
      */
     public ArchivaRepository( String id, String name, String url )
@@ -52,7 +52,7 @@
 
     /**
      * Construct a Repository.
-     * 
+     *
      * @param model the model to use
      */
     public ArchivaRepository( ArchivaRepositoryModel model )
@@ -91,16 +91,6 @@
     public void setBlacklisted( boolean blacklisted )
     {
         this.blacklisted = blacklisted;
-    }
-
-    public boolean isRemote()
-    {
-        return this.url.getProtocol().equals( "file" );
-    }
-
-    public boolean isManaged()
-    {
-        return this.url.getProtocol().equals( "file" );
     }
 
     public String getLayoutType()

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-model/src/main/mdo/archiva-base.xml?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-model/src/main/mdo/archiva-base.xml (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-model/src/main/mdo/archiva-base.xml Sat Aug 18 06:37:43 2007
@@ -15,7 +15,7 @@
   </defaults>
 
   <classes>
-    <class stash.storable="false" 
+    <class stash.storable="false"
            rootElement="true"
            jpox.enabled="false">
       <name>ArchivaAll</name>
@@ -25,6 +25,7 @@
         This object is not serialized to the Database.
       </description>
       <fields>
+        <!-- TODO! check it -->
         <field>
           <name>repositories</name>
           <version>1.0.0+</version>
@@ -121,6 +122,7 @@
             The Name of the repository.
           </description>
         </field>
+        <!-- TODO! check it -->
         <field stash.maxSize="250">
           <name>url</name>
           <identifier>false</identifier>
@@ -527,16 +529,16 @@
         </codeSegment>
       </codeSegments>
     </class>
-    
+
     <!-- _______________________________________________________________
-         __  __      _            _       _
-        |  \/  | ___| |_ __ _  __| | __ _| |_ __ _
-        | |\/| |/ _ \ __/ _` |/ _` |/ _` | __/ _` |
-        | |  | |  __/ || (_| | (_| | (_| | || (_| |
-        |_|  |_|\___|\__\__,_|\__,_|\__,_|\__\__,_|
-        
-      -->
-    
+       __  __      _            _       _
+      |  \/  | ___| |_ __ _  __| | __ _| |_ __ _
+      | |\/| |/ _ \ __/ _` |/ _` |/ _` | __/ _` |
+      | |  | |  __/ || (_| | (_| | (_| | || (_| |
+      |_|  |_|\___|\__\__,_|\__,_|\__,_|\__\__,_|
+
+    -->
+
     <class stash.storable="true"
            jpox.use-identifiers-as-primary-key="false"
            jpox.not-persisted-fields="modelEncoding"
@@ -695,21 +697,21 @@
           <code>
             public void updateTimestamp()
             {
-                setLastUpdatedTimestamp( new java.util.Date() );
+            setLastUpdatedTimestamp( new java.util.Date() );
             }
 
             public void setLastUpdatedTimestamp( java.util.Date date )
             {
-                java.util.TimeZone timezone = java.util.TimeZone.getTimeZone( "UTC" );
-                java.text.DateFormat fmt = new java.text.SimpleDateFormat( "yyyyMMddHHmmss" );
-                fmt.setTimeZone( timezone );
-                setLastUpdated( fmt.format( date ) );
+            java.util.TimeZone timezone = java.util.TimeZone.getTimeZone( "UTC" );
+            java.text.DateFormat fmt = new java.text.SimpleDateFormat( "yyyyMMddHHmmss" );
+            fmt.setTimeZone( timezone );
+            setLastUpdated( fmt.format( date ) );
             }
           </code>
         </codeSegment>
       </codeSegments>
     </class>
-    
+
     <class stash.storable="true"
            jpox.not-persisted-fields="modelEncoding"
            jpox.table="REPOSITORY_METADATA_SNAPSHOTS">
@@ -724,7 +726,7 @@
           <identifier>false</identifier>
           <required>true</required>
           <description>
-          The unique timestamp for the snapshot version.
+            The unique timestamp for the snapshot version.
           </description>
         </field>
         <field>
@@ -744,16 +746,15 @@
         </codeSegment>
       </codeSegments>
     </class>
-    
-    
-    
+
+
     <!-- _______________________________________________________________
-         ____       __
-        |  _ \ ___ / _| ___ _ __ ___ _ __   ___ ___  ___
-        | |_) / _ \ |_ / _ \ '__/ _ \ '_ \ / __/ _ \/ __|
-        |  _ (  __/  _|  __/ | |  __/ | | | (_|  __/\__ \
-        |_| \_\___|_|  \___|_|  \___|_| |_|\___\___||___/
-     -->
+        ____       __
+       |  _ \ ___ / _| ___ _ __ ___ _ __   ___ ___  ___
+       | |_) / _ \ |_ / _ \ '__/ _ \ '_ \ / __/ _ \/ __|
+       |  _ (  __/  _|  __/ | |  __/ | | | (_|  __/\__ \
+       |_| \_\___|_|  \___|_|  \___|_| |_|\___\___||___/
+    -->
 
     <class stash.storable="true"
            jpox.not-persisted-fields="modelEncoding"
@@ -818,7 +819,7 @@
         </codeSegment>
       </codeSegments>
     </class>
-    
+
     <class stash.storable="true"
            jpox.not-persisted-fields="modelEncoding"
            jpox.table="VERSIONED_REFERENCE">
@@ -894,7 +895,7 @@
         </codeSegment>
       </codeSegments>
     </class>
-    
+
     <class stash.storable="true"
            jpox.not-persisted-fields="modelEncoding"
            jpox.table="ARTIFACT_REFERENCE">
@@ -1431,7 +1432,7 @@
         </codeSegment>
       </codeSegments>
     </class>
-    
+
     <class stash.storable="true"
            jpox.not-persisted-fields="modelEncoding"
            jpox.table="MAILING_LISTS">
@@ -1489,7 +1490,7 @@
         </codeSegment>
       </codeSegments>
     </class>
-    
+
     <class stash.storable="true"
            jpox.not-persisted-fields="modelEncoding"
            jpox.table="ORGANIZATION">
@@ -1533,7 +1534,7 @@
         </codeSegment>
       </codeSegments>
     </class>
-    
+
     <class stash.storable="true"
            jpox.not-persisted-fields="modelEncoding"
            jpox.table="LICENSES">
@@ -1584,7 +1585,7 @@
         </codeSegment>
       </codeSegments>
     </class>
-    
+
     <class stash.storable="true"
            jpox.not-persisted-fields="modelEncoding"
            jpox.table="ISSUE_MANAGEMENT">
@@ -1617,7 +1618,7 @@
         </codeSegment>
       </codeSegments>
     </class>
-    
+
     <class jpox.not-persisted-fields="modelEncoding">
       <name>CiManagement</name>
       <version>1.0.0+</version>
@@ -1648,7 +1649,7 @@
         </codeSegment>
       </codeSegments>
     </class>
-    
+
     <class stash.storable="true"
            jpox.not-persisted-fields="modelEncoding">
       <name>Individual</name>
@@ -1942,7 +1943,7 @@
         </codeSegment>
       </codeSegments>
     </class>
-    
+
     <class stash.storable="true"
            jpox.not-persisted-fields="modelEncoding"
            jpox.table="EXCLUSIONS">
@@ -1973,7 +1974,7 @@
         </codeSegment>
       </codeSegments>
     </class>
-    
+
     <class stash.storable="true"
            jpox.not-persisted-fields="modelEncoding"
            jpox.table="SCM">
@@ -2019,7 +2020,7 @@
         </codeSegment>
       </codeSegments>
     </class>
-    
+
     <class stash.storable="true"
            jpox.not-persisted-fields="modelEncoding"
            jpox.table="PROJECT_REPOSITORIES">
@@ -2119,7 +2120,7 @@
             The repository associated with this path and problem.
           </description>
         </field>
-        <field stash.maxSize="250" 
+        <field stash.maxSize="250"
                jpox.column="REPO_PATH">
           <name>path</name>
           <version>1.0.0+</version>

Modified: maven/archiva/branches/MRM-462/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
URL: http://svn.apache.org/viewvc/maven/archiva/branches/MRM-462/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java?view=diff&rev=567269&r1=567268&r2=567269
==============================================================================
--- maven/archiva/branches/MRM-462/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java (original)
+++ maven/archiva/branches/MRM-462/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java Sat Aug 18 06:37:43 2007
@@ -23,15 +23,17 @@
 import org.apache.commons.lang.StringUtils;
 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.configuration.NetworkProxyConfiguration;
 import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+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.VersionedReference;
 import org.apache.maven.archiva.policies.DownloadPolicy;
 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;
@@ -58,15 +60,14 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Map.Entry;
+import java.util.Properties;
 
 /**
- * DefaultRepositoryProxyConnectors 
+ * DefaultRepositoryProxyConnectors
  *
  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
- * 
  * @plexus.component role-hint="default"
  */
 public class DefaultRepositoryProxyConnectors
@@ -110,11 +111,6 @@
     public File fetchFromProxies( ArchivaRepository repository, ArtifactReference artifact )
         throws ProxyException
     {
-        if ( !repository.isManaged() )
-        {
-            throw new ProxyException( "Can only proxy managed repositories." );
-        }
-
         File localFile;
         try
         {
@@ -124,8 +120,8 @@
         }
         catch ( LayoutException e )
         {
-            throw new ProxyException( "Unable to proxy due to bad source repository layout definition: "
-                + e.getMessage(), e );
+            throw new ProxyException(
+                "Unable to proxy due to bad source repository layout definition: " + e.getMessage(), e );
         }
 
         Properties requestProperties = new Properties();
@@ -140,15 +136,15 @@
             ArchivaRepository targetRepository = connector.getTargetRepository();
             try
             {
-                BidirectionalRepositoryLayout targetLayout = layoutFactory.getLayout( targetRepository.getLayoutType() );
+                BidirectionalRepositoryLayout targetLayout =
+                    layoutFactory.getLayout( targetRepository.getLayoutType() );
                 String targetPath = targetLayout.toPath( artifact );
 
-                getLogger().debug(
-                                   "Using target repository: " + targetRepository.getId() + " - layout: "
-                                       + targetRepository.getLayoutType() + " - targetPath: " + targetPath );
+                getLogger().debug( "Using target repository: " + targetRepository.getId() + " - layout: " +
+                    targetRepository.getLayoutType() + " - targetPath: " + targetPath );
 
-                File downloadedFile = transferFile( connector, targetRepository, targetPath, localFile,
-                                                    requestProperties );
+                File downloadedFile =
+                    transferFile( connector, targetRepository, targetPath, localFile, requestProperties );
 
                 if ( fileExists( downloadedFile ) )
                 {
@@ -169,11 +165,6 @@
     public File fetchFromProxies( ArchivaRepository repository, VersionedReference metadata )
         throws ProxyException
     {
-        if ( !repository.isManaged() )
-        {
-            throw new ProxyException( "Can only proxy managed repositories." );
-        }
-
         File localFile;
         try
         {
@@ -183,8 +174,8 @@
         }
         catch ( LayoutException e )
         {
-            throw new ProxyException( "Unable to proxy due to bad source repository layout definition: "
-                + e.getMessage(), e );
+            throw new ProxyException(
+                "Unable to proxy due to bad source repository layout definition: " + e.getMessage(), e );
         }
 
         Properties requestProperties = new Properties();
@@ -197,11 +188,12 @@
             ArchivaRepository targetRepository = connector.getTargetRepository();
             try
             {
-                BidirectionalRepositoryLayout targetLayout = layoutFactory.getLayout( targetRepository.getLayoutType() );
+                BidirectionalRepositoryLayout targetLayout =
+                    layoutFactory.getLayout( targetRepository.getLayoutType() );
                 String targetPath = targetLayout.toPath( metadata );
 
-                File downloadedFile = transferFile( connector, targetRepository, targetPath, localFile,
-                                                    requestProperties );
+                File downloadedFile =
+                    transferFile( connector, targetRepository, targetPath, localFile, requestProperties );
 
                 if ( fileExists( downloadedFile ) )
                 {
@@ -222,11 +214,6 @@
     public File fetchFromProxies( ArchivaRepository repository, ProjectReference metadata )
         throws ProxyException
     {
-        if ( !repository.isManaged() )
-        {
-            throw new ProxyException( "Can only proxy managed repositories." );
-        }
-
         File localFile;
         try
         {
@@ -236,8 +223,8 @@
         }
         catch ( LayoutException e )
         {
-            throw new ProxyException( "Unable to proxy due to bad source repository layout definition: "
-                + e.getMessage(), e );
+            throw new ProxyException(
+                "Unable to proxy due to bad source repository layout definition: " + e.getMessage(), e );
         }
 
         Properties requestProperties = new Properties();
@@ -250,11 +237,12 @@
             ArchivaRepository targetRepository = connector.getTargetRepository();
             try
             {
-                BidirectionalRepositoryLayout targetLayout = layoutFactory.getLayout( targetRepository.getLayoutType() );
+                BidirectionalRepositoryLayout targetLayout =
+                    layoutFactory.getLayout( targetRepository.getLayoutType() );
                 String targetPath = targetLayout.toPath( metadata );
 
-                File downloadedFile = transferFile( connector, targetRepository, targetPath, localFile,
-                                                    requestProperties );
+                File downloadedFile =
+                    transferFile( connector, targetRepository, targetPath, localFile, requestProperties );
 
                 if ( fileExists( downloadedFile ) )
                 {
@@ -294,14 +282,14 @@
 
     /**
      * Perform the transfer of the file.
-     * 
+     *
      * @param connector
      * @param targetRepository
      * @param targetPath
      * @param localFile
      * @param requestProperties
      * @return
-     * @throws ProxyException 
+     * @throws ProxyException
      */
     private File transferFile( ProxyConnector connector, ArchivaRepository targetRepository, String targetPath,
                                File localFile, Properties requestProperties )
@@ -431,7 +419,8 @@
         }
     }
 
-    private File transferSimpleFile( Wagon wagon, ArchivaRepository targetRepository, String targetPath, File localFile )
+    private File transferSimpleFile( Wagon wagon, ArchivaRepository targetRepository, String targetPath,
+                                     File localFile )
         throws ProxyException, WagonException
     {
         // Transfer the file.
@@ -464,8 +453,7 @@
                 if ( !success )
                 {
                     getLogger().debug(
-                                       "Not downloaded, as local file is newer than remote side: "
-                                           + localFile.getAbsolutePath() );
+                        "Not downloaded, as local file is newer than remote side: " + localFile.getAbsolutePath() );
                 }
                 else if ( temp.exists() )
                 {
@@ -563,7 +551,8 @@
 
         try
         {
-            Repository wagonRepository = new Repository( targetRepository.getId(), targetRepository.getUrl().toString() );
+            Repository wagonRepository =
+                new Repository( targetRepository.getId(), targetRepository.getUrl().toString() );
             if ( networkProxy != null )
             {
                 wagon.connect( wagonRepository, networkProxy );
@@ -629,8 +618,10 @@
 
     public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
     {
-        if ( ConfigurationNames.isNetworkProxy( propertyName ) || ConfigurationNames.isRepositories( propertyName )
-            || ConfigurationNames.isProxyConnector( propertyName ) )
+        if ( ConfigurationNames.isNetworkProxy( propertyName ) ||
+            ConfigurationNames.isManagedRepositories( propertyName ) ||
+            ConfigurationNames.isRemoteRepositories( propertyName ) ||
+            ConfigurationNames.isProxyConnector( propertyName ) )
         {
             initConnectorsAndNetworkProxies();
         }
@@ -658,8 +649,8 @@
 
                 // Create connector object.
                 ProxyConnector connector = new ProxyConnector();
-                connector.setSourceRepository( getRepository( proxyConfig.getSourceRepoId() ) );
-                connector.setTargetRepository( getRepository( proxyConfig.getTargetRepoId() ) );
+                connector.setSourceRepository( getManagedRepository( proxyConfig.getSourceRepoId() ) );
+                connector.setTargetRepository( getRemoteRepository( proxyConfig.getTargetRepoId() ) );
                 connector.setProxyId( proxyConfig.getProxyId() );
                 connector.setPolicies( proxyConfig.getPolicies() );
 
@@ -729,17 +720,22 @@
         return collection.size() == 0;
     }
 
-    private ArchivaRepository getRepository( String repoId )
+    private ArchivaRepository getRemoteRepository( String repoId )
     {
-        RepositoryConfiguration repoConfig = archivaConfiguration.getConfiguration().findRepositoryById( repoId );
-        if ( repoConfig == null )
-        {
-            return null;
-        }
+        RemoteRepositoryConfiguration repoConfig =
+            archivaConfiguration.getConfiguration().findRemoteRepositoryById( repoId );
 
         ArchivaRepository repo = new ArchivaRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getUrl() );
         repo.getModel().setLayoutName( repoConfig.getLayout() );
         return repo;
+    }
+
+    private ArchivaRepository getManagedRepository( String repoId )
+    {
+        ManagedRepositoryConfiguration repoConfig =
+            archivaConfiguration.getConfiguration().findManagedRepositoryById( repoId );
+
+        return ArchivaConfigurationAdaptor.toArchivaRepository( repoConfig );
     }
 
     public void initialize()



Mime
View raw message