]> source.dussan.org Git - archiva.git/commitdiff
More Work Against Scanner / Layout / Artifact / Database
authorJoakim Erdfelt <joakime@apache.org>
Fri, 16 Mar 2007 22:45:38 +0000 (22:45 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Fri, 16 Mar 2007 22:45:38 +0000 (22:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@519169 13f79535-47bb-0310-9956-ffa450edef68

124 files changed:
archiva-common/src/main/java/org/apache/maven/archiva/common/utils/DateUtil.java [new file with mode: 0644]
archiva-common/src/test/java/org/apache/maven/archiva/common/utils/DateUtilTest.java [new file with mode: 0644]
archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/AbstractConsumer.java
archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/Consumer.java [deleted file]
archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerException.java [deleted file]
archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerFactory.java [deleted file]
archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericArtifactConsumer.java
archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericModelConsumer.java
archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/GenericRepositoryMetadataConsumer.java
archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractConsumerTestCase.java
archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/AbstractGenericConsumerTestCase.java
archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/FileProblemsTracker.java
archiva-consumer-api/src/test/java/org/apache/maven/archiva/consumers/GenericArtifactConsumerTest.java
archiva-core/src/main/java/org/apache/maven/archiva/scheduler/executors/DataRefreshExecutor.java
archiva-discoverer/pom.xml [deleted file]
archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DefaultDiscoverer.java [deleted file]
archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/Discoverer.java [deleted file]
archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DiscovererException.java [deleted file]
archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DiscovererStatistics.java [deleted file]
archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/RepositoryScanner.java [deleted file]
archiva-discoverer/src/site/apt/design.apt [deleted file]
archiva-discoverer/src/site/site.xml [deleted file]
archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/AbstractDiscovererTestCase.java [deleted file]
archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/AllTests.java [deleted file]
archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/DefaultDiscovererTest.java [deleted file]
archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/MockConsumer.java [deleted file]
archiva-discoverer/src/test/legacy-repository/CVS/Root [deleted file]
archiva-discoverer/src/test/legacy-repository/KEYS [deleted file]
archiva-discoverer/src/test/legacy-repository/invalid/foo/invalid-1.0.foo [deleted file]
archiva-discoverer/src/test/legacy-repository/invalid/invalid-1.0.jar [deleted file]
archiva-discoverer/src/test/legacy-repository/invalid/jars/1.0/invalid-1.0.jar [deleted file]
archiva-discoverer/src/test/legacy-repository/invalid/jars/invalid-1.0.rar [deleted file]
archiva-discoverer/src/test/legacy-repository/invalid/jars/invalid.jar [deleted file]
archiva-discoverer/src/test/legacy-repository/invalid/jars/no-extension [deleted file]
archiva-discoverer/src/test/legacy-repository/javax.sql/jars/jdbc-2.0.jar [deleted file]
archiva-discoverer/src/test/legacy-repository/org.apache.maven.update/jars/test-not-updated-1.0.jar [deleted file]
archiva-discoverer/src/test/legacy-repository/org.apache.maven.update/jars/test-updated-1.0.jar [deleted file]
archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/some-ejb-1.0-client.jar [deleted file]
archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0-20050611.112233-1.jar [deleted file]
archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0-sources.jar [deleted file]
archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0.jar [deleted file]
archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0.tar.gz [deleted file]
archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0.zip [deleted file]
archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-UNKNOWN.jar [deleted file]
archiva-discoverer/src/test/pom-artifacts/org/apache/maven/A/1.0/A-1.0.pom [deleted file]
archiva-discoverer/src/test/pom-artifacts/org/apache/maven/A/1.0/A-1.0.war [deleted file]
archiva-discoverer/src/test/pom-artifacts/org/apache/maven/B/1.0/B-1.0.pom [deleted file]
archiva-discoverer/src/test/pom-artifacts/org/apache/maven/B/2.0/B-2.0.pom [deleted file]
archiva-discoverer/src/test/pom-artifacts/org/apache/maven/C/1.0/C-1.0.pom [deleted file]
archiva-discoverer/src/test/pom-artifacts/org/apache/maven/C/1.0/C-1.0.war [deleted file]
archiva-discoverer/src/test/pom-artifacts/org/apache/maven/discovery/1.0/discovery-1.0.pom [deleted file]
archiva-discoverer/src/test/pom-artifacts/org/apache/maven/samplejar/1.0/samplejar-1.0.jar [deleted file]
archiva-discoverer/src/test/pom-artifacts/org/apache/maven/samplejar/1.0/samplejar-1.0.pom [deleted file]
archiva-discoverer/src/test/pom-artifacts/org/apache/maven/samplejar/2.0/samplejar-2.0.jar [deleted file]
archiva-discoverer/src/test/pom-artifacts/org/apache/maven/samplejar/2.0/samplejar-2.0.pom [deleted file]
archiva-discoverer/src/test/pom-artifacts/org/apache/testgroup/discovery/1.0/discovery-1.0.pom [deleted file]
archiva-discoverer/src/test/repository/CVS/Root [deleted file]
archiva-discoverer/src/test/repository/KEYS [deleted file]
archiva-discoverer/src/test/repository/invalid/invalid-1.0.jar [deleted file]
archiva-discoverer/src/test/repository/invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar [deleted file]
archiva-discoverer/src/test/repository/invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar [deleted file]
archiva-discoverer/src/test/repository/invalid/invalid/1.0/invalid-1.0b.jar [deleted file]
archiva-discoverer/src/test/repository/invalid/invalid/1.0/invalid-2.0.jar [deleted file]
archiva-discoverer/src/test/repository/invalid/invalid/1/invalid-1 [deleted file]
archiva-discoverer/src/test/repository/javax/maven-metadata.xml [deleted file]
archiva-discoverer/src/test/repository/javax/sql/jdbc/2.0/jdbc-2.0.jar [deleted file]
archiva-discoverer/src/test/repository/javax/sql/jdbc/2.0/maven-metadata-repository.xml [deleted file]
archiva-discoverer/src/test/repository/javax/sql/jdbc/maven-metadata-repository.xml [deleted file]
archiva-discoverer/src/test/repository/javax/sql/maven-metadata-repository.xml [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/A/1.0/A-1.0.pom [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/A/1.0/A-1.0.war [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/B/1.0/B-1.0.pom [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/B/2.0/B-2.0.pom [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/C/1.0/C-1.0.pom [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/C/1.0/C-1.0.war [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/discovery/1.0/discovery-1.0.pom [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/maven-metadata.xml [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/samplejar/1.0/samplejar-1.0.jar [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/samplejar/1.0/samplejar-1.0.pom [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/samplejar/2.0/samplejar-2.0.jar [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/samplejar/2.0/samplejar-2.0.pom [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata.xml [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/some-ejb/1.0/some-ejb-1.0-client.jar [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1-javadoc.jar [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1.jar [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0-sources.jar [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0-test-sources.jar [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0.jar [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0.tar.gz [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0.zip [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/update/test-not-updated/1.0/test-not-updated-1.0.jar [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/update/test-not-updated/1.0/test-not-updated-1.0.pom [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/update/test-not-updated/maven-metadata.xml [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/update/test-updated/1.0/test-updated-1.0.jar [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/update/test-updated/1.0/test-updated-1.0.pom [deleted file]
archiva-discoverer/src/test/repository/org/apache/maven/update/test-updated/maven-metadata.xml [deleted file]
archiva-discoverer/src/test/repository/org/apache/testgroup/discovery/1.0/discovery-1.0.pom [deleted file]
archiva-discoverer/src/test/repository/org/apache/testgroup/discovery/1.0/maven-metadata.xml [deleted file]
archiva-discoverer/src/test/repository/org/apache/testgroup/discovery/maven-metadata.xml [deleted file]
archiva-model/pom.xml
archiva-model/src/main/mdo/archiva.xml
archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ArchivaArtifact.java
archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/BidirectionalRepositoryLayout.java [deleted file]
archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultBidirectionalRepositoryLayout.java [deleted file]
archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyBidirectionalRepositoryLayout.java [deleted file]
archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/BidirectionalRepositoryLayout.java [new file with mode: 0644]
archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayout.java [new file with mode: 0644]
archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LayoutException.java [new file with mode: 0644]
archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayout.java [new file with mode: 0644]
archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtils.java [new file with mode: 0644]
archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/version/VersionUtil.java [new file with mode: 0644]
archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractBidirectionalRepositoryLayoutTestCase.java [deleted file]
archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultBidirectionalRepositoryLayoutTest.java [deleted file]
archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyBidirectionalRepositoryLayoutTest.java [deleted file]
archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AbstractBidirectionalRepositoryLayoutTestCase.java [new file with mode: 0644]
archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayoutTest.java [new file with mode: 0644]
archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayoutTest.java [new file with mode: 0644]
archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtilsTest.java [new file with mode: 0644]
archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/CentralScannerTiming.java [new file with mode: 0644]
archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerTest.java [new file with mode: 0644]
archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/ScanConsumer.java [new file with mode: 0644]
archiva-repository-layer/src/test/resources/log4j.xml [new file with mode: 0644]
pom.xml

diff --git a/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/DateUtil.java b/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/DateUtil.java
new file mode 100644 (file)
index 0000000..212aece
--- /dev/null
@@ -0,0 +1,130 @@
+package org.apache.maven.archiva.common.utils;
+
+/*
+ * 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 java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+/**
+ * DateUtil - some (not-so) common date utility methods. 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class DateUtil
+{
+    public static String getDuration( long duration )
+    {
+        return getDuration( new Date( 0 ), new Date( duration ) );
+    }
+    
+    public static String getDuration( long ms1, long ms2 )
+    {
+        return getDuration( new Date( ms1 ), new Date( ms2 ) );
+    }
+
+    public static String getDuration( Date d1, Date d2 )
+    {
+        Calendar cal1 = new GregorianCalendar();
+        cal1.setTime( d1 );
+
+        Calendar cal2 = new GregorianCalendar();
+        cal2.setTime( d2 );
+
+        return getDuration( cal1, cal2 );
+    }
+
+    public static String getDuration( Calendar cal1, Calendar cal2 )
+    {
+        int year1 = cal1.get( Calendar.YEAR );
+        int day1 = cal1.get( Calendar.DAY_OF_YEAR );
+        int hour1 = cal1.get( Calendar.HOUR_OF_DAY );
+        int min1 = cal1.get( Calendar.MINUTE );
+        int sec1 = cal1.get( Calendar.SECOND );
+        int ms1 = cal1.get( Calendar.MILLISECOND );
+
+        int year2 = cal2.get( Calendar.YEAR );
+        int day2 = cal2.get( Calendar.DAY_OF_YEAR );
+        int hour2 = cal2.get( Calendar.HOUR_OF_DAY );
+        int min2 = cal2.get( Calendar.MINUTE );
+        int sec2 = cal2.get( Calendar.SECOND );
+        int ms2 = cal2.get( Calendar.MILLISECOND );
+
+        int leftDays = ( day1 - day2 ) + ( year1 - year2 ) * 365;
+        int leftHours = hour2 - hour1;
+        int leftMins = min2 - min1;
+        int leftSeconds = sec2 - sec1;
+        int leftMilliSeconds = ms2 - ms1;
+
+        if ( leftMilliSeconds < 0 )
+        {
+            leftMilliSeconds += 1000;
+            --leftSeconds;
+        }
+
+        if ( leftSeconds < 0 )
+        {
+            leftSeconds += 60;
+            --leftMins;
+        }
+
+        if ( leftMins < 0 )
+        {
+            leftMins += 60;
+            --leftHours;
+        }
+        
+        if ( leftHours < 0 )
+        {
+            leftHours += 24;
+            --leftDays;
+        }
+
+        StringBuffer interval = new StringBuffer();
+
+        appendInterval( interval, leftDays, "Day" );
+        appendInterval( interval, leftHours, "Hour" );
+        appendInterval( interval, leftMins, "Minute" );
+        appendInterval( interval, leftSeconds, "Second" );
+        appendInterval( interval, leftMilliSeconds, "Millisecond" );
+
+        return interval.toString();
+    }
+
+    private static void appendInterval( StringBuffer interval, int count, String type )
+    {
+        if ( count > 0 )
+        {
+            if ( interval.length() > 0 )
+            {
+                interval.append( " " );
+            }
+
+            interval.append( count );
+            interval.append( " " ).append( type );
+            if ( count > 1 )
+            {
+                interval.append( "s" );
+            }
+        }
+    }
+
+}
diff --git a/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/DateUtilTest.java b/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/DateUtilTest.java
new file mode 100644 (file)
index 0000000..09785b6
--- /dev/null
@@ -0,0 +1,69 @@
+package org.apache.maven.archiva.common.utils;
+
+/*
+ * 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 java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+/**
+ * DateUtilTest 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class DateUtilTest extends TestCase
+{
+    private void assertDuration( String expectedDuration, String startTimestamp, String endTimestamp )
+        throws ParseException
+    {
+        SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss SSS" );
+        Date startDate = sdf.parse( startTimestamp );
+        Date endDate = sdf.parse( endTimestamp );
+        
+//        System.out.println( "Date: " + endTimestamp + " - " + startTimestamp + " = "
+//                        + ( endDate.getTime() - startDate.getTime() ) + " ms" );
+
+        assertEquals( expectedDuration, DateUtil.getDuration( startDate, endDate ) );
+    }
+
+    public void testGetDurationDifference() throws ParseException
+    {
+        assertDuration( "2 Seconds", "2006-08-22 13:00:02 0000", 
+                                     "2006-08-22 13:00:04 0000" );
+
+        assertDuration( "12 Minutes 12 Seconds 234 Milliseconds", "2006-08-22 13:12:02 0000",
+                                                                  "2006-08-22 13:24:14 0234" );
+        
+        assertDuration( "12 Minutes 501 Milliseconds", "2006-08-22 13:12:01 0500",
+                                                       "2006-08-22 13:24:02 0001" );
+    }
+    
+    public void testGetDurationDirect() throws ParseException
+    {
+        assertEquals( "2 Seconds", DateUtil.getDuration( 2000 ) );
+
+        assertEquals( "12 Minutes 12 Seconds 234 Milliseconds", DateUtil.getDuration( 732234 ) );
+        
+        assertEquals( "12 Minutes 501 Milliseconds", DateUtil.getDuration( 720501 ) );
+    }
+}
index 200844a1102335fc74cce1c8d8a73ff80a8babff..1b6915c9329f3afcca059223ecf3d0cd7d717994 100644 (file)
@@ -19,7 +19,8 @@ package org.apache.maven.archiva.consumers;
  * under the License.
  */
 
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.repository.ArchivaRepository;
+import org.apache.maven.archiva.repository.consumer.Consumer;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 
diff --git a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/Consumer.java b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/Consumer.java
deleted file mode 100644 (file)
index 2ed0f1b..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.apache.maven.archiva.consumers;
-
-/*
- * 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.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.model.ArchivaRepository;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-
-import java.util.List;
-
-/**
- * DiscovererConsumer 
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public interface Consumer
-{
-    public static final String ROLE = Consumer.class.getName();
-
-    /**
-     * This is the human readable name for the discoverer.
-     * 
-     * @return the human readable discoverer name.
-     */
-    public String getName();
-    
-    /**
-     * This is used to initialize any internals in the consumer before it is used.
-     * 
-     * This method is called by the internals of archiva and is not meant to be used by other developers.
-     * This method is called once per repository.
-     * 
-     * @param repository the repository to initialize the consumer against.
-     * @return true if the repository is valid for this consumer. false will result in consumer being disabled 
-     *      for the provided repository.
-     */
-    public boolean init( ArchivaRepository repository );
-    
-    /**
-     * Get the List of excluded file patterns for this consumer.
-     * 
-     * @return the list of excluded file patterns for this consumer.
-     */
-    public List getExcludePatterns();
-    
-    /**
-     * Get the List of included file patterns for this consumer.
-     * 
-     * @return the list of included file patterns for this consumer.
-     */
-    public List getIncludePatterns();
-
-    /**
-     * Called by archiva framework to indicate that there is a file suitable for consuming, 
-     * This method will only be called if the {@link #init(ArtifactRepository)} and {@link #getExcludePatterns()}
-     * and {@link #getIncludePatterns()} all pass for this consumer.
-     * 
-     * @param file the file to process.
-     * @throws ConsumerException if there was a problem processing this file.
-     */
-    public void processFile( BaseFile file ) throws ConsumerException;
-    
-    /**
-     * Called by archiva framework to indicate that there has been a problem detected
-     * on a specific file.
-     * 
-     * NOTE: It is very possible for 1 file to have more than 1 problem associated with it.
-     * 
-     * @param file the file to process.
-     * @param message the message describing the problem.
-     */
-    public void processFileProblem( BaseFile file, String message );
-}
diff --git a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerException.java b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerException.java
deleted file mode 100644 (file)
index 790620b..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.maven.archiva.consumers;
-
-/*
- * 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.maven.archiva.common.ArchivaException;
-import org.apache.maven.archiva.common.utils.BaseFile;
-
-/**
- * ConsumerException - details about the failure of a consumer.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class ConsumerException
-    extends ArchivaException
-{
-    private BaseFile file;
-
-    public ConsumerException( BaseFile file, String message, Throwable cause )
-    {
-        super( message, cause );
-        this.file = file;
-    }
-
-    public ConsumerException( BaseFile file, String message )
-    {
-        super( message );
-        this.file = file;
-    }
-
-    public BaseFile getFile()
-    {
-        return file;
-    }
-}
diff --git a/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerFactory.java b/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerFactory.java
deleted file mode 100644 (file)
index d95bfda..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.apache.maven.archiva.consumers;
-
-/*
- * 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.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.context.Context;
-import org.codehaus.plexus.context.ContextException;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
-
-/**
- * DiscovererConsumerFactory - factory for consumers.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- * @plexus.component role="org.apache.maven.archiva.common.consumers.ConsumerFactory"
- */
-public class ConsumerFactory
-    extends AbstractLogEnabled
-    implements Contextualizable
-{
-    public static final String ROLE = ConsumerFactory.class.getName();
-
-    private PlexusContainer container;
-
-    public Consumer createConsumer( String name )
-        throws ConsumerException
-    {
-        getLogger().info( "Attempting to create consumer [" + name + "]" );
-
-        Consumer consumer;
-        try
-        {
-            consumer = (Consumer) container.lookup( Consumer.ROLE, name, container.getLookupRealm() );
-        }
-        catch ( Throwable t )
-        {
-            String emsg = "Unable to create consumer [" + name + "]: " + t.getMessage();
-            getLogger().warn( t.getMessage(), t );
-            throw new ConsumerException( null, emsg, t );
-        }
-
-        getLogger().info( "Created consumer [" + name + "|" + consumer.getName() + "]" );
-        return consumer;
-    }
-
-    public void contextualize( Context context )
-        throws ContextException
-    {
-        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
-    }
-}
index 4c6f57bdb8b4b6a4957f925bd6860ec1ce891a1d..084c388819db4f24d8a15d5a1b2852f6b5d8ce3c 100644 (file)
@@ -24,7 +24,9 @@ import org.apache.maven.archiva.common.artifact.builder.DefaultLayoutArtifactBui
 import org.apache.maven.archiva.common.artifact.builder.LayoutArtifactBuilder;
 import org.apache.maven.archiva.common.artifact.builder.LegacyLayoutArtifactBuilder;
 import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.repository.ArchivaRepository;
+import org.apache.maven.archiva.repository.consumer.Consumer;
+import org.apache.maven.archiva.repository.consumer.ConsumerException;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
index 4fe0c429b83038d4fe3a291e0ef9bae3c932bbf1..f44315d4ec2d1a84fe8941cdcd524dc05a5fde91 100644 (file)
@@ -20,6 +20,8 @@ package org.apache.maven.archiva.consumers;
  */
 
 import org.apache.maven.archiva.common.utils.BaseFile;
+import org.apache.maven.archiva.repository.consumer.Consumer;
+import org.apache.maven.archiva.repository.consumer.ConsumerException;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.codehaus.plexus.util.IOUtil;
index a575f156a210725242b95e40162499c19381dabc..2c0573011b644a4f81fc981c2abc2040fe37a303 100644 (file)
@@ -21,6 +21,8 @@ package org.apache.maven.archiva.consumers;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.common.utils.BaseFile;
+import org.apache.maven.archiva.repository.consumer.Consumer;
+import org.apache.maven.archiva.repository.consumer.ConsumerException;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
index dc35fc44d479980627cee2f96080b5be43cdd80a..a6a90e3f3b789e39a86b1900b159b24daf12d419 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.consumers;
  * under the License.
  */
 
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.repository.ArchivaRepository;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
index db51092e3b99c064f11993672786f94d37bf370c..bbb5610bd36573f324d5b21d6767b0ac9430046f 100644 (file)
@@ -1,5 +1,7 @@
 package org.apache.maven.archiva.consumers;
 
+import org.apache.maven.archiva.repository.consumer.ConsumerFactory;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
index 35457c4b13d7ed6ee9188bd619b2e2e96fbdeadf..bc96f03ecdba6ff5aeb145aa0a68afdb002939da 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.maven.archiva.consumers;
  */
 
 import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.consumers.ConsumerException;
+import org.apache.maven.archiva.repository.consumer.ConsumerException;
 import org.codehaus.plexus.util.StringUtils;
 
 import java.util.ArrayList;
index 27111ac1eae9419b6c8c42c727097840a712eb41..a436cdd94816ba50ccb9dc6f3dc1a25ee0f48d0d 100644 (file)
@@ -21,7 +21,8 @@ package org.apache.maven.archiva.consumers;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.repository.ArchivaRepository;
+import org.apache.maven.archiva.repository.consumer.ConsumerException;
 import org.apache.maven.artifact.Artifact;
 
 import java.util.ArrayList;
index 0d92adf71f6e57300d95621701ef7412c6cbe593..8f0dd4d37bb1b0cce3f1dc25ee0bbc19630abe67 100644 (file)
@@ -23,12 +23,12 @@ import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory;
 import org.apache.maven.archiva.configuration.RepositoryConfiguration;
-import org.apache.maven.archiva.consumers.Consumer;
-import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.archiva.consumers.ConsumerFactory;
 import org.apache.maven.archiva.discoverer.Discoverer;
 import org.apache.maven.archiva.discoverer.DiscovererException;
 import org.apache.maven.archiva.discoverer.DiscovererStatistics;
+import org.apache.maven.archiva.repository.consumer.Consumer;
+import org.apache.maven.archiva.repository.consumer.ConsumerException;
+import org.apache.maven.archiva.repository.consumer.ConsumerFactory;
 import org.apache.maven.archiva.scheduler.task.DataRefreshTask;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
diff --git a/archiva-discoverer/pom.xml b/archiva-discoverer/pom.xml
deleted file mode 100755 (executable)
index e32a384..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one
-  ~ or more contributor license agreements.  See the NOTICE file
-  ~ distributed with this work for additional information
-  ~ regarding copyright ownership.  The ASF licenses this file
-  ~ to you under the Apache License, Version 2.0 (the
-  ~ "License"); you may not use this file except in compliance
-  ~ with the License.  You may obtain a copy of the License at
-  ~
-  ~   http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing,
-  ~ software distributed under the License is distributed on an
-  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  ~ KIND, either express or implied.  See the License for the
-  ~ specific language governing permissions and limitations
-  ~ under the License.
-  -->
-
-<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</artifactId>
-    <version>1.0-SNAPSHOT</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>archiva-discoverer</artifactId>
-  <name>Archiva Discoverer</name>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.maven.archiva</groupId>
-      <artifactId>archiva-consumer-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven.archiva</groupId>
-      <artifactId>archiva-common</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-utils</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-container-default</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-repository-metadata</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact-manager</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-model</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>commons-lang</groupId>
-      <artifactId>commons-lang</artifactId>
-    </dependency>
-  </dependencies>
-</project>
diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DefaultDiscoverer.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DefaultDiscoverer.java
deleted file mode 100644 (file)
index 8a6a618..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-package org.apache.maven.archiva.discoverer;
-
-/*
- * 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.maven.archiva.consumers.Consumer;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.codehaus.plexus.util.DirectoryWalker;
-import org.codehaus.plexus.util.FileUtils;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Discoverer Implementation.
- *
- * @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.discoverer.Discoverer"
- */
-public class DefaultDiscoverer
-    extends AbstractLogEnabled
-    implements Discoverer
-{
-    /**
-     * Standard patterns to exclude from discovery as they are usually noise.
-     */
-    private static final String[] STANDARD_DISCOVERY_EXCLUDES = {
-        "bin/**",
-        "reports/**",
-        ".index",
-        ".reports/**",
-        ".maven/**",
-        "**/*snapshot-version",
-        "*/website/**",
-        "*/licences/**",
-        "**/.htaccess",
-        "**/*.html",
-        "**/*.txt",
-        "**/README*",
-        "**/CHANGELOG*",
-        "**/KEYS*" };
-
-    public DefaultDiscoverer()
-    {
-    }
-
-    public DiscovererStatistics walkRepository( ArtifactRepository repository, List consumers, boolean includeSnapshots )
-        throws DiscovererException
-    {
-        return walkRepository( repository, consumers, includeSnapshots, 0, null, null );
-    }
-
-    public DiscovererStatistics walkRepository( ArtifactRepository repository, List consumers,
-                                                boolean includeSnapshots, long onlyModifiedAfterTimestamp,
-                                                List extraFileExclusions, List extraFileInclusions )
-        throws DiscovererException
-    {
-        // Sanity Check
-
-        if ( repository == null )
-        {
-            throw new IllegalArgumentException( "Unable to operate on a null repository." );
-        }
-
-        if ( !"file".equals( repository.getProtocol() ) )
-        {
-            throw new UnsupportedOperationException( "Only filesystem repositories are supported." );
-        }
-
-        File repositoryBase = new File( repository.getBasedir() );
-
-        if ( !repositoryBase.exists() )
-        {
-            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." );
-        }
-
-        // Setup Includes / Excludes.
-
-        List allExcludes = new ArrayList();
-        List allIncludes = new ArrayList();
-
-        // Exclude all of the SCM patterns.
-        allExcludes.addAll( FileUtils.getDefaultExcludesAsList() );
-
-        // Exclude all of the archiva noise patterns.
-        allExcludes.addAll( Arrays.asList( STANDARD_DISCOVERY_EXCLUDES ) );
-
-        if ( !includeSnapshots )
-        {
-            allExcludes.add( "**/*-SNAPSHOT*" );
-        }
-
-        if ( extraFileExclusions != null )
-        {
-            allExcludes.addAll( extraFileExclusions );
-        }
-
-        Iterator it = consumers.iterator();
-        while ( it.hasNext() )
-        {
-            Consumer consumer = (Consumer) it.next();
-
-            /* NOTE: Do not insert the consumer exclusion patterns here.
-             * Exclusion patterns are handled by RepositoryScanner.wantsFile(Consumer, String)
-             * 
-             * addUniqueElements( consumer.getExcludePatterns(), allExcludes );
-             */
-            addUniqueElements( consumer.getIncludePatterns(), allIncludes );
-        }
-
-        if ( extraFileInclusions != null )
-        {
-            allIncludes.addAll( extraFileInclusions );
-        }
-
-        // Setup Directory Walker
-
-        DirectoryWalker dirWalker = new DirectoryWalker();
-
-        dirWalker.setBaseDir( repositoryBase );
-
-        dirWalker.setIncludes( allIncludes );
-        dirWalker.setExcludes( allExcludes );
-
-        // Setup the Scan Instance
-        RepositoryScanner repoScanner = new RepositoryScanner( repository, consumers );
-        repoScanner.setOnlyModifiedAfterTimestamp( onlyModifiedAfterTimestamp );
-
-        repoScanner.setLogger( getLogger() );
-        dirWalker.addDirectoryWalkListener( repoScanner );
-
-        // Execute scan.
-        dirWalker.scan();
-
-        return repoScanner.getStatistics();
-    }
-
-    private void addUniqueElements( List fromList, List toList )
-    {
-        Iterator itFrom = fromList.iterator();
-        while ( itFrom.hasNext() )
-        {
-            Object o = itFrom.next();
-            if ( !toList.contains( o ) )
-            {
-                toList.add( o );
-            }
-        }
-    }
-}
diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/Discoverer.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/Discoverer.java
deleted file mode 100644 (file)
index 4f670c4..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.apache.maven.archiva.discoverer;
-
-/*
- * 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.maven.artifact.repository.ArtifactRepository;
-
-import java.io.File;
-import java.util.List;
-
-/**
- * Discoverer - generic discoverer of content in an ArtifactRepository. 
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public interface Discoverer
-{
-    public static final String ROLE = Discoverer.class.getName();
-    
-    /**
-     * Walk the repository, and report to the consumers the files found.
-     * 
-     * Report changes to the appropriate Consumer.
-     * 
-     * This is just a convenience method to {@link #walkRepository(ArtifactRepository, List, boolean, long, List, List)}
-     * equivalent to calling <code>walkRepository( repository, consumers, includeSnapshots, 0, null, null );</code>
-     * 
-     * @param repository the repository to change.
-     * @param consumers use the provided list of consumers.
-     * @param includeSnapshots true to include snapshots in the walking of this repository.
-     * @return the statistics for this scan.
-     * @throws DiscovererException if there was a fundamental problem with getting the discoverer started.
-     */
-    public DiscovererStatistics walkRepository( ArtifactRepository repository, List consumers, boolean includeSnapshots )
-        throws DiscovererException;
-
-    /**
-     * Walk the repository, and report to the consumers the files found.
-     * 
-     * Report changes to the appropriate Consumer.
-     * 
-     * @param repository the repository to change.
-     * @param consumers use the provided list of consumers.
-     * @param includeSnapshots true to include snapshots in the scanning of this repository.
-     * @param onlyModifiedAfterTimestamp Only report to the consumers, files that have a {@link File#lastModified()}) 
-     *          after the provided timestamp.
-     * @param extraFileExclusions an optional list of file exclusions on the walk.
-     * @param extraFileInclusions an optional list of file inclusions on the walk.
-     * @return the statistics for this scan.
-     * @throws DiscovererException if there was a fundamental problem with getting the discoverer started. 
-     */
-    public DiscovererStatistics walkRepository( ArtifactRepository repository, List consumers,
-                                                boolean includeSnapshots, long onlyModifiedAfterTimestamp,
-                                                List extraFileExclusions, List extraFileInclusions )
-        throws DiscovererException;
-}
diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DiscovererException.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DiscovererException.java
deleted file mode 100644 (file)
index d662c67..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.apache.maven.archiva.discoverer;
-
-/*
- * 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.
- */
-
-/**
- * @author Edwin Punzalan
- */
-public class DiscovererException
-    extends Exception
-{
-    public DiscovererException( String message )
-    {
-        super( message );
-    }
-
-    public DiscovererException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-}
diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DiscovererStatistics.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DiscovererStatistics.java
deleted file mode 100644 (file)
index 28c2186..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-package org.apache.maven.archiva.discoverer;
-
-/*
- * 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.lang.math.NumberUtils;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.codehaus.plexus.logging.Logger;
-import org.codehaus.plexus.util.IOUtil;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Properties;
-
-/**
- * DiscovererStatistics 
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class DiscovererStatistics
-{
-    private static final String PROP_FILES_CONSUMED = "scan.consumed.files";
-
-    private static final String PROP_FILES_INCLUDED = "scan.included.files";
-
-    private static final String PROP_FILES_SKIPPED = "scan.skipped.files";
-
-    private static final String PROP_TIMESTAMP_STARTED = "scan.started.timestamp";
-
-    private static final String PROP_TIMESTAMP_FINISHED = "scan.finished.timestamp";
-
-    protected long timestampStarted = 0;
-
-    protected long timestampFinished = 0;
-
-    protected long filesIncluded = 0;
-
-    protected long filesConsumed = 0;
-
-    protected long filesSkipped = 0;
-
-    private ArtifactRepository repository;
-
-    public DiscovererStatistics( ArtifactRepository repository )
-    {
-        this.repository = repository;
-    }
-
-    public void load( String filename )
-        throws IOException
-    {
-        File repositoryBase = new File( this.repository.getBasedir() );
-
-        File scanProperties = new File( repositoryBase, filename );
-        FileInputStream fis = null;
-        try
-        {
-            Properties props = new Properties();
-            fis = new FileInputStream( scanProperties );
-            props.load( fis );
-
-            timestampFinished = NumberUtils.toLong( props.getProperty( PROP_TIMESTAMP_FINISHED ), 0 );
-            timestampStarted = NumberUtils.toLong( props.getProperty( PROP_TIMESTAMP_STARTED ), 0 );
-            filesIncluded = NumberUtils.toLong( props.getProperty( PROP_FILES_INCLUDED ), 0 );
-            filesConsumed = NumberUtils.toLong( props.getProperty( PROP_FILES_CONSUMED ), 0 );
-            filesSkipped = NumberUtils.toLong( props.getProperty( PROP_FILES_SKIPPED ), 0 );
-        }
-        catch ( IOException e )
-        {
-            reset();
-            throw e;
-        }
-        finally
-        {
-            IOUtil.close( fis );
-        }
-    }
-
-    public void save( String filename )
-        throws IOException
-    {
-        Properties props = new Properties();
-        props.setProperty( PROP_TIMESTAMP_FINISHED, String.valueOf( timestampFinished ) );
-        props.setProperty( PROP_TIMESTAMP_STARTED, String.valueOf( timestampStarted ) );
-        props.setProperty( PROP_FILES_INCLUDED, String.valueOf( filesIncluded ) );
-        props.setProperty( PROP_FILES_CONSUMED, String.valueOf( filesConsumed ) );
-        props.setProperty( PROP_FILES_SKIPPED, String.valueOf( filesSkipped ) );
-
-        File repositoryBase = new File( this.repository.getBasedir() );
-        File statsFile = new File( repositoryBase, filename );
-
-        FileOutputStream fos = null;
-        try
-        {
-            fos = new FileOutputStream( statsFile );
-            props.store( fos, "Last Scan Information, managed by Archiva. DO NOT EDIT" );
-            fos.flush();
-        }
-        finally
-        {
-            IOUtil.close( fos );
-        }
-    }
-
-    public void reset()
-    {
-        timestampStarted = 0;
-        timestampFinished = 0;
-        filesIncluded = 0;
-        filesConsumed = 0;
-        filesSkipped = 0;
-    }
-
-    public long getElapsedMilliseconds()
-    {
-        return timestampFinished - timestampStarted;
-    }
-
-    public long getFilesConsumed()
-    {
-        return filesConsumed;
-    }
-
-    public long getFilesIncluded()
-    {
-        return filesIncluded;
-    }
-
-    public ArtifactRepository getRepository()
-    {
-        return repository;
-    }
-
-    public long getTimestampFinished()
-    {
-        return timestampFinished;
-    }
-
-    public long getTimestampStarted()
-    {
-        return timestampStarted;
-    }
-
-    public long getFilesSkipped()
-    {
-        return filesSkipped;
-    }
-
-    public void setTimestampFinished( long timestampFinished )
-    {
-        this.timestampFinished = timestampFinished;
-    }
-
-    public void setTimestampStarted( long timestampStarted )
-    {
-        this.timestampStarted = timestampStarted;
-    }
-
-    public void dump( Logger logger )
-    {
-        logger.info( "----------------------------------------------------" );
-        logger.info( "Scan of Repository: " + repository.getId() );
-        logger.info( "   Started : " + toHumanTimestamp( this.getTimestampStarted() ) );
-        logger.info( "   Finished: " + toHumanTimestamp( this.getTimestampFinished() ) );
-        // TODO: pretty print ellapsed time.
-        logger.info( "   Duration: " + this.getElapsedMilliseconds() + "ms" );
-        logger.info( "   Files   : " + this.getFilesIncluded() );
-        logger.info( "   Consumed: " + this.getFilesConsumed() );
-        logger.info( "   Skipped : " + this.getFilesSkipped() );
-    }
-    
-    private String toHumanTimestamp( long timestamp )
-    {
-        SimpleDateFormat dateFormat = new SimpleDateFormat();
-        return dateFormat.format( new Date( timestamp ) );
-    }
-}
diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/RepositoryScanner.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/RepositoryScanner.java
deleted file mode 100644 (file)
index 9a37ac4..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-package org.apache.maven.archiva.discoverer;
-
-/*
- * 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.lang.SystemUtils;
-import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.consumers.Consumer;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.codehaus.plexus.logging.Logger;
-import org.codehaus.plexus.util.DirectoryWalkListener;
-import org.codehaus.plexus.util.SelectorUtils;
-import org.codehaus.plexus.util.StringUtils;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * RepositoryScanner - this is an instance of a scan against a repository.
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class RepositoryScanner
-    implements DirectoryWalkListener
-{
-    public static final String ROLE = RepositoryScanner.class.getName();
-
-    private List consumers;
-
-    private ArtifactRepository repository;
-
-    private Logger logger;
-
-    private boolean isCaseSensitive = true;
-
-    private DiscovererStatistics stats;
-
-    private long onlyModifiedAfterTimestamp = 0;
-
-    public RepositoryScanner( ArtifactRepository repository, List consumerList )
-    {
-        this.repository = repository;
-        this.consumers = consumerList;
-        stats = new DiscovererStatistics( repository );
-
-        Iterator it = this.consumers.iterator();
-        while ( it.hasNext() )
-        {
-            Consumer consumer = (Consumer) it.next();
-
-            if ( !consumer.init( this.repository ) )
-            {
-                throw new IllegalStateException( "Consumer [" + consumer.getName() +
-                    "] is reporting that it is incompatible with the [" + repository.getId() + "] repository." );
-            }
-        }
-
-        if ( SystemUtils.IS_OS_WINDOWS )
-        {
-            isCaseSensitive = false;
-        }
-    }
-
-    public DiscovererStatistics getStatistics()
-    {
-        return stats;
-    }
-
-    public void directoryWalkStarting( File basedir )
-    {
-        getLogger().info( "Walk Started: [" + this.repository.getId() + "] " + this.repository.getBasedir() );
-        stats.reset();
-        stats.timestampStarted = System.currentTimeMillis();
-    }
-
-    public void directoryWalkStep( int percentage, File file )
-    {
-        getLogger().debug( "Walk Step: " + percentage + ", " + file );
-
-        // Timestamp finished points to the last successful scan, not this current one.
-        if ( file.lastModified() < onlyModifiedAfterTimestamp )
-        {
-            // Skip file as no change has occured.
-            getLogger().debug( "Skipping, No Change: " + file.getAbsolutePath() );
-            stats.filesSkipped++;
-            return;
-        }
-
-        synchronized ( consumers )
-        {
-            stats.filesIncluded++;
-
-            BaseFile basefile = new BaseFile( repository.getBasedir(), file );
-
-            Iterator itConsumers = this.consumers.iterator();
-            while ( itConsumers.hasNext() )
-            {
-                Consumer consumer = (Consumer) itConsumers.next();
-
-                if ( wantsFile( consumer, StringUtils.replace( basefile.getRelativePath(), "\\", "/" ) ) )
-                {
-                    try
-                    {
-                        getLogger().debug( "Sending to consumer: " + consumer.getName() );
-                        stats.filesConsumed++;
-                        consumer.processFile( basefile );
-                    }
-                    catch ( Exception e )
-                    {
-                        /* Intentionally Catch all exceptions.
-                         * So that the discoverer processing can continue.
-                         */
-                        getLogger().error( "Consumer [" + consumer.getName() + "] had an error when processing file [" +
-                            basefile.getAbsolutePath() + "]: " + e.getMessage(), e );
-                    }
-                }
-                else
-                {
-                    getLogger().debug(
-                        "Skipping consumer " + consumer.getName() + " for file " + basefile.getRelativePath() );
-                }
-            }
-        }
-    }
-
-    public void directoryWalkFinished()
-    {
-        getLogger().info( "Walk Finished: [" + this.repository.getId() + "] " + this.repository.getBasedir() );
-        stats.timestampFinished = System.currentTimeMillis();
-    }
-
-    private boolean wantsFile( Consumer consumer, String relativePath )
-    {
-        Iterator it;
-
-        // Test excludes first.
-        it = consumer.getExcludePatterns().iterator();
-        while ( it.hasNext() )
-        {
-            String pattern = (String) it.next();
-            if ( SelectorUtils.matchPath( pattern, relativePath, isCaseSensitive ) )
-            {
-                // Definately does NOT WANT FILE.
-                return false;
-            }
-        }
-
-        // Now test includes.
-        it = consumer.getIncludePatterns().iterator();
-        while ( it.hasNext() )
-        {
-            String pattern = (String) it.next();
-            if ( SelectorUtils.matchPath( pattern, relativePath, isCaseSensitive ) )
-            {
-                // Specifically WANTS FILE.
-                return true;
-            }
-        }
-
-        // Not included, and Not excluded?  Default to EXCLUDE.
-        return false;
-    }
-
-    public long getOnlyModifiedAfterTimestamp()
-    {
-        return onlyModifiedAfterTimestamp;
-    }
-
-    public void setOnlyModifiedAfterTimestamp( long onlyModifiedAfterTimestamp )
-    {
-        this.onlyModifiedAfterTimestamp = onlyModifiedAfterTimestamp;
-    }
-
-    /**
-     * Debug method from DirectoryWalker.
-     */
-    public void debug( String message )
-    {
-        getLogger().debug( "Repository Scanner: " + message );
-    }
-
-    public Logger getLogger()
-    {
-        return logger;
-    }
-
-    public void setLogger( Logger logger )
-    {
-        this.logger = logger;
-    }
-}
diff --git a/archiva-discoverer/src/site/apt/design.apt b/archiva-discoverer/src/site/apt/design.apt
deleted file mode 100644 (file)
index 2045d72..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
- -----
- Discoverer Design
- -----
- Brett Porter
- -----
- 24 July 2006
- -----
-
-~~ Copyright 2006 The Apache Software Foundation.
-~~
-~~ Licensed 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.
-
-~~ NOTE: For help with the syntax of this file, see:
-~~ http://maven.apache.org/guides/mini/guide-apt-format.html
-
-Discoverer Design
-
-  The artifact discoverer is designed to traverse the paths in the repository and identify files that are part of
-  a legitimate artifact.
-
-  There are two plexus components available:
-
-    * {{{../apidocs/org/apache/maven/archiva/discoverer/ArtifactDiscoverer.html} ArtifactDiscoverer}}
-
-    * {{{../apidocs/org/apache/maven/archiva/discoverer/MetadataDiscoverer.html} MetadataDiscoverer}}
-
-  Each of these components currently have an implementation for the both <<<legacy>>> and <<<default>>> repository
-  layouts.
-
-  The artifact discoverer will find all artifacts in the repository, while metadata discovery finds any
-  <<<maven-metadata.xml>>> files (both remote and local repository formats).
-
-  Note that POMs will be identified as separate artifacts to their related artifacts, as will each
-  individual derivative artifact at present. Currently, it has been decided not to link them - MRM-40 was closed as
-  won't fix as a result.
-
-  * Limitations
-
-    * Currently, deleted artifacts are not tracked. This requires a separate event - see
-      {{{http://jira.codehaus.org/browse/MRM-37} MRM-37}}.
diff --git a/archiva-discoverer/src/site/site.xml b/archiva-discoverer/src/site/site.xml
deleted file mode 100644 (file)
index 74a3077..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<project>
-  <body>
-    <menu name="Design Documentation">
-      <item name="Discoverer Design" href="/design.html"/>
-    </menu>
-  </body>
-</project>
diff --git a/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/AbstractDiscovererTestCase.java b/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/AbstractDiscovererTestCase.java
deleted file mode 100644 (file)
index e718561..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.apache.maven.archiva.discoverer;
-
-/*
- * 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.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.codehaus.plexus.PlexusTestCase;
-
-import java.io.File;
-
-/**
- * @author Edwin Punzalan
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- */
-public abstract class AbstractDiscovererTestCase
-    extends PlexusTestCase
-{
-    protected Discoverer discoverer;
-
-    protected void setUp()
-        throws Exception
-    {
-        super.setUp();
-
-        discoverer = (Discoverer) lookup( Discoverer.ROLE );
-    }
-
-    protected void tearDown()
-        throws Exception
-    {
-        release( discoverer );
-        super.tearDown();
-    }
-
-    protected ArtifactRepository getLegacyRepository()
-        throws Exception
-    {
-        File repoBaseDir = new File( getBasedir(), "src/test/legacy-repository" );
-        ArtifactRepository repository = createRepository( repoBaseDir, "legacy" );
-        resetRepositoryState( repository );
-        return repository;
-    }
-
-    protected ArtifactRepository getDefaultRepository()
-        throws Exception
-    {
-        File repoBaseDir = new File( getBasedir(), "src/test/repository" );
-        ArtifactRepository repository = createRepository( repoBaseDir, "default" );
-        resetRepositoryState( repository );
-        return repository;
-    }
-
-    protected void resetRepositoryState( ArtifactRepository repository )
-    {
-        // Implement any kind of repository cleanup.
-    }
-
-    protected ArtifactRepository createRepository( File basedir, String layout )
-        throws Exception
-    {
-        ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
-
-        ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, layout );
-
-        return factory.createArtifactRepository( "discoveryRepo-" + getName(), "file://" + basedir, repoLayout, null,
-                                                 null );
-    }
-}
diff --git a/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/AllTests.java b/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/AllTests.java
deleted file mode 100644 (file)
index a32460b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.apache.maven.archiva.discoverer;
-
-/*
- * 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 junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * AllTests - added to allow IDE users to pull all tests into their tool. 
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class AllTests
-{
-
-    public static Test suite()
-    {
-        TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.discoverer" );
-        //$JUnit-BEGIN$
-        suite.addTestSuite( DefaultDiscovererTest.class );
-        //$JUnit-END$
-        return suite;
-    }
-
-}
diff --git a/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/DefaultDiscovererTest.java b/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/DefaultDiscovererTest.java
deleted file mode 100644 (file)
index f105fc6..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-package org.apache.maven.archiva.discoverer;
-
-/*
- * 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.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.codehaus.plexus.logging.Logger;
-import org.codehaus.plexus.logging.console.ConsoleLogger;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * DefaultDiscovererTest 
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class DefaultDiscovererTest
-    extends AbstractDiscovererTestCase
-{
-    private MockConsumer createAndAddMockConsumer( List consumers, String includePattern, String excludePattern )
-    {
-        MockConsumer mockConsumer = new MockConsumer();
-        mockConsumer.getIncludePatterns().add( includePattern );
-        if ( StringUtils.isNotBlank( excludePattern ) )
-        {
-            mockConsumer.getExcludePatterns().add( excludePattern );
-        }
-        consumers.add( mockConsumer );
-        return mockConsumer;
-    }
-    
-    private void assertFilesProcessed( int expectedFileCount, DiscovererStatistics stats, MockConsumer mockConsumer )
-    {
-        assertNotNull( "Stats should not be null.", stats );
-        assertNotNull( "MockConsumer should not be null.", mockConsumer );
-        assertNotNull( "MockConsumer.filesProcessed should not be null.", mockConsumer.getFilesProcessed() );
-
-        if ( stats.getFilesConsumed() != mockConsumer.getFilesProcessed().size() )
-        {
-            fail( "Somehow, the stats count of files consumed, and the count of actual files "
-                + "processed by the consumer do not match." );
-        }
-
-        int actualFileCount = mockConsumer.getFilesProcessed().size();
-
-        if ( expectedFileCount != actualFileCount )
-        {
-            stats.dump( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
-            System.out.println( "Base Dir:" + stats.getRepository().getBasedir() );
-            int num = 0;
-            Iterator it = mockConsumer.getFilesProcessed().iterator();
-            while ( it.hasNext() )
-            {
-                BaseFile file = (BaseFile) it.next();
-                System.out.println( "  Processed File [" + num + "]: " + file.getRelativePath() );
-                num++;
-            }
-
-            fail( "Files Processed mismatch: expected:<" + expectedFileCount + ">, actual:<" + actualFileCount + ">" );
-        }
-    }
-
-    public void testLegacyLayoutRepositoryAll()
-        throws Exception
-    {
-        ArtifactRepository repository = getLegacyRepository();
-        List consumers = new ArrayList();
-        MockConsumer mockConsumer = createAndAddMockConsumer( consumers, "**/*", null );
-
-        DiscovererStatistics stats = discoverer.walkRepository( repository, consumers, true );
-
-        assertNotNull( stats );
-
-        assertFilesProcessed( 16, stats, mockConsumer );
-    }
-
-    public void testDefaultLayoutRepositoryAll()
-        throws Exception
-    {
-        ArtifactRepository repository = getDefaultRepository();
-        List consumers = new ArrayList();
-        MockConsumer mockConsumer = createAndAddMockConsumer( consumers, "**/*", null );
-
-        DiscovererStatistics stats = discoverer.walkRepository( repository, consumers, true );
-
-        assertNotNull( stats );
-        
-        assertFilesProcessed( 42, stats, mockConsumer );
-    }
-
-    public void testDefaultLayoutRepositoryPomsOnly()
-        throws Exception
-    {
-        ArtifactRepository repository = getDefaultRepository();
-        List consumers = new ArrayList();
-        MockConsumer mockConsumer = createAndAddMockConsumer( consumers, "**/*.pom", null );
-
-        DiscovererStatistics stats = discoverer.walkRepository( repository, consumers, true );
-
-        assertNotNull( stats );
-
-        assertFilesProcessed( 10, stats, mockConsumer );
-    }
-
-    public void testDefaultLayoutRepositoryJarsOnly()
-        throws Exception
-    {
-        ArtifactRepository repository = getDefaultRepository();
-        List consumers = new ArrayList();
-        MockConsumer mockConsumer = createAndAddMockConsumer( consumers, "**/*.jar", null );
-
-        DiscovererStatistics stats = discoverer.walkRepository( repository, consumers, true );
-
-        assertNotNull( stats );
-
-        assertFilesProcessed( 17, stats, mockConsumer );
-    }
-
-    public void testDefaultLayoutRepositoryJarsNoSnapshots()
-        throws Exception
-    {
-        ArtifactRepository repository = getDefaultRepository();
-        List consumers = new ArrayList();
-        MockConsumer mockConsumer = createAndAddMockConsumer( consumers, "**/*.jar", null );
-
-        DiscovererStatistics stats = discoverer.walkRepository( repository, consumers, false );
-
-        assertNotNull( stats );
-
-        assertFilesProcessed( 13, stats, mockConsumer );
-    }
-
-    public void testDefaultLayoutRepositoryJarsNoSnapshotsWithExclusions()
-        throws Exception
-    {
-        ArtifactRepository repository = getDefaultRepository();
-        List consumers = new ArrayList();
-        MockConsumer mockConsumer = createAndAddMockConsumer( consumers, "**/*.jar", null );
-
-        List exclusions = new ArrayList();
-        exclusions.add( "**/*-client.jar" );
-        DiscovererStatistics stats = discoverer.walkRepository( repository, consumers, false, 0, exclusions, null );
-
-        assertNotNull( stats );
-
-        assertFilesProcessed( 12, stats, mockConsumer );
-    }
-}
diff --git a/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/MockConsumer.java b/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/MockConsumer.java
deleted file mode 100644 (file)
index e6b7b14..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * 
- */
-package org.apache.maven.archiva.discoverer;
-
-import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.consumers.Consumer;
-import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class MockConsumer
-    implements Consumer
-{
-    private List excludePatterns = new ArrayList();
-
-    private List includePatterns = new ArrayList();
-
-    private List filesProcessed = new ArrayList();
-
-    private int countFileProblems = 0;
-
-    public String getName()
-    {
-        return "MockConsumer (Testing Only)";
-    }
-
-    public boolean init( ArtifactRepository repository )
-    {
-        return true;
-    }
-
-    public void processFile( BaseFile file )
-        throws ConsumerException
-    {
-        filesProcessed.add( file );
-    }
-
-    public void processFileProblem( BaseFile file, String message )
-    {
-        countFileProblems++;
-    }
-
-    public List getExcludePatterns()
-    {
-        return excludePatterns;
-    }
-
-    public void setExcludePatterns( List excludePatterns )
-    {
-        this.excludePatterns = excludePatterns;
-    }
-
-    public List getIncludePatterns()
-    {
-        return includePatterns;
-    }
-
-    public void setIncludePatterns( List includePatterns )
-    {
-        this.includePatterns = includePatterns;
-    }
-
-    public int getCountFileProblems()
-    {
-        return countFileProblems;
-    }
-
-    public List getFilesProcessed()
-    {
-        return filesProcessed;
-    }
-}
\ No newline at end of file
diff --git a/archiva-discoverer/src/test/legacy-repository/CVS/Root b/archiva-discoverer/src/test/legacy-repository/CVS/Root
deleted file mode 100644 (file)
index 2e65f24..0000000
+++ /dev/null
@@ -1 +0,0 @@
-not a real CVS root - for testing exclusions
diff --git a/archiva-discoverer/src/test/legacy-repository/KEYS b/archiva-discoverer/src/test/legacy-repository/KEYS
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/invalid/foo/invalid-1.0.foo b/archiva-discoverer/src/test/legacy-repository/invalid/foo/invalid-1.0.foo
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/invalid/invalid-1.0.jar b/archiva-discoverer/src/test/legacy-repository/invalid/invalid-1.0.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/invalid/jars/1.0/invalid-1.0.jar b/archiva-discoverer/src/test/legacy-repository/invalid/jars/1.0/invalid-1.0.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/invalid/jars/invalid-1.0.rar b/archiva-discoverer/src/test/legacy-repository/invalid/jars/invalid-1.0.rar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/invalid/jars/invalid.jar b/archiva-discoverer/src/test/legacy-repository/invalid/jars/invalid.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/invalid/jars/no-extension b/archiva-discoverer/src/test/legacy-repository/invalid/jars/no-extension
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/javax.sql/jars/jdbc-2.0.jar b/archiva-discoverer/src/test/legacy-repository/javax.sql/jars/jdbc-2.0.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/org.apache.maven.update/jars/test-not-updated-1.0.jar b/archiva-discoverer/src/test/legacy-repository/org.apache.maven.update/jars/test-not-updated-1.0.jar
deleted file mode 100644 (file)
index 54d190b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dummy content. sample file only.\r
diff --git a/archiva-discoverer/src/test/legacy-repository/org.apache.maven.update/jars/test-updated-1.0.jar b/archiva-discoverer/src/test/legacy-repository/org.apache.maven.update/jars/test-updated-1.0.jar
deleted file mode 100644 (file)
index 54d190b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dummy content. sample file only.\r
diff --git a/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/some-ejb-1.0-client.jar b/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/some-ejb-1.0-client.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0-20050611.112233-1.jar b/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0-20050611.112233-1.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0-sources.jar b/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0-sources.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0.jar b/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0.tar.gz b/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0.tar.gz
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0.zip b/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-1.0.zip
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-UNKNOWN.jar b/archiva-discoverer/src/test/legacy-repository/org.apache.maven/jars/testing-UNKNOWN.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/A/1.0/A-1.0.pom b/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/A/1.0/A-1.0.pom
deleted file mode 100644 (file)
index 202a0a4..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>A</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <packaging>war</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/A/1.0/A-1.0.war b/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/A/1.0/A-1.0.war
deleted file mode 100644 (file)
index 54d190b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dummy content. sample file only.\r
diff --git a/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/B/1.0/B-1.0.pom b/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/B/1.0/B-1.0.pom
deleted file mode 100644 (file)
index fa5f8f6..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>B</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <packaging>pom</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/B/2.0/B-2.0.pom b/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/B/2.0/B-2.0.pom
deleted file mode 100644 (file)
index c3034e8..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>B</artifactId>
-  <version>2.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <packaging>pom</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/C/1.0/C-1.0.pom b/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/C/1.0/C-1.0.pom
deleted file mode 100644 (file)
index ae14cd7..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>C</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <packaging>war</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/C/1.0/C-1.0.war b/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/C/1.0/C-1.0.war
deleted file mode 100644 (file)
index 54d190b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dummy content. sample file only.\r
diff --git a/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/discovery/1.0/discovery-1.0.pom b/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/discovery/1.0/discovery-1.0.pom
deleted file mode 100644 (file)
index 5a29f61..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>discovery</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <packaging>pom</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/samplejar/1.0/samplejar-1.0.jar b/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/samplejar/1.0/samplejar-1.0.jar
deleted file mode 100644 (file)
index 54d190b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dummy content. sample file only.\r
diff --git a/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/samplejar/1.0/samplejar-1.0.pom b/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/samplejar/1.0/samplejar-1.0.pom
deleted file mode 100644 (file)
index 6ab57d1..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>C</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <!-- default packaging is jar -->
-  <!--packaging>jar</packaging-->
-</project>
diff --git a/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/samplejar/2.0/samplejar-2.0.jar b/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/samplejar/2.0/samplejar-2.0.jar
deleted file mode 100644 (file)
index 54d190b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dummy content. sample file only.\r
diff --git a/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/samplejar/2.0/samplejar-2.0.pom b/archiva-discoverer/src/test/pom-artifacts/org/apache/maven/samplejar/2.0/samplejar-2.0.pom
deleted file mode 100644 (file)
index a959980..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>C</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <!-- specified packaging -->
-  <packaging>jar</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/pom-artifacts/org/apache/testgroup/discovery/1.0/discovery-1.0.pom b/archiva-discoverer/src/test/pom-artifacts/org/apache/testgroup/discovery/1.0/discovery-1.0.pom
deleted file mode 100644 (file)
index 12538e8..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.testgroup</groupId>
-  <artifactId>discovery</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <packaging>pom</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/repository/CVS/Root b/archiva-discoverer/src/test/repository/CVS/Root
deleted file mode 100644 (file)
index 2e65f24..0000000
+++ /dev/null
@@ -1 +0,0 @@
-not a real CVS root - for testing exclusions
diff --git a/archiva-discoverer/src/test/repository/KEYS b/archiva-discoverer/src/test/repository/KEYS
deleted file mode 100644 (file)
index d3b34d5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-test KEYS file
\ No newline at end of file
diff --git a/archiva-discoverer/src/test/repository/invalid/invalid-1.0.jar b/archiva-discoverer/src/test/repository/invalid/invalid-1.0.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar b/archiva-discoverer/src/test/repository/invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar b/archiva-discoverer/src/test/repository/invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/invalid/invalid/1.0/invalid-1.0b.jar b/archiva-discoverer/src/test/repository/invalid/invalid/1.0/invalid-1.0b.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/invalid/invalid/1.0/invalid-2.0.jar b/archiva-discoverer/src/test/repository/invalid/invalid/1.0/invalid-2.0.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/invalid/invalid/1/invalid-1 b/archiva-discoverer/src/test/repository/invalid/invalid/1/invalid-1
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/javax/maven-metadata.xml b/archiva-discoverer/src/test/repository/javax/maven-metadata.xml
deleted file mode 100644 (file)
index b3baf54..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<!-- This metdata is intentionally wrong.  -->
-<metadata>
-  <groupId>javax.sql</groupId>
-  <artifactId>jdbc</artifactId>
-  <version>2.0</version>
-</metadata>
diff --git a/archiva-discoverer/src/test/repository/javax/sql/jdbc/2.0/jdbc-2.0.jar b/archiva-discoverer/src/test/repository/javax/sql/jdbc/2.0/jdbc-2.0.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/javax/sql/jdbc/2.0/maven-metadata-repository.xml b/archiva-discoverer/src/test/repository/javax/sql/jdbc/2.0/maven-metadata-repository.xml
deleted file mode 100644 (file)
index caf5b66..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<metadata>
-  <groupId>javax.sql</groupId>
-  <artifactId>jdbc</artifactId>
-  <version>2.0</version>
-</metadata>
diff --git a/archiva-discoverer/src/test/repository/javax/sql/jdbc/maven-metadata-repository.xml b/archiva-discoverer/src/test/repository/javax/sql/jdbc/maven-metadata-repository.xml
deleted file mode 100644 (file)
index bb75708..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<metadata>
-  <groupId>javax.sql</groupId>
-  <artifactId>jdbc</artifactId>
-  <version>2.0</version>
-  <versioning>
-    <versions>
-      <version>2.0</version>
-    </versions>
-  </versioning>
-</metadata>
diff --git a/archiva-discoverer/src/test/repository/javax/sql/maven-metadata-repository.xml b/archiva-discoverer/src/test/repository/javax/sql/maven-metadata-repository.xml
deleted file mode 100644 (file)
index caf5b66..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<metadata>
-  <groupId>javax.sql</groupId>
-  <artifactId>jdbc</artifactId>
-  <version>2.0</version>
-</metadata>
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/A/1.0/A-1.0.pom b/archiva-discoverer/src/test/repository/org/apache/maven/A/1.0/A-1.0.pom
deleted file mode 100644 (file)
index 202a0a4..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>A</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <packaging>war</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/A/1.0/A-1.0.war b/archiva-discoverer/src/test/repository/org/apache/maven/A/1.0/A-1.0.war
deleted file mode 100644 (file)
index 54d190b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dummy content. sample file only.\r
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/B/1.0/B-1.0.pom b/archiva-discoverer/src/test/repository/org/apache/maven/B/1.0/B-1.0.pom
deleted file mode 100644 (file)
index fa5f8f6..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>B</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <packaging>pom</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/B/2.0/B-2.0.pom b/archiva-discoverer/src/test/repository/org/apache/maven/B/2.0/B-2.0.pom
deleted file mode 100644 (file)
index c3034e8..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>B</artifactId>
-  <version>2.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <packaging>pom</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/C/1.0/C-1.0.pom b/archiva-discoverer/src/test/repository/org/apache/maven/C/1.0/C-1.0.pom
deleted file mode 100644 (file)
index ae14cd7..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>C</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <packaging>war</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/C/1.0/C-1.0.war b/archiva-discoverer/src/test/repository/org/apache/maven/C/1.0/C-1.0.war
deleted file mode 100644 (file)
index 54d190b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dummy content. sample file only.\r
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/discovery/1.0/discovery-1.0.pom b/archiva-discoverer/src/test/repository/org/apache/maven/discovery/1.0/discovery-1.0.pom
deleted file mode 100644 (file)
index 5a29f61..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>discovery</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <packaging>pom</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/maven-metadata.xml b/archiva-discoverer/src/test/repository/org/apache/maven/maven-metadata.xml
deleted file mode 100644 (file)
index 8ce7fc7..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<metadata>
-  <groupId>org.apache.maven</groupId>
-</metadata>
\ No newline at end of file
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/samplejar/1.0/samplejar-1.0.jar b/archiva-discoverer/src/test/repository/org/apache/maven/samplejar/1.0/samplejar-1.0.jar
deleted file mode 100644 (file)
index 54d190b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dummy content. sample file only.\r
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/samplejar/1.0/samplejar-1.0.pom b/archiva-discoverer/src/test/repository/org/apache/maven/samplejar/1.0/samplejar-1.0.pom
deleted file mode 100644 (file)
index 6ab57d1..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>C</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <!-- default packaging is jar -->
-  <!--packaging>jar</packaging-->
-</project>
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/samplejar/2.0/samplejar-2.0.jar b/archiva-discoverer/src/test/repository/org/apache/maven/samplejar/2.0/samplejar-2.0.jar
deleted file mode 100644 (file)
index 54d190b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dummy content. sample file only.\r
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/samplejar/2.0/samplejar-2.0.pom b/archiva-discoverer/src/test/repository/org/apache/maven/samplejar/2.0/samplejar-2.0.pom
deleted file mode 100644 (file)
index a959980..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven</groupId>
-  <artifactId>C</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <!-- specified packaging -->
-  <packaging>jar</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata.xml b/archiva-discoverer/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata.xml
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/some-ejb/1.0/some-ejb-1.0-client.jar b/archiva-discoverer/src/test/repository/org/apache/maven/some-ejb/1.0/some-ejb-1.0-client.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1-javadoc.jar b/archiva-discoverer/src/test/repository/org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1-javadoc.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1.jar b/archiva-discoverer/src/test/repository/org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar b/archiva-discoverer/src/test/repository/org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0-sources.jar b/archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0-sources.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0-test-sources.jar b/archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0-test-sources.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0.jar b/archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0.jar
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0.tar.gz b/archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0.tar.gz
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0.zip b/archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0.zip
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/update/test-not-updated/1.0/test-not-updated-1.0.jar b/archiva-discoverer/src/test/repository/org/apache/maven/update/test-not-updated/1.0/test-not-updated-1.0.jar
deleted file mode 100644 (file)
index 54d190b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dummy content. sample file only.\r
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/update/test-not-updated/1.0/test-not-updated-1.0.pom b/archiva-discoverer/src/test/repository/org/apache/maven/update/test-not-updated/1.0/test-not-updated-1.0.pom
deleted file mode 100644 (file)
index 452727f..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven.update</groupId>
-  <artifactId>test-not-updated</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <!-- default packaging is jar -->
-  <!--packaging>jar</packaging-->
-</project>
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/update/test-not-updated/maven-metadata.xml b/archiva-discoverer/src/test/repository/org/apache/maven/update/test-not-updated/maven-metadata.xml
deleted file mode 100644 (file)
index bd56a21..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<metadata>
-  <groupId>org.apache.maven.update</groupId>
-  <artifactId>test-not-updated</artifactId>
-</metadata>
\ No newline at end of file
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/update/test-updated/1.0/test-updated-1.0.jar b/archiva-discoverer/src/test/repository/org/apache/maven/update/test-updated/1.0/test-updated-1.0.jar
deleted file mode 100644 (file)
index 54d190b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dummy content. sample file only.\r
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/update/test-updated/1.0/test-updated-1.0.pom b/archiva-discoverer/src/test/repository/org/apache/maven/update/test-updated/1.0/test-updated-1.0.pom
deleted file mode 100644 (file)
index edd7b64..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.maven.update</groupId>
-  <artifactId>test-updated</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <!-- default packaging is jar -->
-  <!--packaging>jar</packaging-->
-</project>
diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/update/test-updated/maven-metadata.xml b/archiva-discoverer/src/test/repository/org/apache/maven/update/test-updated/maven-metadata.xml
deleted file mode 100644 (file)
index 86e063c..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<metadata>
-  <groupId>org.apache.maven.update</groupId>
-  <artifactId>test-updated</artifactId>
-</metadata>
\ No newline at end of file
diff --git a/archiva-discoverer/src/test/repository/org/apache/testgroup/discovery/1.0/discovery-1.0.pom b/archiva-discoverer/src/test/repository/org/apache/testgroup/discovery/1.0/discovery-1.0.pom
deleted file mode 100644 (file)
index 12538e8..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~ 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.
-  -->
-
-<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">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.testgroup</groupId>
-  <artifactId>discovery</artifactId>
-  <version>1.0</version>
-  <name>Maven Test Repository Artifact Discovery</name>
-  <packaging>pom</packaging>
-</project>
diff --git a/archiva-discoverer/src/test/repository/org/apache/testgroup/discovery/1.0/maven-metadata.xml b/archiva-discoverer/src/test/repository/org/apache/testgroup/discovery/1.0/maven-metadata.xml
deleted file mode 100644 (file)
index 8ee1804..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<metadata>
-  <groupId>org.apache.testgroup</groupId>
-  <artifactId>discovery</artifactId>
-  <version>1.0</version>
-</metadata>
\ No newline at end of file
diff --git a/archiva-discoverer/src/test/repository/org/apache/testgroup/discovery/maven-metadata.xml b/archiva-discoverer/src/test/repository/org/apache/testgroup/discovery/maven-metadata.xml
deleted file mode 100644 (file)
index b024ef7..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<metadata>
-  <groupId>org.apache.testgroup</groupId>
-  <artifactId>discovery</artifactId>
-</metadata>
\ No newline at end of file
index 007df7295009a8d2ef270247c375602637323324..5bb0f6c16c7badcd06db64fb05ee90d602cb674e 100755 (executable)
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
     </dependency>
+    <dependency>
+      <groupId>javax.jdo</groupId>
+      <artifactId>jdo2-api</artifactId>
+      <version>2.0</version>
+    </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-container-default</artifactId>
index b9b93f244a04f73f606831c7d58b87744bb33ab8..6d11351a6dfbbc4d891de31c5dce9e7c80224047 100644 (file)
         <codeSegment>
           <version>1.0.0+</version>
           <code>
+    public RepositoryContent( String groupId, String artifactId, String version )
+    {
+        this.setGroupId( groupId );
+        this.setArtifactId( artifactId );
+        this.setVersion( version );
+    }
+
     public RepositoryContent( String repositoryId, String groupId, String artifactId, String version )
     {
         this.setRepositoryId( repositoryId );
index 4aa0025b73d89a400b1e212a9fa1bff161267a29..2456f29f3ace1e23efb5b3909256fb490fa621d8 100644 (file)
@@ -21,11 +21,9 @@ package org.apache.maven.archiva.repository;
 
 import org.apache.maven.archiva.model.ArchivaArtifactModel;
 import org.apache.maven.archiva.model.RepositoryContent;
+import org.apache.maven.archiva.repository.version.VersionUtil;
 import org.codehaus.plexus.util.StringUtils;
 
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
 /**
  * ArchivaArtifact - Mutable artifact object.
  *
@@ -34,16 +32,17 @@ import java.util.regex.Pattern;
  */
 public class ArchivaArtifact
 {
-    private static final String SNAPSHOT_VERSION = "SNAPSHOT";
-
-    private static final Pattern VERSION_FILE_PATTERN = Pattern.compile( "^(.*)-([0-9]{8}\\.[0-9]{6})-([0-9]+)$" );
-
     private ArchivaArtifactModel model;
-    
+
     private String baseVersion;
-    
+
     private boolean snapshot = false;
-    
+
+    public ArchivaArtifact( String groupId, String artifactId, String version, String classifier, String type )
+    {
+        this( null, groupId, artifactId, version, classifier, type );
+    }
+
     public ArchivaArtifact( ArchivaRepository repository, String groupId, String artifactId, String version,
                             String classifier, String type )
     {
@@ -69,22 +68,19 @@ public class ArchivaArtifact
 
         model = new ArchivaArtifactModel();
 
-        model.setContentKey( new RepositoryContent( repository.getModel(), groupId, artifactId, version ) );
-        model.setClassifier( StringUtils.defaultString( classifier ) );
-        model.setType( type );
-        
-        // Determine Snapshot Base Version.
-        Matcher m = VERSION_FILE_PATTERN.matcher( version );
-        if ( m.matches() )
+        if( repository == null )
         {
-            this.baseVersion =  m.group( 1 ) + "-" + SNAPSHOT_VERSION ;
-            snapshot = true;
+            model.setContentKey( new RepositoryContent( groupId, artifactId, version ) );
         }
         else
         {
-            this.baseVersion = version;
-            snapshot = version.endsWith( SNAPSHOT_VERSION );
+            model.setContentKey( new RepositoryContent( repository.getModel(), groupId, artifactId, version ) );
         }
+        model.setClassifier( StringUtils.defaultString( classifier ) );
+        model.setType( type );
+
+        this.snapshot = VersionUtil.isSnapshot( version );
+        this.baseVersion = VersionUtil.getBaseVersion( version );
     }
 
     public String getGroupId()
@@ -106,12 +102,12 @@ public class ArchivaArtifact
     {
         return baseVersion;
     }
-    
+
     public boolean isSnapshot()
     {
         return snapshot;
     }
-    
+
     public String getClassifier()
     {
         return model.getClassifier();
diff --git a/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/BidirectionalRepositoryLayout.java b/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/BidirectionalRepositoryLayout.java
deleted file mode 100644 (file)
index 4e46722..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.apache.maven.archiva.repository.content;
-
-/*
- * 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.maven.archiva.repository.ArchivaArtifact;
-
-/**
- * BidirectionalRepositoryLayout - Similar in scope to ArtifactRepositoryLayout, but does
- * the both the Path to Artifact, and Artifact to Path conversions.  
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public interface BidirectionalRepositoryLayout
-{
-    /**
-     * Get the identifier for this layout.
-     * 
-     * @return the identifier for this layout.
-     */
-    public String getId();
-    
-    /**
-     * Given an ArchivaArtifact, return the relative path to the artifact.
-     * 
-     * @param artifact the artifact to compute the path of.
-     * @return the relative path to the artifact. 
-     */
-    public String pathOf( ArchivaArtifact artifact );
-
-    /**
-     * Given a repository relative path to a filename, return the ArchivaArtifact object suitable for the path.
-     * 
-     * @param path the path relative to the repository base dir for the artifact.
-     * @return the ArchivaArtifact representing the path. (or null if path cannot be converted to an ArchivaArtifact)
-     */
-    ArchivaArtifact toArtifact( String path );
-}
diff --git a/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultBidirectionalRepositoryLayout.java b/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultBidirectionalRepositoryLayout.java
deleted file mode 100644 (file)
index a199c1e..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.apache.maven.archiva.repository.content;
-
-/*
- * 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.maven.archiva.repository.ArchivaArtifact;
-
-/**
- * DefaultBidirectionalRepositoryLayout - the layout mechanism for use by Maven 2.x repositories.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- * 
- * @plexus.component role="org.apache.maven.archiva.repository.content.BidirectionalRepositoryLayout"
- *                   role-hint="default"
- */
-public class DefaultBidirectionalRepositoryLayout implements BidirectionalRepositoryLayout
-{
-    private static final char PATH_SEPARATOR = '/';
-
-    private static final char GROUP_SEPARATOR = '.';
-
-    private static final char ARTIFACT_SEPARATOR = '-';
-    
-    private ArtifactExtensionMapping extensionMapper = new DefaultArtifactExtensionMapping();
-    
-    public String getId()
-    {
-        return "default";
-    }
-
-    public String pathOf( ArchivaArtifact artifact )
-    {
-        StringBuffer path = new StringBuffer();
-
-        path.append( formatAsDirectory( artifact.getGroupId() ) ).append( PATH_SEPARATOR );
-        path.append( artifact.getArtifactId() ).append( PATH_SEPARATOR );
-        path.append( artifact.getBaseVersion() ).append( PATH_SEPARATOR );
-        path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() );
-
-        if ( artifact.hasClassifier() )
-        {
-            path.append( ARTIFACT_SEPARATOR ).append( artifact.getClassifier() );
-        }
-
-        path.append( GROUP_SEPARATOR ).append( extensionMapper.getExtension( artifact ) );
-
-        return path.toString();
-    }
-    
-    private String formatAsDirectory( String directory )
-    {
-        return directory.replace( GROUP_SEPARATOR, PATH_SEPARATOR );
-    }
-
-    public ArchivaArtifact toArtifact( String path )
-    {
-        
-        
-        return null;
-    }
-}
diff --git a/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyBidirectionalRepositoryLayout.java b/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyBidirectionalRepositoryLayout.java
deleted file mode 100644 (file)
index a739c9b..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.apache.maven.archiva.repository.content;
-
-/*
- * 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.maven.archiva.repository.ArchivaArtifact;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * LegacyBidirectionalRepositoryLayout - the layout mechanism for use by Maven 1.x repositories.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- * 
- * @plexus.component role="org.apache.maven.archiva.repository.content.BidirectionalRepositoryLayout"
- *                   role-hint="legacy"
- */
-public class LegacyBidirectionalRepositoryLayout implements BidirectionalRepositoryLayout
-{
-    private static final String PATH_SEPARATOR = "/";
-
-    private ArtifactExtensionMapping extensionMapper = new LegacyArtifactExtensionMapping();
-
-    private Map typeToDirectoryMap;
-
-    public LegacyBidirectionalRepositoryLayout()
-    {
-        typeToDirectoryMap = new HashMap();
-        typeToDirectoryMap.put( "ejb-client", "ejb" );
-        typeToDirectoryMap.put( "distribution-tgz", "distribution" );
-        typeToDirectoryMap.put( "distribution-zip", "distribution" );
-    }
-
-    public String getId()
-    {
-        return "legacy";
-    }
-
-    public String pathOf( ArchivaArtifact artifact )
-    {
-        StringBuffer path = new StringBuffer();
-
-        path.append( artifact.getGroupId() ).append( PATH_SEPARATOR );
-        path.append( getDirectory( artifact ) ).append( PATH_SEPARATOR );
-        path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
-
-        if ( artifact.hasClassifier() )
-        {
-            path.append( '-' ).append( artifact.getClassifier() );
-        }
-
-        path.append( '.' ).append( extensionMapper.getExtension( artifact ) );
-
-        return path.toString();
-    }
-
-    private String getDirectory( ArchivaArtifact artifact )
-    {
-        // Special Cases involving classifiers and type.
-        if ( "jar".equals( artifact.getType() ) && "sources".equals( artifact.getClassifier() ) )
-        {
-            return "javadoc.jars";
-        }
-
-        // Special Cases involving only type.
-        String dirname = (String) typeToDirectoryMap.get( artifact.getType() );
-
-        if ( dirname != null )
-        {
-            return dirname + "s";
-        }
-
-        // Default process.
-        return artifact.getType() + "s";
-    }
-
-    public ArchivaArtifact toArtifact( String path )
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-}
diff --git a/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/BidirectionalRepositoryLayout.java b/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/BidirectionalRepositoryLayout.java
new file mode 100644 (file)
index 0000000..29770df
--- /dev/null
@@ -0,0 +1,56 @@
+package org.apache.maven.archiva.repository.layout;
+
+/*
+ * 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.maven.archiva.repository.ArchivaArtifact;
+
+/**
+ * BidirectionalRepositoryLayout - Similar in scope to ArtifactRepositoryLayout, but does
+ * the both the Path to Artifact, and Artifact to Path conversions.  
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface BidirectionalRepositoryLayout
+{
+    /**
+     * Get the identifier for this layout.
+     * 
+     * @return the identifier for this layout.
+     */
+    public String getId();
+    
+    /**
+     * Given an ArchivaArtifact, return the relative path to the artifact.
+     * 
+     * @param artifact the artifact to compute the path of.
+     * @return the relative path to the artifact. 
+     */
+    public String pathOf( ArchivaArtifact artifact );
+
+    /**
+     * Given a repository relative path to a filename, return the ArchivaArtifact object suitable for the path.
+     * 
+     * @param path the path relative to the repository base dir for the artifact.
+     * @return the ArchivaArtifact representing the path. (or null if path cannot be converted to an ArchivaArtifact)
+     * @throws LayoutException if there was a problem converting the path to an artifact.
+     */
+    public ArchivaArtifact toArtifact( String path ) throws LayoutException;
+}
diff --git a/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayout.java b/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayout.java
new file mode 100644 (file)
index 0000000..35406aa
--- /dev/null
@@ -0,0 +1,129 @@
+package org.apache.maven.archiva.repository.layout;
+
+/*
+ * 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.lang.StringUtils;
+import org.apache.maven.archiva.repository.ArchivaArtifact;
+import org.apache.maven.archiva.repository.content.ArtifactExtensionMapping;
+import org.apache.maven.archiva.repository.content.DefaultArtifactExtensionMapping;
+
+/**
+ * DefaultBidirectionalRepositoryLayout - the layout mechanism for use by Maven 2.x repositories.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role-hint="default"
+ */
+public class DefaultBidirectionalRepositoryLayout
+    implements BidirectionalRepositoryLayout
+{
+    private static final char PATH_SEPARATOR = '/';
+
+    private static final char GROUP_SEPARATOR = '.';
+
+    private static final char ARTIFACT_SEPARATOR = '-';
+
+    private ArtifactExtensionMapping extensionMapper = new DefaultArtifactExtensionMapping();
+
+    public String getId()
+    {
+        return "default";
+    }
+
+    public String pathOf( ArchivaArtifact artifact )
+    {
+        StringBuffer path = new StringBuffer();
+
+        path.append( formatAsDirectory( artifact.getGroupId() ) ).append( PATH_SEPARATOR );
+        path.append( artifact.getArtifactId() ).append( PATH_SEPARATOR );
+        path.append( artifact.getBaseVersion() ).append( PATH_SEPARATOR );
+        path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() );
+
+        if ( artifact.hasClassifier() )
+        {
+            path.append( ARTIFACT_SEPARATOR ).append( artifact.getClassifier() );
+        }
+
+        path.append( GROUP_SEPARATOR ).append( extensionMapper.getExtension( artifact ) );
+
+        return path.toString();
+    }
+
+    private String formatAsDirectory( String directory )
+    {
+        return directory.replace( GROUP_SEPARATOR, PATH_SEPARATOR );
+    }
+
+    public ArchivaArtifact toArtifact( String path ) throws LayoutException
+    {
+        String normalizedPath = StringUtils.replace( path, "\\", "/" );
+
+        String pathParts[] = StringUtils.split( normalizedPath, '/' );
+
+        /* Minimum parts.
+         * 
+         *   path = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar"
+         *   path[0] = "commons-lang";        // The Group ID
+         *   path[1] = "commons-lang";        // The Artifact ID
+         *   path[2] = "2.1";                 // The Version
+         *   path[3] = "commons-lang-2.1.jar" // The filename.
+         */
+
+        if ( pathParts.length < 4 )
+        {
+            // Illegal Path Parts Length.
+            throw new LayoutException( "Not enough parts to the path [" + path
+                            + "] to construct an ArchivaArtifact from. (Requires at least 4 parts)" );
+        }
+
+        // Maven 2.x path.
+        int partCount = pathParts.length;
+
+        // Last part is the filename
+        String filename = pathParts[partCount - 1];
+
+        // Second to last is the baseVersion (the directory version)
+        // (Don't need it) String baseVersion = pathParts[partCount - 2];
+
+        // Third to last is the artifact Id.
+        String artifactId = pathParts[partCount - 3];
+
+        // Remaining pieces are the groupId.
+        String groupId = "";
+        for ( int i = 0; i <= partCount - 4; i++ )
+        {
+            if ( groupId.length() > 0 )
+            {
+                groupId += ".";
+            }
+            groupId += pathParts[i];
+        }
+        
+        // Now we need to parse the filename to get the artifact version Id. 
+        String fileParts[] = RepositoryLayoutUtils.splitFilename( filename, artifactId );
+        String version = fileParts[1];
+        String classifier = fileParts[2];
+
+        String type = extensionMapper.getType( filename );
+
+        return new ArchivaArtifact( groupId, artifactId, version, classifier, type );
+    }
+}
diff --git a/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LayoutException.java b/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LayoutException.java
new file mode 100644 (file)
index 0000000..0fc8336
--- /dev/null
@@ -0,0 +1,41 @@
+package org.apache.maven.archiva.repository.layout;
+
+/*
+ * 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.maven.archiva.common.ArchivaException;
+
+/**
+ * LayoutException 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class LayoutException extends ArchivaException
+{
+    public LayoutException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public LayoutException( String message )
+    {
+        super( message );
+    }
+}
diff --git a/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayout.java b/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayout.java
new file mode 100644 (file)
index 0000000..0344a52
--- /dev/null
@@ -0,0 +1,135 @@
+package org.apache.maven.archiva.repository.layout;
+
+/*
+ * 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.lang.StringUtils;
+import org.apache.maven.archiva.repository.ArchivaArtifact;
+import org.apache.maven.archiva.repository.content.ArtifactExtensionMapping;
+import org.apache.maven.archiva.repository.content.LegacyArtifactExtensionMapping;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * LegacyBidirectionalRepositoryLayout - the layout mechanism for use by Maven 1.x repositories.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * 
+ * @plexus.component role-hint="legacy"
+ */
+public class LegacyBidirectionalRepositoryLayout implements BidirectionalRepositoryLayout
+{
+    private static final String PATH_SEPARATOR = "/";
+
+    private ArtifactExtensionMapping extensionMapper = new LegacyArtifactExtensionMapping();
+
+    private Map typeToDirectoryMap;
+
+    public LegacyBidirectionalRepositoryLayout()
+    {
+        typeToDirectoryMap = new HashMap();
+        typeToDirectoryMap.put( "ejb-client", "ejb" );
+        typeToDirectoryMap.put( "distribution-tgz", "distribution" );
+        typeToDirectoryMap.put( "distribution-zip", "distribution" );
+    }
+
+    public String getId()
+    {
+        return "legacy";
+    }
+
+    public String pathOf( ArchivaArtifact artifact )
+    {
+        StringBuffer path = new StringBuffer();
+
+        path.append( artifact.getGroupId() ).append( PATH_SEPARATOR );
+        path.append( getDirectory( artifact ) ).append( PATH_SEPARATOR );
+        path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
+
+        if ( artifact.hasClassifier() )
+        {
+            path.append( '-' ).append( artifact.getClassifier() );
+        }
+
+        path.append( '.' ).append( extensionMapper.getExtension( artifact ) );
+
+        return path.toString();
+    }
+
+    private String getDirectory( ArchivaArtifact artifact )
+    {
+        // Special Cases involving classifiers and type.
+        if ( "jar".equals( artifact.getType() ) && "sources".equals( artifact.getClassifier() ) )
+        {
+            return "javadoc.jars";
+        }
+
+        // Special Cases involving only type.
+        String dirname = (String) typeToDirectoryMap.get( artifact.getType() );
+
+        if ( dirname != null )
+        {
+            return dirname + "s";
+        }
+
+        // Default process.
+        return artifact.getType() + "s";
+    }
+
+    public ArchivaArtifact toArtifact( String path ) throws LayoutException
+    {
+        String normalizedPath = StringUtils.replace( path, "\\", "/" );
+
+        String pathParts[] = StringUtils.split( normalizedPath, '/' );
+
+        /* Always 3 parts. (Never more or less)
+         * 
+         *   path = "commons-lang/jars/commons-lang-2.1.jar"
+         *   path[0] = "commons-lang";          // The Group ID
+         *   path[1] = "jars";                  // The Directory Type
+         *   path[2] = "commons-lang-2.1.jar";  // The Filename.
+         */
+
+        if ( pathParts.length != 3 )
+        {
+            // Illegal Path Parts Length.
+            throw new LayoutException( "Invalid number of parts to the path [" + path
+                            + "] to construct an ArchivaArtifact from. (Required to be 3 parts)" );
+        }
+
+        // The Group ID.
+        String groupId = pathParts[0];
+
+        // The Filename.
+        String filename = pathParts[2];
+
+        String fileParts[] = RepositoryLayoutUtils.splitFilename( filename, null );
+
+        String artifactId = fileParts[0];
+        String version = fileParts[1];
+        String classifier = fileParts[2];
+
+        String type = extensionMapper.getType( filename );
+
+        return new ArchivaArtifact( groupId, artifactId, version, classifier, type );
+    }
+
+}
diff --git a/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtils.java b/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtils.java
new file mode 100644 (file)
index 0000000..8e2c144
--- /dev/null
@@ -0,0 +1,219 @@
+package org.apache.maven.archiva.repository.layout;
+
+/*
+ * 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.lang.StringUtils;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * RepositoryLayoutUtils - utility methods common for most BidirectionalRepositoryLayout implementation. 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryLayoutUtils
+{
+    /**
+     * Complex 2+ part extensions.
+     * Do not include initial "." character in extension names here.
+     */
+    private static final String ComplexExtensions[] = new String[] { "tar.gz", "tar.bz2" };
+
+    /**
+     * These are the version patterns found in the filenames of the various artifact's versions IDs.
+     * These patterns are all tackling lowercase version IDs.
+     */
+    private static final String VersionPatterns[] =
+        new String[] { "(snapshot)", "([0-9][_.0-9a-z]*)", "(g?[_.0-9ab]*(pre|rc|g|m)[_.0-9]*)", "(dev[_.0-9]*)",
+            "(alpha[_.0-9]*)", "(beta[_.0-9]*)", "(rc[_.0-9]*)", "(test[_.0-9]*)", "(debug[_.0-9]*)",
+            "(unofficial[_.0-9]*)", "(current)", "(latest)", "(fcs)", "(release[_.0-9]*)", "(nightly)", "(final)",
+            "(incubating)", "(incubator)", "([ab][_.0-9]*)" };
+
+    private static final String VersionMegaPattern = StringUtils.join( VersionPatterns, '|' );
+
+    /**
+     * Filename Parsing Mode - Artifact Id.
+     */
+    private static final int ARTIFACTID = 1;
+
+    /**
+     * Filename Parsing Mode - Version.
+     */
+    private static final int VERSION = 2;
+
+    /**
+     * Filename Parsing Mode - Classifier.
+     */
+    private static final int CLASSIFIER = 3;
+
+    /**
+     * Split the provided filename into 4 String parts.
+     * 
+     * <pre>
+     * String part[] = splitFilename( filename );
+     * artifactId = part[0];
+     * version    = part[1];
+     * classifier = part[2];
+     * extension  = part[3];
+     * </pre>
+     * 
+     * @param filename the filename to split.
+     * @param possibleArtifactId the optional artifactId to aide in splitting the filename. 
+     *                  (null to allow algorithm to calculate one)
+     * @return the parts of the filename.
+     * @throws LayoutException 
+     */
+    public static String[] splitFilename( String filename, String possibleArtifactId ) throws LayoutException
+    {
+        if ( StringUtils.isBlank( filename ) )
+        {
+            throw new IllegalArgumentException( "Unable to split blank filename." );
+        }
+
+        String filestring = filename.trim();
+
+        String artifactId = "";
+        String version = "";
+        String classifier = "";
+        String extension = "";
+
+        // I like working backwards.
+
+        // Find the extension.
+
+        // Work on multipart extensions first.
+        boolean found = false;
+
+        String lowercaseFilename = filestring.toLowerCase();
+        for ( int i = 0; i < ComplexExtensions.length && !found; i++ )
+        {
+            if ( lowercaseFilename.endsWith( "." + ComplexExtensions[i] ) )
+            {
+                extension = ComplexExtensions[i];
+                filestring = filestring.substring( 0, filestring.length() - ComplexExtensions[i].length() - 1 );
+                found = true;
+            }
+        }
+
+        if ( !found )
+        {
+            // Default to 1 part extension.
+
+            int index = filestring.lastIndexOf( '.' );
+            if ( index <= 0 )
+            {
+                // Bad Filename - No Extension
+                throw new LayoutException( "Unable to determine extension from filename " + filename );
+            }
+            extension = filestring.substring( index + 1 );
+            filestring = filestring.substring( 0, index );
+        }
+
+        // Work on version string.
+
+        if ( ( possibleArtifactId != null ) && filename.startsWith( possibleArtifactId ) )
+        {
+            artifactId = possibleArtifactId;
+            filestring = filestring.substring( possibleArtifactId.length() + 1 );
+        }
+
+        String fileParts[] = StringUtils.split( filestring, '-' );
+
+        int versionStart = -1;
+        int versionEnd = -1;
+
+        Pattern pat = Pattern.compile( VersionMegaPattern, Pattern.CASE_INSENSITIVE );
+        Matcher mat;
+
+        for ( int i = 0; i < fileParts.length; i++ )
+        {
+            String part = fileParts[i];
+            mat = pat.matcher( part );
+
+            if ( mat.matches() )
+            {
+                // It is a potential verion part.
+                if ( versionStart < 0 )
+                {
+                    versionStart = i;
+                }
+
+                versionEnd = i;
+            }
+        }
+
+        if ( versionStart < 0 )
+        {
+            throw new LayoutException( "Unable to determine version from filename " + filename );
+        }
+
+        // Gather up the ArtifactID - Version - Classifier pieces found. 
+
+        int mode = ARTIFACTID;
+        for ( int i = 0; i < fileParts.length; i++ )
+        {
+            String part = fileParts[i];
+
+            if ( ( mode == ARTIFACTID ) && ( i >= versionStart ) )
+            {
+                if ( StringUtils.isBlank( artifactId ) )
+                {
+                    throw new LayoutException( "No Artifact Id detected." );
+                }
+                mode = VERSION;
+            }
+
+            switch ( mode )
+            {
+                case ARTIFACTID:
+                    if ( artifactId.length() > 0 )
+                    {
+                        artifactId += "-";
+                    }
+                    artifactId += part;
+                    break;
+                case VERSION:
+                    if ( version.length() > 0 )
+                    {
+                        version += "-";
+                    }
+                    version += part;
+                    break;
+                case CLASSIFIER:
+                    if ( classifier.length() > 0 )
+                    {
+                        classifier += "-";
+                    }
+                    classifier += part;
+                    break;
+            }
+
+            if ( i >= versionEnd )
+            {
+                mode = CLASSIFIER;
+            }
+        }
+
+        return new String[] { artifactId, version, classifier, extension };
+    }
+
+}
diff --git a/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/version/VersionUtil.java b/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/version/VersionUtil.java
new file mode 100644 (file)
index 0000000..c8ce371
--- /dev/null
@@ -0,0 +1,62 @@
+package org.apache.maven.archiva.repository.version;
+
+/*
+ * 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 java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * VersionConstants 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class VersionUtil
+{
+    public static final String SNAPSHOT = "SNAPSHOT";
+
+    public static final Pattern UNIQUE_SNAPSHOT_PATTERN = Pattern.compile( "^(.*)-([0-9]{8}\\.[0-9]{6})-([0-9]+)$" );
+
+    public static boolean isSnapshot( String version )
+    {
+        Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
+        if ( m.matches() )
+        {
+            return true;
+        }
+        else
+        {
+            return version.endsWith( SNAPSHOT );
+        }
+    }
+
+    public static String getBaseVersion( String version )
+    {
+        Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
+        if ( m.matches() )
+        {
+            return m.group( 1 ) + "-" + SNAPSHOT;
+        }
+        else
+        {
+            return version;
+        }
+    }
+}
diff --git a/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractBidirectionalRepositoryLayoutTestCase.java b/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractBidirectionalRepositoryLayoutTestCase.java
deleted file mode 100644 (file)
index c2eca44..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.apache.maven.archiva.repository.content;
-
-/*
- * 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.lang.StringUtils;
-import org.apache.maven.archiva.repository.ArchivaArtifact;
-import org.apache.maven.archiva.repository.ArchivaRepository;
-import org.codehaus.plexus.PlexusTestCase;
-
-import java.io.File;
-
-/**
- * AbstractBidirectionalRepositoryLayoutTestCase 
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class AbstractBidirectionalRepositoryLayoutTestCase extends PlexusTestCase
-{
-    protected ArchivaRepository repository;
-
-    protected void setUp() throws Exception
-    {
-        super.setUp();
-        
-        repository = createTestRepository();
-    }
-    
-    protected ArchivaRepository createTestRepository()
-    {
-        File targetDir = new File( getBasedir(), "target" );
-        File testRepo = new File( targetDir, "test-repo" );
-    
-        if ( !testRepo.exists() )
-        {
-            testRepo.mkdirs();
-        }
-    
-        String repoUri = "file://" + StringUtils.replace( testRepo.getAbsolutePath(), "\\", "/" ) ;
-    
-        ArchivaRepository repo = new ArchivaRepository( "testRepo", "Test Repository", repoUri );
-    
-        return repo;
-    }
-
-    protected ArchivaArtifact createArtifact( String groupId, String artifactId, String version, String classifier, String type )
-    {
-        ArchivaArtifact artifact = new ArchivaArtifact( repository, groupId, artifactId, version, classifier, type );
-        assertNotNull( artifact );
-        return artifact;
-    }
-
-    protected void assertArtifact( ArchivaArtifact actualArtifact, String groupId, String artifactId, String version, String classifier, String type )
-    {
-        String expectedId = groupId + ":" + artifactId + ":" + version + ":" + classifier + ":" + type;
-    
-        assertEquals( expectedId + " - Group ID", actualArtifact.getGroupId(), groupId );
-        assertEquals( expectedId + " - Artifact ID", actualArtifact.getArtifactId(), artifactId );
-        assertEquals( expectedId + " - Version ID", actualArtifact.getVersion(), version );
-        assertEquals( expectedId + " - Classifier", actualArtifact.getClassifier(), classifier );
-        assertEquals( expectedId + " - Type", actualArtifact.getType(), type );
-    }
-
-    protected void assertSnapshotArtifact( ArchivaArtifact actualArtifact, String groupId, String artifactId, String version, String classifier, String type )
-    {
-        String expectedId = groupId + ":" + artifactId + ":" + version + ":" + classifier + ":" + type;
-    
-        assertEquals( expectedId + " - Group ID", actualArtifact.getGroupId(), groupId );
-        assertEquals( expectedId + " - Artifact ID", actualArtifact.getArtifactId(), artifactId );
-        assertEquals( expectedId + " - Version ID", actualArtifact.getVersion(), version );
-        assertEquals( expectedId + " - Classifier", actualArtifact.getClassifier(), classifier );
-        assertEquals( expectedId + " - Type", actualArtifact.getType(), type );
-        assertTrue( expectedId + " - Snapshot", actualArtifact.isSnapshot() );
-    }
-
-}
diff --git a/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultBidirectionalRepositoryLayoutTest.java b/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultBidirectionalRepositoryLayoutTest.java
deleted file mode 100644 (file)
index a2e186f..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.apache.maven.archiva.repository.content;
-
-/*
- * 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.maven.archiva.repository.ArchivaArtifact;
-
-/**
- * DefaultBidirectionalRepositoryLayoutTest 
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class DefaultBidirectionalRepositoryLayoutTest extends AbstractBidirectionalRepositoryLayoutTestCase
-{
-    private BidirectionalRepositoryLayout layout;
-
-    protected void setUp() throws Exception
-    {
-        super.setUp();
-
-        layout = (BidirectionalRepositoryLayout) lookup( BidirectionalRepositoryLayout.class.getName(), "default" );
-    }
-
-    public void testToPathBasic()
-    {
-        ArchivaArtifact artifact = createArtifact( "com.foo", "foo-tool", "1.0", "", "jar" );
-
-        assertEquals( "com/foo/foo-tool/1.0/foo-tool-1.0.jar", layout.pathOf( artifact ) );
-    }
-
-    public void testToPathEjbClient()
-    {
-        ArchivaArtifact artifact = createArtifact( "com.foo", "foo-client", "1.0", "", "ejb-client" );
-
-        assertEquals( "com/foo/foo-client/1.0/foo-client-1.0.jar", layout.pathOf( artifact ) );
-    }
-
-    public void testToPathWithClassifier()
-    {
-        ArchivaArtifact artifact = createArtifact( "com.foo.lib", "foo-lib", "2.1-alpha-1", "sources", "jar" );
-
-        assertEquals( "com/foo/lib/foo-lib/2.1-alpha-1/foo-lib-2.1-alpha-1-sources.jar", layout.pathOf( artifact ) );
-    }
-
-    public void testToPathUsingUniqueSnapshot()
-    {
-        ArchivaArtifact artifact = createArtifact( "com.foo", "foo-connector", "2.1-20060822.123456-35", "", "jar" );
-
-        assertEquals( "com/foo/foo-connector/2.1-SNAPSHOT/foo-connector-2.1-20060822.123456-35.jar",
-                      layout.pathOf( artifact ) );
-    }
-
-    public void testToArtifactBasic()
-    {
-        ArchivaArtifact artifact = layout.toArtifact( "com/foo/foo-tool/1.0/foo-tool-1.0.jar" );
-        assertArtifact( artifact, "com.foo", "foo-tool", "1.0", "", "jar" );
-    }
-
-    public void testToArtifactEjbClient()
-    {
-        ArchivaArtifact artifact = layout.toArtifact( "com/foo/foo-client/1.0/foo-client-1.0.jar" );
-        // The type is correct. as we cannot possibly know this is an ejb client without parsing the pom
-        assertArtifact( artifact, "com.foo", "foo-client", "1.0", "", "jar" );
-    }
-
-    public void testToArtifactWithClassifier()
-    {
-        ArchivaArtifact artifact =
-            layout.toArtifact( "com/foo/lib/foo-lib/2.1-alpha-1/foo-lib-2.1-alpha-1-sources.jar" );
-        assertArtifact( artifact, "com.foo.lib", "foo-lib", "2.1-alpha-1", "sources", "jar" );
-    }
-    
-    public void testToArtifactUsingUniqueSnapshot()
-    {
-        ArchivaArtifact artifact =
-            layout.toArtifact( "com/foo/foo-connector/2.1-SNAPSHOT/foo-connector-2.1-20060822.123456-35.jar" );
-        assertSnapshotArtifact( artifact, "com.foo", "foo-connector", "2.1-20060822.123456-35", "", "jar" );
-    }
-}
diff --git a/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyBidirectionalRepositoryLayoutTest.java b/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyBidirectionalRepositoryLayoutTest.java
deleted file mode 100644 (file)
index af61e1e..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.apache.maven.archiva.repository.content;
-
-/*
- * 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.maven.archiva.repository.ArchivaArtifact;
-
-/**
- * LegacyBidirectionalRepositoryLayoutTest 
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class LegacyBidirectionalRepositoryLayoutTest extends AbstractBidirectionalRepositoryLayoutTestCase
-{
-    private BidirectionalRepositoryLayout layout;
-
-    protected void setUp() throws Exception
-    {
-        super.setUp();
-
-        layout = (BidirectionalRepositoryLayout) lookup( BidirectionalRepositoryLayout.class.getName(), "legacy" );
-    }
-
-    public void testToPathBasic()
-    {
-        ArchivaArtifact artifact = createArtifact( "com.foo", "foo-tool", "1.0", "", "jar" );
-
-        assertEquals( "com.foo/jars/foo-tool-1.0.jar", layout.pathOf( artifact ) );
-    }
-
-    public void testToPathEjbClient()
-    {
-        ArchivaArtifact artifact = createArtifact( "com.foo", "foo-client", "1.0", "", "ejb-client" );
-
-        assertEquals( "com.foo/ejbs/foo-client-1.0.jar", layout.pathOf( artifact ) );
-    }
-
-    public void testToPathWithClassifier()
-    {
-        ArchivaArtifact artifact = createArtifact( "com.foo.lib", "foo-lib", "2.1-alpha-1", "sources", "jar" );
-
-        assertEquals( "com.foo.lib/javadoc.jars/foo-lib-2.1-alpha-1-sources.jar", layout.pathOf( artifact ) );
-    }
-
-    public void testToPathUsingUniqueSnapshot()
-    {
-        ArchivaArtifact artifact = createArtifact( "com.foo", "foo-connector", "2.1-20060822.123456-35", "", "jar" );
-
-        assertEquals( "com.foo/jars/foo-connector-2.1-20060822.123456-35.jar",
-                      layout.pathOf( artifact ) );
-    }
-}
diff --git a/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AbstractBidirectionalRepositoryLayoutTestCase.java b/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AbstractBidirectionalRepositoryLayoutTestCase.java
new file mode 100644 (file)
index 0000000..b15685a
--- /dev/null
@@ -0,0 +1,100 @@
+package org.apache.maven.archiva.repository.layout;
+
+/*
+ * 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.lang.StringUtils;
+import org.apache.maven.archiva.repository.ArchivaArtifact;
+import org.apache.maven.archiva.repository.ArchivaRepository;
+import org.codehaus.plexus.PlexusTestCase;
+
+import java.io.File;
+
+/**
+ * AbstractBidirectionalRepositoryLayoutTestCase 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AbstractBidirectionalRepositoryLayoutTestCase extends PlexusTestCase
+{
+    protected ArchivaRepository repository;
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+
+        repository = createTestRepository();
+    }
+
+    protected ArchivaRepository createTestRepository()
+    {
+        File targetDir = new File( getBasedir(), "target" );
+        File testRepo = new File( targetDir, "test-repo" );
+
+        if ( !testRepo.exists() )
+        {
+            testRepo.mkdirs();
+        }
+
+        String repoUri = "file://" + StringUtils.replace( testRepo.getAbsolutePath(), "\\", "/" );
+
+        ArchivaRepository repo = new ArchivaRepository( "testRepo", "Test Repository", repoUri );
+
+        return repo;
+    }
+
+    protected ArchivaArtifact createArtifact( String groupId, String artifactId, String version, String classifier,
+                                              String type )
+    {
+        ArchivaArtifact artifact = new ArchivaArtifact( repository, groupId, artifactId, version, classifier, type );
+        assertNotNull( artifact );
+        return artifact;
+    }
+
+    protected void assertArtifact( ArchivaArtifact actualArtifact, String groupId, String artifactId, String version,
+                                   String classifier, String type )
+    {
+        String expectedId = groupId + ":" + artifactId + ":" + version + ":" + classifier + ":" + type;
+
+        assertNotNull( expectedId + " - Should not be null.", actualArtifact );
+
+        assertEquals( expectedId + " - Group ID", actualArtifact.getGroupId(), groupId );
+        assertEquals( expectedId + " - Artifact ID", actualArtifact.getArtifactId(), artifactId );
+        assertEquals( expectedId + " - Version ID", actualArtifact.getVersion(), version );
+        assertEquals( expectedId + " - Classifier", actualArtifact.getClassifier(), classifier );
+        assertEquals( expectedId + " - Type", actualArtifact.getType(), type );
+    }
+
+    protected void assertSnapshotArtifact( ArchivaArtifact actualArtifact, String groupId, String artifactId,
+                                           String version, String classifier, String type )
+    {
+        String expectedId = groupId + ":" + artifactId + ":" + version + ":" + classifier + ":" + type;
+        
+        assertNotNull( expectedId + " - Should not be null.", actualArtifact );
+
+        assertEquals( expectedId + " - Group ID", actualArtifact.getGroupId(), groupId );
+        assertEquals( expectedId + " - Artifact ID", actualArtifact.getArtifactId(), artifactId );
+        assertEquals( expectedId + " - Version ID", actualArtifact.getVersion(), version );
+        assertEquals( expectedId + " - Classifier", actualArtifact.getClassifier(), classifier );
+        assertEquals( expectedId + " - Type", actualArtifact.getType(), type );
+        assertTrue( expectedId + " - Snapshot", actualArtifact.isSnapshot() );
+    }
+
+}
diff --git a/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayoutTest.java b/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayoutTest.java
new file mode 100644 (file)
index 0000000..249104a
--- /dev/null
@@ -0,0 +1,105 @@
+package org.apache.maven.archiva.repository.layout;
+
+/*
+ * 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.maven.archiva.repository.ArchivaArtifact;
+import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+
+/**
+ * DefaultBidirectionalRepositoryLayoutTest 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class DefaultBidirectionalRepositoryLayoutTest extends AbstractBidirectionalRepositoryLayoutTestCase
+{
+    private BidirectionalRepositoryLayout layout;
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+
+        layout = (BidirectionalRepositoryLayout) lookup( BidirectionalRepositoryLayout.class.getName(), "default" );
+    }
+
+    public void testToPathBasic()
+    {
+        ArchivaArtifact artifact = createArtifact( "com.foo", "foo-tool", "1.0", "", "jar" );
+
+        assertEquals( "com/foo/foo-tool/1.0/foo-tool-1.0.jar", layout.pathOf( artifact ) );
+    }
+
+    public void testToPathEjbClient()
+    {
+        ArchivaArtifact artifact = createArtifact( "com.foo", "foo-client", "1.0", "", "ejb-client" );
+
+        assertEquals( "com/foo/foo-client/1.0/foo-client-1.0.jar", layout.pathOf( artifact ) );
+    }
+
+    public void testToPathWithClassifier()
+    {
+        ArchivaArtifact artifact = createArtifact( "com.foo.lib", "foo-lib", "2.1-alpha-1", "sources", "java-source" );
+
+        assertEquals( "com/foo/lib/foo-lib/2.1-alpha-1/foo-lib-2.1-alpha-1-sources.jar", layout.pathOf( artifact ) );
+    }
+
+    public void testToPathUsingUniqueSnapshot()
+    {
+        ArchivaArtifact artifact = createArtifact( "com.foo", "foo-connector", "2.1-20060822.123456-35", "", "jar" );
+
+        assertEquals( "com/foo/foo-connector/2.1-SNAPSHOT/foo-connector-2.1-20060822.123456-35.jar",
+                      layout.pathOf( artifact ) );
+    }
+    
+    public void testToArtifactBasicSimpleGroupId() throws LayoutException
+    {
+        ArchivaArtifact artifact = layout.toArtifact( "commons-lang/commons-lang/2.1/commons-lang-2.1.jar" );
+        assertArtifact( artifact, "commons-lang", "commons-lang", "2.1", "", "jar" );
+    }
+
+    public void testToArtifactBasicLongGroupId() throws LayoutException
+    {
+        ArchivaArtifact artifact = layout.toArtifact( "com/foo/foo-tool/1.0/foo-tool-1.0.jar" );
+        assertArtifact( artifact, "com.foo", "foo-tool", "1.0", "", "jar" );
+    }
+
+    public void testToArtifactEjbClient() throws LayoutException
+    {
+        ArchivaArtifact artifact = layout.toArtifact( "com/foo/foo-client/1.0/foo-client-1.0.jar" );
+        // The type is correct. as we cannot possibly know this is an ejb client without parsing the pom
+        assertArtifact( artifact, "com.foo", "foo-client", "1.0", "", "jar" );
+    }
+
+    public void testToArtifactWithClassifier() throws LayoutException
+    {
+        ArchivaArtifact artifact =
+            layout.toArtifact( "com/foo/lib/foo-lib/2.1-alpha-1/foo-lib-2.1-alpha-1-sources.jar" );
+        // The 'java-source' type is correct.  You might be thinking of extension, which we are not testing here.
+        assertArtifact( artifact, "com.foo.lib", "foo-lib", "2.1-alpha-1", "sources", "java-source" );
+    }
+    
+    public void testToArtifactUsingUniqueSnapshot() throws LayoutException
+    {
+        ArchivaArtifact artifact =
+            layout.toArtifact( "com/foo/foo-connector/2.1-SNAPSHOT/foo-connector-2.1-20060822.123456-35.jar" );
+        assertSnapshotArtifact( artifact, "com.foo", "foo-connector", "2.1-20060822.123456-35", "", "jar" );
+    }
+}
diff --git a/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayoutTest.java b/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayoutTest.java
new file mode 100644 (file)
index 0000000..c90f3b5
--- /dev/null
@@ -0,0 +1,107 @@
+package org.apache.maven.archiva.repository.layout;
+
+/*
+ * 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.maven.archiva.repository.ArchivaArtifact;
+import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
+
+/**
+ * LegacyBidirectionalRepositoryLayoutTest 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class LegacyBidirectionalRepositoryLayoutTest extends AbstractBidirectionalRepositoryLayoutTestCase
+{
+    private BidirectionalRepositoryLayout layout;
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+
+        layout = (BidirectionalRepositoryLayout) lookup( BidirectionalRepositoryLayout.class.getName(), "legacy" );
+    }
+
+    public void testToPathBasic()
+    {
+        ArchivaArtifact artifact = createArtifact( "com.foo", "foo-tool", "1.0", "", "jar" );
+
+        assertEquals( "com.foo/jars/foo-tool-1.0.jar", layout.pathOf( artifact ) );
+    }
+
+    public void testToPathEjbClient()
+    {
+        ArchivaArtifact artifact = createArtifact( "com.foo", "foo-client", "1.0", "", "ejb-client" );
+
+        assertEquals( "com.foo/ejbs/foo-client-1.0.jar", layout.pathOf( artifact ) );
+    }
+
+    public void testToPathWithClassifier()
+    {
+        ArchivaArtifact artifact = createArtifact( "com.foo.lib", "foo-lib", "2.1-alpha-1", "sources", "jar" );
+
+        assertEquals( "com.foo.lib/javadoc.jars/foo-lib-2.1-alpha-1-sources.jar", layout.pathOf( artifact ) );
+    }
+
+    public void testToPathUsingUniqueSnapshot()
+    {
+        ArchivaArtifact artifact = createArtifact( "com.foo", "foo-connector", "2.1-20060822.123456-35", "", "jar" );
+
+        assertEquals( "com.foo/jars/foo-connector-2.1-20060822.123456-35.jar", layout.pathOf( artifact ) );
+    }
+
+    public void testToArtifactBasicSimpleGroupId() throws LayoutException
+    {
+        ArchivaArtifact artifact = layout.toArtifact( "commons-lang/jars/commons-lang-2.1.jar" );
+        assertArtifact( artifact, "commons-lang", "commons-lang", "2.1", "", "jar" );
+    }
+
+    public void testToArtifactBasicLongGroupId() throws LayoutException
+    {
+        ArchivaArtifact artifact = layout.toArtifact( "org.apache.derby/jars/derby-10.2.2.0.jar" );
+        assertArtifact( artifact, "org.apache.derby", "derby", "10.2.2.0", "", "jar" );
+    }
+
+    public void testToArtifactLongGroupId() throws LayoutException
+    {
+        ArchivaArtifact artifact = layout.toArtifact( "org.apache.geronimo.specs/jars/geronimo-ejb_2.1_spec-1.0.1.jar" );
+        assertArtifact( artifact, "org.apache.geronimo.specs", "geronimo-ejb_2.1_spec", "1.0.1", "", "jar" );
+    }
+
+    public void testToArtifactEjbClient() throws LayoutException
+    {
+        ArchivaArtifact artifact = layout.toArtifact( "org.apache.beehive/jars/beehive-ejb-control-1.0.1.jar" );
+        // The type is correct. as we cannot possibly know this is an ejb client without parsing the pom
+        assertArtifact( artifact, "org.apache.beehive", "beehive-ejb-control", "1.0.1", "", "jar" );
+    }
+
+    public void testToArtifactWithClassifier() throws LayoutException
+    {
+        ArchivaArtifact artifact = layout.toArtifact( "commons-lang/jars/commons-lang-2.3-sources.jar" );
+        // The 'java-source' type is correct.  You might be thinking of extension, which we are not testing here.
+        assertArtifact( artifact, "commons-lang", "commons-lang", "2.3", "sources", "java-source" );
+    }
+
+    public void testToArtifactSnapshot() throws LayoutException
+    {
+        ArchivaArtifact artifact = layout.toArtifact( "directory-clients/poms/ldap-clients-0.9.1-SNAPSHOT.pom" );
+        assertSnapshotArtifact( artifact, "directory-clients", "ldap-clients", "0.9.1-SNAPSHOT", "", "pom" );
+    }
+}
diff --git a/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtilsTest.java b/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtilsTest.java
new file mode 100644 (file)
index 0000000..5a4e704
--- /dev/null
@@ -0,0 +1,206 @@
+package org.apache.maven.archiva.repository.layout;
+
+/*
+ * 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 junit.framework.TestCase;
+
+/**
+ * RepositoryLayoutUtilsTest 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryLayoutUtilsTest extends TestCase
+{
+    public void testSplitFilenameBasic() throws LayoutException
+    {
+        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-2.1.jar", "commons-lang" ), "commons-lang",
+                     "2.1", "", "jar" );
+    }
+
+    public void testSplitFilenameAlphaVersion() throws LayoutException
+    {
+        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-2.0-alpha-1.jar", "commons-lang" ),
+                     "commons-lang", "2.0-alpha-1", "", "jar" );
+    }
+
+    public void testSplitFilenameSnapshot() throws LayoutException
+    {
+        assertSplit( RepositoryLayoutUtils.splitFilename( "foo-2.0-SNAPSHOT.jar", "foo" ), "foo", "2.0-SNAPSHOT", "",
+                     "jar" );
+    }
+
+    public void testSplitFilenameUniqueSnapshot() throws LayoutException
+    {
+        assertSplit( RepositoryLayoutUtils.splitFilename( "fletch-2.0-20060822-123456-35.tar.gz", "fletch" ), "fletch",
+                     "2.0-20060822-123456-35", "", "tar.gz" );
+    }
+
+    public void testSplitFilenameBasicClassifier() throws LayoutException
+    {
+        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-2.1-sources.jar", "commons-lang" ),
+                     "commons-lang", "2.1", "sources", "jar" );
+        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-2.1-javadoc.jar", "commons-lang" ),
+                     "commons-lang", "2.1", "javadoc", "jar" );
+    }
+
+    public void testSplitFilenameAlphaClassifier() throws LayoutException
+    {
+        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-2.0-alpha-1-sources.jar", "commons-lang" ),
+                     "commons-lang", "2.0-alpha-1", "sources", "jar" );
+        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-2.0-alpha-1-javadoc.jar", "commons-lang" ),
+                     "commons-lang", "2.0-alpha-1", "javadoc", "jar" );
+    }
+
+    public void testSplitFilenameSnapshotClassifier() throws LayoutException
+    {
+        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-3.1-SNAPSHOT-sources.jar", "commons-lang" ),
+                     "commons-lang", "3.1-SNAPSHOT", "sources", "jar" );
+        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-3.1-SNAPSHOT-javadoc.jar", "commons-lang" ),
+                     "commons-lang", "3.1-SNAPSHOT", "javadoc", "jar" );
+    }
+
+    public void testSplitFilenameUniqueSnapshotClassifier() throws LayoutException
+    {
+        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-3.1-SNAPSHOT-sources.jar", "commons-lang" ),
+                     "commons-lang", "3.1-SNAPSHOT", "sources", "jar" );
+        assertSplit( RepositoryLayoutUtils.splitFilename( "commons-lang-3.1-SNAPSHOT-javadoc.jar", "commons-lang" ),
+                     "commons-lang", "3.1-SNAPSHOT", "javadoc", "jar" );
+    }
+
+    public void testSplitFilenameApacheIncubator() throws LayoutException
+    {
+        assertSplit( RepositoryLayoutUtils.splitFilename( "cxf-common-2.0-incubator-M1.pom", null ), "cxf-common",
+                     "2.0-incubator-M1", "", "pom" );
+        assertSplit( RepositoryLayoutUtils.splitFilename( "commonj-api_r1.1-1.0-incubator-M2.jar", null ),
+                     "commonj-api_r1.1", "1.0-incubator-M2", "", "jar" );
+    }
+
+    public void testSplitFilenameBlankInputs()
+    {
+        try
+        {
+            RepositoryLayoutUtils.splitFilename( null, null );
+            fail( "Should have thrown an IllegalArgumentException." );
+        }
+        catch ( IllegalArgumentException e )
+        {
+            /* expected path */
+        }
+        catch ( LayoutException e )
+        {
+            fail( "Should have thrown an IllegalArgumentException." );
+        }
+        
+        try
+        {
+            RepositoryLayoutUtils.splitFilename( "", null );
+            fail( "Should have thrown an IllegalArgumentException." );
+        }
+        catch ( IllegalArgumentException e )
+        {
+            /* expected path */
+        }
+        catch ( LayoutException e )
+        {
+            fail( "Should have thrown an IllegalArgumentException." );
+        }
+        
+        try
+        {
+            RepositoryLayoutUtils.splitFilename( "   ", null );
+            fail( "Should have thrown an IllegalArgumentException." );
+        }
+        catch ( IllegalArgumentException e )
+        {
+            /* expected path */
+        }
+        catch ( LayoutException e )
+        {
+            fail( "Should have thrown an IllegalArgumentException." );
+        }
+        
+        try
+        {
+            RepositoryLayoutUtils.splitFilename( " \t  \n  ", null );
+            fail( "Should have thrown an IllegalArgumentException." );
+        }
+        catch ( IllegalArgumentException e )
+        {
+            /* expected path */
+        }
+        catch ( LayoutException e )
+        {
+            fail( "Should have thrown an IllegalArgumentException." );
+        }
+    }
+    
+    public void testSplitFilenameBadInputs()
+    {
+        try
+        {
+            RepositoryLayoutUtils.splitFilename( "commons-lang.jar", null );
+            fail( "Should have thrown a LayoutException (No Version)." );
+        }
+        catch ( LayoutException e )
+        {
+            /* Expected Path */
+        }
+        
+        try
+        {
+            RepositoryLayoutUtils.splitFilename( "geronimo-store", null );
+            fail( "Should have thrown a LayoutException (No Extension)." );
+        }
+        catch ( LayoutException e )
+        {
+            /* Expected Path */
+        }
+        
+        try
+        {
+            RepositoryLayoutUtils.splitFilename( "The Sixth Sick Sheiks Sixth Sheep is Sick.", null );
+            fail( "Should have thrown a LayoutException (No Extension)." );
+        }
+        catch ( LayoutException e )
+        {
+            /* Expected Path */
+        }
+        
+        try
+        {
+            RepositoryLayoutUtils.splitFilename( "1.0.jar", null );
+            fail( "Should have thrown a LayoutException (No Artifact ID)." );
+        }
+        catch ( LayoutException e )
+        {
+            /* Expected Path */
+        }
+    }
+
+    private void assertSplit( String[] actualSplit, String artifactId, String version, String classifier,
+                              String extension )
+    {
+        assertEquals( "Split - artifactId", artifactId, actualSplit[0] );
+        assertEquals( "Split - version", version, actualSplit[1] );
+        assertEquals( "Split - classifier", classifier, actualSplit[2] );
+        assertEquals( "Split - extension", extension, actualSplit[3] );
+    }
+}
diff --git a/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/CentralScannerTiming.java b/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/CentralScannerTiming.java
new file mode 100644 (file)
index 0000000..3c2c3a2
--- /dev/null
@@ -0,0 +1,132 @@
+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.maven.archiva.common.utils.BaseFile;
+import org.apache.maven.archiva.common.utils.DateUtil;
+import org.apache.maven.archiva.model.RepositoryContentStatistics;
+import org.apache.maven.archiva.repository.ArchivaRepository;
+import org.apache.maven.archiva.repository.RepositoryException;
+import org.apache.maven.archiva.repository.consumer.Consumer;
+import org.apache.maven.archiva.repository.consumer.ConsumerException;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * CentralScannerTiming 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class CentralScannerTiming
+{
+    public static void main( String[] args )
+    {
+        String pathToCentral = "/home/repo1/ibiblio";
+
+        ( new CentralScannerTiming() ).scanIt( pathToCentral );
+    }
+
+    public void scanIt( String path )
+    {
+        ArchivaRepository centralRepo = new ArchivaRepository( "central", "Central Mirror", "file://" + path );
+
+        RepositoryScanner scanner = new RepositoryScanner();
+
+        List consumerList = new ArrayList();
+        BasicConsumer consumer = new BasicConsumer();
+        consumerList.add( consumer );
+
+        try
+        {
+            RepositoryContentStatistics stats = scanner.scan( centralRepo, consumerList, true );
+
+            SimpleDateFormat df = new SimpleDateFormat();
+            System.out.println( "-------" );
+            System.out.println( "  Repository ID   : " + stats.getRepositoryId() );
+            System.out.println( "  Duration        : " + DateUtil.getDuration( stats.getDuration() ) );
+            System.out.println( "  When Gathered   : " + df.format( stats.getWhenGathered() ) );
+            System.out.println( "  Total File Count: " + stats.getTotalFileCount() );
+            System.out.println( "  New File Count  : " + stats.getNewFileCount() );
+        }
+        catch ( RepositoryException e )
+        {
+            e.printStackTrace( System.err );
+        }
+    }
+
+    class BasicConsumer implements Consumer
+    {
+        int count = 0;
+
+        public List getExcludePatterns()
+        {
+            return Collections.EMPTY_LIST;
+        }
+
+        public List getIncludePatterns()
+        {
+            List includes = new ArrayList();
+            includes.add( "**/*.pom" );
+            includes.add( "**/*.jar" );
+            includes.add( "**/*.war" );
+            includes.add( "**/*.ear" );
+            includes.add( "**/*.sar" );
+            includes.add( "**/*.car" );
+            includes.add( "**/*.mar" );
+//            includes.add( "**/*.sha1" );
+//            includes.add( "**/*.md5" );
+//            includes.add( "**/*.asc" );
+            includes.add( "**/*.dtd" );
+            includes.add( "**/*.tld" );
+            includes.add( "**/*.gz" );
+            includes.add( "**/*.bz2" );
+            includes.add( "**/*.zip" );
+            return includes;
+        }
+
+        public String getName()
+        {
+            return "Basic No-op Consumer";
+        }
+
+        public boolean init( ArchivaRepository repository )
+        {
+            return true;
+        }
+
+        public void processFile( BaseFile file ) throws ConsumerException
+        {
+            count++;
+            if ( ( count % 1000 ) == 0 )
+            {
+                System.out.println( "Files Processed: " + count );
+            }
+        }
+
+        public void processFileProblem( BaseFile file, String message )
+        {
+            /* no-op */
+        }
+    }
+}
diff --git a/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerTest.java b/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerTest.java
new file mode 100644 (file)
index 0000000..4907819
--- /dev/null
@@ -0,0 +1,70 @@
+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.lang.StringUtils;
+import org.apache.maven.archiva.model.RepositoryContentStatistics;
+import org.apache.maven.archiva.repository.ArchivaRepository;
+import org.apache.maven.archiva.repository.RepositoryException;
+import org.codehaus.plexus.PlexusTestCase;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * RepositoryScannerTest 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryScannerTest extends PlexusTestCase
+{
+    private ArchivaRepository createDefaultRepository()
+    {
+        File repoDir = new File( getBasedir(), "src/test/repositories/default-repository" );
+
+        assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
+
+        String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" );
+
+        ArchivaRepository repo = new ArchivaRepository( "testDefaultRepo", "Test Default Repository", repoUri );
+
+        return repo;
+    }
+
+    public void testDefaultRepositoryScanner() throws RepositoryException
+    {
+        ArchivaRepository repository = createDefaultRepository();
+
+        List consumers = new ArrayList();
+        ScanConsumer consumer = new ScanConsumer();
+        consumers.add( consumer );
+
+        RepositoryScanner scanner = new RepositoryScanner();
+        boolean includeSnapshots = true;
+        RepositoryContentStatistics stats = scanner.scan( repository, consumers, includeSnapshots );
+
+        assertNotNull( "Stats should not be null.", stats );
+        assertEquals( "Stats.totalFileCount", 17, stats.getTotalFileCount() );
+        assertEquals( "Processed Count", 17, consumer.getProcessCount() );
+    }
+
+}
diff --git a/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/ScanConsumer.java b/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/ScanConsumer.java
new file mode 100644 (file)
index 0000000..d1c8e0a
--- /dev/null
@@ -0,0 +1,82 @@
+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.maven.archiva.common.utils.BaseFile;
+import org.apache.maven.archiva.repository.ArchivaRepository;
+import org.apache.maven.archiva.repository.consumer.Consumer;
+import org.apache.maven.archiva.repository.consumer.ConsumerException;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * ScanConsumer 
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ScanConsumer implements Consumer
+{
+    private int processCount = 0;
+
+    public List getExcludePatterns()
+    {
+        return Collections.EMPTY_LIST;
+    }
+
+    public List getIncludePatterns()
+    {
+        List includes = new ArrayList();
+        includes.add( "**/*.jar" );
+        return includes;
+    }
+
+    public String getName()
+    {
+        return "Scan Consumer";
+    }
+
+    public boolean init( ArchivaRepository repository )
+    {
+        return true;
+    }
+
+    public void processFile( BaseFile file ) throws ConsumerException
+    {
+        this.processCount++;
+    }
+
+    public void processFileProblem( BaseFile file, String message )
+    {
+        /* do nothing */
+    }
+
+    public int getProcessCount()
+    {
+        return processCount;
+    }
+
+    public void setProcessCount( int processCount )
+    {
+        this.processCount = processCount;
+    }
+}
diff --git a/archiva-repository-layer/src/test/resources/log4j.xml b/archiva-repository-layer/src/test/resources/log4j.xml
new file mode 100644 (file)
index 0000000..23d4d08
--- /dev/null
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+  <appender name="console" class="org.apache.log4j.ConsoleAppender">
+    <param name="Target" value="System.out"/>
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d [%t] %-5p %-30c{1} - %m%n"/>
+    </layout>
+  </appender>
+
+  <!-- Help identify bugs during testing -->
+  <logger name="org.apache.maven">
+    <level value="info"/>
+  </logger>
+
+  <logger name="org.codehaus.plexus.security">
+    <level value="info"/>
+  </logger>
+
+  <!-- squelch noisy objects (for now) -->
+  <logger name="org.codehaus.plexus.mailsender.MailSender">
+    <level value="info"/>
+  </logger>
+
+  <logger name="org.codehaus.plexus.PlexusContainer">
+    <level value="info"/>
+  </logger>
+
+  <logger name="org.codehaus.plexus.component.manager.ClassicSingletonComponentManager">
+    <level value="error"/>
+  </logger>
+
+  <root>
+    <priority value ="warn" />
+    <appender-ref ref="console" />
+  </root>
+
+</log4j:configuration>
diff --git a/pom.xml b/pom.xml
index a500c2f61d185633892f302365e287645893da4b..b3acaa8a07d2c4a42de0c5f413ea8fbfaebcf8b7 100644 (file)
--- a/pom.xml
+++ b/pom.xml
     <module>archiva-applet</module>
     <module>archiva-converter</module>
     <module>archiva-common</module>
-    <module>archiva-discoverer</module>
     <module>archiva-reports-standard</module>
     <module>archiva-indexer</module>
     <module>archiva-webapp</module>