You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ArchivaIndexManager.java 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. package org.apache.archiva.indexer;
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. */
  20. import org.apache.archiva.repository.Repository;
  21. import org.apache.archiva.repository.RepositoryType;
  22. import java.net.URI;
  23. import java.util.Collection;
  24. import java.util.List;
  25. public interface ArchivaIndexManager {
  26. String DEFAULT_INDEX_PATH=".indexer";
  27. String DEFAULT_PACKED_INDEX_PATH=".index";
  28. /**
  29. * Compresses the index to a more dense packed format.
  30. * @param context
  31. */
  32. void pack(ArchivaIndexingContext context) throws IndexUpdateFailedException;
  33. /**
  34. * Rescans the whole repository, this index is associated to.
  35. * @param context
  36. *
  37. */
  38. void scan(ArchivaIndexingContext context) throws IndexUpdateFailedException;
  39. /**
  40. * Updates the index from the remote url.
  41. * @param context
  42. * @param fullUpdate
  43. */
  44. void update(ArchivaIndexingContext context, boolean fullUpdate) throws IndexUpdateFailedException;
  45. /**
  46. * Adds a list of artifacts to the index.
  47. * @param context
  48. * @param artifactReference
  49. */
  50. void addArtifactsToIndex(ArchivaIndexingContext context, Collection<URI> artifactReference) throws IndexUpdateFailedException;
  51. /**
  52. * Removes a list of artifacts from the index.
  53. * @param context
  54. * @param artifactReference
  55. */
  56. void removeArtifactsFromIndex(ArchivaIndexingContext context, Collection<URI> artifactReference) throws IndexUpdateFailedException;
  57. /**
  58. * Returns true, if this manager is able to apply the index actions for the given repository type.
  59. * @param type
  60. * @return
  61. */
  62. boolean supportsRepository(RepositoryType type);
  63. /**
  64. * Creates the indexing context for the given repository.
  65. * @param repository the repository for which the index context should be created
  66. * @return the index context
  67. */
  68. ArchivaIndexingContext createContext(Repository repository) throws IndexCreationFailedException;
  69. /**
  70. * Reinitializes the index. E.g. remove the files and create a new empty index.
  71. *
  72. * @param context
  73. * @return the new created index
  74. */
  75. ArchivaIndexingContext reset(ArchivaIndexingContext context) throws IndexUpdateFailedException;
  76. /**
  77. * Moves the context to a new directory. It's up to the implementation, if a new context is created
  78. * or the context is moved only.
  79. *
  80. * @param context The current context
  81. * @param repo The repository
  82. * @return The new context
  83. * @throws IndexCreationFailedException
  84. */
  85. ArchivaIndexingContext move(ArchivaIndexingContext context, Repository repo) throws IndexCreationFailedException;
  86. /**
  87. * Updates the local path where the index is stored using the repository information.
  88. * @return
  89. */
  90. void updateLocalIndexPath(Repository repo);
  91. /**
  92. * Merges a list of contexts into a single one.
  93. *
  94. * @param destinationRepo The destination repository
  95. * @param contexts The contexts of the indexes that should be merged.
  96. * @param packIndex True, if the merged index should be packed, otherwise false.
  97. * @return The merged context
  98. * @throws UnsupportedOperationException if the underlying implementation does not allow to merge indexing contexts
  99. */
  100. ArchivaIndexingContext mergeContexts(Repository destinationRepo, List<ArchivaIndexingContext> contexts,
  101. boolean packIndex) throws UnsupportedOperationException,
  102. IndexCreationFailedException;
  103. }