1 package org.apache.maven.archiva.indexer;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.lucene.analysis.Analyzer;
23 import org.apache.lucene.queryParser.QueryParser;
24 import org.apache.lucene.search.Searchable;
25 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
26 import org.apache.maven.archiva.indexer.lucene.LuceneEntryConverter;
27 import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentRecord;
30 import java.util.Collection;
33 * Common access methods for a Repository Content index.
35 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
37 public interface RepositoryContentIndex
40 * Indexes the records.
42 * @param records list of {@link LuceneRepositoryContentRecord} objects.
43 * @throws RepositoryIndexException if there is a problem indexing the records.
45 void indexRecords( Collection records )
46 throws RepositoryIndexException;
49 * Modify (potentially) existing records in the index.
51 * @param records the collection of {@link LuceneRepositoryContentRecord} objects to modify in the index.
52 * @throws RepositoryIndexException if there is a problem modifying the records.
54 public void modifyRecords( Collection records )
55 throws RepositoryIndexException;
58 * Modify an existing (potential) record in the index.
60 * @param record the record to modify.
61 * @throws RepositoryIndexException if there is a problem modifying the record.
63 public void modifyRecord( LuceneRepositoryContentRecord record )
64 throws RepositoryIndexException;
67 * Check if the index already exists.
69 * @return true if the index already exists
70 * @throws RepositoryIndexException if the index location is not valid
73 throws RepositoryIndexException;
76 * Delete records from the index. Simply ignore the request any did not exist.
78 * @param records the records to delete
79 * @throws RepositoryIndexException if there is a problem removing the record
81 void deleteRecords( Collection records )
82 throws RepositoryIndexException;
85 * Retrieve all primary keys of records in the index.
88 * @throws RepositoryIndexException if there was an error searching the index
90 Collection getAllRecordKeys()
91 throws RepositoryIndexException;
94 * Get the index directory.
96 * @return the index directory.
98 File getIndexDirectory();
101 * Get the {@link QueryParser} appropriate for searches within this index.
103 * @return the query parser;
105 QueryParser getQueryParser();
108 * Get the id of index.
110 * @return the id of index.
115 * Get the repository that this index belongs to.
117 * @return the repository that this index belongs to.
119 ManagedRepositoryConfiguration getRepository();
122 * Get the analyzer in use for this index.
124 * @return the analyzer in use.
126 Analyzer getAnalyzer();
129 * Get the document to record (and back again) converter.
131 * @return the converter in use.
133 LuceneEntryConverter getEntryConverter();
136 * Create a Searchable for this index.
138 * @return the Searchable.
139 * @throws RepositoryIndexSearchException if there was a problem creating the searchable.
141 Searchable getSearchable()
142 throws RepositoryIndexSearchException;