]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1003] Repackage sources from org.apache.maven.archiva.. to org.apache.archiva...
authorOlivier Lamy <olamy@apache.org>
Fri, 16 Sep 2011 07:42:25 +0000 (07:42 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 16 Sep 2011 07:42:25 +0000 (07:42 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1171418 13f79535-47bb-0310-9956-ffa450edef68

94 files changed:
archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java
archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/ArchivaException.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/FileTypeUtils.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/BaseFile.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/DateUtil.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/FileUtil.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/PathUtil.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/Slf4JPlexusLogger.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionComparator.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionUtil.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/ArchivaException.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/FileTypeUtils.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/BaseFile.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/DateUtil.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/FileUtil.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/PathUtil.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/Slf4JPlexusLogger.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionComparator.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionUtil.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/BaseFileTest.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/DateUtilTest.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/PathUtilTest.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/ResourceUtils.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/VersionComparatorTest.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/VersionUtilTest.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/DateUtilTest.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/PathUtilTest.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/ResourceUtils.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/VersionComparatorTest.java [deleted file]
archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/VersionUtilTest.java [deleted file]
archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java
archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/AbstractMonitoredConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/ConsumerException.java
archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/functors/ConsumerWantsFilePredicate.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/AbstractArtifactConsumerTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java
archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java
archiva-modules/archiva-base/archiva-indexer/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java
archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java
archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java
archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/AbstractUpdatePolicy.java
archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/PolicyConfigurationException.java
archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/PolicyViolationException.java
archiva-modules/archiva-base/archiva-policies/src/main/java/org/apache/maven/archiva/policies/ProxyDownloadException.java
archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java
archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java
archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LayoutException.java
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java
archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java
archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java
archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java
archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java
archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/XMLException.java
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/RepositoryArchivaTaskScheduler.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java
archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/ArchivaSecurityException.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/tags/DependencyTree.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/tags/DependencyTreeTag.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/tags/DependencyTreeTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/ShowArtifactActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/DefaultDependencyTreeBuilder.java
archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryPathTranslator.java
archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java
archiva-modules/plugins/stage-repository-merge/src/main/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMerger.java

index e7850b525316cb4c364d44ae09a136ef0ce494db..5b8a6dd24c6410405e7ba30f5f2ed58ada0e3cc7 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.archiva.converter.artifact;
 import junit.framework.TestCase;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.common.utils.FileUtil;
+import org.apache.archiva.common.utils.FileUtil;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
index 6f8d285a05eae8adabba57b7ab644f866722521f..812cc708b98f438af1dc52080f8196a6c60fa228 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.archiva.checksum;
 import java.io.File;
 
 import junit.framework.TestCase;
-import org.apache.maven.archiva.common.utils.FileUtil;
+import org.apache.archiva.common.utils.FileUtil;
 
 /**
  * AbstractChecksumTestCase
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/ArchivaException.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/ArchivaException.java
new file mode 100644 (file)
index 0000000..5ff2220
--- /dev/null
@@ -0,0 +1,39 @@
+package org.apache.archiva.common;
+
+/*
+ * 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.
+ */
+
+/**
+ * ArchivaException 
+ *
+ * @version $Id$
+ */
+public class ArchivaException
+    extends Exception
+{
+    public ArchivaException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public ArchivaException( String message )
+    {
+        super( message );
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/FileTypeUtils.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/FileTypeUtils.java
new file mode 100644 (file)
index 0000000..b0621bb
--- /dev/null
@@ -0,0 +1,39 @@
+package org.apache.archiva.common;
+/*
+ * 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.Arrays;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+public class FileTypeUtils
+{
+
+    /**
+     * Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the
+     * case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual
+     * artifacts and exclude later during scanning.
+     */
+    public static final List<String> DEFAULT_EXCLUSIONS =
+        Arrays.asList( "**/maven-metadata.xml", "**/maven-metadata-*.xml", "**/*.sha1", "**/*.asc", "**/*.md5",
+                       "**/*.pgp", "**/.index/**", "**/.indexer/**" );
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/BaseFile.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/BaseFile.java
new file mode 100644 (file)
index 0000000..fc10f95
--- /dev/null
@@ -0,0 +1,104 @@
+package org.apache.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.io.File;
+import java.net.URI;
+
+/**
+ * BaseFile - convenient File object that tracks the Base Directory and can provide relative path values
+ * for the file object based on that Base Directory value. 
+ *
+ * @version $Id$
+ */
+public class BaseFile
+    extends File
+{
+    private File baseDir;
+
+    public BaseFile( File pathFile )
+    {
+        this( pathFile.getAbsolutePath() );
+    }
+
+    public BaseFile( File repoDir, File pathFile )
+    {
+        this( repoDir, PathUtil.getRelative( repoDir.getAbsolutePath(), pathFile ) );
+    }
+
+    public BaseFile( File parent, String child )
+    {
+        super( parent, child );
+        this.baseDir = parent;
+    }
+
+    public BaseFile( String pathname )
+    {
+        super( pathname );
+
+        // Calculate the top level directory.
+
+        File parent = this;
+        while ( parent.getParentFile() != null )
+        {
+            parent = parent.getParentFile();
+        }
+
+        this.baseDir = parent;
+    }
+
+    public BaseFile( String repoDir, File pathFile )
+    {
+        this( new File( repoDir ), pathFile );
+    }
+
+    public BaseFile( String parent, String child )
+    {
+        super( parent, child );
+        this.baseDir = new File( parent );
+    }
+
+    public BaseFile( URI uri )
+    {
+        super( uri ); // only to satisfy java compiler.
+        throw new IllegalStateException( "The " + BaseFile.class.getName()
+            + " object does not support URI construction." );
+    }
+
+    public File getBaseDir()
+    {
+        return baseDir;
+    }
+
+    public String getRelativePath()
+    {
+        return PathUtil.getRelative( this.baseDir.getAbsolutePath(), this );
+    }
+
+    public void setBaseDir( File baseDir )
+    {
+        this.baseDir = baseDir;
+    }
+
+    public void setBaseDir( String repoDir )
+    {
+        setBaseDir( new File( repoDir ) );
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/DateUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/DateUtil.java
new file mode 100644 (file)
index 0000000..f146906
--- /dev/null
@@ -0,0 +1,129 @@
+package org.apache.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. 
+ *
+ * @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-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/FileUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/FileUtil.java
new file mode 100644 (file)
index 0000000..d60a3a5
--- /dev/null
@@ -0,0 +1,36 @@
+package org.apache.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.io.File;
+
+public class FileUtil
+{
+    public static String getBasedir()
+    {
+        String basedir = System.getProperty( "basedir" );
+        if ( basedir == null )
+        {
+            basedir = new File( "" ).getAbsolutePath();
+        }
+
+        return basedir;
+    }
+}
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/PathUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/PathUtil.java
new file mode 100644 (file)
index 0000000..1c35c60
--- /dev/null
@@ -0,0 +1,106 @@
+package org.apache.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 org.apache.commons.lang.StringUtils;
+
+import java.io.File;
+import java.net.MalformedURLException;
+
+/**
+ * PathUtil - simple utility methods for path manipulation. 
+ *
+ * @version $Id$
+ */
+public class PathUtil
+{
+    public static String toUrl( String path )
+    {
+        // Is our work already done for us?
+        if ( path.startsWith( "file:/" ) )
+        {
+            return path;
+        }
+
+        return toUrl( new File( path ) );
+    }
+
+    public static String toUrl( File file )
+    {
+        try
+        {
+            return file.toURL().toExternalForm();
+        }
+        catch ( MalformedURLException e )
+        {
+            String pathCorrected = StringUtils.replaceChars( file.getAbsolutePath(), '\\', '/' );
+            if ( pathCorrected.startsWith( "file:/" ) )
+            {
+                return pathCorrected;
+            }
+
+            return "file://" + pathCorrected;
+        }
+    }
+
+    /**
+     * Given a basedir and a child file, return the relative path to the child.
+     * 
+     * @param basedir the basedir.
+     * @param file the file to get the relative path for.
+     * @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character)
+     */
+    public static String getRelative( String basedir, File file )
+    {
+        return getRelative( basedir, file.getAbsolutePath() );
+    }
+
+    /**
+     * Given a basedir and a child file, return the relative path to the child.
+     * 
+     * @param basedir the basedir.
+     * @param child the child path (can be a full path)
+     * @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character)
+     */
+    public static String getRelative( String basedir, String child )
+    {
+        if ( basedir.endsWith( "/" ) || basedir.endsWith( "\\" ) )
+        {
+            basedir = basedir.substring( 0, basedir.length() - 1 );
+        }
+
+        if ( child.startsWith( basedir ) )
+        {
+            // simple solution.
+            return child.substring( basedir.length() + 1 );
+        }
+
+        String absoluteBasedir = new File( basedir ).getAbsolutePath();
+        if ( child.startsWith( absoluteBasedir ) )
+        {
+            // resolved basedir solution.
+            return child.substring( absoluteBasedir.length() + 1 );
+        }
+
+        // File is not within basedir.
+        throw new IllegalStateException( "Unable to obtain relative path of file " + child
+            + ", it is not within basedir " + basedir + "." );
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/Slf4JPlexusLogger.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/Slf4JPlexusLogger.java
new file mode 100644 (file)
index 0000000..097bd54
--- /dev/null
@@ -0,0 +1,129 @@
+package org.apache.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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Slf4JPlexusLogger - temporary logger to provide an Slf4j Logger to those components
+ * outside of the archiva codebase that require a plexus logger.
+ *
+ * @version $Id$
+ */
+public class Slf4JPlexusLogger implements org.codehaus.plexus.logging.Logger {
+    private Logger log;
+
+    public Slf4JPlexusLogger(Class<?> clazz) {
+        log = LoggerFactory.getLogger(clazz);
+    }
+
+    public Slf4JPlexusLogger(String name) {
+        log = LoggerFactory.getLogger(name);
+    }
+
+    public void debug(String message) {
+        log.debug(message);
+    }
+
+    public void debug(String message, Throwable throwable) {
+        log.debug(message, throwable);
+    }
+
+    public void error(String message) {
+        log.error(message);
+    }
+
+    public void error(String message, Throwable throwable) {
+        log.error(message, throwable);
+    }
+
+    public void fatalError(String message) {
+        log.error(message);
+    }
+
+    public void fatalError(String message, Throwable throwable) {
+        log.error(message, throwable);
+    }
+
+    public org.codehaus.plexus.logging.Logger getChildLogger(String name) {
+        return new Slf4JPlexusLogger(log.getName() + "." + name);
+    }
+
+    public String getName() {
+        return log.getName();
+    }
+
+    public int getThreshold() {
+        if (log.isTraceEnabled()) {
+            return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
+        } else if (log.isDebugEnabled()) {
+            return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
+        } else if (log.isInfoEnabled()) {
+            return org.codehaus.plexus.logging.Logger.LEVEL_INFO;
+        } else if (log.isWarnEnabled()) {
+            return org.codehaus.plexus.logging.Logger.LEVEL_WARN;
+        } else if (log.isErrorEnabled()) {
+            return org.codehaus.plexus.logging.Logger.LEVEL_ERROR;
+        }
+
+        return org.codehaus.plexus.logging.Logger.LEVEL_DISABLED;
+    }
+
+    public void info(String message) {
+        log.info(message);
+    }
+
+    public void info(String message, Throwable throwable) {
+        log.info(message, throwable);
+    }
+
+    public boolean isDebugEnabled() {
+        return log.isDebugEnabled();
+    }
+
+    public boolean isErrorEnabled() {
+        return log.isErrorEnabled();
+    }
+
+    public boolean isFatalErrorEnabled() {
+        return log.isErrorEnabled();
+    }
+
+    public boolean isInfoEnabled() {
+        return log.isInfoEnabled();
+    }
+
+    public boolean isWarnEnabled() {
+        return log.isWarnEnabled();
+    }
+
+    public void setThreshold(int threshold) {
+        /* do nothing */
+    }
+
+    public void warn(String message) {
+        log.warn(message);
+    }
+
+    public void warn(String message, Throwable throwable) {
+        log.warn(message, throwable);
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionComparator.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionComparator.java
new file mode 100644 (file)
index 0000000..6a790cd
--- /dev/null
@@ -0,0 +1,259 @@
+package org.apache.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 org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * VersionComparator - compare the parts of two version strings.
+ * <p/>
+ * Technique.
+ * <p/>
+ * * Split the version strings into parts by splitting on <code>"-._"</code> first, then breaking apart words from numbers.
+ * <p/>
+ * <code>
+ * "1.0"         = "1", "0"
+ * "1.0-alpha-1" = "1", "0", "alpha", "1"
+ * "2.0-rc2"     = "2", "0", "rc", "2"
+ * "1.3-m2"      = "1", "3", "m", "3"
+ * </code>
+ * <p/>
+ * compare each part individually, and when they do not match, perform the following test.
+ * <p/>
+ * Numbers are calculated per normal comparison rules.
+ * Words that are part of the "special word list" will be treated as their index within that heirarchy.
+ * Words that cannot be identified as special, are treated using normal case-insensitive comparison rules.
+ *
+ * @version $Id$
+ */
+public class VersionComparator
+    implements Comparator<String>
+{
+    private static Comparator<String> INSTANCE = new VersionComparator();
+
+    private List<String> specialWords;
+
+    public VersionComparator()
+    {
+        specialWords = new ArrayList<String>();
+
+        // ids that refer to LATEST
+        specialWords.add( "final" );
+        specialWords.add( "release" );
+        specialWords.add( "current" );
+        specialWords.add( "latest" );
+        specialWords.add( "g" );
+        specialWords.add( "gold" );
+        specialWords.add( "fcs" );
+
+        // ids that are for a release cycle.
+        specialWords.add( "a" );
+        specialWords.add( "alpha" );
+        specialWords.add( "b" );
+        specialWords.add( "beta" );
+        specialWords.add( "pre" );
+        specialWords.add( "rc" );
+        specialWords.add( "m" );
+        specialWords.add( "milestone" );
+
+        // ids that are for dev / debug cycles.
+        specialWords.add( "dev" );
+        specialWords.add( "test" );
+        specialWords.add( "debug" );
+        specialWords.add( "unofficial" );
+        specialWords.add( "nightly" );
+        specialWords.add( "incubating" );
+        specialWords.add( "incubator" );
+        specialWords.add( "snapshot" );
+    }
+
+    public static Comparator<String> getInstance()
+    {
+        return INSTANCE;
+    }
+
+    public int compare( String o1, String o2 )
+    {
+        if ( o1 == null && o2 == null )
+        {
+            return 0;
+        }
+
+        if ( o1 == null )
+        {
+            return 1;
+        }
+
+        if ( o2 == null )
+        {
+            return -1;
+        }
+
+        String[] parts1 = toParts( o1 );
+        String[] parts2 = toParts( o2 );
+
+        int diff;
+        int partLen = Math.max( parts1.length, parts2.length );
+        for ( int i = 0; i < partLen; i++ )
+        {
+            diff = comparePart( safePart( parts1, i ), safePart( parts2, i ) );
+            if ( diff != 0 )
+            {
+                return diff;
+            }
+        }
+
+        diff = parts2.length - parts1.length;
+
+        if ( diff != 0 )
+        {
+            return diff;
+        }
+
+        return o1.compareToIgnoreCase( o2 );
+    }
+
+    private String safePart( String[] parts, int idx )
+    {
+        if ( idx < parts.length )
+        {
+            return parts[idx];
+        }
+
+        return "0";
+    }
+
+    private int comparePart( String s1, String s2 )
+    {
+        boolean is1Num = NumberUtils.isNumber( s1 );
+        boolean is2Num = NumberUtils.isNumber( s2 );
+
+        // (Special Case) Test for numbers both first.
+        if ( is1Num && is2Num )
+        {
+            int i1 = NumberUtils.toInt( s1 );
+            int i2 = NumberUtils.toInt( s2 );
+
+            return i1 - i2;
+        }
+
+        // Test for text both next.
+        if ( !is1Num && !is2Num )
+        {
+            int idx1 = specialWords.indexOf( s1.toLowerCase() );
+            int idx2 = specialWords.indexOf( s2.toLowerCase() );
+
+            // Only operate perform index based operation, if both strings
+            // are found in the specialWords index.
+            if ( idx1 >= 0 && idx2 >= 0 )
+            {
+                return idx1 - idx2;
+            }
+        }
+
+        // Comparing text to num
+        if ( !is1Num && is2Num )
+        {
+            return -1;
+        }
+
+        // Comparing num to text
+        if ( is1Num && !is2Num )
+        {
+            return 1;
+        }
+
+        // Return comparison of strings themselves.
+        return s1.compareToIgnoreCase( s2 );
+    }
+
+    public static String[] toParts( String version )
+    {
+        if ( StringUtils.isBlank( version ) )
+        {
+            return ArrayUtils.EMPTY_STRING_ARRAY;
+        }
+
+        int modeOther = 0;
+        int modeDigit = 1;
+        int modeText = 2;
+
+        List<String> parts = new ArrayList<String>();
+        int len = version.length();
+        int i = 0;
+        int start = 0;
+        int mode = modeOther;
+
+        while ( i < len )
+        {
+            char c = version.charAt( i );
+
+            if ( Character.isDigit( c ) )
+            {
+                if ( mode != modeDigit )
+                {
+                    if ( mode != modeOther )
+                    {
+                        parts.add( version.substring( start, i ) );
+                    }
+                    mode = modeDigit;
+                    start = i;
+                }
+            }
+            else if ( Character.isLetter( c ) )
+            {
+                if ( mode != modeText )
+                {
+                    if ( mode != modeOther )
+                    {
+                        parts.add( version.substring( start, i ) );
+                    }
+                    mode = modeText;
+                    start = i;
+                }
+            }
+            else
+            {
+                // Other.
+                if ( mode != modeOther )
+                {
+                    parts.add( version.substring( start, i ) );
+                    mode = modeOther;
+                }
+            }
+
+            i++;
+        }
+
+        // Add remainder
+        if ( mode != modeOther )
+        {
+            parts.add( version.substring( start, i ) );
+        }
+
+        return parts.toArray( new String[parts.size()] );
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionUtil.java
new file mode 100644 (file)
index 0000000..fe9fd59
--- /dev/null
@@ -0,0 +1,207 @@
+package org.apache.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 org.apache.commons.lang.StringUtils;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Version utility methods. 
+ *
+ * @version $Id$
+ */
+public class VersionUtil
+{
+    /**
+     * 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[] {
+        "([0-9][_.0-9a-z]*)",
+        "(snapshot)",
+        "(g?[_.0-9ab]*(pre|rc|g|m)[_.0-9]*)",
+        "(dev[_.0-9]*)",
+        "(alpha[_.0-9]*)",
+        "(beta[_.0-9]*)",
+        "(rc[_.0-9]*)",
+//        "(test[_.0-9]*)", -- omitted for MRM-681, can be reinstated as part of MRM-712
+        "(debug[_.0-9]*)",
+        "(unofficial[_.0-9]*)",
+        "(current)",
+        "(latest)",
+        "(fcs)",
+        "(release[_.0-9]*)",
+        "(nightly)",
+        "(final)",
+        "(incubating)",
+        "(incubator)",
+        "([ab][_.0-9]+)" };
+
+    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 final Pattern TIMESTAMP_PATTERN = Pattern.compile( "^([0-9]{8})\\.([0-9]{6})$" );
+
+    public static final Pattern GENERIC_SNAPSHOT_PATTERN = Pattern.compile( "^(.*)-" + SNAPSHOT );
+
+    private static final Pattern VERSION_MEGA_PATTERN = Pattern.compile( StringUtils.join( versionPatterns, '|' ), Pattern.CASE_INSENSITIVE );
+
+    /**
+     * <p>
+     * Tests if the unknown string contains elements that identify it as a version string (or not).
+     * </p>
+     * 
+     * <p>
+     * The algorithm tests each part of the string that is delimited by a '-' (dash) character.
+     * If 75% or more of the sections are identified as 'version' strings, the result is
+     * determined to be of a high probability to be version identifier string.
+     * </p>
+     * 
+     * @param unknown the unknown string to test.
+     * @return true if the unknown string is likely a version string.
+     */
+    public static boolean isVersion( String unknown )
+    {
+        String versionParts[] = StringUtils.split( unknown, '-' );
+
+        Matcher mat;
+
+        int countValidParts = 0;
+
+        for ( int i = 0; i < versionParts.length; i++ )
+        {
+            String part = versionParts[i];
+            mat = VERSION_MEGA_PATTERN.matcher( part );
+
+            if ( mat.matches() )
+            {
+                if ( i == 0 ) // loosen rule to return true if first token matches
+                {
+                    return true;
+                }
+                countValidParts++;
+            }
+        }
+
+        /* Calculate version probability as true if 3/4's of the input string has pieces of
+         * of known version identifier strings.
+         */
+        int threshold = (int) Math.floor( Math.max( (double) 1.0, (double) ( versionParts.length * 0.75 ) ) );
+
+        return ( countValidParts >= threshold );
+    }
+
+    /**
+     * <p>
+     * Tests if the identifier is a known simple version keyword.
+     * </p>
+     * 
+     * <p>
+     * This method is different from {@link #isVersion(String)} in that it tests the whole input string in
+     * one go as a simple identifier. (eg "alpha", "1.0", "beta", "debug", "latest", "rc#", etc...)
+     * </p>
+     * 
+     * @param identifier the identifier to test.
+     * @return true if the unknown string is likely a version string.
+     */
+    public static boolean isSimpleVersionKeyword( String identifier )
+    {
+        Matcher mat = VERSION_MEGA_PATTERN.matcher( identifier );
+
+        return mat.matches();
+    }
+
+    public static boolean isSnapshot( String version )
+    {
+        Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
+        if ( m.matches() )
+        {
+            return true;
+        }
+        else
+        {
+            return isGenericSnapshot(version);
+        }
+    }
+
+    public static String getBaseVersion( String version )
+    {
+        Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
+        if ( m.matches() )
+        {
+            return m.group( 1 ) + "-" + SNAPSHOT;
+        }
+        else
+        {
+            return version;
+        }
+    }
+    
+    /**
+     * <p>
+     * Get the release version of the snapshot version.
+     * </p>
+     * 
+     * <p>
+     * If snapshot version is 1.0-SNAPSHOT, then release version would be 1.0
+     * And if snapshot version is 1.0-20070113.163208-1.jar, then release version would still be 1.0
+     * </p>
+     * 
+     * @param snapshotVersion
+     * @return
+     */
+    public static String getReleaseVersion( String snapshotVersion )
+    {
+        Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( snapshotVersion );
+        
+        if( isGenericSnapshot( snapshotVersion ) )
+        {
+            m = GENERIC_SNAPSHOT_PATTERN.matcher( snapshotVersion );
+        }
+                
+        if ( m.matches() )
+        {   
+            return m.group( 1 );
+        }
+        else
+        {        
+            return snapshotVersion;
+        }
+    }
+
+    public static boolean isUniqueSnapshot( String version )
+    {             
+        Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
+        if( m.matches() )
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+    public static boolean isGenericSnapshot( String version )
+    {
+        return version.endsWith( SNAPSHOT );    
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/ArchivaException.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/ArchivaException.java
deleted file mode 100644 (file)
index 3b2b925..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.apache.maven.archiva.common;
-
-/*
- * 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.
- */
-
-/**
- * ArchivaException 
- *
- * @version $Id$
- */
-public class ArchivaException
-    extends Exception
-{
-    public ArchivaException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-
-    public ArchivaException( String message )
-    {
-        super( message );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/FileTypeUtils.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/FileTypeUtils.java
deleted file mode 100644 (file)
index d6d11cc..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.apache.maven.archiva.common;
-/*
- * 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.Arrays;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-public class FileTypeUtils
-{
-
-    /**
-     * Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the
-     * case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual
-     * artifacts and exclude later during scanning.
-     */
-    public static final List<String> DEFAULT_EXCLUSIONS =
-        Arrays.asList( "**/maven-metadata.xml", "**/maven-metadata-*.xml", "**/*.sha1", "**/*.asc", "**/*.md5",
-                       "**/*.pgp", "**/.index/**", "**/.indexer/**" );
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/BaseFile.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/BaseFile.java
deleted file mode 100644 (file)
index 2a5ebf0..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-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.io.File;
-import java.net.URI;
-
-/**
- * BaseFile - convenient File object that tracks the Base Directory and can provide relative path values
- * for the file object based on that Base Directory value. 
- *
- * @version $Id$
- */
-public class BaseFile
-    extends File
-{
-    private File baseDir;
-
-    public BaseFile( File pathFile )
-    {
-        this( pathFile.getAbsolutePath() );
-    }
-
-    public BaseFile( File repoDir, File pathFile )
-    {
-        this( repoDir, PathUtil.getRelative( repoDir.getAbsolutePath(), pathFile ) );
-    }
-
-    public BaseFile( File parent, String child )
-    {
-        super( parent, child );
-        this.baseDir = parent;
-    }
-
-    public BaseFile( String pathname )
-    {
-        super( pathname );
-
-        // Calculate the top level directory.
-
-        File parent = this;
-        while ( parent.getParentFile() != null )
-        {
-            parent = parent.getParentFile();
-        }
-
-        this.baseDir = parent;
-    }
-
-    public BaseFile( String repoDir, File pathFile )
-    {
-        this( new File( repoDir ), pathFile );
-    }
-
-    public BaseFile( String parent, String child )
-    {
-        super( parent, child );
-        this.baseDir = new File( parent );
-    }
-
-    public BaseFile( URI uri )
-    {
-        super( uri ); // only to satisfy java compiler.
-        throw new IllegalStateException( "The " + BaseFile.class.getName()
-            + " object does not support URI construction." );
-    }
-
-    public File getBaseDir()
-    {
-        return baseDir;
-    }
-
-    public String getRelativePath()
-    {
-        return PathUtil.getRelative( this.baseDir.getAbsolutePath(), this );
-    }
-
-    public void setBaseDir( File baseDir )
-    {
-        this.baseDir = baseDir;
-    }
-
-    public void setBaseDir( String repoDir )
-    {
-        setBaseDir( new File( repoDir ) );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/DateUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/DateUtil.java
deleted file mode 100644 (file)
index 7e3dc23..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-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. 
- *
- * @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-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/FileUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/FileUtil.java
deleted file mode 100644 (file)
index 8c451dc..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-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.io.File;
-
-public class FileUtil
-{
-    public static String getBasedir()
-    {
-        String basedir = System.getProperty( "basedir" );
-        if ( basedir == null )
-        {
-            basedir = new File( "" ).getAbsolutePath();
-        }
-
-        return basedir;
-    }
-}
\ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/PathUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/PathUtil.java
deleted file mode 100644 (file)
index 34905ec..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-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 org.apache.commons.lang.StringUtils;
-
-import java.io.File;
-import java.net.MalformedURLException;
-
-/**
- * PathUtil - simple utility methods for path manipulation. 
- *
- * @version $Id$
- */
-public class PathUtil
-{
-    public static String toUrl( String path )
-    {
-        // Is our work already done for us?
-        if ( path.startsWith( "file:/" ) )
-        {
-            return path;
-        }
-
-        return toUrl( new File( path ) );
-    }
-
-    public static String toUrl( File file )
-    {
-        try
-        {
-            return file.toURL().toExternalForm();
-        }
-        catch ( MalformedURLException e )
-        {
-            String pathCorrected = StringUtils.replaceChars( file.getAbsolutePath(), '\\', '/' );
-            if ( pathCorrected.startsWith( "file:/" ) )
-            {
-                return pathCorrected;
-            }
-
-            return "file://" + pathCorrected;
-        }
-    }
-
-    /**
-     * Given a basedir and a child file, return the relative path to the child.
-     * 
-     * @param basedir the basedir.
-     * @param file the file to get the relative path for.
-     * @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character)
-     */
-    public static String getRelative( String basedir, File file )
-    {
-        return getRelative( basedir, file.getAbsolutePath() );
-    }
-
-    /**
-     * Given a basedir and a child file, return the relative path to the child.
-     * 
-     * @param basedir the basedir.
-     * @param child the child path (can be a full path)
-     * @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character)
-     */
-    public static String getRelative( String basedir, String child )
-    {
-        if ( basedir.endsWith( "/" ) || basedir.endsWith( "\\" ) )
-        {
-            basedir = basedir.substring( 0, basedir.length() - 1 );
-        }
-
-        if ( child.startsWith( basedir ) )
-        {
-            // simple solution.
-            return child.substring( basedir.length() + 1 );
-        }
-
-        String absoluteBasedir = new File( basedir ).getAbsolutePath();
-        if ( child.startsWith( absoluteBasedir ) )
-        {
-            // resolved basedir solution.
-            return child.substring( absoluteBasedir.length() + 1 );
-        }
-
-        // File is not within basedir.
-        throw new IllegalStateException( "Unable to obtain relative path of file " + child
-            + ", it is not within basedir " + basedir + "." );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/Slf4JPlexusLogger.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/Slf4JPlexusLogger.java
deleted file mode 100644 (file)
index 9e0a93f..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-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 org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Slf4JPlexusLogger - temporary logger to provide an Slf4j Logger to those components
- * outside of the archiva codebase that require a plexus logger.
- *
- * @version $Id$
- */
-public class Slf4JPlexusLogger implements org.codehaus.plexus.logging.Logger {
-    private Logger log;
-
-    public Slf4JPlexusLogger(Class<?> clazz) {
-        log = LoggerFactory.getLogger(clazz);
-    }
-
-    public Slf4JPlexusLogger(String name) {
-        log = LoggerFactory.getLogger(name);
-    }
-
-    public void debug(String message) {
-        log.debug(message);
-    }
-
-    public void debug(String message, Throwable throwable) {
-        log.debug(message, throwable);
-    }
-
-    public void error(String message) {
-        log.error(message);
-    }
-
-    public void error(String message, Throwable throwable) {
-        log.error(message, throwable);
-    }
-
-    public void fatalError(String message) {
-        log.error(message);
-    }
-
-    public void fatalError(String message, Throwable throwable) {
-        log.error(message, throwable);
-    }
-
-    public org.codehaus.plexus.logging.Logger getChildLogger(String name) {
-        return new Slf4JPlexusLogger(log.getName() + "." + name);
-    }
-
-    public String getName() {
-        return log.getName();
-    }
-
-    public int getThreshold() {
-        if (log.isTraceEnabled()) {
-            return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
-        } else if (log.isDebugEnabled()) {
-            return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
-        } else if (log.isInfoEnabled()) {
-            return org.codehaus.plexus.logging.Logger.LEVEL_INFO;
-        } else if (log.isWarnEnabled()) {
-            return org.codehaus.plexus.logging.Logger.LEVEL_WARN;
-        } else if (log.isErrorEnabled()) {
-            return org.codehaus.plexus.logging.Logger.LEVEL_ERROR;
-        }
-
-        return org.codehaus.plexus.logging.Logger.LEVEL_DISABLED;
-    }
-
-    public void info(String message) {
-        log.info(message);
-    }
-
-    public void info(String message, Throwable throwable) {
-        log.info(message, throwable);
-    }
-
-    public boolean isDebugEnabled() {
-        return log.isDebugEnabled();
-    }
-
-    public boolean isErrorEnabled() {
-        return log.isErrorEnabled();
-    }
-
-    public boolean isFatalErrorEnabled() {
-        return log.isErrorEnabled();
-    }
-
-    public boolean isInfoEnabled() {
-        return log.isInfoEnabled();
-    }
-
-    public boolean isWarnEnabled() {
-        return log.isWarnEnabled();
-    }
-
-    public void setThreshold(int threshold) {
-        /* do nothing */
-    }
-
-    public void warn(String message) {
-        log.warn(message);
-    }
-
-    public void warn(String message, Throwable throwable) {
-        log.warn(message, throwable);
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionComparator.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionComparator.java
deleted file mode 100644 (file)
index fee56a1..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-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 org.apache.commons.lang.ArrayUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.math.NumberUtils;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-
-/**
- * VersionComparator - compare the parts of two version strings.
- * <p/>
- * Technique.
- * <p/>
- * * Split the version strings into parts by splitting on <code>"-._"</code> first, then breaking apart words from numbers.
- * <p/>
- * <code>
- * "1.0"         = "1", "0"
- * "1.0-alpha-1" = "1", "0", "alpha", "1"
- * "2.0-rc2"     = "2", "0", "rc", "2"
- * "1.3-m2"      = "1", "3", "m", "3"
- * </code>
- * <p/>
- * compare each part individually, and when they do not match, perform the following test.
- * <p/>
- * Numbers are calculated per normal comparison rules.
- * Words that are part of the "special word list" will be treated as their index within that heirarchy.
- * Words that cannot be identified as special, are treated using normal case-insensitive comparison rules.
- *
- * @version $Id$
- */
-public class VersionComparator
-    implements Comparator<String>
-{
-    private static Comparator<String> INSTANCE = new VersionComparator();
-
-    private List<String> specialWords;
-
-    public VersionComparator()
-    {
-        specialWords = new ArrayList<String>();
-
-        // ids that refer to LATEST
-        specialWords.add( "final" );
-        specialWords.add( "release" );
-        specialWords.add( "current" );
-        specialWords.add( "latest" );
-        specialWords.add( "g" );
-        specialWords.add( "gold" );
-        specialWords.add( "fcs" );
-
-        // ids that are for a release cycle.
-        specialWords.add( "a" );
-        specialWords.add( "alpha" );
-        specialWords.add( "b" );
-        specialWords.add( "beta" );
-        specialWords.add( "pre" );
-        specialWords.add( "rc" );
-        specialWords.add( "m" );
-        specialWords.add( "milestone" );
-
-        // ids that are for dev / debug cycles.
-        specialWords.add( "dev" );
-        specialWords.add( "test" );
-        specialWords.add( "debug" );
-        specialWords.add( "unofficial" );
-        specialWords.add( "nightly" );
-        specialWords.add( "incubating" );
-        specialWords.add( "incubator" );
-        specialWords.add( "snapshot" );
-    }
-
-    public static Comparator<String> getInstance()
-    {
-        return INSTANCE;
-    }
-
-    public int compare( String o1, String o2 )
-    {
-        if ( o1 == null && o2 == null )
-        {
-            return 0;
-        }
-
-        if ( o1 == null )
-        {
-            return 1;
-        }
-
-        if ( o2 == null )
-        {
-            return -1;
-        }
-
-        String[] parts1 = toParts( o1 );
-        String[] parts2 = toParts( o2 );
-
-        int diff;
-        int partLen = Math.max( parts1.length, parts2.length );
-        for ( int i = 0; i < partLen; i++ )
-        {
-            diff = comparePart( safePart( parts1, i ), safePart( parts2, i ) );
-            if ( diff != 0 )
-            {
-                return diff;
-            }
-        }
-
-        diff = parts2.length - parts1.length;
-
-        if ( diff != 0 )
-        {
-            return diff;
-        }
-
-        return o1.compareToIgnoreCase( o2 );
-    }
-
-    private String safePart( String[] parts, int idx )
-    {
-        if ( idx < parts.length )
-        {
-            return parts[idx];
-        }
-
-        return "0";
-    }
-
-    private int comparePart( String s1, String s2 )
-    {
-        boolean is1Num = NumberUtils.isNumber( s1 );
-        boolean is2Num = NumberUtils.isNumber( s2 );
-
-        // (Special Case) Test for numbers both first.
-        if ( is1Num && is2Num )
-        {
-            int i1 = NumberUtils.toInt( s1 );
-            int i2 = NumberUtils.toInt( s2 );
-
-            return i1 - i2;
-        }
-
-        // Test for text both next.
-        if ( !is1Num && !is2Num )
-        {
-            int idx1 = specialWords.indexOf( s1.toLowerCase() );
-            int idx2 = specialWords.indexOf( s2.toLowerCase() );
-
-            // Only operate perform index based operation, if both strings
-            // are found in the specialWords index.
-            if ( idx1 >= 0 && idx2 >= 0 )
-            {
-                return idx1 - idx2;
-            }
-        }
-
-        // Comparing text to num
-        if ( !is1Num && is2Num )
-        {
-            return -1;
-        }
-
-        // Comparing num to text
-        if ( is1Num && !is2Num )
-        {
-            return 1;
-        }
-
-        // Return comparison of strings themselves.
-        return s1.compareToIgnoreCase( s2 );
-    }
-
-    public static String[] toParts( String version )
-    {
-        if ( StringUtils.isBlank( version ) )
-        {
-            return ArrayUtils.EMPTY_STRING_ARRAY;
-        }
-
-        int modeOther = 0;
-        int modeDigit = 1;
-        int modeText = 2;
-
-        List<String> parts = new ArrayList<String>();
-        int len = version.length();
-        int i = 0;
-        int start = 0;
-        int mode = modeOther;
-
-        while ( i < len )
-        {
-            char c = version.charAt( i );
-
-            if ( Character.isDigit( c ) )
-            {
-                if ( mode != modeDigit )
-                {
-                    if ( mode != modeOther )
-                    {
-                        parts.add( version.substring( start, i ) );
-                    }
-                    mode = modeDigit;
-                    start = i;
-                }
-            }
-            else if ( Character.isLetter( c ) )
-            {
-                if ( mode != modeText )
-                {
-                    if ( mode != modeOther )
-                    {
-                        parts.add( version.substring( start, i ) );
-                    }
-                    mode = modeText;
-                    start = i;
-                }
-            }
-            else
-            {
-                // Other.
-                if ( mode != modeOther )
-                {
-                    parts.add( version.substring( start, i ) );
-                    mode = modeOther;
-                }
-            }
-
-            i++;
-        }
-
-        // Add remainder
-        if ( mode != modeOther )
-        {
-            parts.add( version.substring( start, i ) );
-        }
-
-        return parts.toArray( new String[parts.size()] );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionUtil.java
deleted file mode 100644 (file)
index 3cbcb8d..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-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 org.apache.commons.lang.StringUtils;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Version utility methods. 
- *
- * @version $Id$
- */
-public class VersionUtil
-{
-    /**
-     * 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[] {
-        "([0-9][_.0-9a-z]*)",
-        "(snapshot)",
-        "(g?[_.0-9ab]*(pre|rc|g|m)[_.0-9]*)",
-        "(dev[_.0-9]*)",
-        "(alpha[_.0-9]*)",
-        "(beta[_.0-9]*)",
-        "(rc[_.0-9]*)",
-//        "(test[_.0-9]*)", -- omitted for MRM-681, can be reinstated as part of MRM-712
-        "(debug[_.0-9]*)",
-        "(unofficial[_.0-9]*)",
-        "(current)",
-        "(latest)",
-        "(fcs)",
-        "(release[_.0-9]*)",
-        "(nightly)",
-        "(final)",
-        "(incubating)",
-        "(incubator)",
-        "([ab][_.0-9]+)" };
-
-    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 final Pattern TIMESTAMP_PATTERN = Pattern.compile( "^([0-9]{8})\\.([0-9]{6})$" );
-
-    public static final Pattern GENERIC_SNAPSHOT_PATTERN = Pattern.compile( "^(.*)-" + SNAPSHOT );
-
-    private static final Pattern VERSION_MEGA_PATTERN = Pattern.compile( StringUtils.join( versionPatterns, '|' ), Pattern.CASE_INSENSITIVE );
-
-    /**
-     * <p>
-     * Tests if the unknown string contains elements that identify it as a version string (or not).
-     * </p>
-     * 
-     * <p>
-     * The algorithm tests each part of the string that is delimited by a '-' (dash) character.
-     * If 75% or more of the sections are identified as 'version' strings, the result is
-     * determined to be of a high probability to be version identifier string.
-     * </p>
-     * 
-     * @param unknown the unknown string to test.
-     * @return true if the unknown string is likely a version string.
-     */
-    public static boolean isVersion( String unknown )
-    {
-        String versionParts[] = StringUtils.split( unknown, '-' );
-
-        Matcher mat;
-
-        int countValidParts = 0;
-
-        for ( int i = 0; i < versionParts.length; i++ )
-        {
-            String part = versionParts[i];
-            mat = VERSION_MEGA_PATTERN.matcher( part );
-
-            if ( mat.matches() )
-            {
-                if ( i == 0 ) // loosen rule to return true if first token matches
-                {
-                    return true;
-                }
-                countValidParts++;
-            }
-        }
-
-        /* Calculate version probability as true if 3/4's of the input string has pieces of
-         * of known version identifier strings.
-         */
-        int threshold = (int) Math.floor( Math.max( (double) 1.0, (double) ( versionParts.length * 0.75 ) ) );
-
-        return ( countValidParts >= threshold );
-    }
-
-    /**
-     * <p>
-     * Tests if the identifier is a known simple version keyword.
-     * </p>
-     * 
-     * <p>
-     * This method is different from {@link #isVersion(String)} in that it tests the whole input string in
-     * one go as a simple identifier. (eg "alpha", "1.0", "beta", "debug", "latest", "rc#", etc...)
-     * </p>
-     * 
-     * @param identifier the identifier to test.
-     * @return true if the unknown string is likely a version string.
-     */
-    public static boolean isSimpleVersionKeyword( String identifier )
-    {
-        Matcher mat = VERSION_MEGA_PATTERN.matcher( identifier );
-
-        return mat.matches();
-    }
-
-    public static boolean isSnapshot( String version )
-    {
-        Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
-        if ( m.matches() )
-        {
-            return true;
-        }
-        else
-        {
-            return isGenericSnapshot(version);
-        }
-    }
-
-    public static String getBaseVersion( String version )
-    {
-        Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
-        if ( m.matches() )
-        {
-            return m.group( 1 ) + "-" + SNAPSHOT;
-        }
-        else
-        {
-            return version;
-        }
-    }
-    
-    /**
-     * <p>
-     * Get the release version of the snapshot version.
-     * </p>
-     * 
-     * <p>
-     * If snapshot version is 1.0-SNAPSHOT, then release version would be 1.0
-     * And if snapshot version is 1.0-20070113.163208-1.jar, then release version would still be 1.0
-     * </p>
-     * 
-     * @param snapshotVersion
-     * @return
-     */
-    public static String getReleaseVersion( String snapshotVersion )
-    {
-        Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( snapshotVersion );
-        
-        if( isGenericSnapshot( snapshotVersion ) )
-        {
-            m = GENERIC_SNAPSHOT_PATTERN.matcher( snapshotVersion );
-        }
-                
-        if ( m.matches() )
-        {   
-            return m.group( 1 );
-        }
-        else
-        {        
-            return snapshotVersion;
-        }
-    }
-
-    public static boolean isUniqueSnapshot( String version )
-    {             
-        Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
-        if( m.matches() )
-        {
-            return true;
-        }
-
-        return false;
-    }
-
-    public static boolean isGenericSnapshot( String version )
-    {
-        return version.endsWith( SNAPSHOT );    
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/BaseFileTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/BaseFileTest.java
new file mode 100644 (file)
index 0000000..2808f49
--- /dev/null
@@ -0,0 +1,131 @@
+package org.apache.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 org.apache.commons.lang.StringUtils;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+
+/**
+ * BaseFileTest
+ *
+ * @version $Id$
+ */
+public class BaseFileTest
+    extends TestCase
+{
+    public void testFileString()
+    {
+        File repoDir = new File( "/home/user/foo/repository" );
+        String pathFile = "path/to/resource.xml";
+        BaseFile file = new BaseFile( repoDir, pathFile );
+
+        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
+        assertRelativePath( "path/to/resource.xml", file );
+        assertBasedir( "/home/user/foo/repository", file );
+    }
+
+    public void testFileFile()
+    {
+        File repoDir = new File( "/home/user/foo/repository" );
+        File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
+        BaseFile file = new BaseFile( repoDir, pathFile );
+
+        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
+        assertRelativePath( "path/to/resource.xml", file );
+        assertBasedir( "/home/user/foo/repository", file );
+    }
+
+    public void testStringFile()
+    {
+        String repoDir = "/home/user/foo/repository";
+        File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
+        BaseFile file = new BaseFile( repoDir, pathFile );
+
+        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
+        assertRelativePath( "path/to/resource.xml", file );
+        assertBasedir( "/home/user/foo/repository", file );
+    }
+
+    public void testFileThenSetBaseString()
+    {
+        String repoDir = "/home/user/foo/repository";
+        File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
+        BaseFile file = new BaseFile( pathFile );
+        file.setBaseDir( repoDir );
+
+        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
+        assertRelativePath( "path/to/resource.xml", file );
+        assertBasedir( "/home/user/foo/repository", file );
+    }
+
+    public void testFileThenSetBaseFile()
+    {
+        File repoDir = new File( "/home/user/foo/repository" );
+        File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
+        BaseFile file = new BaseFile( pathFile );
+        file.setBaseDir( repoDir );
+
+        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
+        assertRelativePath( "path/to/resource.xml", file );
+        assertBasedir( "/home/user/foo/repository", file );
+    }
+
+    public void testStringThenSetBaseString()
+    {
+        String repoDir = "/home/user/foo/repository";
+        String pathFile = "/home/user/foo/repository/path/to/resource.xml";
+        BaseFile file = new BaseFile( pathFile );
+        file.setBaseDir( repoDir );
+
+        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
+        assertRelativePath( "path/to/resource.xml", file );
+        assertBasedir( "/home/user/foo/repository", file );
+    }
+
+    public void testStringThenSetBaseFile()
+    {
+        File repoDir = new File( "/home/user/foo/repository" );
+        String pathFile = "/home/user/foo/repository/path/to/resource.xml";
+        BaseFile file = new BaseFile( pathFile );
+        file.setBaseDir( repoDir );
+
+        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
+        assertRelativePath( "path/to/resource.xml", file );
+        assertBasedir( "/home/user/foo/repository", file );
+    }
+
+    private void assertAbsolutePath( String expectedPath, BaseFile actualFile )
+    {
+        assertEquals( new File( expectedPath ).getAbsolutePath(), actualFile.getAbsolutePath() );
+    }
+
+    private void assertRelativePath( String expectedPath, BaseFile actualFile )
+    {
+        assertEquals( expectedPath, StringUtils.replace( actualFile.getRelativePath(), "\\", "/" ) );
+    }
+
+    private void assertBasedir( String expectedPath, BaseFile actualFile )
+    {
+        assertEquals( new File( expectedPath ), actualFile.getBaseDir() );
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/DateUtilTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/DateUtilTest.java
new file mode 100644 (file)
index 0000000..56f843c
--- /dev/null
@@ -0,0 +1,68 @@
+package org.apache.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 
+ *
+ * @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 ) );
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/PathUtilTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/PathUtilTest.java
new file mode 100644 (file)
index 0000000..0a7d855
--- /dev/null
@@ -0,0 +1,93 @@
+package org.apache.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 org.apache.commons.lang.StringUtils;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+/**
+ * PathUtilTest 
+ *
+ * @version $Id$
+ */
+public class PathUtilTest
+    extends TestCase
+{
+    public void testToRelativeWithoutSlash()
+    {
+        assertEquals( "path/to/resource.xml", PathUtil.getRelative( "/home/user/foo/repository",
+                                                                    "/home/user/foo/repository/path/to/resource.xml" ) );
+    }
+    
+    public void testToRelativeWithSlash()
+    {
+        assertEquals( "path/to/resource.xml", PathUtil.getRelative( "/home/user/foo/repository/",
+                                                                    "/home/user/foo/repository/path/to/resource.xml" ) );
+    }
+
+    public void testToUrlRelativePath()
+    {
+        File workingDir = new File( "." );
+
+        String workingDirname = StringUtils.replaceChars( workingDir.getAbsolutePath(), '\\', '/' );
+
+        // Some JVM's retain the "." at the end of the path.  Drop it.
+        if ( workingDirname.endsWith( "/." ) )
+        {
+            workingDirname = workingDirname.substring( 0, workingDirname.length() - 2 );
+        }
+
+        if ( !workingDirname.startsWith( "/" ) )
+        {
+            workingDirname = "/" + workingDirname;
+        }
+
+        String path = "path/to/resource.xml";
+        String expectedPath = "file:" + workingDirname + "/" + path;
+
+        assertEquals( expectedPath, PathUtil.toUrl( path ) );
+    }
+
+    public void testToUrlUsingFileUrl()
+    {
+        File workingDir = new File( "." );
+
+        String workingDirname = StringUtils.replaceChars( workingDir.getAbsolutePath(), '\\', '/' );
+
+        // Some JVM's retain the "." at the end of the path.  Drop it.
+        if ( workingDirname.endsWith( "/." ) )
+        {
+            workingDirname = workingDirname.substring( 0, workingDirname.length() - 2 );
+        }
+
+        if ( !workingDirname.startsWith( "/" ) )
+        {
+            workingDirname = "/" + workingDirname;
+        }
+
+        String path = "path/to/resource.xml";
+        String expectedPath = "file:" + workingDirname + "/" + path;
+
+        assertEquals( expectedPath, PathUtil.toUrl( expectedPath ) );
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/ResourceUtils.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/ResourceUtils.java
new file mode 100644 (file)
index 0000000..5ba7912
--- /dev/null
@@ -0,0 +1,90 @@
+package org.apache.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 org.apache.commons.lang.StringUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * <code>ResourceUtils</code>
+ */
+public class ResourceUtils
+{
+    /**
+     * Lookup resource at the given path relative to the root of the classpath and if it exists return a file object
+     * that can be used to access it.
+     * <p>
+     * At test time the contents of both the src/resources and test/resources dirs are available at the root of the
+     * classpath.
+     * <p>
+     * To retrieve the file src/test/resources/sometest/test.properties use getResource("/sometest/test.properties").
+     * 
+     * @param resourcePath the path to the resource relative to the root of the classpath
+     * @return File a file object pointing to the resource on the classpath or null if the resource cannot be found
+     */
+    public static File getResource( String resourcePath )
+        throws IOException
+    {
+        return getResource( resourcePath, null );
+    }
+
+    /**
+     * Lookup resource at the given path relative to the root of the classpath and if it exists return a file object
+     * that can be used to access it.
+     * <p>
+     * At test time the contents of both the src/resources and test/resources dirs are available at the root of the
+     * classpath.
+     * <p>
+     * To retrieve the file src/test/resources/sometest/test.properties use getResource("/sometest/test.properties").
+     * 
+     * @param resourcePath the path to the resource relative to the root of the classpath
+     * @param classloader the classloader who's classpath should be searched for the resource
+     * @return File a file object pointing to the resource on the classpath or null if the resource cannot be found
+     */
+    public static File getResource( String resourcePath, ClassLoader classloader )
+        throws IOException
+    {
+        File testResource = null;
+
+        if ( StringUtils.isNotBlank( resourcePath ) )
+        {
+            // make sure the retrieval is relative to the root of the classpath
+            resourcePath = resourcePath.startsWith( "/" ) ? resourcePath : "/" + resourcePath;
+
+            URL resourceUrl = getResourceUrl( resourcePath, classloader );
+            if ( resourceUrl == null )
+            {
+                throw new IOException( "Could not find test resource at path '" + resourcePath + "'" );
+            }
+            testResource = new File( resourceUrl.getFile() );
+        }
+
+        return testResource;
+    }
+
+    private static URL getResourceUrl( String resourcePath, ClassLoader classloader )
+    {
+        return classloader != null ? classloader.getResource( resourcePath )
+                        : ResourceUtils.class.getResource( resourcePath );
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/VersionComparatorTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/VersionComparatorTest.java
new file mode 100644 (file)
index 0000000..01e9e11
--- /dev/null
@@ -0,0 +1,130 @@
+package org.apache.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.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+/**
+ * VersionComparatorTest 
+ *
+ * @version $Id$
+ */
+public class VersionComparatorTest
+    extends TestCase
+{
+    public void testComparator()
+    {
+        /* Sort order is oldest to newest */
+
+        assertSort( new String[] { "1.0", "3.0", "2.0" }, new String[] { "1.0", "2.0", "3.0" } );
+        assertSort( new String[] { "1.5", "1.2", "1.0" }, new String[] { "1.0", "1.2", "1.5" } );
+
+        assertSort( new String[] { "1.5-SNAPSHOT", "1.2", "1.20" }, new String[] { "1.2", "1.5-SNAPSHOT", "1.20" } );
+
+        assertSort( new String[] { "1.1", "1.0-SNAPSHOT", "1.1-m6", "1.1-rc1" }, new String[] {
+            "1.0-SNAPSHOT",
+            "1.1-rc1",
+            "1.1-m6",
+            "1.1" } );
+
+        assertSort( new String[] { "1.1-m6", "1.0-SNAPSHOT", "1.1-rc1", "1.1" }, new String[] {
+            "1.0-SNAPSHOT",
+            "1.1-rc1",
+            "1.1-m6",
+            "1.1" } );
+
+        assertSort( new String[] { "2.0.5", "2.0.4-SNAPSHOT", "2.0", "2.0-rc1" }, new String[] {
+            "2.0-rc1",
+            "2.0",
+            "2.0.4-SNAPSHOT",
+            "2.0.5" } );
+
+        assertSort( new String[] { "1.0-alpha-1", "1.0-alpha-22", "1.0-alpha-10", "1.0-alpha-9" }, new String[] {
+            "1.0-alpha-1",
+            "1.0-alpha-9",
+            "1.0-alpha-10",
+            "1.0-alpha-22" } );
+
+        assertSort( new String[] { "1.0-alpha1", "1.0-alpha22", "1.0-alpha10", "1.0-alpha9" }, new String[] {
+            "1.0-alpha1",
+            "1.0-alpha9",
+            "1.0-alpha10",
+            "1.0-alpha22" } );
+        
+        assertSort( new String[] { "1.0-1", "1.0-22", "1.0-10", "1.0-9" }, new String[] {
+            "1.0-1",
+            "1.0-9",
+            "1.0-10",
+            "1.0-22" } );
+        
+        assertSort( new String[] { "alpha-1", "alpha-22", "alpha-10", "alpha-9" }, new String[] {
+            "alpha-1",
+            "alpha-9",
+            "alpha-10",
+            "alpha-22" } );
+        
+        assertSort( new String[] { "1.0.1", "1.0.22", "1.0.10", "1.0.9" }, new String[] {
+            "1.0.1",
+            "1.0.9",
+            "1.0.10",
+            "1.0.22" } );
+        
+        
+        // TODO: write more unit tests.
+    }
+
+    private void assertSort( String[] rawVersions, String[] expectedSort )
+    {
+        List<String> versions = new ArrayList<String>();
+        versions.addAll( Arrays.asList( rawVersions ) );
+
+        Collections.sort( versions, VersionComparator.getInstance() );
+
+        assertEquals( "Versions.size()", expectedSort.length, versions.size() );
+        for ( int i = 0; i < expectedSort.length; i++ )
+        {
+            assertEquals( "Sorted Versions[" + i + "]", expectedSort[i], (String) versions.get( i ) );
+        }
+    }
+
+    public void testToParts()
+    {
+        assertParts( "1.0", new String[] { "1", "0" } );
+        assertParts( "1.0-alpha-1", new String[] { "1", "0", "alpha", "1" } );
+        assertParts( "2.0-rc2", new String[] { "2", "0", "rc", "2" } );
+        assertParts( "1.3-m6", new String[] { "1", "3", "m", "6" } );
+    }
+
+    private void assertParts( String version, String[] expectedParts )
+    {
+        String actualParts[] = VersionComparator.toParts( version );
+        assertEquals( "Parts.length", expectedParts.length, actualParts.length );
+
+        for ( int i = 0; i < expectedParts.length; i++ )
+        {
+            assertEquals( "parts[" + i + "]", expectedParts[i], actualParts[i] );
+        }
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/VersionUtilTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/archiva/common/utils/VersionUtilTest.java
new file mode 100644 (file)
index 0000000..154cab2
--- /dev/null
@@ -0,0 +1,94 @@
+package org.apache.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 junit.framework.TestCase;
+
+public class VersionUtilTest extends TestCase
+{
+
+    public void testIsVersion()
+    {
+        // 0%
+        assertFalse( VersionUtil.isVersion( "project" ) );
+        
+        // 0%
+        assertFalse( VersionUtil.isVersion( "project-not-version" ) );
+        
+        // 50%
+        assertFalse( VersionUtil.isVersion( "project-ver-1.0-dev" ) );
+        
+        // > 75%
+        assertTrue( VersionUtil.isVersion( "project-1.0-alpha" ) );
+        
+        // 75%
+        assertTrue( VersionUtil.isVersion( "project-1.0-latest-nightly" ) );
+        
+        // >75%
+        assertTrue( VersionUtil.isVersion( "1.0-project-unofficial-nightly-alpha-release" ) );
+      
+        //only first token matches
+        assertTrue( VersionUtil.isVersion( "1.0-project-my-own-version" ) );
+        
+    }
+    
+    public void testIsSimpleVersionKeyword()
+    {
+        assertTrue( VersionUtil.isSimpleVersionKeyword( "rc4.34" ) );
+        
+        assertTrue( VersionUtil.isSimpleVersionKeyword( "beta" ) );
+        
+        assertFalse( VersionUtil.isSimpleVersionKeyword( "1.0-SNAPSHOT" ) );
+    }
+   
+    public void testIsSnapshot()
+    {
+        assertTrue( VersionUtil.isSnapshot( "1.0-20070113.163208-99" ) );
+        
+        assertTrue( VersionUtil.isSnapshot( "1.0-SNAPSHOT" ) );
+        
+        assertFalse( VersionUtil.isSnapshot( "1.0-beta1" ) );
+    }
+    
+    public void testGetBaseVersion()
+    {
+        assertEquals( VersionUtil.getBaseVersion( "1.3.2-20090420.083501-3" ), "1.3.2-SNAPSHOT" );
+    }
+    
+    public void testGetReleaseVersion()
+    {
+        assertEquals( VersionUtil.getReleaseVersion( "1.3.2-20090420.083501-3" ), "1.3.2" );
+    }
+    
+    public void testIsUniqueSnapshot()
+    {
+        assertTrue( VersionUtil.isUniqueSnapshot( "1.3.2-20090420.083501-3" ) );
+        
+        assertFalse( VersionUtil.isUniqueSnapshot( "1.3.2" ) );
+    }
+    
+    public void testIsGenericSnapshot()
+    {
+        assertFalse( VersionUtil.isGenericSnapshot( "1.3.2-20090420.083501-3" ) );
+        
+        assertTrue( VersionUtil.isGenericSnapshot( "1.3.2-SNAPSHOT" ) );
+    }
+    
+}
diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/BaseFileTest.java
deleted file mode 100644 (file)
index 7569404..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-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 org.apache.commons.lang.StringUtils;
-
-import junit.framework.TestCase;
-
-import java.io.File;
-
-/**
- * BaseFileTest
- *
- * @version $Id$
- */
-public class BaseFileTest
-    extends TestCase
-{
-    public void testFileString()
-    {
-        File repoDir = new File( "/home/user/foo/repository" );
-        String pathFile = "path/to/resource.xml";
-        BaseFile file = new BaseFile( repoDir, pathFile );
-
-        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
-        assertRelativePath( "path/to/resource.xml", file );
-        assertBasedir( "/home/user/foo/repository", file );
-    }
-
-    public void testFileFile()
-    {
-        File repoDir = new File( "/home/user/foo/repository" );
-        File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
-        BaseFile file = new BaseFile( repoDir, pathFile );
-
-        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
-        assertRelativePath( "path/to/resource.xml", file );
-        assertBasedir( "/home/user/foo/repository", file );
-    }
-
-    public void testStringFile()
-    {
-        String repoDir = "/home/user/foo/repository";
-        File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
-        BaseFile file = new BaseFile( repoDir, pathFile );
-
-        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
-        assertRelativePath( "path/to/resource.xml", file );
-        assertBasedir( "/home/user/foo/repository", file );
-    }
-
-    public void testFileThenSetBaseString()
-    {
-        String repoDir = "/home/user/foo/repository";
-        File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
-        BaseFile file = new BaseFile( pathFile );
-        file.setBaseDir( repoDir );
-
-        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
-        assertRelativePath( "path/to/resource.xml", file );
-        assertBasedir( "/home/user/foo/repository", file );
-    }
-
-    public void testFileThenSetBaseFile()
-    {
-        File repoDir = new File( "/home/user/foo/repository" );
-        File pathFile = new File( "/home/user/foo/repository/path/to/resource.xml" );
-        BaseFile file = new BaseFile( pathFile );
-        file.setBaseDir( repoDir );
-
-        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
-        assertRelativePath( "path/to/resource.xml", file );
-        assertBasedir( "/home/user/foo/repository", file );
-    }
-
-    public void testStringThenSetBaseString()
-    {
-        String repoDir = "/home/user/foo/repository";
-        String pathFile = "/home/user/foo/repository/path/to/resource.xml";
-        BaseFile file = new BaseFile( pathFile );
-        file.setBaseDir( repoDir );
-
-        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
-        assertRelativePath( "path/to/resource.xml", file );
-        assertBasedir( "/home/user/foo/repository", file );
-    }
-
-    public void testStringThenSetBaseFile()
-    {
-        File repoDir = new File( "/home/user/foo/repository" );
-        String pathFile = "/home/user/foo/repository/path/to/resource.xml";
-        BaseFile file = new BaseFile( pathFile );
-        file.setBaseDir( repoDir );
-
-        assertAbsolutePath( "/home/user/foo/repository/path/to/resource.xml", file );
-        assertRelativePath( "path/to/resource.xml", file );
-        assertBasedir( "/home/user/foo/repository", file );
-    }
-
-    private void assertAbsolutePath( String expectedPath, BaseFile actualFile )
-    {
-        assertEquals( new File( expectedPath ).getAbsolutePath(), actualFile.getAbsolutePath() );
-    }
-
-    private void assertRelativePath( String expectedPath, BaseFile actualFile )
-    {
-        assertEquals( expectedPath, StringUtils.replace( actualFile.getRelativePath(), "\\", "/" ) );
-    }
-
-    private void assertBasedir( String expectedPath, BaseFile actualFile )
-    {
-        assertEquals( new File( expectedPath ), actualFile.getBaseDir() );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/DateUtilTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/DateUtilTest.java
deleted file mode 100644 (file)
index ff43aee..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-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 
- *
- * @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 ) );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/PathUtilTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/PathUtilTest.java
deleted file mode 100644 (file)
index 1713c86..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-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 org.apache.commons.lang.StringUtils;
-
-import java.io.File;
-
-import junit.framework.TestCase;
-
-/**
- * PathUtilTest 
- *
- * @version $Id$
- */
-public class PathUtilTest
-    extends TestCase
-{
-    public void testToRelativeWithoutSlash()
-    {
-        assertEquals( "path/to/resource.xml", PathUtil.getRelative( "/home/user/foo/repository",
-                                                                    "/home/user/foo/repository/path/to/resource.xml" ) );
-    }
-    
-    public void testToRelativeWithSlash()
-    {
-        assertEquals( "path/to/resource.xml", PathUtil.getRelative( "/home/user/foo/repository/",
-                                                                    "/home/user/foo/repository/path/to/resource.xml" ) );
-    }
-
-    public void testToUrlRelativePath()
-    {
-        File workingDir = new File( "." );
-
-        String workingDirname = StringUtils.replaceChars( workingDir.getAbsolutePath(), '\\', '/' );
-
-        // Some JVM's retain the "." at the end of the path.  Drop it.
-        if ( workingDirname.endsWith( "/." ) )
-        {
-            workingDirname = workingDirname.substring( 0, workingDirname.length() - 2 );
-        }
-
-        if ( !workingDirname.startsWith( "/" ) )
-        {
-            workingDirname = "/" + workingDirname;
-        }
-
-        String path = "path/to/resource.xml";
-        String expectedPath = "file:" + workingDirname + "/" + path;
-
-        assertEquals( expectedPath, PathUtil.toUrl( path ) );
-    }
-
-    public void testToUrlUsingFileUrl()
-    {
-        File workingDir = new File( "." );
-
-        String workingDirname = StringUtils.replaceChars( workingDir.getAbsolutePath(), '\\', '/' );
-
-        // Some JVM's retain the "." at the end of the path.  Drop it.
-        if ( workingDirname.endsWith( "/." ) )
-        {
-            workingDirname = workingDirname.substring( 0, workingDirname.length() - 2 );
-        }
-
-        if ( !workingDirname.startsWith( "/" ) )
-        {
-            workingDirname = "/" + workingDirname;
-        }
-
-        String path = "path/to/resource.xml";
-        String expectedPath = "file:" + workingDirname + "/" + path;
-
-        assertEquals( expectedPath, PathUtil.toUrl( expectedPath ) );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/ResourceUtils.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/ResourceUtils.java
deleted file mode 100644 (file)
index db2a0dc..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-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 org.apache.commons.lang.StringUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
-/**
- * <code>ResourceUtils</code>
- */
-public class ResourceUtils
-{
-    /**
-     * Lookup resource at the given path relative to the root of the classpath and if it exists return a file object
-     * that can be used to access it.
-     * <p>
-     * At test time the contents of both the src/resources and test/resources dirs are available at the root of the
-     * classpath.
-     * <p>
-     * To retrieve the file src/test/resources/sometest/test.properties use getResource("/sometest/test.properties").
-     * 
-     * @param resourcePath the path to the resource relative to the root of the classpath
-     * @return File a file object pointing to the resource on the classpath or null if the resource cannot be found
-     */
-    public static File getResource( String resourcePath )
-        throws IOException
-    {
-        return getResource( resourcePath, null );
-    }
-
-    /**
-     * Lookup resource at the given path relative to the root of the classpath and if it exists return a file object
-     * that can be used to access it.
-     * <p>
-     * At test time the contents of both the src/resources and test/resources dirs are available at the root of the
-     * classpath.
-     * <p>
-     * To retrieve the file src/test/resources/sometest/test.properties use getResource("/sometest/test.properties").
-     * 
-     * @param resourcePath the path to the resource relative to the root of the classpath
-     * @param classloader the classloader who's classpath should be searched for the resource
-     * @return File a file object pointing to the resource on the classpath or null if the resource cannot be found
-     */
-    public static File getResource( String resourcePath, ClassLoader classloader )
-        throws IOException
-    {
-        File testResource = null;
-
-        if ( StringUtils.isNotBlank( resourcePath ) )
-        {
-            // make sure the retrieval is relative to the root of the classpath
-            resourcePath = resourcePath.startsWith( "/" ) ? resourcePath : "/" + resourcePath;
-
-            URL resourceUrl = getResourceUrl( resourcePath, classloader );
-            if ( resourceUrl == null )
-            {
-                throw new IOException( "Could not find test resource at path '" + resourcePath + "'" );
-            }
-            testResource = new File( resourceUrl.getFile() );
-        }
-
-        return testResource;
-    }
-
-    private static URL getResourceUrl( String resourcePath, ClassLoader classloader )
-    {
-        return classloader != null ? classloader.getResource( resourcePath )
-                        : ResourceUtils.class.getResource( resourcePath );
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/VersionComparatorTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/VersionComparatorTest.java
deleted file mode 100644 (file)
index b28e780..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-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.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-/**
- * VersionComparatorTest 
- *
- * @version $Id$
- */
-public class VersionComparatorTest
-    extends TestCase
-{
-    public void testComparator()
-    {
-        /* Sort order is oldest to newest */
-
-        assertSort( new String[] { "1.0", "3.0", "2.0" }, new String[] { "1.0", "2.0", "3.0" } );
-        assertSort( new String[] { "1.5", "1.2", "1.0" }, new String[] { "1.0", "1.2", "1.5" } );
-
-        assertSort( new String[] { "1.5-SNAPSHOT", "1.2", "1.20" }, new String[] { "1.2", "1.5-SNAPSHOT", "1.20" } );
-
-        assertSort( new String[] { "1.1", "1.0-SNAPSHOT", "1.1-m6", "1.1-rc1" }, new String[] {
-            "1.0-SNAPSHOT",
-            "1.1-rc1",
-            "1.1-m6",
-            "1.1" } );
-
-        assertSort( new String[] { "1.1-m6", "1.0-SNAPSHOT", "1.1-rc1", "1.1" }, new String[] {
-            "1.0-SNAPSHOT",
-            "1.1-rc1",
-            "1.1-m6",
-            "1.1" } );
-
-        assertSort( new String[] { "2.0.5", "2.0.4-SNAPSHOT", "2.0", "2.0-rc1" }, new String[] {
-            "2.0-rc1",
-            "2.0",
-            "2.0.4-SNAPSHOT",
-            "2.0.5" } );
-
-        assertSort( new String[] { "1.0-alpha-1", "1.0-alpha-22", "1.0-alpha-10", "1.0-alpha-9" }, new String[] {
-            "1.0-alpha-1",
-            "1.0-alpha-9",
-            "1.0-alpha-10",
-            "1.0-alpha-22" } );
-
-        assertSort( new String[] { "1.0-alpha1", "1.0-alpha22", "1.0-alpha10", "1.0-alpha9" }, new String[] {
-            "1.0-alpha1",
-            "1.0-alpha9",
-            "1.0-alpha10",
-            "1.0-alpha22" } );
-        
-        assertSort( new String[] { "1.0-1", "1.0-22", "1.0-10", "1.0-9" }, new String[] {
-            "1.0-1",
-            "1.0-9",
-            "1.0-10",
-            "1.0-22" } );
-        
-        assertSort( new String[] { "alpha-1", "alpha-22", "alpha-10", "alpha-9" }, new String[] {
-            "alpha-1",
-            "alpha-9",
-            "alpha-10",
-            "alpha-22" } );
-        
-        assertSort( new String[] { "1.0.1", "1.0.22", "1.0.10", "1.0.9" }, new String[] {
-            "1.0.1",
-            "1.0.9",
-            "1.0.10",
-            "1.0.22" } );
-        
-        
-        // TODO: write more unit tests.
-    }
-
-    private void assertSort( String[] rawVersions, String[] expectedSort )
-    {
-        List<String> versions = new ArrayList<String>();
-        versions.addAll( Arrays.asList( rawVersions ) );
-
-        Collections.sort( versions, VersionComparator.getInstance() );
-
-        assertEquals( "Versions.size()", expectedSort.length, versions.size() );
-        for ( int i = 0; i < expectedSort.length; i++ )
-        {
-            assertEquals( "Sorted Versions[" + i + "]", expectedSort[i], (String) versions.get( i ) );
-        }
-    }
-
-    public void testToParts()
-    {
-        assertParts( "1.0", new String[] { "1", "0" } );
-        assertParts( "1.0-alpha-1", new String[] { "1", "0", "alpha", "1" } );
-        assertParts( "2.0-rc2", new String[] { "2", "0", "rc", "2" } );
-        assertParts( "1.3-m6", new String[] { "1", "3", "m", "6" } );
-    }
-
-    private void assertParts( String version, String[] expectedParts )
-    {
-        String actualParts[] = VersionComparator.toParts( version );
-        assertEquals( "Parts.length", expectedParts.length, actualParts.length );
-
-        for ( int i = 0; i < expectedParts.length; i++ )
-        {
-            assertEquals( "parts[" + i + "]", expectedParts[i], actualParts[i] );
-        }
-    }
-}
diff --git a/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/VersionUtilTest.java b/archiva-modules/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/VersionUtilTest.java
deleted file mode 100644 (file)
index ca1f29c..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-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 junit.framework.TestCase;
-
-public class VersionUtilTest extends TestCase
-{
-
-    public void testIsVersion()
-    {
-        // 0%
-        assertFalse( VersionUtil.isVersion( "project" ) );
-        
-        // 0%
-        assertFalse( VersionUtil.isVersion( "project-not-version" ) );
-        
-        // 50%
-        assertFalse( VersionUtil.isVersion( "project-ver-1.0-dev" ) );
-        
-        // > 75%
-        assertTrue( VersionUtil.isVersion( "project-1.0-alpha" ) );
-        
-        // 75%
-        assertTrue( VersionUtil.isVersion( "project-1.0-latest-nightly" ) );
-        
-        // >75%
-        assertTrue( VersionUtil.isVersion( "1.0-project-unofficial-nightly-alpha-release" ) );
-      
-        //only first token matches
-        assertTrue( VersionUtil.isVersion( "1.0-project-my-own-version" ) );
-        
-    }
-    
-    public void testIsSimpleVersionKeyword()
-    {
-        assertTrue( VersionUtil.isSimpleVersionKeyword( "rc4.34" ) );
-        
-        assertTrue( VersionUtil.isSimpleVersionKeyword( "beta" ) );
-        
-        assertFalse( VersionUtil.isSimpleVersionKeyword( "1.0-SNAPSHOT" ) );
-    }
-   
-    public void testIsSnapshot()
-    {
-        assertTrue( VersionUtil.isSnapshot( "1.0-20070113.163208-99" ) );
-        
-        assertTrue( VersionUtil.isSnapshot( "1.0-SNAPSHOT" ) );
-        
-        assertFalse( VersionUtil.isSnapshot( "1.0-beta1" ) );
-    }
-    
-    public void testGetBaseVersion()
-    {
-        assertEquals( VersionUtil.getBaseVersion( "1.3.2-20090420.083501-3" ), "1.3.2-SNAPSHOT" );
-    }
-    
-    public void testGetReleaseVersion()
-    {
-        assertEquals( VersionUtil.getReleaseVersion( "1.3.2-20090420.083501-3" ), "1.3.2" );
-    }
-    
-    public void testIsUniqueSnapshot()
-    {
-        assertTrue( VersionUtil.isUniqueSnapshot( "1.3.2-20090420.083501-3" ) );
-        
-        assertFalse( VersionUtil.isUniqueSnapshot( "1.3.2" ) );
-    }
-    
-    public void testIsGenericSnapshot()
-    {
-        assertFalse( VersionUtil.isGenericSnapshot( "1.3.2-20090420.083501-3" ) );
-        
-        assertTrue( VersionUtil.isGenericSnapshot( "1.3.2-SNAPSHOT" ) );
-    }
-    
-}
index 35ae50d0eff07ec359817aa535a2a1beac01fe90..304f7426705dcd10f5b22d0e314ca41862a2e18d 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.maven.archiva.configuration;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.Predicate;
 import org.apache.commons.configuration.CombinedConfiguration;
-import org.apache.maven.archiva.common.FileTypeUtils;
+import org.apache.archiva.common.FileTypeUtils;
 import org.apache.maven.archiva.configuration.functors.FiletypeSelectionPredicate;
 import org.apache.maven.archiva.configuration.io.registry.ConfigurationRegistryReader;
 import org.codehaus.plexus.registry.Registry;
@@ -37,7 +37,6 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
index 5587db04fc6ed65d99a204a76155b930fd6e541e..b5e16bf8ca5b5f61d99d075c3a230e15a7066306 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.maven.archiva.configuration;
 import junit.framework.TestCase;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.FileUtil;
+import org.apache.archiva.common.utils.FileUtil;
 import org.codehaus.plexus.registry.RegistryException;
 import org.codehaus.redback.components.springutils.ComponentContainer;
 import org.custommonkey.xmlunit.XMLAssert;
index 20786a1eee7227cfc15968d92d944ef6e1b84a87..e401e21afb7739ea7adab38cf9e24196ae90b0c8 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.consumers;
  * under the License.
  */
 
-import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.archiva.common.ArchivaException;
 
 /**
  * ConsumerException - details about the failure of a consumer.
index 112cc4709ca9fae25cb6fa23ef1038cb30b22518..65f29c55d2ccd89fc2d19f7db7ccb172e9ba20b3 100644 (file)
@@ -23,7 +23,7 @@ import java.util.List;
 
 import org.apache.commons.collections.Predicate;
 import org.apache.commons.io.FilenameUtils;
-import org.apache.maven.archiva.common.utils.BaseFile;
+import org.apache.archiva.common.utils.BaseFile;
 import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
 import org.codehaus.plexus.util.SelectorUtils;
 
index 8a9413228e13574576572a650d6a5b77eebd5dc5..d5fcf122ae7dac3145a70848df011e28235bdb0b 100644 (file)
@@ -25,8 +25,8 @@ import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.RepositorySession;
 import org.apache.archiva.repository.events.RepositoryListener;
-import org.apache.maven.archiva.common.utils.VersionComparator;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionComparator;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.ProjectReference;
index 3930589e021be94b28fc99b3d4025cae5000b2ff..ab4d61a936ee7d3e14f0fdab07ee67bfa2339800 100644 (file)
@@ -22,8 +22,8 @@ package org.apache.maven.archiva.consumers.core.repository;
 import org.apache.archiva.metadata.repository.RepositorySession;
 import org.apache.archiva.repository.events.RepositoryListener;
 import org.apache.commons.lang.time.DateUtils;
-import org.apache.maven.archiva.common.utils.VersionComparator;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionComparator;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.VersionedReference;
 import org.apache.maven.archiva.repository.ContentNotFoundException;
index 63a362c764e395c18d2d78ac7eca7605179afda3..c1f031dc5e2d38f502826804fc7e6a9025f9f2cb 100644 (file)
@@ -21,8 +21,8 @@ package org.apache.maven.archiva.consumers.core.repository;
 
 import org.apache.archiva.metadata.repository.RepositorySession;
 import org.apache.archiva.repository.events.RepositoryListener;
-import org.apache.maven.archiva.common.utils.VersionComparator;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionComparator;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.VersionedReference;
 import org.apache.maven.archiva.repository.ContentNotFoundException;
index 882d5340782981b1da1a58d4dbd5e9b3d424e01d..3a4316e8ae3110ea61197efa903ec15d88a50683 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.maven.archiva.consumers.core;
  */
 
 import junit.framework.TestCase;
-import org.apache.maven.archiva.common.utils.BaseFile;
+import org.apache.archiva.common.utils.BaseFile;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.FileType;
 import org.apache.maven.archiva.configuration.FileTypes;
index aff3735e7f31a320ebdb1534ff82e33ee4e71876..37006627e9dc36ab7ecf84a7a574e261e44f4387 100644 (file)
@@ -24,7 +24,7 @@ import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.archiva.metadata.repository.TestRepositorySessionFactory;
 import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.common.utils.BaseFile;
+import org.apache.archiva.common.utils.BaseFile;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.FileType;
 import org.apache.maven.archiva.configuration.FileTypes;
index cf23270e55fc61f6f0be17489481ec31f507ac72..53f71aa72c481687ea4db6969b2cc30f732a3043 100644 (file)
@@ -35,7 +35,7 @@
       <constructor-arg ref="mavenIndexerUtils"/>
     </bean>
 
-    <bean id="logger" class="org.apache.maven.archiva.common.utils.Slf4JPlexusLogger">
+    <bean id="logger" class="org.apache.archiva.common.utils.Slf4JPlexusLogger">
       <constructor-arg type="java.lang.Class"><value>org.sonatype.nexus.index.DefaultNexusIndexer</value></constructor-arg>
     </bean>
 </beans>
\ No newline at end of file
index 98e708817d03669555cbf01dba9b3dab2e00f808..bd1cba8607cd9ae977a898cbed210c345ec4c336 100644 (file)
@@ -30,7 +30,7 @@ import org.apache.archiva.metadata.repository.RepositorySessionFactory;
 import org.apache.archiva.metadata.repository.storage.RepositoryStorage;
 import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException;
 import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.FileTypes;
index 85d8a1dfaf977e0b4ab124e8c1edf421b022ab46..34594a061775d65341c65eb3b738cdb337078d80 100644 (file)
@@ -25,7 +25,7 @@ import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.archiva.converter.RepositoryConversionException;
 import org.apache.archiva.repository.scanner.RepositoryScanner;
 import org.apache.archiva.repository.scanner.RepositoryScannerException;
-import org.apache.maven.archiva.common.utils.PathUtil;
+import org.apache.archiva.common.utils.PathUtil;
 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.artifact.repository.ArtifactRepository;
index 7530b546cfcad07436a8261eb7e8f3e5ab86a092..39041ba0afd9204c1528575594dbefbbeb854941 100644 (file)
@@ -31,7 +31,7 @@
   <context:annotation-config/>
   <context:component-scan base-package="org.apache.archiva.indexer.search"/>
 
-  <bean id="logger" class="org.apache.maven.archiva.common.utils.Slf4JPlexusLogger">
+  <bean id="logger" class="org.apache.archiva.common.utils.Slf4JPlexusLogger">
     <constructor-arg type="java.lang.Class"><value>org.sonatype.nexus.index.DefaultNexusIndexer</value></constructor-arg>
   </bean>
 
index 701d397868d8e4e6d40fda536bb56eb9f8c36960..2ca7f5c03ff57cea8df30f660190d43bb84ff8a3 100644 (file)
@@ -25,7 +25,7 @@ import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.SystemUtils;
-import org.apache.maven.archiva.common.utils.FileUtil;
+import org.apache.archiva.common.utils.FileUtil;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
index 2f7da7585f8e1992ac1fb75f52fd2be044a860b7..c04c89b1024c2c0ed676622988da194e34dac8a1 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.archiva.indexer.search;
  */
 
 import org.apache.archiva.indexer.util.SearchUtil;
-import org.apache.maven.archiva.common.utils.FileUtil;
+import org.apache.archiva.common.utils.FileUtil;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.test.context.ContextConfiguration;
index baf086296858f1fa62a3ba661daef37d420e1d44..a68490aa49872e37ceefd37d3df11f8180b1a955 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.maven.archiva.model;
  */
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionUtil;
 
 /**
  * ArchivaArtifact - Mutable artifact object.
index 06486113e2b4ae293d0af2fec65811c909790410..dbfc5588dbc7daf7498a003b2754edd846cbb2ec 100644 (file)
@@ -26,7 +26,7 @@ import java.util.List;
 import java.util.Properties;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index c19682cf3e045bd030f71c8ebc95edb562d9bc7e..e384c0d5d3294adb627ca0f71a3e7789cb8eddec 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.policies;
  * under the License.
  */
 
-import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.archiva.common.ArchivaException;
 
 /**
  * PolicyConfigurationException is thrown when a policy cannot be executed due to a 
index 3c1481fa5e726fb3ec6f19e628d6499419b33fcf..602f8abc6a9925a68912c046f686cc7d76c1eaec 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.policies;
  * under the License.
  */
 
-import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.archiva.common.ArchivaException;
 
 /**
  * PolicyViolationException 
index 845df4ecb81ffad626079c52af448d78272dac2b..c0aad19c1c6ddf441418758f143d30657bf3e268 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.policies;
  * under the License.
  */
 
-import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.archiva.common.ArchivaException;
 
 import java.util.Collections;
 import java.util.Map;
index 215d68017fb320b51d2088ecf3ac3f71dc1d95c0..478333b6a6205766c5a18ad97a0863b9c0c49f01 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.maven.archiva.policies;
  */
 
 import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.common.utils.FileUtil;
+import org.apache.archiva.common.utils.FileUtil;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestName;
index d6ddb995a53d9b3baa66a5f13697ed45945c0e25..6b9f15cd287142228e7ad7e72a8de9717a791911 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.proxy;
  * under the License.
  */
 
-import org.apache.maven.archiva.common.utils.PathUtil;
+import org.apache.archiva.common.utils.PathUtil;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.policies.CachedFailuresPolicy;
 import org.apache.maven.archiva.policies.ChecksumPolicy;
index e021d96b2b50c51604803acea29b2a1ec71ce148..6ba9fecbfa5818c33a22e7db525a85c7fea4b94c 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.maven.archiva.proxy;
  */
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
 import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
 import org.apache.maven.archiva.model.Plugin;
index a691b13e40e8ec8dd2dba0f0e599780dd9bbed1b..36559edcd86b2f4192811665c7aa35b5c61a9f76 100644 (file)
@@ -23,7 +23,7 @@ import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
 import org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider;
 import org.apache.archiva.metadata.repository.storage.maven2.Maven2RepositoryPathTranslator;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.ProjectReference;
@@ -31,11 +31,9 @@ import org.apache.maven.archiva.model.VersionedReference;
 import org.apache.maven.archiva.repository.layout.LayoutException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
 
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
-import java.util.ArrayList;
 import java.util.List;
 
 /**
index 1e2a09e8c4dd3e0a5f10cfb9ee37ac3386c83147..2b1d1b5b80cd5183ffba3b63dbb3bf9c7606945d 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.repository.content;
  * under the License.
  */
 
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionUtil;
 
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
index b6cef14b2260428c1a99915e460ba6c2eb3550db..b2770ec42cc3ec2f3117e441367e6a2ad9aa3043 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.maven.archiva.repository.content;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.metadata.repository.storage.maven2.DefaultArtifactMappingProvider;
 import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.common.utils.PathUtil;
+import org.apache.archiva.common.utils.PathUtil;
 import org.apache.maven.archiva.configuration.FileTypes;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.ArtifactReference;
index 82a6f74b2bbe44fcc96dcbfdd565f3a9ad7bb7bf..a02347cc04164a9da44b84ab4e9db856933e8c6a 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.maven.archiva.repository.content;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.PathUtil;
+import org.apache.archiva.common.utils.PathUtil;
 import org.apache.maven.archiva.configuration.FileTypes;
 import org.apache.maven.archiva.model.ArchivaArtifact;
 import org.apache.maven.archiva.model.ArtifactReference;
index adfceeacb46fd7ad4c84b03dbaa2603d9be1cfd0..cf7b1bee6b528cf1688530582712ca5b0fb573d0 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.repository.layout;
  * under the License.
  */
 
-import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.archiva.common.ArchivaException;
 
 /**
  * LayoutException 
index ace302fcbe70686fa3f53f255fe3d65556726a2a..defd49dae7d8285070c6b36575ac49e570856b5e 100644 (file)
@@ -26,9 +26,9 @@ import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.math.NumberUtils;
 import org.apache.commons.lang.time.DateUtils;
-import org.apache.maven.archiva.common.utils.PathUtil;
-import org.apache.maven.archiva.common.utils.VersionComparator;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.PathUtil;
+import org.apache.archiva.common.utils.VersionComparator;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.FileTypes;
index 07b2ff1b4dfed906a84c4f1776c4d9ad4aee4ee4..4471b11b7ec8fa1ec79d7be3ae11ea9f4f79655c 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.maven.archiva.repository.content;
  */
 
 import org.apache.archiva.admin.model.beans.ManagedRepository;
-import org.apache.maven.archiva.common.utils.VersionComparator;
+import org.apache.archiva.common.utils.VersionComparator;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.FileType;
 import org.apache.maven.archiva.configuration.FileTypes;
index c19dc0f55450e00989cb8f2cd173c5290da4e2e3..07127fcf361bec415642061344a1f39b00c1b052 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.maven.archiva.repository.content;
  */
 
 import org.apache.archiva.admin.model.beans.ManagedRepository;
-import org.apache.maven.archiva.common.utils.VersionComparator;
+import org.apache.archiva.common.utils.VersionComparator;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.ProjectReference;
 import org.apache.maven.archiva.model.VersionedReference;
index 6305cf1b633a3147e5efd0b951b63b194a0aebb1..29ce2123fb78fe81d1ed511b6b9414345604ceca 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.maven.archiva.repository.content;
  */
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.FileUtil;
+import org.apache.archiva.common.utils.FileUtil;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
index 1d172d5e1a322bec99d6ecc527b0a068cf00bc50..f3b664c5b366ca666f08536253caf260e98568c9 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.maven.archiva.repository.metadata;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.VersionComparator;
+import org.apache.archiva.common.utils.VersionComparator;
 import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
 import org.apache.maven.archiva.model.ProjectReference;
 import org.apache.maven.archiva.model.VersionedReference;
index cf8f6b877e3460a72dc54a1f79c0a7a62e51cd31..7a0c387a44e463a917c8f5b556c2bc94b89bd30a 100644 (file)
@@ -28,7 +28,7 @@ import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosur
 import org.apache.commons.collections.Closure;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.functors.IfClosure;
-import org.apache.maven.archiva.common.utils.BaseFile;
+import org.apache.archiva.common.utils.BaseFile;
 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.functors.ConsumerWantsFilePredicate;
index 702f2ad284300a2f556e2ab063344b33f5955d0d..5a836214f8844a0fc4f6ef9c59f50ba84a3e4679 100644 (file)
@@ -176,7 +176,7 @@ public class RepositoryScanStatistics
         }
 
         buf.append( "\n  Duration          : " );
-        buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( this.getDuration() ) );
+        buf.append( org.apache.archiva.common.utils.DateUtil.getDuration( this.getDuration() ) );
         buf.append( "\n  When Gathered     : " );
         if ( this.getWhenGathered() == null )
         {
@@ -197,7 +197,7 @@ public class RepositoryScanStatistics
         }
 
         buf.append( "\n  Avg Time Per File : " );
-        buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( averageMsPerFile ) );
+        buf.append( org.apache.archiva.common.utils.DateUtil.getDuration( averageMsPerFile ) );
         buf.append( "\n______________________________________________________________" );
 
         return buf.toString();
index 9707253da4c8d601df448757fabeb619cf876375..e0f628e608e2d54ca18ee992a9968d5f0eb491a6 100644 (file)
@@ -27,7 +27,7 @@ import org.apache.commons.collections.Closure;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.functors.IfClosure;
 import org.apache.commons.lang.SystemUtils;
-import org.apache.maven.archiva.common.utils.BaseFile;
+import org.apache.archiva.common.utils.BaseFile;
 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.functors.ConsumerWantsFilePredicate;
index e0b3c681b8fbbf63d8649f3b3f297c28c8b121b1..370a28df216c704500132e194c14ea769708e5d6 100644 (file)
@@ -20,12 +20,11 @@ package org.apache.archiva.repository.scanner.functors;
  */
 
 import org.apache.commons.collections.Closure;
-import org.apache.maven.archiva.common.utils.BaseFile;
+import org.apache.archiva.common.utils.BaseFile;
 import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.HashMap;
 import java.util.Map;
 
 /**
index 96db6e4fa4f03da9f84c7d9caf23ea682d452f37..d832ec40c11312083b6aa1d8a321cb41838ea1ee 100644 (file)
@@ -20,7 +20,7 @@ package org.apache.archiva.transaction;
  */
 
 import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.common.utils.FileUtil;
+import org.apache.archiva.common.utils.FileUtil;
 
 import java.io.File;
 import java.io.IOException;
index fda168c1c3ea3ad5a93aba9ce9bfd0d6cb71133a..9d23fe9aeb5c79b90bff8e32269391b1c4a6dfaf 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.archiva.transaction;
 import java.io.File;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.common.utils.FileUtil;
+import org.apache.archiva.common.utils.FileUtil;
 
 /**
  */
index 72492789cfc23438418bf19109ad8e61a48a48df..8557b43455d125a621cdc0a2ae0c5e8145868cb6 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.archiva.xml;
  * under the License.
  */
 
-import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.archiva.common.ArchivaException;
 
 /**
  * XMLException 
index 32a077bab862c74bac8d1cb8d82c86a92df27a27..514ebba089cb35b6b3575e71325fe728c962de6b 100644 (file)
@@ -29,7 +29,7 @@
   <context:annotation-config/>
   <context:component-scan base-package="org.apache.archiva.scheduler.indexing"/>
 
-  <bean id="logger" class="org.apache.maven.archiva.common.utils.Slf4JPlexusLogger">
+  <bean id="logger" class="org.apache.archiva.common.utils.Slf4JPlexusLogger">
     <constructor-arg type="java.lang.Class"><value>org.sonatype.nexus.index.DefaultNexusIndexer</value></constructor-arg>
   </bean>
 
index c9cb9b24ccf98b12831d98bb35284bec3dd92be7..875fccc86838335cf77c51a1747cad11ae73aad6 100644 (file)
@@ -25,7 +25,7 @@ import org.apache.archiva.metadata.repository.RepositorySession;
 import org.apache.archiva.metadata.repository.RepositorySessionFactory;
 import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
 import org.apache.archiva.scheduler.ArchivaTaskScheduler;
-import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.archiva.common.ArchivaException;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationEvent;
 import org.apache.maven.archiva.configuration.ConfigurationListener;
@@ -34,9 +34,6 @@ import org.codehaus.plexus.taskqueue.TaskQueue;
 import org.codehaus.plexus.taskqueue.TaskQueueException;
 import org.codehaus.redback.components.scheduler.CronExpressionValidator;
 import org.codehaus.redback.components.scheduler.Scheduler;
-import org.quartz.CronTrigger;
-import org.quartz.JobDataMap;
-import org.quartz.JobDetail;
 import org.quartz.SchedulerException;
 import org.quartz.impl.JobDetailImpl;
 import org.quartz.impl.triggers.CronTriggerImpl;
index 893d29736d74d4c4ee1b82e627123aa3982c014f..2e61044df5e2038b15a834d3cb476d2c0fade2b6 100644 (file)
@@ -31,7 +31,7 @@ import org.apache.archiva.rest.api.services.RepositoryGroupService;
 import org.apache.archiva.rest.api.services.SearchService;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.WebClient;
-import org.apache.maven.archiva.common.utils.FileUtil;
+import org.apache.archiva.common.utils.FileUtil;
 import org.codehaus.redback.rest.services.AbstractRestServicesTest;
 
 import java.io.File;
index 0dacb9d670aac778b39a4d9da41a24650ca913e4..3181c800da1db0e3032bdd9e6c9a077ca069c4b9 100644 (file)
@@ -24,7 +24,7 @@ import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
 import org.apache.archiva.rest.api.services.RepositoriesService;
 import org.apache.cxf.jaxrs.client.ServerWebApplicationException;
 import org.apache.cxf.jaxrs.client.WebClient;
-import org.apache.maven.archiva.common.utils.FileUtil;
+import org.apache.archiva.common.utils.FileUtil;
 import org.junit.Test;
 
 import java.io.File;
index 07a4355dbaec2e7d4cf1b4077d0c750a3ce95948..5d87d6b4996d9d5def7c72de5cc3d07d2140b70b 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.archiva.security;
  * under the License.
  */
 
-import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.archiva.common.ArchivaException;
 
 /**
  * ArchivaSecurityException 
index 5532f8c08d58deb5664ca6ca33d2049377d27e37..da4bcce2558c239b71f401a9afe67288462c30c5 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.archiva.web.startup;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
-import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.archiva.common.ArchivaException;
 import org.apache.maven.index.NexusIndexer;
 import org.apache.maven.index.context.IndexingContext;
 import org.codehaus.plexus.taskqueue.Task;
index 2e1d8db01482ca5569499b94113980b14c131017..9d1714edbd769ea795239b1bd3e26f876a3c3342 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.archiva.web.startup;
 import org.apache.archiva.security.common.ArchivaRoleConstants;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.archiva.common.ArchivaException;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ConfigurationNames;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
index 5afa4e2f19f9cfc71efedf6e28e4a6a83cdd1d73..577ebfc85af654a17dfec2182403df4860e374b4 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.archiva.web.tags;
 import com.opensymphony.xwork2.ActionContext;
 import org.apache.archiva.dependency.tree.maven2.DependencyTreeBuilder;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.archiva.common.ArchivaException;
 import org.apache.maven.archiva.model.Keys;
 import org.apache.archiva.security.ArchivaXworkUser;
 import org.apache.archiva.security.UserRepositories;
index f96a7dff39531078900f9de5c852344951be0f81..ef3452f1d3ee12ba3c0bdffb47ad8a2f57b21d81 100644 (file)
@@ -22,7 +22,7 @@ package org.apache.archiva.web.tags;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.IteratorUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.archiva.common.ArchivaException;
 import org.apache.archiva.web.tags.DependencyTree.TreeEntry;
 import org.springframework.beans.BeansException;
 import org.springframework.web.context.WebApplicationContext;
index 43498a0777937de564dc71c4795cdae3dc7dedbe..014b4633af2e8c694194447e6cd1c21edeae75b0 100644 (file)
@@ -39,8 +39,8 @@ import org.apache.archiva.security.ArchivaSecurityException;
 import org.apache.archiva.security.PrincipalNotFoundException;
 import org.apache.archiva.security.UserRepositories;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.VersionComparator;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionComparator;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
 import org.apache.maven.archiva.model.VersionedReference;
 import org.apache.maven.archiva.repository.ContentNotFoundException;
index 1c44b3d8f4de9b3cc4816000e336b6211ffc36f9..add160b145cfc60eadfe755f66bc26e6927d5e1a 100644 (file)
@@ -38,8 +38,8 @@ import org.apache.archiva.security.UserRepositories;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.VersionComparator;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionComparator;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.SnapshotVersion;
index bbd6ffd3fc6ada207e1997ccce4b44df59d84151..09cdd69e4138577c7c979202256a6483b7c8676c 100644 (file)
@@ -31,7 +31,7 @@ import org.apache.archiva.metadata.model.ProjectVersionMetadata;
 import org.apache.archiva.metadata.repository.RepositorySession;
 import org.apache.archiva.metadata.repository.memory.TestMetadataResolver;
 import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
-import org.apache.maven.archiva.common.ArchivaException;
+import org.apache.archiva.common.ArchivaException;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
index c715d06b97a4702eef8d12bd5dd3f8ea2e4c4cfd..59565efb6d74a211fd30b047c45865d3ad0f7622 100644 (file)
@@ -33,7 +33,7 @@ import org.apache.archiva.metadata.repository.memory.TestMetadataResolver;
 import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
 import org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacet;
 import org.apache.archiva.reports.RepositoryProblemFacet;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
index c8b86a289a41c545f98312a2486f3b41910ec2d7..7901a2732721f2c08b5b9da657f969d01bae0829 100644 (file)
@@ -31,7 +31,7 @@ import org.apache.archiva.checksum.ChecksummedFile;
 import org.apache.archiva.scheduler.ArchivaTaskScheduler;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.FileUtil;
+import org.apache.archiva.common.utils.FileUtil;
 import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
 import org.apache.maven.archiva.model.SnapshotVersion;
 import org.apache.maven.archiva.repository.ManagedRepositoryContent;
index 8d8082aad6d31654b806575307a0c1fef207eb66..46828f134388512f335cd6c71bc079e7e6da85a2 100644 (file)
@@ -37,8 +37,8 @@ import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.DavSession;
 import org.apache.jackrabbit.webdav.lock.LockManager;
 import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
-import org.apache.maven.archiva.common.utils.PathUtil;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.PathUtil;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
 import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
index 8a78ed3d6323cf143172edb420c1096480ad5f63..c9e0484063948f68bd7524625f9ac556abc118db 100644 (file)
@@ -29,7 +29,7 @@ import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
 import org.apache.archiva.metadata.repository.storage.maven2.RepositoryModelResolver;
 import org.apache.archiva.proxy.common.WagonFactory;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.Slf4JPlexusLogger;
+import org.apache.archiva.common.utils.Slf4JPlexusLogger;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
index e66f66504c6384cc1318c6c3dd3e15fdad96aae9..4dbab61feb74c0c97250aa9e46f86cc692f482cb 100644 (file)
@@ -21,14 +21,12 @@ package org.apache.archiva.metadata.repository.storage.maven2;
 
 import org.apache.archiva.metadata.model.ArtifactMetadata;
 import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
-import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.springframework.context.ApplicationContext;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 import java.io.File;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
index f3473db7cefd07a08fd4188de6919303d99be155..1a104c09ef6dbaa26ae5d27d3ff92239ab142485 100644 (file)
@@ -31,7 +31,7 @@ import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataI
 import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException;
 import org.apache.archiva.proxy.common.WagonFactory;
 import org.apache.archiva.reports.RepositoryProblemFacet;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
index e5932b2722882ee7572f51a27fd96d17cbd2f1c8..d3b8bfc2cf3ebdf04605c3d681ac8323b27010d5 100644 (file)
@@ -29,7 +29,7 @@ import org.apache.archiva.proxy.common.WagonFactory;
 import org.apache.archiva.proxy.common.WagonFactoryException;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.archiva.xml.XMLException;
index 72132cf9f9dcdacd43973dbed3386f6e5352fb70..4bb7a277dda67c0f831b8a599df1a7c9be9d5750 100644 (file)
@@ -32,7 +32,7 @@ import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataI
 import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException;
 import org.apache.archiva.proxy.common.WagonFactory;
 import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.common.utils.FileUtil;
+import org.apache.archiva.common.utils.FileUtil;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
index 863fdfa5fad463e8a971d1436bba09c8d34666fd..483cdf2e811cf5b098a3e063fb637f1ed152ae3f 100644 (file)
@@ -25,8 +25,8 @@ import org.apache.archiva.metadata.repository.filter.Filter;
 import org.apache.archiva.metadata.repository.filter.IncludesFilter;
 import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
 import org.apache.commons.io.IOUtils;
-import org.apache.maven.archiva.common.utils.VersionComparator;
-import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.archiva.common.utils.VersionComparator;
+import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;