1 package org.apache.archiva.repository.features;
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
24 import java.time.Duration;
27 * Feature for remote index download.
29 public class RemoteIndexFeature implements RepositoryFeature<RemoteIndexFeature> {
31 private boolean downloadRemoteIndex = false;
33 private boolean downloadRemoteIndexOnStartup = false;
34 private Duration downloadTimeout = Duration.ofSeconds( 600 );
35 private String proxyId = "";
39 public RemoteIndexFeature get() {
44 * True, if the remote index should be downloaded.
45 * @return True if download, otherwise false.
47 public boolean isDownloadRemoteIndex() {
48 return downloadRemoteIndex;
51 public void setDownloadRemoteIndex(boolean downloadRemoteIndex) {
52 this.downloadRemoteIndex = downloadRemoteIndex;
56 * The URI to access the remote index. May be a relative URI that is relative to the
61 public URI getIndexUri() {
66 * Sets the URI to access the remote index. May be a relative URI that is relative to the
67 * repository URI. The allowed URI schemes are dependent on the repository type.
69 * @param indexUri The URI of the index
71 public void setIndexUri(URI indexUri) {
72 this.indexUri = indexUri;
76 * Returns true, if the remote index should be downloaded on startup of the repository.
77 * @return true, if the index should be downloaded during startup, otherwise false.
79 public boolean isDownloadRemoteIndexOnStartup() {
80 return downloadRemoteIndexOnStartup;
84 * Sets the flag for download of the remote repository index.
86 * @param downloadRemoteIndexOnStartup
88 public void setDownloadRemoteIndexOnStartup(boolean downloadRemoteIndexOnStartup) {
89 this.downloadRemoteIndexOnStartup = downloadRemoteIndexOnStartup;
93 * Returns the timeout after that the remote index download is aborted.
94 * @return the time duration after that, the download is aborted.
96 public Duration getDownloadTimeout() {
97 return this.downloadTimeout;
101 * Sets the timeout after that a remote index download will be aborted.
102 * @param timeout The duration
104 public void setDownloadTimeout(Duration timeout) {
105 this.downloadTimeout = timeout;
109 * Returns the id of the proxy, that should be used to download the remote index.
110 * @return The proxy id
112 public String getProxyId( )
118 * Sets the id of the proxy that should be used to download the remote index.
121 public void setProxyId( String proxyId )
123 this.proxyId = proxyId;