1 package org.apache.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.archiva.repository.Repository;
23 import org.apache.archiva.repository.RepositoryType;
25 import java.io.IOException;
27 import java.time.LocalDateTime;
28 import java.time.ZonedDateTime;
32 * This represents a indexing context that is used to manage the index of a certain repository.
35 public interface ArchivaIndexingContext {
38 * The identifier of the context
44 * Returns the repository this index context is associated to.
47 Repository getRepository();
50 * The path where the index is stored.
56 * Returns true, if the index has no entries or is not initialized.
59 boolean isEmpty() throws IOException;
62 * Writes the last changes to the index.
65 void commit() throws IOException;
68 * Throws away the last changes.
71 void rollback() throws IOException;
77 void optimize() throws IOException;
80 * Closes any resources, this context has open.
81 * @param deleteFiles True, if the index files should be deleted.
84 void close(boolean deleteFiles) throws IOException;
87 * Removes all entries from the index. After this method finished,
88 * isEmpty() should return true.
91 void purge() throws IOException;
94 * Returns true, if this index implementation has support for the given repository specific
95 * implementation class.
99 boolean supports(Class<?> clazz);
102 * Returns the repository specific implementation of the index. E.g. the maven index class.
103 * @param clazz the specific class
104 * @return the instance of the given class representing this index
105 * @throws UnsupportedOperationException if the implementation is not supported
107 <T> T getBaseContext(Class<T> clazz) throws UnsupportedOperationException;
112 * Returns the list of groups that are assigned to this index
115 Set<String> getGroups() throws IOException;
118 * Updates the timestamp of the index.
120 * @throws IOException
122 void updateTimestamp(boolean save) throws IOException;
125 * Updates the timestamp with the given time.
128 * @throws IOException
130 void updateTimestamp(boolean save, ZonedDateTime time) throws IOException;