1 package org.apache.archiva.rest.api.model.v2;
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
11 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
20 import io.swagger.v3.oas.annotations.media.Schema;
23 import java.util.TreeMap;
26 * @author Martin Stockhammer <martin_s@apache.org>
29 @Schema(name="MavenRemoteRepository",description = "A remote repository definition is used to pull artifacts from other repositories")
30 public class MavenRemoteRepository extends Repository
32 private static final long serialVersionUID = 5625043398766480265L;
36 Map<String,String> extraParameters = new TreeMap<>( );
37 Map<String,String> requestHeader = new TreeMap<>( );
40 @Schema(name="login_user",description = "Username for login to the remote repository")
41 public String getLoginUser( )
46 public void setLoginUser( String loginUser )
48 this.loginUser = loginUser;
51 @Schema(name="login_password",description = "Password for connecting to the remote repository")
52 public String getLoginPassword( )
57 public void setLoginPassword( String loginPassword )
59 this.loginPassword = loginPassword;
62 @Schema(name="check_path",description = "Path relative to the repository URL that is used to check of availability of the remote repository.")
63 public String getCheckPath( )
68 public void setCheckPath( String checkPath )
70 this.checkPath = checkPath;
73 @Schema(name="extra_parameters", description = "Key-Value map with extra parameters sent to the remote repository")
74 public Map<String, String> getExtraParameters( )
76 return extraParameters;
79 public void setExtraParameters( Map<String, String> extraParameters )
81 this.extraParameters = new TreeMap<>( extraParameters );
84 public void addExtraParameter(String key, String value) {
85 this.extraParameters.put( key, value );
88 @Schema(name="request_header",description = "Key-Value map with request headers that are sent to the remote repository")
89 public Map<String, String> getRequestHeader( )
94 public void setRequestHeader( Map<String, String> requestHeader )
96 this.requestHeader = new TreeMap<>( requestHeader );
99 public void addRequestHeader(String headerName, String headerValue) {
100 this.requestHeader.put( headerName, headerValue );
103 @Schema(name="timeout_ms", description = "The time in milliseconds after that a request to the remote repository is aborted")
104 public long getTimeoutMs( )
109 public void setTimeoutMs( long timeoutMs )
111 this.timeoutMs = timeoutMs;
115 public boolean equals( Object o )
117 if ( this == o ) return true;
118 if ( o == null || getClass( ) != o.getClass( ) ) return false;
119 if ( !super.equals( o ) ) return false;
121 MavenRemoteRepository that = (MavenRemoteRepository) o;
123 if ( timeoutMs != that.timeoutMs ) return false;
124 if ( loginUser != null ? !loginUser.equals( that.loginUser ) : that.loginUser != null ) return false;
125 if ( loginPassword != null ? !loginPassword.equals( that.loginPassword ) : that.loginPassword != null )
127 if ( checkPath != null ? !checkPath.equals( that.checkPath ) : that.checkPath != null ) return false;
128 if ( extraParameters != null ? !extraParameters.equals( that.extraParameters ) : that.extraParameters != null )
130 return requestHeader != null ? requestHeader.equals( that.requestHeader ) : that.requestHeader == null;
134 public int hashCode( )
136 int result = super.hashCode( );
137 result = 31 * result + ( loginUser != null ? loginUser.hashCode( ) : 0 );
138 result = 31 * result + ( loginPassword != null ? loginPassword.hashCode( ) : 0 );
139 result = 31 * result + ( checkPath != null ? checkPath.hashCode( ) : 0 );
140 result = 31 * result + ( extraParameters != null ? extraParameters.hashCode( ) : 0 );
141 result = 31 * result + ( requestHeader != null ? requestHeader.hashCode( ) : 0 );
142 result = 31 * result + (int) ( timeoutMs ^ ( timeoutMs >>> 32 ) );
147 public String toString( )
149 final StringBuilder sb = new StringBuilder( "RemoteRepository{" );
150 sb.append( "loginUser='" ).append( loginUser ).append( '\'' );
151 sb.append( ", loginPassword='" ).append( loginPassword ).append( '\'' );
152 sb.append( ", checkPath='" ).append( checkPath ).append( '\'' );
153 sb.append( ", extraParameters=" ).append( extraParameters );
154 sb.append( ", requestHeader=" ).append( requestHeader );
155 sb.append( ", timeOut=" ).append( timeoutMs );
156 sb.append( ", id='" ).append( id ).append( '\'' );
157 sb.append( ", name='" ).append( name ).append( '\'' );
158 sb.append( ", description='" ).append( description ).append( '\'' );
159 sb.append( ", type='" ).append( type ).append( '\'' );
160 sb.append( ", location='" ).append( location ).append( '\'' );
161 sb.append( ", scanned=" ).append( scanned );
162 sb.append( ", schedulingDefinition='" ).append( schedulingDefinition ).append( '\'' );
163 sb.append( ", index=" ).append( index );
164 sb.append( ", layout='" ).append( layout ).append( '\'' );
166 return sb.toString( );