* This will look in a single managed repository, and purge any snapshots that are present
@@ -78,11 +77,12 @@ public class CleanupReleasedSnapshotsRepositoryPurge
private RepositoryContentFactory repoContentFactory;
- public CleanupReleasedSnapshotsRepositoryPurge( ManagedRepositoryContent repository, ArtifactDAO artifactDao,
- MetadataTools metadataTools, Map indices,
- ArchivaConfiguration archivaConfig, RepositoryContentFactory repoContentFactory )
+ public CleanupReleasedSnapshotsRepositoryPurge( ManagedRepositoryContent repository, MetadataTools metadataTools,
+ ArchivaConfiguration archivaConfig,
+ RepositoryContentFactory repoContentFactory,
+ List listeners )
{
- super( repository, artifactDao, indices );
+ super( repository, listeners );
this.metadataTools = metadataTools;
this.archivaConfig = archivaConfig;
this.repoContentFactory = repoContentFactory;
@@ -101,17 +101,17 @@ public class CleanupReleasedSnapshotsRepositoryPurge
return;
}
- ArtifactReference artifact = repository.toArtifactReference( path );
+ ArtifactReference artifactRef = repository.toArtifactReference( path );
- if ( !VersionUtil.isSnapshot( artifact.getVersion() ) )
+ if ( !VersionUtil.isSnapshot( artifactRef.getVersion() ) )
{
// Nothing to do here, not a snapshot, skip it.
return;
}
ProjectReference reference = new ProjectReference();
- reference.setGroupId( artifact.getGroupId() );
- reference.setArtifactId( artifact.getArtifactId() );
+ reference.setGroupId( artifactRef.getGroupId() );
+ reference.setArtifactId( artifactRef.getArtifactId() );
// Gather up all of the versions.
List allVersions = new ArrayList( repository.getVersions( reference ) );
@@ -161,8 +161,12 @@ public class CleanupReleasedSnapshotsRepositoryPurge
boolean needsMetadataUpdate = false;
VersionedReference versionRef = new VersionedReference();
- versionRef.setGroupId( artifact.getGroupId() );
- versionRef.setArtifactId( artifact.getArtifactId() );
+ versionRef.setGroupId( artifactRef.getGroupId() );
+ versionRef.setArtifactId( artifactRef.getArtifactId() );
+
+ ArchivaArtifact artifact =
+ new ArchivaArtifact( artifactRef.getGroupId(), artifactRef.getArtifactId(), artifactRef.getVersion(),
+ artifactRef.getClassifier(), artifactRef.getType() );
for ( String version : snapshotVersions )
{
@@ -170,13 +174,19 @@ public class CleanupReleasedSnapshotsRepositoryPurge
{
versionRef.setVersion( version );
repository.deleteVersion( versionRef );
+
+ for ( RepositoryListener listener : listeners )
+ {
+ listener.deleteArtifact( repository, artifact );
+ }
+
needsMetadataUpdate = true;
}
}
if ( needsMetadataUpdate )
{
- updateMetadata( artifact );
+ updateMetadata( artifactRef );
}
}
catch ( LayoutException e )
diff --git a/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java b/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
index a844128c3..415fa6082 100644
--- a/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
+++ b/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
@@ -19,17 +19,6 @@ package org.apache.maven.archiva.consumers.core.repository;
* under the License.
*/
-import org.apache.commons.lang.time.DateUtils;
-import org.apache.maven.archiva.common.utils.VersionComparator;
-import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.maven.archiva.indexer.RepositoryContentIndex;
-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.text.ParseException;
import java.text.SimpleDateFormat;
@@ -38,10 +27,19 @@ import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.maven.archiva.common.utils.VersionComparator;
+import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.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.events.RepositoryListener;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+
/**
* Purge from repository all snapshots older than the specified days in the repository configuration.
*
@@ -56,10 +54,10 @@ public class DaysOldRepositoryPurge
private int retentionCount;
- public DaysOldRepositoryPurge( ManagedRepositoryContent repository, ArtifactDAO artifactDao, int daysOlder,
- int retentionCount, Map indices )
+ public DaysOldRepositoryPurge( ManagedRepositoryContent repository, int daysOlder,
+ int retentionCount, List listeners )
{
- super( repository, artifactDao, indices );
+ super( repository, listeners );
this.daysOlder = daysOlder;
this.retentionCount = retentionCount;
timestampParser = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
diff --git a/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java b/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
index ad13411bb..d388814c9 100644
--- a/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
+++ b/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
@@ -19,6 +19,10 @@ package org.apache.maven.archiva.consumers.core.repository;
* under the License.
*/
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ConfigurationNames;
import org.apache.maven.archiva.configuration.FileTypes;
@@ -26,24 +30,18 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.maven.archiva.database.ArchivaDAO;
-import org.apache.maven.archiva.indexer.RepositoryContentIndex;
-import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
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.events.RepositoryListener;
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;
import org.codehaus.plexus.registry.RegistryListener;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import edu.emory.mathcs.backport.java.util.Collections;
/**
* Consumer for removing old snapshots in the repository based on the criteria
@@ -75,11 +73,6 @@ public class RepositoryPurgeConsumer
*/
private ArchivaConfiguration configuration;
- /**
- * @plexus.requirement role-hint="jdo"
- */
- private ArchivaDAO dao;
-
/**
* @plexus.requirement
*/
@@ -97,19 +90,15 @@ public class RepositoryPurgeConsumer
private List includes = new ArrayList();
- private List propertyNameTriggers = new ArrayList();
-
private RepositoryPurge repoPurge;
private RepositoryPurge cleanUp;
private boolean deleteReleasedSnapshots;
-
- /**
- * @plexus.requirement role-hint="lucene"
- */
- private RepositoryContentIndexFactory indexFactory;
+ /** @plexus.requirement role="org.apache.maven.archiva.repository.events.RepositoryListener" */
+ private List listeners = Collections.emptyList();
+
public String getId()
{
return this.id;
@@ -140,27 +129,23 @@ public class RepositoryPurgeConsumer
{
try
{
- Map indices = new HashMap();
- indices.put( "bytecode", indexFactory.createBytecodeIndex( repository ) );
- indices.put( "hashcodes", indexFactory.createHashcodeIndex( repository ) );
- indices.put( "filecontent", indexFactory.createFileContentIndex( repository ) );
-
ManagedRepositoryContent repositoryContent = repositoryFactory.getManagedRepositoryContent( repository
.getId() );
if ( repository.getDaysOlder() != 0 )
{
- repoPurge = new DaysOldRepositoryPurge( repositoryContent, dao.getArtifactDAO(), repository
- .getDaysOlder(), repository.getRetentionCount(), indices );
+ repoPurge = new DaysOldRepositoryPurge( repositoryContent, repository.getDaysOlder(),
+ repository.getRetentionCount(), listeners );
}
else
{
- repoPurge = new RetentionCountRepositoryPurge( repositoryContent, dao.getArtifactDAO(), repository
- .getRetentionCount(), indices );
+ repoPurge = new RetentionCountRepositoryPurge( repositoryContent, repository.getRetentionCount(),
+ listeners );
}
- cleanUp = new CleanupReleasedSnapshotsRepositoryPurge( repositoryContent, dao.getArtifactDAO(),
- metadataTools, indices, configuration, repositoryFactory );
+ cleanUp =
+ new CleanupReleasedSnapshotsRepositoryPurge( repositoryContent, metadataTools, configuration,
+ repositoryFactory, listeners );
deleteReleasedSnapshots = repository.isDeleteReleasedSnapshots();
}
@@ -230,9 +215,4 @@ public class RepositoryPurgeConsumer
// we need to check all files for deletion, especially if not modified
return true;
}
-
- public void setRepositoryContentIndexFactory( RepositoryContentIndexFactory indexFactory )
- {
- this.indexFactory = indexFactory;
- }
}
diff --git a/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java b/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java
index 20c728f00..2580c3d96 100644
--- a/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java
+++ b/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java
@@ -19,23 +19,21 @@ package org.apache.maven.archiva.consumers.core.repository;
* under the License.
*/
-import org.apache.maven.archiva.common.utils.VersionComparator;
-import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.maven.archiva.indexer.RepositoryContentIndex;
-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.List;
-import java.util.Map;
import java.util.Set;
+import org.apache.maven.archiva.common.utils.VersionComparator;
+import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.model.VersionedReference;
+import org.apache.maven.archiva.repository.ContentNotFoundException;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
+import org.apache.maven.archiva.repository.events.RepositoryListener;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+
/**
* Purge the repository by retention count. Retain only the specified number of snapshots.
*
@@ -46,10 +44,10 @@ public class RetentionCountRepositoryPurge
{
private int retentionCount;
- public RetentionCountRepositoryPurge( ManagedRepositoryContent repository, ArtifactDAO artifactDao,
- int retentionCount, Map indices )
+ public RetentionCountRepositoryPurge( ManagedRepositoryContent repository,
+ int retentionCount, List listeners )
{
- super( repository, artifactDao, indices );
+ super( repository, listeners );
this.retentionCount = retentionCount;
}
diff --git a/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java b/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
index 5d0869942..7335d4694 100644
--- a/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
+++ b/archiva-database-decoupling/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
@@ -19,28 +19,16 @@ package org.apache.maven.archiva.consumers.core.repository;
* under the License.
*/
-import org.apache.commons.io.FileUtils;
-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.model.ArchivaArtifact;
-import org.apache.maven.archiva.repository.ManagedRepositoryContent;
-import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
-import org.codehaus.plexus.jdo.JdoFactory;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
-import org.jpox.SchemaTool;
-
import java.io.File;
import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Properties;
-import java.util.Map.Entry;
-import javax.jdo.PersistenceManager;
-import javax.jdo.PersistenceManagerFactory;
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.model.ArchivaArtifact;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
+import org.apache.maven.archiva.repository.events.RepositoryListener;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
+import org.easymock.MockControl;
/**
* @author Maria Odea Ching
@@ -74,74 +62,21 @@ public abstract class AbstractRepositoryPurgeTest
private ManagedRepositoryContent repo;
- protected ArtifactDAO dao;
-
protected RepositoryPurge repoPurge;
+ protected MockControl listenerControl;
+
+ protected RepositoryListener listener;
+
+ @Override
protected void setUp()
throws Exception
{
super.setUp();
+
+ listenerControl = MockControl.createControl( RepositoryListener.class );
- DefaultConfigurableJdoFactory jdoFactory = (DefaultConfigurableJdoFactory) lookup( JdoFactory.ROLE, "archiva" );
- assertEquals( DefaultConfigurableJdoFactory.class.getName(), jdoFactory.getClass().getName() );
-
- jdoFactory.setPersistenceManagerFactoryClass( "org.jpox.PersistenceManagerFactoryImpl" );
-
- jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.hsqldb.jdbcDriver" ) );
- jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:hsqldb:mem:testdb" ) );
-
- jdoFactory.setUserName( System.getProperty( "jdo.test.user", "sa" ) );
-
- jdoFactory.setPassword( System.getProperty( "jdo.test.pass", "" ) );
-
- jdoFactory.setProperty( "org.jpox.transactionIsolation", "READ_COMMITTED" );
-
- jdoFactory.setProperty( "org.jpox.poid.transactionIsolation", "READ_COMMITTED" );
-
- jdoFactory.setProperty( "org.jpox.autoCreateSchema", "true" );
-
- jdoFactory.setProperty( "javax.jdo.option.RetainValues", "true" );
-
- jdoFactory.setProperty( "javax.jdo.option.RestoreValues", "true" );
-
- // jdoFactory.setProperty( "org.jpox.autoCreateColumns", "true" );
-
- jdoFactory.setProperty( "org.jpox.validateTables", "true" );
-
- jdoFactory.setProperty( "org.jpox.validateColumns", "true" );
-
- jdoFactory.setProperty( "org.jpox.validateConstraints", "true" );
-
- Properties properties = jdoFactory.getProperties();
-
- for ( Entry
-
- org.apache.derby
- derby
- org.codehaus.plexus.registry
diff --git a/archiva-database-decoupling/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryDatabaseEventListener.java b/archiva-database-decoupling/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryDatabaseEventListener.java
new file mode 100644
index 000000000..fa865e3ba
--- /dev/null
+++ b/archiva-database-decoupling/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryDatabaseEventListener.java
@@ -0,0 +1,55 @@
+package org.apache.maven.archiva.database;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.model.ArchivaArtifact;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
+import org.apache.maven.archiva.repository.events.RepositoryListener;
+
+/**
+ * Process repository management events and respond appropriately.
+ *
+ * @plexus.component role="org.apache.maven.archiva.repository.events.RepositoryListener" role-hint="database"
+ */
+public class RepositoryDatabaseEventListener
+ implements RepositoryListener
+{
+ /**
+ * @plexus.requirement role-hint="jdo"
+ */
+ private ArtifactDAO artifactDAO;
+
+ public void deleteArtifact( ManagedRepositoryContent repository, ArchivaArtifact artifact )
+ {
+ try
+ {
+ ArchivaArtifact queriedArtifact =
+ artifactDAO.getArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
+ artifact.getClassifier(), artifact.getType() );
+ artifactDAO.deleteArtifact( queriedArtifact );
+ }
+ catch ( ArchivaDatabaseException e )
+ {
+ // ignored
+ }
+
+ // TODO [MRM-37]: re-run the database consumers to clean up
+ }
+}
diff --git a/archiva-database-decoupling/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/RepositoryDatabaseEventListenerTest.java b/archiva-database-decoupling/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/RepositoryDatabaseEventListenerTest.java
new file mode 100644
index 000000000..7e76ee6b0
--- /dev/null
+++ b/archiva-database-decoupling/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/RepositoryDatabaseEventListenerTest.java
@@ -0,0 +1,90 @@
+package org.apache.maven.archiva.database;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Date;
+import java.util.List;
+
+import org.apache.maven.archiva.model.ArchivaArtifact;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
+import org.apache.maven.archiva.repository.events.RepositoryListener;
+import org.codehaus.plexus.spring.PlexusToSpringUtils;
+
+public class RepositoryDatabaseEventListenerTest
+ extends AbstractArchivaDatabaseTestCase
+{
+ private RepositoryListener listener;
+
+ @Override
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ listener = (RepositoryListener) lookup( RepositoryListener.class.getName(), "database" );
+ }
+
+ public void testWiring()
+ {
+ List listeners =
+ PlexusToSpringUtils.lookupList( PlexusToSpringUtils.buildSpringId( RepositoryListener.class ),
+ getApplicationContext() );
+
+ assertEquals( 1, listeners.size() );
+ assertEquals( listener, listeners.get( 0 ) );
+ }
+
+ public ArchivaArtifact createArtifact( String artifactId, String version, ArtifactDAO artifactDao )
+ {
+ ArchivaArtifact artifact =
+ artifactDao.createArtifact( "org.apache.maven.archiva.test", artifactId, version, "", "jar" );
+ artifact.getModel().setLastModified( new Date() );
+ artifact.getModel().setRepositoryId( "testable_repo" );
+ return artifact;
+ }
+
+ public void testDeleteArtifact()
+ throws Exception
+ {
+ ArtifactDAO artifactDao = (ArtifactDAO) lookup( ArtifactDAO.class.getName(), "jdo" );
+
+ // Setup artifacts in fresh DB.
+ ArchivaArtifact artifact = createArtifact( "test-artifact", "1.0", artifactDao );
+ artifactDao.saveArtifact( artifact );
+
+ assertEquals( artifact, artifactDao.getArtifact( "org.apache.maven.archiva.test", "test-artifact", "1.0", null,
+ "jar" ) );
+
+ artifact = new ArchivaArtifact( "org.apache.maven.archiva.test", "test-artifact", "1.0", null, "jar" );
+ ManagedRepositoryContent repository =
+ (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class.getName(), "default" );
+ listener.deleteArtifact( repository, artifact );
+
+ try
+ {
+ artifactDao.getArtifact( "org.apache.maven.archiva.test", "test-artifact", "1.0", null, "jar" );
+ fail( "Should not find artifact" );
+ }
+ catch ( ObjectNotFoundException e )
+ {
+ assertTrue( true );
+ }
+ }
+}
diff --git a/archiva-database-decoupling/archiva-modules/archiva-web/archiva-rss/pom.xml b/archiva-database-decoupling/archiva-modules/archiva-web/archiva-rss/pom.xml
index 9aa671e60..be70c4a21 100644
--- a/archiva-database-decoupling/archiva-modules/archiva-web/archiva-rss/pom.xml
+++ b/archiva-database-decoupling/archiva-modules/archiva-web/archiva-rss/pom.xml
@@ -18,6 +18,7 @@
org.apache.archivaarchiva-model
+
org.apache.archivaarchiva-database
diff --git a/archiva-database-decoupling/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-database-decoupling/archiva-modules/archiva-web/archiva-webapp/pom.xml
index 7e1927a81..3b8079ede 100644
--- a/archiva-database-decoupling/archiva-modules/archiva-web/archiva-webapp/pom.xml
+++ b/archiva-database-decoupling/archiva-modules/archiva-web/archiva-webapp/pom.xml
@@ -171,11 +171,6 @@
org.springframeworkspring-web
-
- org.apache.derby
- derby
- provided
- javax.mailmail
diff --git a/archiva-database-decoupling/branch-working-notes.txt b/archiva-database-decoupling/branch-working-notes.txt
new file mode 100644
index 000000000..c8a4db677
--- /dev/null
+++ b/archiva-database-decoupling/branch-working-notes.txt
@@ -0,0 +1,28 @@
+Stage 1: remove use of database and index from core consumers (move implementation into respective database and index modules)
+
+Done!
+
+Stage 2: separate model from JPOX annotated classes, centralising JPOX use in database
+
+* archiva-model to be reviewed, possibly split into a basic model with extensible parts. See metadata proposal
+* add consumer to generate Archiva metadata at same time as database model
+
+Stage 3: add a basic repository querying API for base artifact information and retrieval of metadata
+
+* RSS, browse
+* consider repository-api refactorings
+* at this point, should be able to have functional Archiva without a database
+* note that metadata need not be stored with the artifacts themselves, but will be by default
+
+Stage 4: incorporation of event API
+
+* used to centralise arrival, removal, etc of files/artifacts in the repository
+* errors should be events as well to avoid exceptions in the logs and instead meaningful handling/reporting
+
+Stage 5: isolate scanning code
+
+* Repository should operate without scanning code, it should push events if enabled
+* better assessment of its progress, performance
+* removal of database / repository scanning duality - all operations are driven by the event bus
+* move some database operations to a housekeeping scheduled task (same for index), make scheduled tasks a listable item based on available plugins
+