This project has retired. For details please refer to its Attic page.
ArchivaIndexManager xref
View Javadoc
1   package org.apache.archiva.indexer;
2   
3   /*
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
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
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
19   * under the License.
20   */
21  
22  import org.apache.archiva.repository.Repository;
23  import org.apache.archiva.repository.RepositoryType;
24  
25  import java.net.URI;
26  import java.util.Collection;
27  import java.util.List;
28  
29  public interface ArchivaIndexManager {
30  
31      String DEFAULT_INDEX_PATH=".indexer";
32      String DEFAULT_PACKED_INDEX_PATH=".index";
33  
34      /**
35       * Compresses the index to a more dense packed format.
36       * @param context
37       */
38      void pack(ArchivaIndexingContext context) throws IndexUpdateFailedException;
39  
40      /**
41       * Rescans the whole repository, this index is associated to.
42       * @param context
43       *
44       */
45      void scan(ArchivaIndexingContext context) throws IndexUpdateFailedException;
46  
47      /**
48       * Updates the index from the remote url.
49       * @param context
50       * @param fullUpdate
51       */
52      void update(ArchivaIndexingContext context, boolean fullUpdate) throws IndexUpdateFailedException;
53  
54      /**
55       * Adds a list of artifacts to the index.
56       * @param context
57       * @param artifactReference
58       */
59      void addArtifactsToIndex(ArchivaIndexingContext context, Collection<URI> artifactReference) throws IndexUpdateFailedException;
60  
61      /**
62       * Removes a list of artifacts from the index.
63       * @param context
64       * @param artifactReference
65       */
66      void removeArtifactsFromIndex(ArchivaIndexingContext context, Collection<URI> artifactReference) throws IndexUpdateFailedException;
67  
68  
69      /**
70       * Returns true, if this manager is able to apply the index actions for the given repository type.
71       * @param type
72       * @return
73       */
74      boolean supportsRepository(RepositoryType type);
75  
76      /**
77       * Creates the indexing context for the given repository.
78       * @param repository the repository for which the index context should be created
79       * @return the index context
80       */
81      ArchivaIndexingContext createContext(Repository repository) throws IndexCreationFailedException;
82  
83      /**
84       * Reinitializes the index. E.g. remove the files and create a new empty index.
85       *
86       * @param context
87       * @return the new created index
88       */
89      ArchivaIndexingContextorg/apache/archiva/indexer/ArchivaIndexingContext.html#ArchivaIndexingContext">ArchivaIndexingContext reset(ArchivaIndexingContext context) throws IndexUpdateFailedException;
90  
91      /**
92       * Moves the context to a new directory. It's up to the implementation, if a new context is created
93       * or the context is moved only.
94       *
95       * @param context The current context
96       * @param repo The repository
97       * @return The new context
98       * @throws IndexCreationFailedException
99       */
100     ArchivaIndexingContext/org/apache/archiva/indexer/ArchivaIndexingContext.html#ArchivaIndexingContext">ArchivaIndexingContext move(ArchivaIndexingContext context, Repository repo) throws IndexCreationFailedException;
101 
102     /**
103      * Updates the local path where the index is stored using the repository information.
104      * @return
105      */
106     void updateLocalIndexPath(Repository repo);
107 
108 
109     /**
110      * Merges a list of contexts into a single one.
111      *
112      * @param destinationRepo The destination repository
113      * @param contexts The contexts of the indexes that should be merged.
114      * @param packIndex True, if the merged index should be packed, otherwise false.
115      * @return The merged context
116      * @throws UnsupportedOperationException if the underlying implementation does not allow to merge indexing contexts
117      */
118     ArchivaIndexingContext mergeContexts(Repository destinationRepo, List<ArchivaIndexingContext> contexts,
119                                          boolean packIndex) throws UnsupportedOperationException,
120             IndexCreationFailedException;
121 }