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.

RepositoryContentProvider.java 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package org.apache.archiva.repository;
  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 java.util.Set;
  21. /**
  22. * A repository content provider creates repository content instances for specific repository types.
  23. */
  24. public interface RepositoryContentProvider
  25. {
  26. /**
  27. * Returns true, if this content object supports the given layout otherwise, false.
  28. * @param layout the layout string
  29. * @return true, if layout is supported, otherwise false.
  30. */
  31. boolean supportsLayout(String layout);
  32. /**
  33. * Returns the repository types, this content object can be used for.
  34. *
  35. * @return all supported repository types.
  36. */
  37. Set<RepositoryType> getSupportedRepositoryTypes();
  38. /**
  39. * Returns true, if this content object supports the given repository type.
  40. *
  41. * @param type the type to check.
  42. * @return true, if the type is supported, otherwise false.
  43. */
  44. boolean supports(RepositoryType type);
  45. /**
  46. * Creates a new instance of RemoteRepositoryContent. The returned instance should be initialized
  47. * from the given repository data.
  48. *
  49. * @param repository the repository
  50. * @return a repository content instance
  51. * @throws RepositoryException if the layout is not supported, or a error occured during initialization
  52. */
  53. RemoteRepositoryContent createRemoteContent(RemoteRepository repository) throws RepositoryException;
  54. /**
  55. * Creates a new instance of ManagedRepositoryContent.
  56. *
  57. * @param repository the repository
  58. * @return a new instance
  59. * @throws RepositoryException if the layout is not supported, or a error occured during initialization
  60. */
  61. ManagedRepositoryContent createManagedContent(ManagedRepository repository) throws RepositoryException;
  62. /**
  63. * Creates a generic content object.
  64. *
  65. * @param repository the repository
  66. * @param clazz the content class
  67. * @param <T> the generic type of the content
  68. * @param <V> the generic type of the repository (must correspond to the content class)
  69. * @return a new instance
  70. * @throws RepositoryException if the clazz, or layout is not supported, or something went wrong during initialization
  71. */
  72. <T extends RepositoryContent, V extends Repository> T createContent(Class<T> clazz, V repository) throws RepositoryException;
  73. }