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