1 package org.apache.archiva.repository;
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
23 import java.time.Duration;
24 import java.util.Collections;
25 import java.util.HashMap;
26 import java.util.Locale;
30 * Abstract implementation of a remote repository. Abstract classes must implement the
31 * features and capabilities by themselves.
33 public abstract class AbstractRemoteRepository extends AbstractRepository implements EditableRemoteRepository
36 private RepositoryCredentials credentials;
37 private String checkPath;
38 private Map<String,String> extraParameters = new HashMap<>( );
39 private Map<String,String> uExtraParameters = Collections.unmodifiableMap( extraParameters );
40 private Map<String,String> extraHeaders = new HashMap<>( );
41 private Map<String,String> uExtraHeaders = Collections.unmodifiableMap( extraHeaders );
42 private Duration timeout;
43 private String proxyId;
44 private RemoteRepositoryContent content;
46 public AbstractRemoteRepository( RepositoryType type, String id, String name )
48 super( type, id, name );
51 public AbstractRemoteRepository( Locale primaryLocale, RepositoryType type, String id, String name )
53 super( primaryLocale, type, id, name );
57 public void setCredentials( RepositoryCredentials credentials )
59 this.credentials = credentials;
63 public void setCheckPath( String path )
65 this.checkPath = path;
69 public void setExtraParameters( Map<String, String> params )
71 this.extraParameters.clear();
72 this.extraParameters.putAll(params);
76 public void addExtraParameter( String key, String value )
78 this.extraParameters.put(key, value);
82 public void setExtraHeaders( Map<String, String> headers )
84 this.extraHeaders.clear();
85 this.extraHeaders.putAll(headers);
89 public void addExtraHeader( String header, String value )
91 this.extraHeaders.put(header, value);
95 public void setTimeout( Duration duration )
97 this.timeout = duration;
101 public RemoteRepositoryContent getContent( )
107 public void setContent(RemoteRepositoryContent content) {
108 this.content = content;
112 public RepositoryCredentials getLoginCredentials( )
118 public String getCheckPath( )
124 public Map<String, String> getExtraParameters( )
126 return uExtraParameters;
130 public Map<String, String> getExtraHeaders( )
132 return uExtraHeaders;
136 public Duration getTimeout( )