This project has retired. For details please refer to its
Attic page.
AbstractRemoteRepository xref
1 package org.apache.archiva.repository.base;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import org.apache.archiva.repository.EditableRemoteRepository;
24 import org.apache.archiva.repository.RemoteRepositoryContent;
25 import org.apache.archiva.repository.RepositoryCredentials;
26 import org.apache.archiva.repository.RepositoryType;
27 import org.apache.archiva.repository.storage.RepositoryStorage;
28 import org.apache.archiva.repository.storage.StorageAsset;
29
30 import java.net.URI;
31 import java.time.Duration;
32 import java.util.Collections;
33 import java.util.HashMap;
34 import java.util.Locale;
35 import java.util.Map;
36
37
38
39
40
41 public abstract class AbstractRemoteRepository extends AbstractRepository implements EditableRemoteRepository
42 {
43
44 private RepositoryCredentials credentials;
45 private String checkPath;
46 private Map<String,String> extraParameters = new HashMap<>( );
47 private Map<String,String> uExtraParameters = Collections.unmodifiableMap( extraParameters );
48 private Map<String,String> extraHeaders = new HashMap<>( );
49 private Map<String,String> uExtraHeaders = Collections.unmodifiableMap( extraHeaders );
50 private Duration timeout = Duration.ofSeconds( 60 );
51 private String proxyId;
52 private RemoteRepositoryContent content;
53
54 public AbstractRemoteRepository( RepositoryType type, String id, String name , RepositoryStorage storage)
55 {
56 super( type, id, name, storage );
57 }
58
59 public AbstractRemoteRepository( Locale primaryLocale, RepositoryType type, String id, String name, RepositoryStorage storage )
60 {
61 super( primaryLocale, type, id, name, storage );
62 }
63
64 @Override
65 public void setCredentials( RepositoryCredentials credentials )
66 {
67 this.credentials = credentials;
68 }
69
70 @Override
71 public void setCheckPath( String path )
72 {
73 this.checkPath = path;
74 }
75
76 @Override
77 public void setExtraParameters( Map<String, String> params )
78 {
79 this.extraParameters.clear();
80 this.extraParameters.putAll(params);
81 }
82
83 @Override
84 public void addExtraParameter( String key, String value )
85 {
86 this.extraParameters.put(key, value);
87 }
88
89 @Override
90 public void setExtraHeaders( Map<String, String> headers )
91 {
92 this.extraHeaders.clear();
93 this.extraHeaders.putAll(headers);
94 }
95
96 @Override
97 public void addExtraHeader( String header, String value )
98 {
99 this.extraHeaders.put(header, value);
100 }
101
102 @Override
103 public void setTimeout( Duration duration )
104 {
105 this.timeout = duration;
106 }
107
108 @Override
109 public RemoteRepositoryContent getContent( )
110 {
111 return content;
112 }
113
114 @Override
115 public void setContent(RemoteRepositoryContent content) {
116 this.content = content;
117 }
118
119 @Override
120 public RepositoryCredentials getLoginCredentials( )
121 {
122 return credentials;
123 }
124
125 @Override
126 public String getCheckPath( )
127 {
128 return checkPath;
129 }
130
131 @Override
132 public Map<String, String> getExtraParameters( )
133 {
134 return uExtraParameters;
135 }
136
137 @Override
138 public Map<String, String> getExtraHeaders( )
139 {
140 return uExtraHeaders;
141 }
142
143 @Override
144 public Duration getTimeout( )
145 {
146 return timeout;
147 }
148
149
150
151
152
153 @Override
154 public StorageAsset getLocalPath() {
155 return getStorage().getAsset("");
156 }
157
158 @Override
159 public String toString() {
160 StringBuilder str = new StringBuilder();
161 return str.append("checkPath=").append(checkPath)
162 .append(",creds:").append(credentials).toString();
163 }
164
165 @Override
166 public void setLocation(URI location) {
167
168 super.location = location;
169 }
170 }