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;
24 import org.apache.archiva.repository.content.StorageAsset;
27 import java.nio.file.Path;
28 import java.util.Collection;
29 import java.util.List;
31 public interface ArchivaIndexManager {
33 String DEFAULT_INDEX_PATH=".indexer";
34 String DEFAULT_PACKED_INDEX_PATH=".index";
37 * Compresses the index to a more dense packed format.
40 void pack(ArchivaIndexingContext context) throws IndexUpdateFailedException;
43 * Rescans the whole repository, this index is associated to.
47 void scan(ArchivaIndexingContext context) throws IndexUpdateFailedException;
50 * Updates the index from the remote url.
54 void update(ArchivaIndexingContext context, boolean fullUpdate) throws IndexUpdateFailedException;
57 * Adds a list of artifacts to the index.
59 * @param artifactReference
61 void addArtifactsToIndex(ArchivaIndexingContext context, Collection<URI> artifactReference) throws IndexUpdateFailedException;
64 * Removes a list of artifacts from the index.
66 * @param artifactReference
68 void removeArtifactsFromIndex(ArchivaIndexingContext context, Collection<URI> artifactReference) throws IndexUpdateFailedException;
72 * Returns true, if this manager is able to apply the index actions for the given repository type.
76 boolean supportsRepository(RepositoryType type);
79 * Creates the indexing context for the given repository.
80 * @param repository the repository for which the index context should be created
81 * @return the index context
83 ArchivaIndexingContext createContext(Repository repository) throws IndexCreationFailedException;
86 * Reinitializes the index. E.g. remove the files and create a new empty index.
89 * @return the new created index
91 ArchivaIndexingContext reset(ArchivaIndexingContext context) throws IndexUpdateFailedException;
94 * Moves the context to a new directory. It's up to the implementation, if a new context is created
95 * or the context is moved only.
97 * @param context The current context
98 * @param repo The repository
99 * @return The new context
100 * @throws IndexCreationFailedException
102 ArchivaIndexingContext move(ArchivaIndexingContext context, Repository repo) throws IndexCreationFailedException;
105 * Updates the local path where the index is stored using the repository information.
108 void updateLocalIndexPath(Repository repo);
112 * Merges a list of contexts into a single one.
114 * @param destinationRepo The destination repository
115 * @param contexts The contexts of the indexes that should be merged.
116 * @param packIndex True, if the merged index should be packed, otherwise false.
117 * @return The merged context
118 * @throws UnsupportedOperationException if the underlying implementation does not allow to merge indexing contexts
120 ArchivaIndexingContext mergeContexts(Repository destinationRepo, List<ArchivaIndexingContext> contexts,
121 boolean packIndex) throws UnsupportedOperationException,
122 IndexCreationFailedException;