You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by jo...@apache.org on 2007/10/10 11:47:28 UTC

svn commit: r583412 [1/8] - in /maven/archiva/trunk: archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ archiva-base...

Author: joakime
Date: Wed Oct 10 02:47:20 2007
New Revision: 583412

URL: http://svn.apache.org/viewvc?rev=583412&view=rev
Log:
[MRM-432] Proxy Connectors are unable to download artifacts with alpha numerical version numbers
[MRM-519] fail to resolve artifactId for libs that contain versionKeyword in artifactId, like "maven-test-plugin"
[MRM-518] Changing the internal repository directory has no effect
[MRM-512] Unable to convert null repository config to archiva repository.
[MRM-533] metadata-updater is changing lastUpdating timestamp when it shouldn't
[MRM-493] Downloaded artifacts are stored in incorrect archiva-managed repository
- Work against proposal in mailing list http://www.nabble.com/-Proposal--Repository-Layout-Detection-Interaction-Changes.-tf4577852.html
- Creation of package org.apache.maven.archiva.repository.content
- Creation of RepositoryContent alternative as outlined in proposal.
- Have not swung all code over to new repositorycontent object yet.
- Left old BidirectionalRepositoryLayout classes in place temporarily.
- Migrated the following over to new RepositoryContent objects...
  * the /repository/ url
  * proxying
  * metadata updating
  * repository purge classes
- Unit testing. Lots and lots of unit testing.
- Correcting bad template email address.


Added:
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ContentNotFoundException.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ManagedRepositoryContent.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RemoteRepositoryContent.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryContentFactory.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/RepositoryNotFoundException.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java
      - copied, changed from r582853, maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractArtifactExtensionMapping.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RemoteDefaultRepositoryContent.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContent.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RepositoryRequest.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContentTestCase.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContentTestCase.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/FilenameParserTest.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContentTest.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContentTest.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteDefaultRepositoryContentTest.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContentTest.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/maven/
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/maven/poms/
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/maven/poms/wagon-ssh-1.0.pom   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/org.apache.maven/javadocs/
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/org.apache.maven/javadocs/testing-1.0-javadoc.jar   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/repositories/legacy-repository/org.apache.maven/poms/testing-1.0.pom   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/m1-repo-filelist.txt   (with props)
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/content/
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/content/RepositoryRequestTest.xml   (with props)
Removed:
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractArtifactExtensionMapping.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultArtifactExtensionMapping.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyArtifactExtensionMapping.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AllTests.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AllTests.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/RepositoryLayoutUtilsTest.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/AllTests.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/AllTests.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/AllTests.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/AllTests.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/AllTests.java
Modified:
    maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationEvent.java
    maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationListener.java
    maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparator.java
    maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/ArtifactFilenameFilter.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager-daysOld.xml
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.xml
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java
    maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
    maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
    maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnectorOrderComparator.java
    maven/archiva/trunk/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/RepositoryProxyConnectors.java
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.java
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ChecksumTransferTest.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/MetadataTransferTest.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/RelocateTransferTest.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/SnapshotTransferTest.xml
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayout.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayout.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelWriter.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400Writer.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanStatistics.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AbstractRepositoryLayerTestCase.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/DefaultBidirectionalRepositoryLayoutTest.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/LegacyBidirectionalRepositoryLayoutTest.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300ReaderTest.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400WriterTest.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.xml
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorFormAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoriesAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRemoteRepositoriesAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractRepositoriesAdminAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/PickReportAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractWebworkTestCase.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsActionTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.java

Modified: maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationEvent.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationEvent.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationEvent.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationEvent.java Wed Oct 10 02:47:20 2007
@@ -22,7 +22,7 @@
 /**
  * ConfigurationEvent 
  *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
  */
 public class ConfigurationEvent

Modified: maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationListener.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationListener.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationListener.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationListener.java Wed Oct 10 02:47:20 2007
@@ -22,7 +22,7 @@
 /**
  * ConfigurationListener 
  *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
  */
 public interface ConfigurationListener

Modified: maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparator.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparator.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparator.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparator.java Wed Oct 10 02:47:20 2007
@@ -26,7 +26,7 @@
 /**
  * ProxyConnectorConfigurationOrderComparator 
  *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
  */
 public class ProxyConnectorConfigurationOrderComparator

Modified: maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java Wed Oct 10 02:47:20 2007
@@ -31,7 +31,7 @@
 /**
  * ProxyConnectorConfigurationOrderComparatorTest 
  *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
  */
 public class ProxyConnectorConfigurationOrderComparatorTest

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java Wed Oct 10 02:47:20 2007
@@ -29,8 +29,12 @@
 import org.apache.maven.archiva.model.ArtifactReference;
 import org.apache.maven.archiva.model.ProjectReference;
 import org.apache.maven.archiva.model.VersionedReference;
+import org.apache.maven.archiva.repository.ContentNotFoundException;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
+import org.apache.maven.archiva.repository.RepositoryContentFactory;
+import org.apache.maven.archiva.repository.RepositoryException;
+import org.apache.maven.archiva.repository.RepositoryNotFoundException;
 import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
 import org.apache.maven.archiva.repository.layout.LayoutException;
 import org.apache.maven.archiva.repository.metadata.MetadataTools;
 import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException;
@@ -70,7 +74,7 @@
     /**
      * @plexus.requirement
      */
-    private BidirectionalRepositoryLayoutFactory layoutFactory;
+    private RepositoryContentFactory repositoryFactory;
 
     /**
      * @plexus.requirement
@@ -93,7 +97,7 @@
 
     private static final String TYPE_METADATA_IO = "metadata-io-warning";
 
-    private ManagedRepositoryConfiguration repository;
+    private ManagedRepositoryContent repository;
 
     private File repositoryDir;
 
@@ -118,22 +122,23 @@
         this.includes = includes;
     }
 
-    public void beginScan( ManagedRepositoryConfiguration repository )
+    public void beginScan( ManagedRepositoryConfiguration repoConfig )
         throws ConsumerException
     {
-        this.repository = repository;
-        this.repositoryDir = new File( repository.getLocation() );
         try
         {
-            this.repositoryLayout = layoutFactory.getLayout( repository.getLayout() );
+            this.repository = repositoryFactory.getManagedRepositoryContent( repoConfig.getId() );
+            this.repositoryDir = new File( repository.getRepoRoot() );
+            this.scanStartTimestamp = System.currentTimeMillis();
         }
-        catch ( LayoutException e )
+        catch ( RepositoryNotFoundException e )
+        {
+            throw new ConsumerException( e.getMessage(), e );
+        }
+        catch ( RepositoryException e )
         {
-            throw new ConsumerException(
-                "Cannot operate with bad layout definition on repo [" + repository.getId() + "]: " + e.getMessage(),
-                e );
+            throw new ConsumerException( e.getMessage(), e );
         }
-        this.scanStartTimestamp = System.currentTimeMillis();
     }
 
     public void completeScan()
@@ -190,18 +195,24 @@
         }
         catch ( LayoutException e )
         {
-            triggerConsumerWarning( TYPE_METADATA_BAD_INTERNAL_REF, "Unable to convert path [" + path +
-                "] to an internal project reference: " + e.getMessage() );
+            triggerConsumerWarning( TYPE_METADATA_BAD_INTERNAL_REF, "Unable to convert path [" + path
+                + "] to an internal project reference: " + e.getMessage() );
         }
         catch ( RepositoryMetadataException e )
         {
-            triggerConsumerError( TYPE_METADATA_WRITE_FAILURE,
-                                  "Unable to write project metadata for artifact [" + path + "]: " + e.getMessage() );
+            triggerConsumerError( TYPE_METADATA_WRITE_FAILURE, "Unable to write project metadata for artifact [" + path
+                + "]: " + e.getMessage() );
         }
         catch ( IOException e )
         {
+            triggerConsumerWarning( TYPE_METADATA_IO, "Project metadata not written due to IO warning: "
+                + e.getMessage() );
+        }
+        catch ( ContentNotFoundException e )
+        {
             triggerConsumerWarning( TYPE_METADATA_IO,
-                                    "Project metadata not written due to IO warning: " + e.getMessage() );
+                                    "Project metadata not written because no versions were found to update: "
+                                        + e.getMessage() );
         }
     }
 
@@ -230,18 +241,24 @@
         }
         catch ( LayoutException e )
         {
-            triggerConsumerWarning( TYPE_METADATA_BAD_INTERNAL_REF, "Unable to convert path [" + path +
-                "] to an internal version reference: " + e.getMessage() );
+            triggerConsumerWarning( TYPE_METADATA_BAD_INTERNAL_REF, "Unable to convert path [" + path
+                + "] to an internal version reference: " + e.getMessage() );
         }
         catch ( RepositoryMetadataException e )
         {
-            triggerConsumerError( TYPE_METADATA_WRITE_FAILURE,
-                                  "Unable to write version metadata for artifact [" + path + "]: " + e.getMessage() );
+            triggerConsumerError( TYPE_METADATA_WRITE_FAILURE, "Unable to write version metadata for artifact [" + path
+                + "]: " + e.getMessage() );
         }
         catch ( IOException e )
         {
+            triggerConsumerWarning( TYPE_METADATA_IO, "Version metadata not written due to IO warning: "
+                + e.getMessage() );
+        }
+        catch ( ContentNotFoundException e )
+        {
             triggerConsumerWarning( TYPE_METADATA_IO,
-                                    "Version metadata not written due to IO warning: " + e.getMessage() );
+                                    "Version metadata not written because no versions were found to update: "
+                                        + e.getMessage() );
         }
     }
 

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java Wed Oct 10 02:47:20 2007
@@ -19,37 +19,33 @@
 * under the License.
 */
 
-import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.database.ArchivaDatabaseException;
 import org.apache.maven.archiva.database.ArtifactDAO;
 import org.apache.maven.archiva.indexer.RepositoryIndexException;
 import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
-import org.apache.maven.archiva.repository.layout.FilenameParts;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
 import org.apache.maven.archiva.repository.layout.LayoutException;
-import org.apache.maven.archiva.repository.layout.RepositoryLayoutUtils;
 
 import java.io.File;
 import java.io.FilenameFilter;
+import java.util.Set;
 
 /**
+ * Base class for all repository purge tasks.
+ * 
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
  */
 public abstract class AbstractRepositoryPurge
     implements RepositoryPurge
 {
-    protected ManagedRepositoryConfiguration repository;
-
-    protected BidirectionalRepositoryLayout layout;
+    protected ManagedRepositoryContent repository;
 
     protected ArtifactDAO artifactDao;
 
-    public AbstractRepositoryPurge( ManagedRepositoryConfiguration repository, BidirectionalRepositoryLayout layout,
-                                    ArtifactDAO artifactDao )
+    public AbstractRepositoryPurge( ManagedRepositoryContent repository, ArtifactDAO artifactDao )
     {
         this.repository = repository;
-        this.layout = layout;
         this.artifactDao = artifactDao;
     }
 
@@ -69,36 +65,82 @@
         return files;
     }
 
+    protected String toRelativePath( File artifactFile )
+    {
+        String artifactPath = artifactFile.getAbsolutePath();
+        if ( artifactPath.startsWith( repository.getRepoRoot() ) )
+        {
+            artifactPath = artifactPath.substring( repository.getRepoRoot().length() );
+        }
+
+        return artifactPath;
+    }
+
     /**
      * Purge the repo. Update db and index of removed artifacts.
      *
      * @param artifactFiles
      * @throws RepositoryIndexException
      */
-    protected void purge( File[] artifactFiles )
+    protected void purge( Set<ArtifactReference> references )
     {
-        for ( int i = 0; i < artifactFiles.length; i++ )
+        for ( ArtifactReference reference : references )
         {
-            artifactFiles[i].delete();
+            File artifactFile = repository.toFile( reference );
 
-            String[] artifactPathParts = artifactFiles[i].getAbsolutePath().split( repository.getLocation() );
-            String artifactPath = artifactPathParts[artifactPathParts.length - 1];
-            if ( !artifactPath.toUpperCase().endsWith( "SHA1" ) && !artifactPath.toUpperCase().endsWith( "MD5" ) )
+            System.err.println( "Purging: " + artifactFile.getAbsolutePath() );
+            artifactFile.delete();
+            purgeSupportFiles( artifactFile );
+
+            // intended to be swallowed
+            // continue updating the database for all artifacts
+            try
+            {
+                String artifactPath = toRelativePath( artifactFile );
+                updateDatabase( artifactPath );
+            }
+            catch ( ArchivaDatabaseException ae )
             {
-                // intended to be swallowed
-                // continue updating the database for all artifacts
-                try
-                {
-                    updateDatabase( artifactPath );
-                }
-                catch ( ArchivaDatabaseException ae )
-                {
-                    //@todo determine logging to be used
-                }
-                catch ( LayoutException le )
-                {
+                // TODO: determine logging to be used
+            }
+            catch ( LayoutException le )
+            {
+                // Ignore
+            }
+        }
+    }
+
+    /**
+     * <p>
+     * This find support files for the artifactFile and deletes them.
+     * </p>
+     * 
+     * <p>
+     * Support Files are things like ".sha1", ".md5", ".asc", etc.
+     * </p>
+     * 
+     * @param artifactFile the file to base off of.
+     */
+    private void purgeSupportFiles( File artifactFile )
+    {
+        File parentDir = artifactFile.getParentFile();
 
-                }
+        if ( !parentDir.exists() )
+        {
+            return;
+        }
+
+        FilenameFilter filter = new ArtifactFilenameFilter( artifactFile.getName() );
+
+        File[] files = parentDir.listFiles( filter );
+
+        for ( File file : files )
+        {
+            if ( file.exists() && file.isFile() )
+            {
+                file.delete();
+                System.err.println( "Deleting support file: " + file.getAbsolutePath() );
+                // TODO: log that it was deleted?
             }
         }
     }
@@ -106,8 +148,7 @@
     private void updateDatabase( String path )
         throws ArchivaDatabaseException, LayoutException
     {
-
-        ArchivaArtifact artifact = layout.toArtifact( path );
+        ArtifactReference artifact = repository.toArtifactReference( path );
         ArchivaArtifact queriedArtifact = artifactDao.getArtifact( artifact.getGroupId(), artifact.getArtifactId(),
                                                                    artifact.getVersion(), artifact.getClassifier(),
                                                                    artifact.getType() );
@@ -116,23 +157,4 @@
 
         // TODO [MRM-37]: re-run the database consumers to clean up
     }
-
-    /**
-     * Get the artifactId, version, extension and classifier from the path parameter
-     *
-     * @param path
-     * @return
-     * @throws LayoutException
-     */
-    protected FilenameParts getFilenameParts( String path )
-        throws LayoutException
-    {
-        String normalizedPath = StringUtils.replace( path, "\\", "/" );
-        String pathParts[] = StringUtils.split( normalizedPath, '/' );
-
-        FilenameParts parts = RepositoryLayoutUtils.splitFilename( pathParts[pathParts.length - 1], null );
-
-        return parts;
-    }
-
 }

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/ArtifactFilenameFilter.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/ArtifactFilenameFilter.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/ArtifactFilenameFilter.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/ArtifactFilenameFilter.java Wed Oct 10 02:47:20 2007
@@ -41,10 +41,9 @@
     {
         this.filename = filename;
     }
-
+    
     public boolean accept( File dir, String name )
     {
         return ( name.startsWith( filename ) );
     }
-
 }

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java Wed Oct 10 02:47:20 2007
@@ -19,29 +19,45 @@
  * under the License.
  */
 
-import org.apache.commons.io.FileUtils;
 import org.apache.maven.archiva.common.utils.VersionComparator;
 import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
-import org.apache.maven.archiva.repository.layout.FilenameParts;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.model.ProjectReference;
+import org.apache.maven.archiva.model.VersionedReference;
+import org.apache.maven.archiva.repository.ContentNotFoundException;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
 import org.apache.maven.archiva.repository.layout.LayoutException;
+import org.apache.maven.archiva.repository.metadata.MetadataTools;
 import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException;
-import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader;
-import org.apache.maven.archiva.repository.metadata.RepositoryMetadataWriter;
 
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 
 /**
- * M2 implementation for cleaning up the released snapshots.
+ * <p>
+ * This will look in a single managed repository, and purge any snapshots that are present
+ * that have a corresponding released version on the same repository.
+ * </p>
+ * 
+ * <p>
+ * So, if you have the following (presented in the m2/default layout form) ...
+ * <pre>
+ *   /com/foo/foo-tool/1.0-SNAPSHOT/foo-tool-1.0-SNAPSHOT.jar
+ *   /com/foo/foo-tool/1.1-SNAPSHOT/foo-tool-1.1-SNAPSHOT.jar
+ *   /com/foo/foo-tool/1.2.1-SNAPSHOT/foo-tool-1.2.1-SNAPSHOT.jar
+ *   /com/foo/foo-tool/1.2.1/foo-tool-1.2.1.jar
+ *   /com/foo/foo-tool/2.0-SNAPSHOT/foo-tool-2.0-SNAPSHOT.jar
+ *   /com/foo/foo-tool/2.0/foo-tool-2.0.jar
+ *   /com/foo/foo-tool/2.1-SNAPSHOT/foo-tool-2.1-SNAPSHOT.jar
+ * </pre>
+ * then the current highest ranked released (non-snapshot) version is 2.0, which means
+ * the snapshots from 1.0-SNAPSHOT, 1.1-SNAPSHOT, 1.2.1-SNAPSHOT, and 2.0-SNAPSHOT can
+ * be purged.  Leaving 2.1-SNAPSHOT in alone.
+ * </p>
  *
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
  * @version $Id$
@@ -49,15 +65,13 @@
 public class CleanupReleasedSnapshotsRepositoryPurge
     extends AbstractRepositoryPurge
 {
-    public static final String SNAPSHOT = "-SNAPSHOT";
+    private MetadataTools metadataTools;
 
-    private RepositoryMetadataReader metadataReader;
-
-    public CleanupReleasedSnapshotsRepositoryPurge( ManagedRepositoryConfiguration repository, BidirectionalRepositoryLayout layout,
-                                                    ArtifactDAO artifactDao )
+    public CleanupReleasedSnapshotsRepositoryPurge( ManagedRepositoryContent repository, ArtifactDAO artifactDao,
+                                                    MetadataTools metadataTools )
     {
-        super( repository, layout, artifactDao );
-        metadataReader = new RepositoryMetadataReader();
+        super( repository, artifactDao );
+        this.metadataTools = metadataTools;
     }
 
     public void process( String path )
@@ -65,126 +79,135 @@
     {
         try
         {
-            File artifactFile = new File( repository.getLocation(), path );
+            File artifactFile = new File( repository.getRepoRoot(), path );
 
             if ( !artifactFile.exists() )
             {
+                // Nothing to do here, file doesn't exist, skip it.
                 return;
             }
 
-            FilenameParts parts = getFilenameParts( path );
+            ArtifactReference artifact = repository.toArtifactReference( path );
 
-            if ( VersionUtil.isSnapshot( parts.version ) )
+            if ( !VersionUtil.isSnapshot( artifact.getVersion() ) )
             {
-                // version
-                File versionDir = artifactFile.getParentFile();
-
-                // artifactID - scan for other versions
-                File artifactIdDir = versionDir.getParentFile();
+                // Nothing to do here, not a snapshot, skip it.
+                return;
+            }
 
-                boolean updated = false;
+            ProjectReference reference = new ProjectReference();
+            reference.setGroupId( artifact.getGroupId() );
+            reference.setArtifactId( artifact.getArtifactId() );
+
+            // Gather up all of the versions.
+            List<String> allVersions = new ArrayList<String>( repository.getVersions( reference ) );
+
+            // Split the versions into released and snapshots.
+            List<String> releasedVersions = new ArrayList<String>();
+            List<String> snapshotVersions = new ArrayList<String>();
 
-                List versions = getVersionsInDir( artifactIdDir );
-                Collections.sort( versions, VersionComparator.getInstance() );
-                for ( int j = 0; j < versions.size(); j++ )
+            for ( String version : allVersions )
+            {
+                if ( VersionUtil.isSnapshot( version ) )
+                {
+                    snapshotVersions.add( version );
+                }
+                else
                 {
-                    String version = (String) versions.get( j );
+                    releasedVersions.add( version );
+                }
+            }
 
-                    if ( VersionComparator.getInstance().compare( version, versionDir.getName() ) > 0 )
-                    {
-                        purge( versionDir.listFiles() );
+            Collections.sort( allVersions, VersionComparator.getInstance() );
+            Collections.sort( releasedVersions, VersionComparator.getInstance() );
+            Collections.sort( snapshotVersions, VersionComparator.getInstance() );
 
-                        FileUtils.deleteDirectory( versionDir );
+            // Find out the highest released version.
+            String highestReleasedVersion = allVersions.get( allVersions.size() - 1 );
 
-                        updated = true;
+            // Now clean out any version that is earlier than the highest released version.
+            boolean needsMetadataUpdate = false;
 
-                        break;
-                    }
-                }
+            VersionedReference versionRef = new VersionedReference();
+            versionRef.setGroupId( artifact.getGroupId() );
+            versionRef.setArtifactId( artifact.getArtifactId() );
 
-                if ( updated )
+            for ( String version : snapshotVersions )
+            {
+                if ( VersionComparator.getInstance().compare( version, highestReleasedVersion ) < 0 )
                 {
-                    updateMetadata( artifactIdDir );
+                    versionRef.setVersion( version );
+                    repository.deleteVersion( versionRef );
+                    needsMetadataUpdate = true;
                 }
             }
+
+            if ( needsMetadataUpdate )
+            {
+                updateMetadata( artifact );
+            }
         }
-        catch ( LayoutException le )
+        catch ( LayoutException e )
         {
-            throw new RepositoryPurgeException( le.getMessage() );
+            throw new RepositoryPurgeException( e.getMessage(), e );
         }
-        catch ( IOException ie )
+        catch ( ContentNotFoundException e )
         {
-            throw new RepositoryPurgeException( ie.getMessage() );
+            throw new RepositoryPurgeException( e.getMessage(), e );
         }
     }
 
-    private void updateMetadata( File artifactIdDir )
-        throws RepositoryPurgeException
+    private void updateMetadata( ArtifactReference artifact )
     {
+        VersionedReference versionRef = new VersionedReference();
+        versionRef.setGroupId( artifact.getGroupId() );
+        versionRef.setArtifactId( artifact.getArtifactId() );
+        versionRef.setVersion( artifact.getVersion() );
+
+        ProjectReference projectRef = new ProjectReference();
+        projectRef.setGroupId( artifact.getGroupId() );
+        projectRef.setArtifactId( artifact.getArtifactId() );
 
-        File[] metadataFiles = getFiles( artifactIdDir, "maven-metadata" );
-        List availableVersions = getVersionsInDir( artifactIdDir );
-
-        Collections.sort( availableVersions );
-
-        String latestReleased = getLatestReleased( availableVersions );
-        for ( int i = 0; i < metadataFiles.length; i++ )
+        try
         {
-            if ( !( metadataFiles[i].getName().toUpperCase() ).endsWith( "SHA1" ) &&
-                !( metadataFiles[i].getName().toUpperCase() ).endsWith( "MD5" ) )
-            {
-                try
-                {
-                    Date lastUpdated = new Date();
-                    ArchivaRepositoryMetadata metadata = metadataReader.read( metadataFiles[i] );
-                    metadata.setAvailableVersions( availableVersions );
-                    metadata.setLatestVersion( (String) availableVersions.get( availableVersions.size() - 1 ) );
-                    metadata.setReleasedVersion( latestReleased );
-                    metadata.setLastUpdatedTimestamp( lastUpdated );
-                    metadata.setLastUpdated( Long.toString( lastUpdated.getTime() ) );
-
-                    RepositoryMetadataWriter.write( metadata, metadataFiles[i] );
-                }
-                catch ( RepositoryMetadataException rme )
-                {
-                    // continue updating other metadata files even if there is an exception
-                    // @todo log to console
-                }
-            }
+            metadataTools.updateMetadata( repository, versionRef );
         }
-    }
-
-    private String getLatestReleased( List availableVersions )
-    {
-        List reversedOrder = new ArrayList( availableVersions );
-        Collections.reverse( reversedOrder );
-        String latestReleased = "";
-
-        for ( Iterator iter = reversedOrder.iterator(); iter.hasNext(); )
+        catch ( ContentNotFoundException e )
         {
-            String version = (String) iter.next();
-            if ( !VersionUtil.getBaseVersion( version ).endsWith( SNAPSHOT ) )
-            {
-                latestReleased = version;
-                return latestReleased;
-            }
+            // Ignore. (Just means we have no snapshot versions left to reference).
         }
-
-        return latestReleased;
-    }
-
-    private List getVersionsInDir( File artifactIdDir )
-    {
-        String[] versionsAndMore = artifactIdDir.list();
-        List versions = new ArrayList();
-        for ( int j = 0; j < versionsAndMore.length; j++ )
+        catch ( RepositoryMetadataException e )
         {
-            if ( VersionUtil.isVersion( versionsAndMore[j] ) )
-            {
-                versions.add( versionsAndMore[j] );
-            }
+            // Ignore. 
+        }
+        catch ( IOException e )
+        {
+            // Ignore. 
+        }
+        catch ( LayoutException e )
+        {
+            // Ignore.
         }
 
-        return versions;
+        try
+        {
+            metadataTools.updateMetadata( repository, projectRef );
+        }
+        catch ( ContentNotFoundException e )
+        {
+            // Ignore. (Just means we have no snapshot versions left to reference).
+        }
+        catch ( RepositoryMetadataException e )
+        {
+            // Ignore. 
+        }
+        catch ( IOException e )
+        {
+            // Ignore. 
+        }
+        catch ( LayoutException e )
+        {
+            // Ignore.
+        }
     }
 }

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java Wed Oct 10 02:47:20 2007
@@ -19,31 +19,43 @@
 * under the License.
 */
 
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
 import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
-import org.apache.maven.archiva.repository.layout.FilenameParts;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.repository.ContentNotFoundException;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
 import org.apache.maven.archiva.repository.layout.LayoutException;
 
 import java.io.File;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Calendar;
+import java.util.Date;
+import java.util.Set;
+import java.util.regex.Matcher;
 
 /**
- * Purge repository for snapshots older than the specified days in the repository configuration.
+ * Purge from repository all snapshots older than the specified days in the repository configuration.
  *
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
  */
 public class DaysOldRepositoryPurge
     extends AbstractRepositoryPurge
 {
+    private static final SimpleDateFormat timestampParser;
+    static
+    {
+        timestampParser = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
+        timestampParser.setTimeZone( DateUtils.UTC_TIME_ZONE );
+    }
+
     private int daysOlder;
 
-    public DaysOldRepositoryPurge( ManagedRepositoryConfiguration repository, BidirectionalRepositoryLayout layout,
-                                   ArtifactDAO artifactDao, int daysOlder )
+    public DaysOldRepositoryPurge( ManagedRepositoryContent repository, ArtifactDAO artifactDao,
+                                   int daysOlder )
     {
-        super( repository, layout, artifactDao );
+        super( repository, artifactDao );
         this.daysOlder = daysOlder;
     }
 
@@ -52,52 +64,40 @@
     {
         try
         {
-            File artifactFile = new File( repository.getLocation(), path );
+            File artifactFile = new File( repository.getRepoRoot(), path );
 
             if ( !artifactFile.exists() )
             {
                 return;
             }
 
-            FilenameParts parts = getFilenameParts( path );
+            ArtifactReference artifact = repository.toArtifactReference( path );
 
-            Calendar olderThanThisDate = Calendar.getInstance();
+            Calendar olderThanThisDate = Calendar.getInstance( DateUtils.UTC_TIME_ZONE );
             olderThanThisDate.add( Calendar.DATE, -daysOlder );
 
-            if ( VersionUtil.isGenericSnapshot( parts.version ) )
+            // Is this a generic snapshot "1.0-SNAPSHOT" ?
+            if ( VersionUtil.isGenericSnapshot( artifact.getVersion() ) )
             {
                 if ( artifactFile.lastModified() < olderThanThisDate.getTimeInMillis() )
                 {
-                    doPurge( artifactFile, parts.extension );
+                    doPurgeAllRelated( artifactFile );
                 }
             }
-            else if ( VersionUtil.isUniqueSnapshot( parts.version ) )
+            // Is this a timestamp snapshot "1.0-20070822.123456-42" ?
+            else if ( VersionUtil.isUniqueSnapshot( artifact.getVersion() ) )
             {
-                String[] versionParts = StringUtils.split( parts.version, '-' );
-                String timestamp = StringUtils.remove( versionParts[1], '.' );
-                int year = Integer.parseInt( StringUtils.substring( timestamp, 0, 4 ) );
-                int month = Integer.parseInt( StringUtils.substring( timestamp, 4, 6 ) ) - 1;
-                int day = Integer.parseInt( StringUtils.substring( timestamp, 6, 8 ) );
-                int hour = Integer.parseInt( StringUtils.substring( timestamp, 8, 10 ) );
-                int min = Integer.parseInt( StringUtils.substring( timestamp, 10, 12 ) );
-                int sec = Integer.parseInt( StringUtils.substring( timestamp, 12 ) );
+                Calendar timestampCal = uniqueSnapshotToCalendar( artifact.getVersion() );
 
-                Calendar timestampDate = Calendar.getInstance();
-                timestampDate.set( year, month, day, hour, min, sec );
-
-                if ( timestampDate.getTimeInMillis() < olderThanThisDate.getTimeInMillis() )
+                if ( timestampCal.getTimeInMillis() < olderThanThisDate.getTimeInMillis() )
                 {
-                    doPurge( artifactFile, parts.extension );
+                    doPurgeAllRelated( artifactFile );
                 }
-                else
+                else if ( artifactFile.lastModified() < olderThanThisDate.getTimeInMillis() )
                 {
-                    if ( artifactFile.lastModified() < olderThanThisDate.getTimeInMillis() )
-                    {
-                        doPurge( artifactFile, parts.extension );
-                    }
+                    doPurgeAllRelated( artifactFile );
                 }
             }
-
         }
         catch ( LayoutException le )
         {
@@ -105,13 +105,52 @@
         }
     }
 
-    private void doPurge( File artifactFile, String extension )
+    private Calendar uniqueSnapshotToCalendar( String version )
     {
-        String[] fileParts = artifactFile.getName().split( "." + extension );
+        // The latestVersion will contain the full version string "1.0-alpha-5-20070821.213044-8"
+        // This needs to be broken down into ${base}-${timestamp}-${build_number}
+
+        Matcher m = VersionUtil.UNIQUE_SNAPSHOT_PATTERN.matcher( version );
+        if ( m.matches() )
+        {
+            Matcher mtimestamp = VersionUtil.TIMESTAMP_PATTERN.matcher( m.group( 2 ) );
+            if ( mtimestamp.matches() )
+            {
+                String tsDate = mtimestamp.group( 1 );
+                String tsTime = mtimestamp.group( 2 );
 
-        File[] artifactFiles = getFiles( artifactFile.getParentFile(), fileParts[0] );
+                Date versionDate;
+                try
+                {
+                    versionDate = timestampParser.parse( tsDate + "." + tsTime );
+                    Calendar cal = Calendar.getInstance( DateUtils.UTC_TIME_ZONE );
+                    cal.setTime( versionDate );
 
-        purge( artifactFiles );
+                    return cal;
+                }
+                catch ( ParseException e )
+                {
+                    // Invalid Date/Time
+                    return null;
+                }
+            }
+        }
+        return null;
     }
-}
 
+    private void doPurgeAllRelated( File artifactFile ) throws LayoutException
+    {
+        ArtifactReference reference = repository.toArtifactReference( artifactFile.getAbsolutePath() );
+        
+        try
+        {
+            Set<ArtifactReference> related = repository.getRelatedArtifacts( reference );
+            purge( related );
+        }
+        catch ( ContentNotFoundException e )
+        {
+            // Nothing to do here.
+            // TODO: Log this?
+        }
+    }
+}

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java Wed Oct 10 02:47:20 2007
@@ -26,9 +26,11 @@
 import org.apache.maven.archiva.consumers.ConsumerException;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.maven.archiva.database.ArchivaDAO;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
-import org.apache.maven.archiva.repository.layout.LayoutException;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
+import org.apache.maven.archiva.repository.RepositoryContentFactory;
+import org.apache.maven.archiva.repository.RepositoryException;
+import org.apache.maven.archiva.repository.RepositoryNotFoundException;
+import org.apache.maven.archiva.repository.metadata.MetadataTools;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 import org.codehaus.plexus.registry.Registry;
@@ -42,9 +44,11 @@
  * specified by the user.
  *
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
- * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
- * role-hint="repository-purge"
- * instantiation-strategy="per-lookup
+ * 
+ * @plexus.component 
+ *      role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
+ *      role-hint="repository-purge"
+ *      instantiation-strategy="per-lookup
  */
 public class RepositoryPurgeConsumer
     extends AbstractMonitoredConsumer
@@ -66,14 +70,19 @@
     private ArchivaConfiguration configuration;
 
     /**
+     * @plexus.requirement role-hint="jdo"
+     */
+    private ArchivaDAO dao;
+
+    /**
      * @plexus.requirement
      */
-    private BidirectionalRepositoryLayoutFactory layoutFactory;
+    private RepositoryContentFactory repositoryFactory;
 
     /**
-     * @plexus.requirement role-hint="jdo"
+     * @plexus.requirement
      */
-    private ArchivaDAO dao;
+    private MetadataTools metadataTools;
 
     /**
      * @plexus.requirement
@@ -118,34 +127,35 @@
     public void beginScan( ManagedRepositoryConfiguration repository )
         throws ConsumerException
     {
-        BidirectionalRepositoryLayout repositoryLayout;
         try
         {
-            repositoryLayout = layoutFactory.getLayout( repository.getLayout() );
-        }
-        catch ( LayoutException e )
-        {
-            throw new ConsumerException(
-                "Unable to initialize consumer due to unknown repository layout: " + e.getMessage(), e );
-        }
+            ManagedRepositoryContent repositoryContent = repositoryFactory.getManagedRepositoryContent( repository
+                .getId() );
 
-        ManagedRepositoryConfiguration repoConfig =
-            configuration.getConfiguration().findManagedRepositoryById( repository.getId() );
+            if ( repository.getDaysOlder() != 0 )
+            {
+                repoPurge = new DaysOldRepositoryPurge( repositoryContent, dao.getArtifactDAO(), repository
+                    .getDaysOlder() );
+            }
+            else
+            {
+                repoPurge = new RetentionCountRepositoryPurge( repositoryContent, dao.getArtifactDAO(), repository
+                    .getRetentionCount() );
+            }
 
-        if ( repoConfig.getDaysOlder() != 0 )
+            cleanUp = new CleanupReleasedSnapshotsRepositoryPurge( repositoryContent, dao.getArtifactDAO(),
+                                                                   metadataTools );
+
+            deleteReleasedSnapshots = repository.isDeleteReleasedSnapshots();
+        }
+        catch ( RepositoryNotFoundException e )
         {
-            repoPurge = new DaysOldRepositoryPurge( repository, repositoryLayout, dao.getArtifactDAO(),
-                                                    repoConfig.getDaysOlder() );
+            throw new ConsumerException( "Can't run repository purge: " + e.getMessage(), e );
         }
-        else
+        catch ( RepositoryException e )
         {
-            repoPurge = new RetentionCountRepositoryPurge( repository, repositoryLayout, dao.getArtifactDAO(),
-                                                           repoConfig.getRetentionCount() );
+            throw new ConsumerException( "Can't run repository purge: " + e.getMessage(), e );
         }
-
-        cleanUp = new CleanupReleasedSnapshotsRepositoryPurge( repository, repositoryLayout, dao.getArtifactDAO() );
-
-        deleteReleasedSnapshots = repoConfig.isDeleteReleasedSnapshots();
     }
 
     public void processFile( String path )
@@ -162,7 +172,7 @@
         }
         catch ( RepositoryPurgeException rpe )
         {
-            throw new ConsumerException( rpe.getMessage() );
+            throw new ConsumerException( rpe.getMessage(), rpe );
         }
     }
 

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java Wed Oct 10 02:47:20 2007
@@ -19,18 +19,20 @@
 * under the License.
 */
 
+import org.apache.maven.archiva.common.utils.VersionComparator;
 import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
-import org.apache.maven.archiva.repository.layout.FilenameParts;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.model.VersionedReference;
+import org.apache.maven.archiva.repository.ContentNotFoundException;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
 import org.apache.maven.archiva.repository.layout.LayoutException;
 
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 /**
  * Purge the repository by retention count. Retain only the specified number of snapshots.
@@ -42,10 +44,10 @@
 {
     private int retentionCount;
 
-    public RetentionCountRepositoryPurge( ManagedRepositoryConfiguration repository, BidirectionalRepositoryLayout layout,
-                                          ArtifactDAO artifactDao, int retentionCount )
+    public RetentionCountRepositoryPurge( ManagedRepositoryContent repository, ArtifactDAO artifactDao,
+                                          int retentionCount )
     {
-        super( repository, layout, artifactDao );
+        super( repository, artifactDao );
         this.retentionCount = retentionCount;
     }
 
@@ -54,39 +56,42 @@
     {
         try
         {
-            File artifactFile = new File( repository.getLocation(), path );
+            File artifactFile = new File( repository.getRepoRoot(), path );
 
             if ( !artifactFile.exists() )
             {
                 return;
             }
 
-            FilenameParts parts = getFilenameParts( path );
+            ArtifactReference artifact = repository.toArtifactReference( path );
 
-            if ( VersionUtil.isSnapshot( parts.version ) )
+            if ( VersionUtil.isSnapshot( artifact.getVersion() ) )
             {
-                File parentDir = artifactFile.getParentFile();
+                VersionedReference reference = new VersionedReference();
+                reference.setGroupId( artifact.getGroupId() );
+                reference.setArtifactId( artifact.getArtifactId() );
+                reference.setVersion( artifact.getVersion() );
 
-                if ( parentDir.isDirectory() )
+                List<String> versions = new ArrayList<String>( repository.getVersions( reference ) );
+
+                Collections.sort( versions, VersionComparator.getInstance() );
+
+                if ( retentionCount > versions.size() )
                 {
-                    File[] files = parentDir.listFiles();
-                    List uniqueVersionFilenames = getUniqueVersions( files );
-                    Collections.sort( uniqueVersionFilenames );
+                    // Done. nothing to do here. skip it.
+                    return;
+                }
 
-                    if ( uniqueVersionFilenames.size() > retentionCount )
+                int countToPurge = versions.size() - retentionCount;
+
+                for ( String version : versions )
+                {
+                    if ( countToPurge-- <= 0 )
                     {
-                        int count = uniqueVersionFilenames.size();
-                        for ( Iterator iter = uniqueVersionFilenames.iterator(); iter.hasNext(); )
-                        {
-                            String filename = (String) iter.next();
-                            if ( count > retentionCount )
-                            {
-                                File[] artifactFiles = getFiles( parentDir, filename );
-                                purge( artifactFiles );
-                                count--;
-                            }
-                        }
+                        break;
                     }
+
+                    doPurgeAllRelated( artifact, version );
                 }
             }
         }
@@ -94,37 +99,34 @@
         {
             throw new RepositoryPurgeException( le.getMessage() );
         }
+        catch ( ContentNotFoundException e )
+        {
+            // Nothing to do here.
+            // TODO: Log this condition?
+        }
     }
 
-    private List getUniqueVersions( File[] files )
+    private void doPurgeAllRelated( ArtifactReference reference, String version )
+        throws LayoutException
     {
-        List uniqueVersions = new ArrayList();
+        ArtifactReference artifact = new ArtifactReference();
+        artifact.setGroupId( reference.getGroupId() );
+        artifact.setArtifactId( reference.getArtifactId() );
+        artifact.setVersion( version );
+        artifact.setClassifier( reference.getClassifier() );
+        artifact.setType( reference.getType() );
+        
+        System.err.println( "Requesting (retention) purge of " + ArtifactReference.toKey( reference ) );
 
-        for ( int i = 0; i < files.length; i++ )
+        try
         {
-            if ( !( files[i].getName().toUpperCase() ).endsWith( "SHA1" ) &&
-                !( files[i].getName().toUpperCase() ).endsWith( "MD5" ) )
-            {
-                FilenameParts filenameParts = null;
-
-                // skip those files that have layout exception (no artifact id/no version/no extension)
-                try
-                {
-                    filenameParts = getFilenameParts( files[i].getAbsolutePath() );
-                }
-                catch ( LayoutException le )
-                {
-
-                }
-
-                if ( filenameParts != null &&
-                    !uniqueVersions.contains( filenameParts.artifactId + "-" + filenameParts.version ) )
-                {
-                    uniqueVersions.add( filenameParts.artifactId + "-" + filenameParts.version );
-                }
-            }
+            Set<ArtifactReference> related = repository.getRelatedArtifacts( artifact );
+            purge( related );
+        }
+        catch ( ContentNotFoundException e )
+        {
+            // Nothing to do here.
+            // TODO: Log this?
         }
-
-        return uniqueVersions;
     }
 }

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager-daysOld.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager-daysOld.xml?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager-daysOld.xml (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager-daysOld.xml Wed Oct 10 02:47:20 2007
@@ -20,58 +20,47 @@
 
 <configuration>
   <version>1</version>
-  <repositories>
-    <repository>
+  <managedRepositories>
+    <managedRepository>
       <id>internal</id>
       <name>Archiva Managed Internal Repository</name>
-      <url>file://${appserver.base}/repositories/internal</url>
+      <location>${appserver.base}/repositories/internal</location>
       <layout>default</layout>
       <releases>true</releases>
       <snapshots>false</snapshots>
       <indexed>true</indexed>
       <refreshCronExpression>0 0 * * ?</refreshCronExpression>
-    </repository>
-    <repository>
+    </managedRepository>
+    <managedRepository>
       <id>snapshots</id>
       <name>Archiva Managed Snapshot Repository</name>
-      <url>file://${appserver.base}/repositories/internal</url>
+      <location>${appserver.base}/repositories/snapshots</location>
       <layout>default</layout>
       <releases>false</releases>
       <snapshots>true</snapshots>
       <indexed>true</indexed>
       <refreshCronExpression>0 0,30 * * ?</refreshCronExpression>
-    </repository>
-    <repository>
+    </managedRepository>
+  </managedRepositories>
+  
+  <remoteRepositories>
+    <remoteRepository>
       <id>central</id>
       <name>Central Repository</name>
       <url>http://repo1.maven.org/maven2</url>
       <layout>default</layout>
       <releases>true</releases>
       <snapshots>false</snapshots>
-      <indexed>false</indexed>
-    </repository>
-    <repository>
+    </remoteRepository>
+    <remoteRepository>
       <id>maven2-repository.dev.java.net</id>
       <name>Java.net Repository for Maven 2</name>
       <url>https://maven2-repository.dev.java.net/nonav/repository</url>
       <layout>default</layout>
       <releases>true</releases>
       <snapshots>false</snapshots>
-      <indexed>false</indexed>
-    </repository>
-    <repository>
-      <id>test-repo</id>
-      <name>Test Repository</name>
-      <url>file://${appserver.base}/repositories/test-repo</url>
-      <layout>default</layout>
-      <releases>true</releases>
-      <snapshots>true</snapshots>
-      <indexed>true</indexed>
-      <refreshCronExpression>0 0 * * ?</refreshCronExpression>
-      <daysOlder>100</daysOlder>
-      <deleteReleasedSnapshots>true</deleteReleasedSnapshots>
-    </repository>
-  </repositories>
+    </remoteRepository>
+  </remoteRepositories>
 
   <proxyConnectors>
     <proxyConnector>

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml Wed Oct 10 02:47:20 2007
@@ -20,58 +20,47 @@
 
 <configuration>
   <version>1</version>
-  <repositories>
-    <repository>
+  <managedRepositories>
+    <managedRepository>
       <id>internal</id>
       <name>Archiva Managed Internal Repository</name>
-      <url>file://${appserver.base}/repositories/internal</url>
+      <location>${appserver.base}/repositories/internal</location>
       <layout>default</layout>
       <releases>true</releases>
       <snapshots>false</snapshots>
       <indexed>true</indexed>
       <refreshCronExpression>0 0 * * ?</refreshCronExpression>
-    </repository>
-    <repository>
+    </managedRepository>
+    <managedRepository>
       <id>snapshots</id>
       <name>Archiva Managed Snapshot Repository</name>
-      <url>file://${appserver.base}/repositories/internal</url>
+      <location>${appserver.base}/repositories/snapshots</location>
       <layout>default</layout>
       <releases>false</releases>
       <snapshots>true</snapshots>
       <indexed>true</indexed>
       <refreshCronExpression>0 0,30 * * ?</refreshCronExpression>
-    </repository>
-    <repository>
+    </managedRepository>
+  </managedRepositories>
+  
+  <remoteRepositories>
+    <remoteRepository>
       <id>central</id>
       <name>Central Repository</name>
       <url>http://repo1.maven.org/maven2</url>
       <layout>default</layout>
       <releases>true</releases>
       <snapshots>false</snapshots>
-      <indexed>false</indexed>
-    </repository>
-    <repository>
+    </remoteRepository>
+    <remoteRepository>
       <id>maven2-repository.dev.java.net</id>
       <name>Java.net Repository for Maven 2</name>
       <url>https://maven2-repository.dev.java.net/nonav/repository</url>
       <layout>default</layout>
       <releases>true</releases>
       <snapshots>false</snapshots>
-      <indexed>false</indexed>
-    </repository>
-    <repository>
-      <id>test-repo</id>
-      <name>Test Repository</name>
-      <url>file://${appserver.base}/repositories/test-repo</url>
-      <layout>default</layout>
-      <releases>true</releases>
-      <snapshots>true</snapshots>
-      <indexed>true</indexed>
-      <refreshCronExpression>0 0 * * ?</refreshCronExpression>
-      <daysOlder>0</daysOlder>
-      <retentionCount>2</retentionCount>
-    </repository>
-  </repositories>
+    </remoteRepository>
+  </remoteRepositories>
 
   <proxyConnectors>
     <proxyConnector>

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java?rev=583412&r1=583411&r2=583412&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java Wed Oct 10 02:47:20 2007
@@ -23,9 +23,7 @@
 import org.apache.maven.archiva.database.ArchivaDatabaseException;
 import org.apache.maven.archiva.database.ArtifactDAO;
 import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
-import org.apache.maven.archiva.repository.layout.DefaultBidirectionalRepositoryLayout;
-import org.apache.maven.archiva.repository.layout.LayoutException;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
 import org.codehaus.plexus.jdo.JdoFactory;
@@ -72,9 +70,7 @@
 
     private ManagedRepositoryConfiguration config;
 
-    private ManagedRepositoryConfiguration repo;
-
-    private BidirectionalRepositoryLayout layout;
+    private ManagedRepositoryContent repo;
 
     protected ArtifactDAO dao;
 
@@ -161,33 +157,22 @@
         config.setLocation( TEST_REPO_LOCATION );
         config.setReleases( true );
         config.setSnapshots( true );
+        config.setDeleteReleasedSnapshots( true );
         config.setRetentionCount( TEST_RETENTION_COUNT );
 
         return config;
     }
 
-    public ManagedRepositoryConfiguration getRepository()
+    public ManagedRepositoryContent getRepository()
+        throws Exception
     {
         if ( repo == null )
         {
-            repo = new ManagedRepositoryConfiguration();
-            repo.setId( TEST_REPO_ID );
-            repo.setName( TEST_REPO_NAME );
-            repo.setLocation( TEST_REPO_LOCATION );
+            repo = (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class, "default" );
+            repo.setRepository( getRepoConfiguration() );
         }
 
         return repo;
-    }
-
-    public BidirectionalRepositoryLayout getLayout()
-        throws LayoutException
-    {
-        if ( layout == null )
-        {
-            layout = new DefaultBidirectionalRepositoryLayout();
-        }
-
-        return layout;
     }
 
     protected void populateDb( String groupId, String artifactId, List versions )



Re: svn commit: r583412 [1/8] - in /maven/archiva/trunk: archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ archiva-base...

Posted by Brett Porter <br...@apache.org>.
On 19/10/2007, at 11:36 AM, Brett Porter wrote:

> archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/ 
> proxy/ManagedDefaultTransferTest.java:392:    /* FIXME
> archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/ 
> proxy/ManagedLegacyTransferTest.java:129:    /* FIXME

I filed MRM-557 for these - the rest of my objections have been taken  
care of.

I re-tested the purging as much as I could, and am happy it is  
working again (with limitations as documented in JIRA). I'm still not  
happy about the way the changes were rolled in, obviously, but in  
testing I managed to find both the problem that seemed to be causing  
the lack of updates to the browse, and repair a recent regression in  
the consumers that would have rendered Archiva pretty much unworkable  
on a new install, so it was a worthwhile exercise :)

Cheers,
Brett


--
Brett Porter - brett@apache.org
Blog: http://www.devzuz.org/blogs/bporter/

Re: svn commit: r583412 [1/8] - in /maven/archiva/trunk: archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ archiva-base...

Posted by Brett Porter <br...@apache.org>.
On 19/10/2007, at 11:10 AM, Joakim Erdfelt wrote:

>
> I can't duplicate this.
> I suspect that this was corrected with the swingover to  
> RepositoryContent code too.
> Can you get me a complete stack trace?

I'll take a look.

>
>>
>>>>>
>>>>>  <configuration>
>>>>>    <version>1</version>
>>>>> -  <repositories>
>>>>> -    <repository>
>>>>> +  <managedRepositories>
>>>>> +    <managedRepository>
>>>>>        <id>internal</id>
>>>>>        <name>Archiva Managed Internal Repository</name>
>>>>> -      <url>file://${appserver.base}/repositories/internal</url>
>>>>> +      <location>${appserver.base}/repositories/internal</ 
>>>>> location>
>>>>
>>>> These changes are incorrect, if it is version '1', it is the old  
>>>> format, you can't update the content (I'm surprised it works).
>>>
>>> As far as I know, version 1 equals <managedRepositories> +  
>>> <remoteRepositories> etc...
>>> This was required to allow the unit tests to operate.
>>> Versions before 1 are in the realm of Archiva 0.9
>>> And I don't see support for a version 2 in the code.
>>
>> No, this isn't correct:
>>
>> version null is 0.9.
>> version 1 was what you introduced, ie <repositories>
>> version 2 is what I changed it to <managedRepositories> +  
>> <remoteRepositories>
>>
>> There is no explicit handling of the version - the existence of  
>> <repositories> triggers the handling in the current case. Now that  
>> version is consistently set it should be easier to keep track of.
>>
>> So, this change is likely to be problematic. We're going to need  
>> to roll back these changes and investigate why the tests actually  
>> broke.
>>
>> I will do this.
>
> This is likely related to MRM-546 (Duplicate repositories show up  
> while editing).

Yes, which I wasn't working on because I wasn't confident the code  
did what it used to based on the above. I'll fix it as part of that.

>
>>
>>>
>>>>
>>>>
>>>> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>>>>> -        assertFalse( el.getValue().equals( "20070315032817" ) );
>>>>> +        // FIXME: assertFalse( el.getValue().equals 
>>>>> ( "20070315032817" ) );
>>>>
>>>> what happened here? (2 more instances in the file)
>>>
>>> That was a holdover on MRM-535, it was known to be bad.
>>> I should have labelled that as // FIXME [MRM-535] instead.
>>
>> but MRM-535 is fixed, why are they still commented out?
>
> Not commented out in my code.
> At least, I'm not seeing what you are seeing.
> What File / line number are you referring to?

archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/ 
org/apache/maven/archiva/consumers/core/repository/ 
CleanupReleasedSnapshotsRepositoryPurgeTest.java:91:        // FIXME  
[MRM-535]: XMLAssert.assertXpathEvaluatesTo( "20070315032817", "// 
metadata/versioning/lastUpdated", metadataXml );
archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/ 
org/apache/maven/archiva/consumers/core/repository/ 
CleanupReleasedSnapshotsRepositoryPurgeTest.java:134:        // FIXME  
[MRM-535]: XMLAssert.assertXpathEvaluatesTo( "20070427033345", "// 
metadata/versioning/lastUpdated", metadataXml );
archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/ 
org/apache/maven/archiva/consumers/core/repository/ 
RepositoryPurgeConsumerTest.java:226:        // FIXME [MRM-535]:  
XMLAssert.assertXpathEvaluatesTo( "20070315032817", "//metadata/ 
versioning/lastUpdated", metadataXml );


>
>>
>>>
>>>>
>>>> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>>>>> +    /* FIXME
>>>>>      public void  
>>>>> testLegacyRequestPluginConvertedToDefaultPathInManagedRepo()
>>>>>          throws Exception
>>>>>      {
>>>>> @@ -400,7 +401,7 @@
>>>>>          setupTestableManagedRepository( path );
>>>>>
>>>>>          File expectedFile = new File( managedDefaultDir, path );
>>>>> -        ArtifactReference artifact = createArtifactReference 
>>>>> ( "legacy", legacyPath );
>>>>> +        ArtifactReference artifact =  
>>>>> managedDefaultRepository.toArtifactReference( path );
>>>>>
>>>>>          expectedFile.delete();
>>>>>          assertFalse( expectedFile.exists() );
>>>>> @@ -415,6 +416,7 @@
>>>>>          assertFileEquals( expectedFile, downloadedFile,  
>>>>> proxiedFile );
>>>>>          assertNoTempFiles( expectedFile );
>>>>>      }
>>>>> +    */
>>>>
>>>> what happened here? (2 instances)
>>>
>>> This whole test case was invalidated with the RepositoryContent  
>>> changes and has been removed.
>>
>> But I still see it in source control, commented out?
>
> Again, I'm not seeing this anymore.
> What File / Line number are you referring to?

archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/ 
proxy/ManagedDefaultTransferTest.java:392:    /* FIXME
archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/ 
proxy/ManagedLegacyTransferTest.java:129:    /* FIXME

- Brett

--
Brett Porter - brett@apache.org
Blog: http://www.devzuz.org/blogs/bporter/

Re: svn commit: r583412 [1/8] - in /maven/archiva/trunk: archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ archiva-base...

Posted by Joakim Erdfelt <jo...@erdfelt.com>.
Brett Porter wrote:
>
> On 19/10/2007, at 4:58 AM, Joakim Erdfelt wrote:
>
>>
>>>
>>>>      /**
>>>>       * Purge the repo. Update db and index of removed artifacts.
>>>>       *
>>>>       * @param artifactFiles
>>>>       * @throws RepositoryIndexException
>>>>       */
>>>> -    protected void purge( File[] artifactFiles )
>>>> +    protected void purge( Set<ArtifactReference> references )
>>>
>>> Was the behaviour of this changed? It looks like we now go File -> 
>>> ArtifactReference -> File which seems redundant?
>>
>> Manipulating the repository directly via file references has caused 
>> many bugs.
>> This is more of an interim step, while we work out the interface for 
>> RepositoryContent to be more useful.
>> I expect things like this to go away completely once we do the 
>> webservices work in post 1.0
>> For now, it's not harming anything, and just validates that what you 
>> are attempting to purge is actual repository content.
>>
>> This is similar to the discussion recently started around actions on 
>> the repository being done via the RepositoryContent interface, not 
>> not via direct filesystem manipulation. See that thread.
>
> My concern is that the first time I tried to use the purge it was 
> broken. I haven't had problems since, but I don't think the changes 
> have been tested enough. Did you explicitly fix something since, or do 
> we need to go back and check the testing?
>
>>
>>>
>>> From what I can tell, you added functionality to delete support 
>>> files (great!), but it wasn't referenced in the commit log or a 
>>> JIRA. It's hard to track when multiple changes like that occur - can 
>>> you clarify?
>>>
>>> Something is not working, since as soon as I run it I get this:
>>>
>>> INFO   | jvm 1    | 2007/10/10 13:47:41 | 2007-10-10 13:47:41,036 
>>> [SocketListener0-4] ERROR 
>>> org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers:default  
>>> - Consumer [repository-purge] had an error when processi
>>> ng file 
>>> [/Applications/Archiva/archiva/data/repositories/snapshots/org/codehaus/plexus/plexus-expression-evaluator/1.0-alpha-2-SNAPSHOT/plexus-expression-evaluator-1.0-alpha-2-20070928.003615-2.jar]: 
>>> For input string: "alph"
>>> INFO   | jvm 1    | 2007/10/10 13:47:41 | 
>>> java.lang.NumberFormatException: For input string: "alph"
>>> INFO   | jvm 1    | 2007/10/10 13:47:41 |       at 
>>> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) 
>>>
>>> INFO   | jvm 1    | 2007/10/10 13:47:41 |       at 
>>> java.lang.Integer.parseInt(Integer.java:447)
>>> INFO   | jvm 1    | 2007/10/10 13:47:41 |       at 
>>> java.lang.Integer.parseInt(Integer.java:497)
>
> This was the problem - can you offer any further what functionality 
> actually changed and why I might have seen this problem?

I can't duplicate this.
I suspect that this was corrected with the swingover to 
RepositoryContent code too.
Can you get me a complete stack trace?

>
>>>>
>>>>  <configuration>
>>>>    <version>1</version>
>>>> -  <repositories>
>>>> -    <repository>
>>>> +  <managedRepositories>
>>>> +    <managedRepository>
>>>>        <id>internal</id>
>>>>        <name>Archiva Managed Internal Repository</name>
>>>> -      <url>file://${appserver.base}/repositories/internal</url>
>>>> +      <location>${appserver.base}/repositories/internal</location>
>>>
>>> These changes are incorrect, if it is version '1', it is the old 
>>> format, you can't update the content (I'm surprised it works).
>>
>> As far as I know, version 1 equals <managedRepositories> + 
>> <remoteRepositories> etc...
>> This was required to allow the unit tests to operate.
>> Versions before 1 are in the realm of Archiva 0.9
>> And I don't see support for a version 2 in the code.
>
> No, this isn't correct:
>
> version null is 0.9.
> version 1 was what you introduced, ie <repositories>
> version 2 is what I changed it to <managedRepositories> + 
> <remoteRepositories>
>
> There is no explicit handling of the version - the existence of 
> <repositories> triggers the handling in the current case. Now that 
> version is consistently set it should be easier to keep track of.
>
> So, this change is likely to be problematic. We're going to need to 
> roll back these changes and investigate why the tests actually broke.
>
> I will do this.

This is likely related to MRM-546 (Duplicate repositories show up while 
editing).

>
>>
>>>
>>>
>>> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>>>> -        assertFalse( el.getValue().equals( "20070315032817" ) );
>>>> +        // FIXME: assertFalse( el.getValue().equals( 
>>>> "20070315032817" ) );
>>>
>>> what happened here? (2 more instances in the file)
>>
>> That was a holdover on MRM-535, it was known to be bad.
>> I should have labelled that as // FIXME [MRM-535] instead.
>
> but MRM-535 is fixed, why are they still commented out?

Not commented out in my code.
At least, I'm not seeing what you are seeing.
What File / line number are you referring to?

>
>>
>>>
>>> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>>>> +    /* FIXME
>>>>      public void 
>>>> testLegacyRequestPluginConvertedToDefaultPathInManagedRepo()
>>>>          throws Exception
>>>>      {
>>>> @@ -400,7 +401,7 @@
>>>>          setupTestableManagedRepository( path );
>>>>
>>>>          File expectedFile = new File( managedDefaultDir, path );
>>>> -        ArtifactReference artifact = createArtifactReference( 
>>>> "legacy", legacyPath );
>>>> +        ArtifactReference artifact = 
>>>> managedDefaultRepository.toArtifactReference( path );
>>>>
>>>>          expectedFile.delete();
>>>>          assertFalse( expectedFile.exists() );
>>>> @@ -415,6 +416,7 @@
>>>>          assertFileEquals( expectedFile, downloadedFile, 
>>>> proxiedFile );
>>>>          assertNoTempFiles( expectedFile );
>>>>      }
>>>> +    */
>>>
>>> what happened here? (2 instances)
>>
>> This whole test case was invalidated with the RepositoryContent 
>> changes and has been removed.
>
> But I still see it in source control, commented out?

Again, I'm not seeing this anymore.
What File / Line number are you referring to?

>
>>
>>>
>>>> +    /**
>>>> +     * <p>
>>>> +     * Gather up the list of related artifacts to the 
>>>> ArtifactReference provided.
>>>> +     * This typically inclues the pom files, and those things with
>>>> +     * classifiers (such as doc, source code, test libs, etc...)
>>>> +     * </p>
>>>> +     *
>>>> +     * <p>
>>>> +     * <strong>NOTE:</strong> Some layouts (such as maven 1 
>>>> "legacy") are not compatible with this query.
>>>> +     * </p>
>>>> +     *
>>>> +     * @param reference the reference to work off of.
>>>> +     * @return the set of ArtifactReferences for related artifacts.
>>>> +     * @throws ContentNotFoundException if the initial artifact 
>>>> reference does not exist within the repository.
>>>> +     * @throws LayoutException
>>>> +     */
>>>> +    public Set<ArtifactReference> getRelatedArtifacts( 
>>>> ArtifactReference reference )
>>>> +        throws ContentNotFoundException, LayoutException;
>>>
>>> How does this work if proxying? Or is it just for things already in 
>>> the repository (ie, for the purge).
>>
>> Related artifacts are the things attached to the artifact.
>> Things like sources, javadoc, pom, etc...
>> There were a few places that had similar routines scattered around 
>> the code, so it felt like a needed method.
>> But after a week or two of cleanup, even those methods no longer need 
>> this concept.
>> This can be removed safely now.
>
> Yikes, no wonder I can't keep track. Can you remove it then?
>
> Actually I just checked - your changes to the purge introduced the use 
> of this there, so are you sure it's not needed?
>
> I'm starting to think that reverting the purge code back to 
> pre-monster commit is the best thing to do, then roll forward on 
> particular changes one at a time. WDYT?

No! Do not revert the purge code.
It was broken.
It didn't do metadata merge correctly.
It didn't remove content correctly.
It blew chunks if the repository was not in default format.
It couldn't handle filenames that contained alpha numeric version ids.
It didn't even test correctly.
It didn't even handle the detection of retention count & days old correctly.
Nor did the unit tests test what you thought it did. (Run the tests 
twice, or in a different order, or on an IDE and you get failures.)

The purge code is 500x better now than it was.
Reverting that code will introduce bugs, and invalidate a few dozen 
closed jiras.

>
>>
>>>
>>> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>>>> +    private static final SimpleDateFormat lastUpdatedFormat;
>>>> +
>>>> +    static
>>>> +    {
>>>> +        lastUpdatedFormat = new SimpleDateFormat( "yyyyMMddHHmmss" );
>>>> +        lastUpdatedFormat.setTimeZone( DateUtils.UTC_TIME_ZONE );
>>>> +    }
>>>
>>> This makes the metadata tools not thread safe and needs to be 
>>> changed. (I think I saw the same the purge changes).
>>
>> Oh-kay.
>> I don't believe this will cause a thread safety issue.
>> But I can wrap a few synchronized blocks around access to those if 
>> it'll make you feel better.
>
> Why? Are the utils never used in multiple threads at a time? 
> SimpleDateFormat is not thread safe. 
> http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html

Yuck.
One of our memory issues before was with creating large amounts of 
SimpleDateFormat objects.
I'll make this object field local.

>
>>
>>>
>>>
>>> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>>>> Added: 
>>>> maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/m1-repo-filelist.txt 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/m1-repo-filelist.txt?rev=583412&view=auto 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/m1-repo-filelist.txt 
>>>> (added)
>>>> +++ 
>>>> maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/m1-repo-filelist.txt 
>>>> Wed Oct 10 02:47:20 2007
>>>> @@ -0,0 +1,6230 @@
>>>> +# Directory listing from people.apache.org
>>>> +# of path /www/people.apache.org/repo/m1-ibiblio-rsync-repository
>>>> +# Taken September 9, 2007
>>>> +#
>>>> +# File listing has been filtered using the following sed command.
>>>> +#
>>>> +#   sed -e "/\.md5$/d" -e "/\.sha1$/d" -e "/\.asc$/d" -e 
>>>> "/\.meta$/d" \
>>>> +#       -e "/LICENSE/d" -e "/\/licenses\//d"
>>>> +#
>>>> +# Any entries in here that are blatently wrong should be deleted.
>>>> +#
>>>
>>> This is interesting as a one off, but not something I think we 
>>> should be running in the unit tests. It's way too huge.
>>
>> I think this is important to test the effectiveness of the layout 
>> routines.
>> And it doesn't take that long.
>> Course, you can't see that as I apparently haven't checked in that 
>> unit test.  ;-)
>> Lemme see if I can find that on my laptop backup cd and get that 
>> commit'd.
>
> it's still cycles, and a 290K source file that basically does the same 
> thing over and over again. And it's not changing. It's not a "unit" 
> test in any way.
>
> Wouldn't it be better to have a separate validation tool that can take 
> a repository location and run those routines against it to sanity 
> check a repository against Archiva compat? And then reduce the unit 
> tests to the representative set of conditions we know we support now?
Sure, sounds good.
I'll move this concept (not that file, the file can go away) to the 
archiva-cli as a debugging tool.

-- 
- Joakim Erdfelt
  joakim@erdfelt.com
  Open Source Software (OSS) Developer


Re: svn commit: r583412 [1/8] - in /maven/archiva/trunk: archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ archiva-base...

Posted by Brett Porter <br...@apache.org>.
On 19/10/2007, at 4:58 AM, Joakim Erdfelt wrote:

>
>>
>>>      /**
>>>       * Purge the repo. Update db and index of removed artifacts.
>>>       *
>>>       * @param artifactFiles
>>>       * @throws RepositoryIndexException
>>>       */
>>> -    protected void purge( File[] artifactFiles )
>>> +    protected void purge( Set<ArtifactReference> references )
>>
>> Was the behaviour of this changed? It looks like we now go File ->  
>> ArtifactReference -> File which seems redundant?
>
> Manipulating the repository directly via file references has caused  
> many bugs.
> This is more of an interim step, while we work out the interface  
> for RepositoryContent to be more useful.
> I expect things like this to go away completely once we do the  
> webservices work in post 1.0
> For now, it's not harming anything, and just validates that what  
> you are attempting to purge is actual repository content.
>
> This is similar to the discussion recently started around actions  
> on the repository being done via the RepositoryContent interface,  
> not not via direct filesystem manipulation. See that thread.

My concern is that the first time I tried to use the purge it was  
broken. I haven't had problems since, but I don't think the changes  
have been tested enough. Did you explicitly fix something since, or  
do we need to go back and check the testing?

>
>>
>> From what I can tell, you added functionality to delete support  
>> files (great!), but it wasn't referenced in the commit log or a  
>> JIRA. It's hard to track when multiple changes like that occur -  
>> can you clarify?
>>
>> Something is not working, since as soon as I run it I get this:
>>
>> INFO   | jvm 1    | 2007/10/10 13:47:41 | 2007-10-10 13:47:41,036  
>> [SocketListener0-4] ERROR  
>> org.apache.maven.archiva.repository.scanner.RepositoryContentConsumer 
>> s:default  - Consumer [repository-purge] had an error when processi
>> ng file [/Applications/Archiva/archiva/data/repositories/snapshots/ 
>> org/codehaus/plexus/plexus-expression-evaluator/1.0-alpha-2- 
>> SNAPSHOT/plexus-expression-evaluator-1.0- 
>> alpha-2-20070928.003615-2.jar]: For input string: "alph"
>> INFO   | jvm 1    | 2007/10/10 13:47:41 |  
>> java.lang.NumberFormatException: For input string: "alph"
>> INFO   | jvm 1    | 2007/10/10 13:47:41 |       at  
>> java.lang.NumberFormatException.forInputString 
>> (NumberFormatException.java:48)
>> INFO   | jvm 1    | 2007/10/10 13:47:41 |       at  
>> java.lang.Integer.parseInt(Integer.java:447)
>> INFO   | jvm 1    | 2007/10/10 13:47:41 |       at  
>> java.lang.Integer.parseInt(Integer.java:497)

This was the problem - can you offer any further what functionality  
actually changed and why I might have seen this problem?

>>>
>>>  <configuration>
>>>    <version>1</version>
>>> -  <repositories>
>>> -    <repository>
>>> +  <managedRepositories>
>>> +    <managedRepository>
>>>        <id>internal</id>
>>>        <name>Archiva Managed Internal Repository</name>
>>> -      <url>file://${appserver.base}/repositories/internal</url>
>>> +      <location>${appserver.base}/repositories/internal</location>
>>
>> These changes are incorrect, if it is version '1', it is the old  
>> format, you can't update the content (I'm surprised it works).
>
> As far as I know, version 1 equals <managedRepositories> +  
> <remoteRepositories> etc...
> This was required to allow the unit tests to operate.
> Versions before 1 are in the realm of Archiva 0.9
> And I don't see support for a version 2 in the code.

No, this isn't correct:

version null is 0.9.
version 1 was what you introduced, ie <repositories>
version 2 is what I changed it to <managedRepositories> +  
<remoteRepositories>

There is no explicit handling of the version - the existence of  
<repositories> triggers the handling in the current case. Now that  
version is consistently set it should be easier to keep track of.

So, this change is likely to be problematic. We're going to need to  
roll back these changes and investigate why the tests actually broke.

I will do this.

>
>>
>>
>> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>>> -        assertFalse( el.getValue().equals( "20070315032817" ) );
>>> +        // FIXME: assertFalse( el.getValue().equals 
>>> ( "20070315032817" ) );
>>
>> what happened here? (2 more instances in the file)
>
> That was a holdover on MRM-535, it was known to be bad.
> I should have labelled that as // FIXME [MRM-535] instead.

but MRM-535 is fixed, why are they still commented out?

>
>>
>> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>>> +    /* FIXME
>>>      public void  
>>> testLegacyRequestPluginConvertedToDefaultPathInManagedRepo()
>>>          throws Exception
>>>      {
>>> @@ -400,7 +401,7 @@
>>>          setupTestableManagedRepository( path );
>>>
>>>          File expectedFile = new File( managedDefaultDir, path );
>>> -        ArtifactReference artifact = createArtifactReference 
>>> ( "legacy", legacyPath );
>>> +        ArtifactReference artifact =  
>>> managedDefaultRepository.toArtifactReference( path );
>>>
>>>          expectedFile.delete();
>>>          assertFalse( expectedFile.exists() );
>>> @@ -415,6 +416,7 @@
>>>          assertFileEquals( expectedFile, downloadedFile,  
>>> proxiedFile );
>>>          assertNoTempFiles( expectedFile );
>>>      }
>>> +    */
>>
>> what happened here? (2 instances)
>
> This whole test case was invalidated with the RepositoryContent  
> changes and has been removed.

But I still see it in source control, commented out?

>
>>
>>> +    /**
>>> +     * <p>
>>> +     * Gather up the list of related artifacts to the  
>>> ArtifactReference provided.
>>> +     * This typically inclues the pom files, and those things with
>>> +     * classifiers (such as doc, source code, test libs, etc...)
>>> +     * </p>
>>> +     *
>>> +     * <p>
>>> +     * <strong>NOTE:</strong> Some layouts (such as maven 1  
>>> "legacy") are not compatible with this query.
>>> +     * </p>
>>> +     *
>>> +     * @param reference the reference to work off of.
>>> +     * @return the set of ArtifactReferences for related artifacts.
>>> +     * @throws ContentNotFoundException if the initial artifact  
>>> reference does not exist within the repository.
>>> +     * @throws LayoutException
>>> +     */
>>> +    public Set<ArtifactReference> getRelatedArtifacts 
>>> ( ArtifactReference reference )
>>> +        throws ContentNotFoundException, LayoutException;
>>
>> How does this work if proxying? Or is it just for things already  
>> in the repository (ie, for the purge).
>
> Related artifacts are the things attached to the artifact.
> Things like sources, javadoc, pom, etc...
> There were a few places that had similar routines scattered around  
> the code, so it felt like a needed method.
> But after a week or two of cleanup, even those methods no longer  
> need this concept.
> This can be removed safely now.

Yikes, no wonder I can't keep track. Can you remove it then?

Actually I just checked - your changes to the purge introduced the  
use of this there, so are you sure it's not needed?

I'm starting to think that reverting the purge code back to pre- 
monster commit is the best thing to do, then roll forward on  
particular changes one at a time. WDYT?

>
>>
>> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>>> +    private static final SimpleDateFormat lastUpdatedFormat;
>>> +
>>> +    static
>>> +    {
>>> +        lastUpdatedFormat = new SimpleDateFormat 
>>> ( "yyyyMMddHHmmss" );
>>> +        lastUpdatedFormat.setTimeZone( DateUtils.UTC_TIME_ZONE );
>>> +    }
>>
>> This makes the metadata tools not thread safe and needs to be  
>> changed. (I think I saw the same the purge changes).
>
> Oh-kay.
> I don't believe this will cause a thread safety issue.
> But I can wrap a few synchronized blocks around access to those if  
> it'll make you feel better.

Why? Are the utils never used in multiple threads at a time?  
SimpleDateFormat is not thread safe. http://java.sun.com/javase/6/ 
docs/api/java/text/SimpleDateFormat.html

>
>>
>>
>> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>>> Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/ 
>>> src/test/resources/m1-repo-filelist.txt
>>> URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva- 
>>> base/archiva-repository-layer/src/test/resources/m1-repo- 
>>> filelist.txt?rev=583412&view=auto
>>> ==================================================================== 
>>> ==========
>>> --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/ 
>>> test/resources/m1-repo-filelist.txt (added)
>>> +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/ 
>>> test/resources/m1-repo-filelist.txt Wed Oct 10 02:47:20 2007
>>> @@ -0,0 +1,6230 @@
>>> +# Directory listing from people.apache.org
>>> +# of path /www/people.apache.org/repo/m1-ibiblio-rsync-repository
>>> +# Taken September 9, 2007
>>> +#
>>> +# File listing has been filtered using the following sed command.
>>> +#
>>> +#   sed -e "/\.md5$/d" -e "/\.sha1$/d" -e "/\.asc$/d" -e "/\.meta 
>>> $/d" \
>>> +#       -e "/LICENSE/d" -e "/\/licenses\//d"
>>> +#
>>> +# Any entries in here that are blatently wrong should be deleted.
>>> +#
>>
>> This is interesting as a one off, but not something I think we  
>> should be running in the unit tests. It's way too huge.
>
> I think this is important to test the effectiveness of the layout  
> routines.
> And it doesn't take that long.
> Course, you can't see that as I apparently haven't checked in that  
> unit test.  ;-)
> Lemme see if I can find that on my laptop backup cd and get that  
> commit'd.

it's still cycles, and a 290K source file that basically does the  
same thing over and over again. And it's not changing. It's not a  
"unit" test in any way.

Wouldn't it be better to have a separate validation tool that can  
take a repository location and run those routines against it to  
sanity check a repository against Archiva compat? And then reduce the  
unit tests to the representative set of conditions we know we support  
now?

- Brett

--
Brett Porter - brett@apache.org
Blog: http://www.devzuz.org/blogs/bporter/

Re: svn commit: r583412 [1/8] - in /maven/archiva/trunk: archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ archiva-base...

Posted by Joakim Erdfelt <jo...@erdfelt.com>.
Brett Porter wrote:
> I tried to scan through this as quickly as I could. I haven't reviewed 
> the repository content classes at this point. I'm frankly not 
> comfortable with the size of this change and inclined to have it moved 
> to a branch until it can be more closely examined.
>
> Here are my obligatory questions and comments...
>
> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>> - Have not swung all code over to new repositorycontent object yet.
>
> what is left to do?

This was actually finished recently in revision 585588.
All of the code is now using the correct logic in RepositoryContent objects.

>
>>      /**
>>       * Purge the repo. Update db and index of removed artifacts.
>>       *
>>       * @param artifactFiles
>>       * @throws RepositoryIndexException
>>       */
>> -    protected void purge( File[] artifactFiles )
>> +    protected void purge( Set<ArtifactReference> references )
>
> Was the behaviour of this changed? It looks like we now go File -> 
> ArtifactReference -> File which seems redundant?

Manipulating the repository directly via file references has caused many 
bugs.
This is more of an interim step, while we work out the interface for 
RepositoryContent to be more useful.
I expect things like this to go away completely once we do the 
webservices work in post 1.0
For now, it's not harming anything, and just validates that what you are 
attempting to purge is actual repository content.

This is similar to the discussion recently started around actions on the 
repository being done via the RepositoryContent interface, not not via 
direct filesystem manipulation. See that thread.

>
> From what I can tell, you added functionality to delete support files 
> (great!), but it wasn't referenced in the commit log or a JIRA. It's 
> hard to track when multiple changes like that occur - can you clarify?
>
> Something is not working, since as soon as I run it I get this:
>
> INFO   | jvm 1    | 2007/10/10 13:47:41 | 2007-10-10 13:47:41,036 
> [SocketListener0-4] ERROR 
> org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers:default  
> - Consumer [repository-purge] had an error when processi
> ng file 
> [/Applications/Archiva/archiva/data/repositories/snapshots/org/codehaus/plexus/plexus-expression-evaluator/1.0-alpha-2-SNAPSHOT/plexus-expression-evaluator-1.0-alpha-2-20070928.003615-2.jar]: 
> For input string: "alph"
> INFO   | jvm 1    | 2007/10/10 13:47:41 | 
> java.lang.NumberFormatException: For input string: "alph"
> INFO   | jvm 1    | 2007/10/10 13:47:41 |       at 
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) 
>
> INFO   | jvm 1    | 2007/10/10 13:47:41 |       at 
> java.lang.Integer.parseInt(Integer.java:447)
> INFO   | jvm 1    | 2007/10/10 13:47:41 |       at 
> java.lang.Integer.parseInt(Integer.java:497)
>
>
>> +            System.err.println( "Purging: " + 
>> artifactFile.getAbsolutePath() );
>
> Oops.
>
>> +        System.err.println( "Requesting (retention) purge of " + 
>> ArtifactReference.toKey( reference ) );
>
> Oops.

Cleaned up in revision 584213.

>
>>
>>
>> Modified: 
>> maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager-daysOld.xml 
>>
>> URL: 
>> http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager-daysOld.xml?rev=583412&r1=583411&r2=583412&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager-daysOld.xml 
>> (original)
>> +++ 
>> maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager-daysOld.xml 
>> Wed Oct 10 02:47:20 2007
>> @@ -20,58 +20,47 @@
>
> and....
>
>> Modified: 
>> maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml 
>>
>> URL: 
>> http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml?rev=583412&r1=583411&r2=583412&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml 
>> (original)
>> +++ 
>> maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/conf/repository-manager.xml 
>> Wed Oct 10 02:47:20 2007
>> @@ -20,58 +20,47 @@
>>
>>  <configuration>
>>    <version>1</version>
>> -  <repositories>
>> -    <repository>
>> +  <managedRepositories>
>> +    <managedRepository>
>>        <id>internal</id>
>>        <name>Archiva Managed Internal Repository</name>
>> -      <url>file://${appserver.base}/repositories/internal</url>
>> +      <location>${appserver.base}/repositories/internal</location>
>
> These changes are incorrect, if it is version '1', it is the old 
> format, you can't update the content (I'm surprised it works).

As far as I know, version 1 equals <managedRepositories> + 
<remoteRepositories> etc...
This was required to allow the unit tests to operate.
Versions before 1 are in the realm of Archiva 0.9
And I don't see support for a version 2 in the code.

>
>
> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>> -        assertFalse( el.getValue().equals( "20070315032817" ) );
>> +        // FIXME: assertFalse( el.getValue().equals( 
>> "20070315032817" ) );
>
> what happened here? (2 more instances in the file)

That was a holdover on MRM-535, it was known to be bad.
I should have labelled that as // FIXME [MRM-535] instead.

>
>>          // check if metadata file was updated
>> -        File artifactMetadataFile =
>> -            new File( 
>> "target/test/test-repo/org/apache/maven/plugins/maven-source-plugin/maven-metadata-local.xml" 
>> );
>> +        File artifactMetadataFile = new File(
>> +                                              
>> "target/test/test-repo/org/apache/maven/plugins/maven-source-plugin/maven-metadata.xml" 
>> );
>
> Did the file format change?

The assumption on maven-metadata-local.xml was bad.
Nothing in archiva uses it, consumes it, requests it, or works with it.

>
>> -        try
>> +        if ( !artifact.getArtifactId().equalsIgnoreCase( 
>> model.getArtifactId() ) )
>
> why are artifact IDs case insensitive?
>
>> +        if ( !artifact.getVersion().equalsIgnoreCase( 
>> model.getVersion() ) &&
>> +            !VersionUtil.getBaseVersion( artifact.getVersion() 
>> ).equalsIgnoreCase( model.getVersion() ) )
>
> as above

This is to work around win32 issues with manual deploys, etc...

>
> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>> +    /* FIXME
>>      public void 
>> testLegacyRequestPluginConvertedToDefaultPathInManagedRepo()
>>          throws Exception
>>      {
>> @@ -400,7 +401,7 @@
>>          setupTestableManagedRepository( path );
>>
>>          File expectedFile = new File( managedDefaultDir, path );
>> -        ArtifactReference artifact = createArtifactReference( 
>> "legacy", legacyPath );
>> +        ArtifactReference artifact = 
>> managedDefaultRepository.toArtifactReference( path );
>>
>>          expectedFile.delete();
>>          assertFalse( expectedFile.exists() );
>> @@ -415,6 +416,7 @@
>>          assertFileEquals( expectedFile, downloadedFile, proxiedFile );
>>          assertNoTempFiles( expectedFile );
>>      }
>> +    */
>
> what happened here? (2 instances)

This whole test case was invalidated with the RepositoryContent changes 
and has been removed.

>
>> +    /**
>> +     * <p>
>> +     * Gather up the list of related artifacts to the 
>> ArtifactReference provided.
>> +     * This typically inclues the pom files, and those things with
>> +     * classifiers (such as doc, source code, test libs, etc...)
>> +     * </p>
>> +     *
>> +     * <p>
>> +     * <strong>NOTE:</strong> Some layouts (such as maven 1 
>> "legacy") are not compatible with this query.
>> +     * </p>
>> +     *
>> +     * @param reference the reference to work off of.
>> +     * @return the set of ArtifactReferences for related artifacts.
>> +     * @throws ContentNotFoundException if the initial artifact 
>> reference does not exist within the repository.
>> +     * @throws LayoutException
>> +     */
>> +    public Set<ArtifactReference> getRelatedArtifacts( 
>> ArtifactReference reference )
>> +        throws ContentNotFoundException, LayoutException;
>
> How does this work if proxying? Or is it just for things already in 
> the repository (ie, for the purge).

Related artifacts are the things attached to the artifact.
Things like sources, javadoc, pom, etc...
There were a few places that had similar routines scattered around the 
code, so it felt like a needed method.
But after a week or two of cleanup, even those methods no longer need 
this concept.
This can be removed safely now.

>
> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>> +    private static final SimpleDateFormat lastUpdatedFormat;
>> +
>> +    static
>> +    {
>> +        lastUpdatedFormat = new SimpleDateFormat( "yyyyMMddHHmmss" );
>> +        lastUpdatedFormat.setTimeZone( DateUtils.UTC_TIME_ZONE );
>> +    }
>
> This makes the metadata tools not thread safe and needs to be changed. 
> (I think I saw the same the purge changes).

Oh-kay.
I don't believe this will cause a thread safety issue.
But I can wrap a few synchronized blocks around access to those if it'll 
make you feel better.

>
> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>> -    /* TODO: Re-enabled in the future.
>> +    /*
>
> Is this no longer going to be re-enabled? Are the tests valid? (3 
> instances)
>
>> +    /* TODO: Re-enabled in the future.
>>      public void testGoodFooEjbClient()
>
> Did this break?
>
>> +    /*
>>      public void testGoodFooLibJavadoc()
>
> What happened here? (2 instances)

Results of the Bad layout routines.
btw, those tests have been disabled for a *long* time.

Those tests have been migrated to the new RepositoryContent test cases 
and work fine now.
The old tests have been removed from source control.

>
>
> On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
>> Added: 
>> maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/m1-repo-filelist.txt 
>>
>> URL: 
>> http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/m1-repo-filelist.txt?rev=583412&view=auto 
>>
>> ============================================================================== 
>>
>> --- 
>> maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/m1-repo-filelist.txt 
>> (added)
>> +++ 
>> maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/resources/m1-repo-filelist.txt 
>> Wed Oct 10 02:47:20 2007
>> @@ -0,0 +1,6230 @@
>> +# Directory listing from people.apache.org
>> +# of path /www/people.apache.org/repo/m1-ibiblio-rsync-repository
>> +# Taken September 9, 2007
>> +#
>> +# File listing has been filtered using the following sed command.
>> +#
>> +#   sed -e "/\.md5$/d" -e "/\.sha1$/d" -e "/\.asc$/d" -e "/\.meta$/d" \
>> +#       -e "/LICENSE/d" -e "/\/licenses\//d"
>> +#
>> +# Any entries in here that are blatently wrong should be deleted.
>> +#
>
> This is interesting as a one off, but not something I think we should 
> be running in the unit tests. It's way too huge.

I think this is important to test the effectiveness of the layout routines.
And it doesn't take that long.
Course, you can't see that as I apparently haven't checked in that unit 
test.  ;-)
Lemme see if I can find that on my laptop backup cd and get that commit'd.

-- 
- Joakim Erdfelt
  joakim@erdfelt.com
  Open Source Software (OSS) Developer


Re: svn commit: r583412 [1/8] - in /maven/archiva/trunk: archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/functors/ archiva-base...

Posted by Brett Porter <br...@apache.org>.
I tried to scan through this as quickly as I could. I haven't  
reviewed the repository content classes at this point. I'm frankly  
not comfortable with the size of this change and inclined to have it  
moved to a branch until it can be more closely examined.

Here are my obligatory questions and comments...

On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
> - Have not swung all code over to new repositorycontent object yet.

what is left to do?

>      /**
>       * Purge the repo. Update db and index of removed artifacts.
>       *
>       * @param artifactFiles
>       * @throws RepositoryIndexException
>       */
> -    protected void purge( File[] artifactFiles )
> +    protected void purge( Set<ArtifactReference> references )

Was the behaviour of this changed? It looks like we now go File ->  
ArtifactReference -> File which seems redundant?

 From what I can tell, you added functionality to delete support  
files (great!), but it wasn't referenced in the commit log or a JIRA.  
It's hard to track when multiple changes like that occur - can you  
clarify?

Something is not working, since as soon as I run it I get this:

INFO   | jvm 1    | 2007/10/10 13:47:41 | 2007-10-10 13:47:41,036  
[SocketListener0-4] ERROR  
org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers:d 
efault  - Consumer [repository-purge] had an error when processi
ng file [/Applications/Archiva/archiva/data/repositories/snapshots/ 
org/codehaus/plexus/plexus-expression-evaluator/1.0-alpha-2-SNAPSHOT/ 
plexus-expression-evaluator-1.0-alpha-2-20070928.003615-2.jar]: For  
input string: "alph"
INFO   | jvm 1    | 2007/10/10 13:47:41 |  
java.lang.NumberFormatException: For input string: "alph"
INFO   | jvm 1    | 2007/10/10 13:47:41 |       at  
java.lang.NumberFormatException.forInputString 
(NumberFormatException.java:48)
INFO   | jvm 1    | 2007/10/10 13:47:41 |       at  
java.lang.Integer.parseInt(Integer.java:447)
INFO   | jvm 1    | 2007/10/10 13:47:41 |       at  
java.lang.Integer.parseInt(Integer.java:497)


> +            System.err.println( "Purging: " +  
> artifactFile.getAbsolutePath() );

Oops.

> +        System.err.println( "Requesting (retention) purge of " +  
> ArtifactReference.toKey( reference ) );

Oops.

>
>
> Modified: maven/archiva/trunk/archiva-base/archiva-consumers/ 
> archiva-core-consumers/src/test/conf/repository-manager-daysOld.xml
> URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/ 
> archiva-consumers/archiva-core-consumers/src/test/conf/repository- 
> manager-daysOld.xml?rev=583412&r1=583411&r2=583412&view=diff
> ====================================================================== 
> ========
> --- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core- 
> consumers/src/test/conf/repository-manager-daysOld.xml (original)
> +++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core- 
> consumers/src/test/conf/repository-manager-daysOld.xml Wed Oct 10  
> 02:47:20 2007
> @@ -20,58 +20,47 @@

and....

> Modified: maven/archiva/trunk/archiva-base/archiva-consumers/ 
> archiva-core-consumers/src/test/conf/repository-manager.xml
> URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/ 
> archiva-consumers/archiva-core-consumers/src/test/conf/repository- 
> manager.xml?rev=583412&r1=583411&r2=583412&view=diff
> ====================================================================== 
> ========
> --- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core- 
> consumers/src/test/conf/repository-manager.xml (original)
> +++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core- 
> consumers/src/test/conf/repository-manager.xml Wed Oct 10 02:47:20  
> 2007
> @@ -20,58 +20,47 @@
>
>  <configuration>
>    <version>1</version>
> -  <repositories>
> -    <repository>
> +  <managedRepositories>
> +    <managedRepository>
>        <id>internal</id>
>        <name>Archiva Managed Internal Repository</name>
> -      <url>file://${appserver.base}/repositories/internal</url>
> +      <location>${appserver.base}/repositories/internal</location>

These changes are incorrect, if it is version '1', it is the old  
format, you can't update the content (I'm surprised it works).


On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
> -        assertFalse( el.getValue().equals( "20070315032817" ) );
> +        // FIXME: assertFalse( el.getValue().equals 
> ( "20070315032817" ) );

what happened here? (2 more instances in the file)

>          // check if metadata file was updated
> -        File artifactMetadataFile =
> -            new File( "target/test/test-repo/org/apache/maven/ 
> plugins/maven-source-plugin/maven-metadata-local.xml" );
> +        File artifactMetadataFile = new File(
> +                                              "target/test/test- 
> repo/org/apache/maven/plugins/maven-source-plugin/maven- 
> metadata.xml" );

Did the file format change?

> -        try
> +        if ( !artifact.getArtifactId().equalsIgnoreCase 
> ( model.getArtifactId() ) )

why are artifact IDs case insensitive?

> +        if ( !artifact.getVersion().equalsIgnoreCase 
> ( model.getVersion() ) &&
> +            !VersionUtil.getBaseVersion( artifact.getVersion 
> () ).equalsIgnoreCase( model.getVersion() ) )

as above

On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
> +    /* FIXME
>      public void  
> testLegacyRequestPluginConvertedToDefaultPathInManagedRepo()
>          throws Exception
>      {
> @@ -400,7 +401,7 @@
>          setupTestableManagedRepository( path );
>
>          File expectedFile = new File( managedDefaultDir, path );
> -        ArtifactReference artifact = createArtifactReference 
> ( "legacy", legacyPath );
> +        ArtifactReference artifact =  
> managedDefaultRepository.toArtifactReference( path );
>
>          expectedFile.delete();
>          assertFalse( expectedFile.exists() );
> @@ -415,6 +416,7 @@
>          assertFileEquals( expectedFile, downloadedFile,  
> proxiedFile );
>          assertNoTempFiles( expectedFile );
>      }
> +    */

what happened here? (2 instances)

> +    /**
> +     * <p>
> +     * Gather up the list of related artifacts to the  
> ArtifactReference provided.
> +     * This typically inclues the pom files, and those things with
> +     * classifiers (such as doc, source code, test libs, etc...)
> +     * </p>
> +     *
> +     * <p>
> +     * <strong>NOTE:</strong> Some layouts (such as maven 1  
> "legacy") are not compatible with this query.
> +     * </p>
> +     *
> +     * @param reference the reference to work off of.
> +     * @return the set of ArtifactReferences for related artifacts.
> +     * @throws ContentNotFoundException if the initial artifact  
> reference does not exist within the repository.
> +     * @throws LayoutException
> +     */
> +    public Set<ArtifactReference> getRelatedArtifacts 
> ( ArtifactReference reference )
> +        throws ContentNotFoundException, LayoutException;

How does this work if proxying? Or is it just for things already in  
the repository (ie, for the purge).

On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
> +    private static final SimpleDateFormat lastUpdatedFormat;
> +
> +    static
> +    {
> +        lastUpdatedFormat = new SimpleDateFormat( "yyyyMMddHHmmss" );
> +        lastUpdatedFormat.setTimeZone( DateUtils.UTC_TIME_ZONE );
> +    }

This makes the metadata tools not thread safe and needs to be  
changed. (I think I saw the same the purge changes).

On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
> -    /* TODO: Re-enabled in the future.
> +    /*

Is this no longer going to be re-enabled? Are the tests valid? (3  
instances)

> +    /* TODO: Re-enabled in the future.
>      public void testGoodFooEjbClient()

Did this break?

> +    /*
>      public void testGoodFooLibJavadoc()

What happened here? (2 instances)


On 10/10/2007, at 11:47 AM, joakime@apache.org wrote:
> Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/ 
> src/test/resources/m1-repo-filelist.txt
> URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/ 
> archiva-repository-layer/src/test/resources/m1-repo-filelist.txt? 
> rev=583412&view=auto
> ====================================================================== 
> ========
> --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/ 
> test/resources/m1-repo-filelist.txt (added)
> +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/ 
> test/resources/m1-repo-filelist.txt Wed Oct 10 02:47:20 2007
> @@ -0,0 +1,6230 @@
> +# Directory listing from people.apache.org
> +# of path /www/people.apache.org/repo/m1-ibiblio-rsync-repository
> +# Taken September 9, 2007
> +#
> +# File listing has been filtered using the following sed command.
> +#
> +#   sed -e "/\.md5$/d" -e "/\.sha1$/d" -e "/\.asc$/d" -e "/\.meta$/ 
> d" \
> +#       -e "/LICENSE/d" -e "/\/licenses\//d"
> +#
> +# Any entries in here that are blatently wrong should be deleted.
> +#

This is interesting as a one off, but not something I think we should  
be running in the unit tests. It's way too huge.

Cheers,
Brett

--
Brett Porter - brett@apache.org
Blog: http://www.devzuz.org/blogs/bporter/