diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexFactoryStub.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexFactoryStub.java
index 2572fab65..fce937f99 100644
--- a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexFactoryStub.java
+++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexFactoryStub.java
@@ -34,7 +34,7 @@ public class LuceneRepositoryContentIndexFactoryStub
{
public RepositoryContentIndex createBytecodeIndex( ManagedRepositoryConfiguration repository )
- {
+ {
// TODO Auto-generated method stub
return new LuceneRepositoryContentIndexStub();
}
diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java
index 82e90f192..e9966def2 100644
--- a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java
+++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java
@@ -126,5 +126,12 @@ public class LuceneRepositoryContentIndexStub
// TODO Auto-generated method stub
}
+
+ public void deleteRecord( LuceneRepositoryContentRecord record )
+ throws RepositoryIndexException
+ {
+ // TODO Auto-generated method stub
+
+ }
}
diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumer.java b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumer.java
index 32a9ce938..a6f729395 100644
--- a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumer.java
+++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumer.java
@@ -22,19 +22,27 @@ package org.apache.maven.archiva.consumers.lucene;
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer;
+import org.apache.maven.archiva.indexer.RepositoryContentIndex;
+import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
+import org.apache.maven.archiva.indexer.RepositoryIndexException;
+import org.apache.maven.archiva.indexer.bytecode.BytecodeRecord;
+import org.apache.maven.archiva.indexer.filecontent.FileContentRecord;
+import org.apache.maven.archiva.indexer.hashcodes.HashcodesRecord;
import org.apache.maven.archiva.model.ArchivaArtifact;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
+import org.apache.maven.archiva.repository.RepositoryContentFactory;
+import org.apache.maven.archiva.repository.RepositoryException;
+import java.io.File;
import java.util.List;
/**
- * LuceneCleanupRemoveIndexedConsumer
- *
+ * LuceneCleanupRemoveIndexedConsumer
+ *
* @author Joakim Erdfelt
* @version $Id$
- *
* @plexus.component role="org.apache.maven.archiva.consumers.DatabaseCleanupConsumer"
- * role-hint="not-present-remove-indexed"
- * instantiation-strategy="per-lookup"
+ * role-hint="not-present-remove-indexed" instantiation-strategy="per-lookup"
*/
public class LuceneCleanupRemoveIndexedConsumer
extends AbstractMonitoredConsumer
@@ -50,6 +58,16 @@ public class LuceneCleanupRemoveIndexedConsumer
*/
private String description;
+ /**
+ * @plexus.requirement role-hint="lucene"
+ */
+ private RepositoryContentIndexFactory repoIndexFactory;
+
+ /**
+ * @plexus.requirement
+ */
+ private RepositoryContentFactory repoFactory;
+
public void beginScan()
{
// TODO Auto-generated method stub
@@ -71,8 +89,41 @@ public class LuceneCleanupRemoveIndexedConsumer
public void processArchivaArtifact( ArchivaArtifact artifact )
throws ConsumerException
{
- // TODO Auto-generated method stub
+ try
+ {
+ ManagedRepositoryContent repoContent =
+ repoFactory.getManagedRepositoryContent( artifact.getModel().getRepositoryId() );
+ File file = new File( repoContent.getRepoRoot(), repoContent.toPath( artifact ) );
+
+ if( !file.exists() )
+ {
+ RepositoryContentIndex bytecodeIndex = repoIndexFactory.createBytecodeIndex( repoContent.getRepository() );
+ RepositoryContentIndex hashcodesIndex = repoIndexFactory.createHashcodeIndex( repoContent.getRepository() );
+ RepositoryContentIndex fileContentIndex =
+ repoIndexFactory.createFileContentIndex( repoContent.getRepository() );
+
+ FileContentRecord fileContentRecord = new FileContentRecord();
+ fileContentRecord.setFilename( repoContent.toPath( artifact ) );
+ fileContentIndex.deleteRecord( fileContentRecord );
+
+ HashcodesRecord hashcodesRecord = new HashcodesRecord();
+ hashcodesRecord.setArtifact( artifact );
+ hashcodesIndex.deleteRecord( hashcodesRecord );
+
+ BytecodeRecord bytecodeRecord = new BytecodeRecord();
+ bytecodeRecord.setArtifact( artifact );
+ bytecodeIndex.deleteRecord( bytecodeRecord );
+ }
+ }
+ catch ( RepositoryException e )
+ {
+ throw new ConsumerException( "Can't run index cleanup consumer: " + e.getMessage() );
+ }
+ catch ( RepositoryIndexException e )
+ {
+ throw new ConsumerException( e.getMessage() );
+ }
}
public String getDescription()
@@ -90,4 +141,13 @@ public class LuceneCleanupRemoveIndexedConsumer
return false;
}
+ public void setRepositoryIndexFactory( RepositoryContentIndexFactory repoIndexFactory )
+ {
+ this.repoIndexFactory = repoIndexFactory;
+ }
+
+ public void setRepositoryContentFactory( RepositoryContentFactory repoFactory )
+ {
+ this.repoFactory = repoFactory;
+ }
}
diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/conf/repository-manager.xml b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/conf/repository-manager.xml
new file mode 100644
index 000000000..4e2e394cb
--- /dev/null
+++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/conf/repository-manager.xml
@@ -0,0 +1,129 @@
+
+
+
+
+ 1
+
+
+ test-repo
+ Test Repository
+ file://src/test/resources/test-repo
+ default
+ true
+ true
+ true
+ 0 0 * * ?
+ 0
+ 2
+
+
+
+
+
+
+
+ example
+ http
+ proxy.mycompany.com
+ 8080
+ myself
+ mypass
+
+
+
+
+
+
+ artifacts
+
+ **/*.pom
+ **/*.jar
+ **/*.ear
+ **/*.war
+
+
+
+ indexable-content
+
+ **/*.txt
+ **/*.TXT
+
+
+
+ auto-remove
+
+ **/*.bak
+ **/*~
+ **/*-
+
+
+
+ ignored
+
+ **/.htaccess
+ **/KEYS
+ **/*.rb
+ **/*.sh
+ **/.svn/**
+ **/.DAV/**
+
+
+
+
+ update-db-artifact
+ create-missing-checksums
+ update-db-repository-metadata
+ validate-checksum
+ validate-signature
+ index-content
+ auto-remove
+ auto-rename
+ repository-purge
+
+
+ update-db-bad-content
+
+
+
+
+ 0 0 * * ?
+
+ index-artifact
+ update-db-project
+ validate-repository-metadata
+ index-archive-toc
+ update-db-bytecode-stats
+ index-public-methods
+
+
+ not-present-remove-db-artifact
+ not-present-remove-db-project
+ not-present-remove-indexed
+
+
+
+
+
+ true
+ true
+
+
+
+
diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumerTest.java b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumerTest.java
new file mode 100644
index 000000000..64eeae2bd
--- /dev/null
+++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumerTest.java
@@ -0,0 +1,77 @@
+package org.apache.maven.archiva.consumers.lucene;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer;
+import org.apache.maven.archiva.model.ArchivaArtifact;
+import org.apache.maven.archiva.model.ArchivaArtifactModel;
+import org.codehaus.plexus.PlexusTestCase;
+
+/**
+ * LuceneCleanupRemoveIndexedConsumerTest
+ *
+ * @author Maria Odea Ching
+ * @version
+ */
+public class LuceneCleanupRemoveIndexedConsumerTest
+ extends PlexusTestCase
+{
+ private DatabaseCleanupConsumer luceneCleanupRemoveIndexConsumer;
+
+ public void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ luceneCleanupRemoveIndexConsumer = (DatabaseCleanupConsumer)
+ lookup( DatabaseCleanupConsumer.class, "lucene-cleanup" );
+ }
+
+ public void testIfArtifactExists()
+ throws Exception
+ {
+ ArchivaArtifact artifact = createArtifact(
+ "org.apache.maven.archiva", "archiva-lucene-cleanup", "1.0", "jar" );
+
+ luceneCleanupRemoveIndexConsumer.processArchivaArtifact( artifact );
+ }
+
+ public void testIfArtifactDoesNotExist()
+ throws Exception
+ {
+ ArchivaArtifact artifact = createArtifact(
+ "org.apache.maven.archiva", "deleted-artifact", "1.0", "jar" );
+
+ luceneCleanupRemoveIndexConsumer.processArchivaArtifact( artifact );
+ }
+
+ private ArchivaArtifact createArtifact( String groupId, String artifactId, String version, String type )
+ {
+ ArchivaArtifactModel model = new ArchivaArtifactModel();
+ model.setGroupId( groupId );
+ model.setArtifactId( artifactId );
+ model.setVersion( version );
+ model.setType( type );
+ model.setRepositoryId( "test-repo" );
+
+ return new ArchivaArtifact( model );
+ }
+
+}
diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/maven/archiva/consumers/lucene/stubs/LuceneRepositoryContentIndexFactoryStub.java b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/maven/archiva/consumers/lucene/stubs/LuceneRepositoryContentIndexFactoryStub.java
new file mode 100644
index 000000000..b7ede95b2
--- /dev/null
+++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/maven/archiva/consumers/lucene/stubs/LuceneRepositoryContentIndexFactoryStub.java
@@ -0,0 +1,55 @@
+package org.apache.maven.archiva.consumers.lucene.stubs;
+
+/*
+ * 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.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.indexer.RepositoryContentIndex;
+import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
+import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentIndex;
+
+/**
+ * LuceneRepositoryContenIndexFactoryStub
+ *
+ * @author Maria Odea Ching
+ * @version
+ */
+public class LuceneRepositoryContentIndexFactoryStub
+ implements RepositoryContentIndexFactory
+{
+
+ public RepositoryContentIndex createBytecodeIndex( ManagedRepositoryConfiguration repository )
+ {
+ // TODO Auto-generated method stub
+ return new LuceneRepositoryContentIndexStub();
+ }
+
+ public RepositoryContentIndex createFileContentIndex( ManagedRepositoryConfiguration repository )
+ {
+ // TODO Auto-generated method stub
+ return new LuceneRepositoryContentIndexStub();
+ }
+
+ public RepositoryContentIndex createHashcodeIndex( ManagedRepositoryConfiguration repository )
+ {
+ // TODO Auto-generated method stub
+ return new LuceneRepositoryContentIndexStub();
+ }
+
+}
diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/maven/archiva/consumers/lucene/stubs/LuceneRepositoryContentIndexStub.java b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/maven/archiva/consumers/lucene/stubs/LuceneRepositoryContentIndexStub.java
new file mode 100644
index 000000000..a5b40c8d9
--- /dev/null
+++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/maven/archiva/consumers/lucene/stubs/LuceneRepositoryContentIndexStub.java
@@ -0,0 +1,145 @@
+package org.apache.maven.archiva.consumers.lucene.stubs;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.Searchable;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.indexer.RepositoryContentIndex;
+import org.apache.maven.archiva.indexer.RepositoryIndexException;
+import org.apache.maven.archiva.indexer.RepositoryIndexSearchException;
+import org.apache.maven.archiva.indexer.lucene.LuceneEntryConverter;
+import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentRecord;
+
+/**
+ * @author Maria Odea Ching
+ * @version
+ */
+public class LuceneRepositoryContentIndexStub
+ implements RepositoryContentIndex
+{
+
+ public void deleteRecords( Collection records )
+ throws RepositoryIndexException
+ {
+ // TODO Auto-generated method stub
+ Assert.assertEquals( 2, records.size() );
+ }
+
+ public boolean exists()
+ throws RepositoryIndexException
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public Collection getAllRecordKeys()
+ throws RepositoryIndexException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Analyzer getAnalyzer()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public LuceneEntryConverter getEntryConverter()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getId()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public File getIndexDirectory()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public QueryParser getQueryParser()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ManagedRepositoryConfiguration getRepository()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Searchable getSearchable()
+ throws RepositoryIndexSearchException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void indexRecords( Collection records )
+ throws RepositoryIndexException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void modifyRecord( LuceneRepositoryContentRecord record )
+ throws RepositoryIndexException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void modifyRecords( Collection records )
+ throws RepositoryIndexException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void deleteRecord( LuceneRepositoryContentRecord record )
+ throws RepositoryIndexException
+ {
+ Assert.assertNotNull( record );
+
+ // fail since the record to be deleted should only be the deleted-artifact-1.0.jar
+ // according to the tests
+ if( record.getPrimaryKey().equals(
+ "org/apache/maven/archiva/archiva-lucene-cleanup/1.0/archiva-lucene-cleanup-1.0.jar" ) &&
+ record.getPrimaryKey().equals( "org.apache.maven.archiva:archiva-lucene-cleanup:1.0:jar" ) )
+ {
+ Assert.fail();
+ }
+ }
+
+}
diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumerTest.xml b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumerTest.xml
new file mode 100644
index 000000000..99a7a2d9f
--- /dev/null
+++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/org/apache/maven/archiva/consumers/lucene/LuceneCleanupRemoveIndexedConsumerTest.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+ org.apache.maven.archiva.consumers.DatabaseCleanupConsumer
+ lucene-cleanup
+ org.apache.maven.archiva.consumers.lucene.LuceneCleanupRemoveIndexedConsumer
+
+
+ org.apache.maven.archiva.indexer.RepositoryContentIndexFactory
+ lucene-cleanup
+ repoIndexFactory
+
+
+ org.apache.maven.archiva.repository.RepositoryContentFactory
+
+
+
+
+ org.apache.maven.archiva.repository.RepositoryContentFactory
+ org.apache.maven.archiva.repository.RepositoryContentFactory
+
+
+ org.apache.maven.archiva.configuration.ArchivaConfiguration
+ lucene-cleanup
+
+
+
+
+ org.apache.maven.archiva.configuration.ArchivaConfiguration
+ lucene-cleanup
+ org.apache.maven.archiva.configuration.DefaultArchivaConfiguration
+
+
+ org.codehaus.plexus.registry.Registry
+ lucene-cleanup
+
+
+
+
+ org.codehaus.plexus.registry.Registry
+ lucene-cleanup
+ org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry
+
+
+
+
+
+
+
+ org.apache.maven.archiva.indexer.RepositoryContentIndexFactory
+ org.apache.maven.archiva.consumers.lucene.stubs.LuceneRepositoryContentIndexFactoryStub
+ lucene-cleanup
+
+
+
+
diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/test-repo/org/apache/maven/archiva/archiva-lucene-cleanup/1.0/archiva-lucene-cleanup-1.0.jar b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/test-repo/org/apache/maven/archiva/archiva-lucene-cleanup/1.0/archiva-lucene-cleanup-1.0.jar
new file mode 100644
index 000000000..e69de29bb
diff --git a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndex.java b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndex.java
index b45f5727a..be089107e 100644
--- a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndex.java
+++ b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndex.java
@@ -80,6 +80,15 @@ public interface RepositoryContentIndex
*/
void deleteRecords( Collection records )
throws RepositoryIndexException;
+
+ /**
+ * Delete a record from the index. Simply ignore the request any did not exist.
+ *
+ * @param record the record to be deleted
+ * @throws RepositoryIndexException if there is a problem removing the record
+ */
+ void deleteRecord( LuceneRepositoryContentRecord record )
+ throws RepositoryIndexException;
/**
* Retrieve all primary keys of records in the index.
diff --git a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndex.java b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndex.java
index 369d67535..469418cdf 100644
--- a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndex.java
+++ b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndex.java
@@ -234,6 +234,38 @@ public class LuceneRepositoryContentIndex
}
}
+ public void deleteRecord( LuceneRepositoryContentRecord record )
+ throws RepositoryIndexException
+ {
+ synchronized( repository )
+ {
+ if ( exists() )
+ {
+ IndexReader indexReader = null;
+ try
+ {
+ indexReader = IndexReader.open( indexLocation );
+
+ if ( record != null )
+ {
+ Term term = new Term( LuceneDocumentMaker.PRIMARY_KEY, record.getPrimaryKey() );
+
+ indexReader.deleteDocuments( term );
+ }
+ }
+ catch ( IOException e )
+ {
+ throw new RepositoryIndexException( "Error deleting document: " + e.getMessage(), e );
+ }
+ finally
+ {
+ closeQuietly( indexReader );
+ }
+ }
+ }
+ }
+
+
public Collection getAllRecordKeys()
throws RepositoryIndexException
{