123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- package org.apache.archiva.admin.model.beans;
-
- /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- import javax.xml.bind.annotation.XmlRootElement;
- import java.io.Serializable;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
-
- /**
- * @author Olivier Lamy
- * @since 1.4-M1
- */
- @XmlRootElement (name = "remoteRepository")
- public class RemoteRepository
- extends AbstractRepository
- implements Serializable
- {
-
- private String url;
-
- private String userName;
-
- private String password;
-
- private int timeout = 60;
-
- /**
- * Activate download of remote index if remoteIndexUrl is set too.
- */
- private boolean downloadRemoteIndex = false;
-
- /**
- * Remote Index Url : if not starting with http will be relative to the remote repository url.
- */
- private String remoteIndexUrl = ".index";
-
- private String remoteDownloadNetworkProxyId;
-
- /**
- * default model value daily : every sunday at 8H00
- */
- private String cronExpression = "0 0 08 ? * SUN";
-
- private int remoteDownloadTimeout = 300;
-
- /**
- * @since 1.4-M2
- */
- private boolean downloadRemoteIndexOnStartup = false;
-
- /**
- * extraParameters.
- *
- * @since 1.4-M4
- */
- private Map<String, String> extraParameters;
-
- /**
- * field to ease json mapping wrapper on <code>extraParameters</code> field
- *
- * @since 1.4-M4
- */
- private List<PropertyEntry> extraParametersEntries;
-
- /**
- * extraHeaders.
- *
- * @since 1.4-M4
- */
- private Map<String, String> extraHeaders;
-
- /**
- * field to ease json mapping wrapper on <code>extraHeaders</code> field
- *
- * @since 1.4-M4
- */
- private List<PropertyEntry> extraHeadersEntries;
-
-
- public RemoteRepository()
- {
- // no op
- }
-
- public RemoteRepository( String id, String name, String url, String layout )
- {
- super( id, name, layout );
- this.url = url;
- }
-
- public RemoteRepository( String id, String name, String url, String layout, String userName, String password,
- int timeout )
- {
- super( id, name, layout );
- this.url = url;
- this.userName = userName;
- this.password = password;
- this.timeout = timeout;
- }
-
- /**
- * @since 1.4-M3
- */
- public RemoteRepository( String id, String name, String url, String layout, String userName, String password,
- int timeout, String description )
- {
- this( id, name, url, layout, userName, password, timeout );
- setDescription( description );
- }
-
- public String getUrl()
- {
- return url;
- }
-
- public void setUrl( String url )
- {
- this.url = url;
- }
-
- public String getUserName()
- {
- return userName;
- }
-
- public void setUserName( String userName )
- {
- this.userName = userName;
- }
-
- public String getPassword()
- {
- return password;
- }
-
- public void setPassword( String password )
- {
- this.password = password;
- }
-
- public int getTimeout()
- {
- return timeout;
- }
-
- public void setTimeout( int timeout )
- {
- this.timeout = timeout;
- }
-
- public boolean isDownloadRemoteIndex()
- {
- return downloadRemoteIndex;
- }
-
- public void setDownloadRemoteIndex( boolean downloadRemoteIndex )
- {
- this.downloadRemoteIndex = downloadRemoteIndex;
- }
-
- public String getRemoteIndexUrl()
- {
- return remoteIndexUrl;
- }
-
- public void setRemoteIndexUrl( String remoteIndexUrl )
- {
- this.remoteIndexUrl = remoteIndexUrl;
- }
-
- public String getRemoteDownloadNetworkProxyId()
- {
- return remoteDownloadNetworkProxyId;
- }
-
- public void setRemoteDownloadNetworkProxyId( String remoteDownloadNetworkProxyId )
- {
- this.remoteDownloadNetworkProxyId = remoteDownloadNetworkProxyId;
- }
-
- public String getCronExpression()
- {
- return cronExpression;
- }
-
- public void setCronExpression( String cronExpression )
- {
- this.cronExpression = cronExpression;
- }
-
- public int getRemoteDownloadTimeout()
- {
- return remoteDownloadTimeout;
- }
-
- public void setRemoteDownloadTimeout( int remoteDownloadTimeout )
- {
- this.remoteDownloadTimeout = remoteDownloadTimeout;
- }
-
- public boolean isDownloadRemoteIndexOnStartup()
- {
- return downloadRemoteIndexOnStartup;
- }
-
- public void setDownloadRemoteIndexOnStartup( boolean downloadRemoteIndexOnStartup )
- {
- this.downloadRemoteIndexOnStartup = downloadRemoteIndexOnStartup;
- }
-
- public Map<String, String> getExtraParameters()
- {
- if ( this.extraParameters == null )
- {
- this.extraParameters = new HashMap<String, String>();
- }
- return extraParameters;
- }
-
- public void setExtraParameters( Map<String, String> extraParameters )
- {
- this.extraParameters = extraParameters;
- }
-
- public void addExtraParameter( String key, String value )
- {
- getExtraParameters().put( key, value );
- }
-
- public List<PropertyEntry> getExtraParametersEntries()
- {
- this.extraParametersEntries = new ArrayList<>();
- for ( Map.Entry<String, String> entry : getExtraParameters().entrySet() )
- {
- this.extraParametersEntries.add( new PropertyEntry( entry.getKey(), entry.getValue() ) );
- }
- return this.extraParametersEntries;
- }
-
- public void setExtraParametersEntries( List<PropertyEntry> extraParametersEntries )
- {
- if ( extraParametersEntries == null )
- {
- return;
- }
-
- this.extraParametersEntries = extraParametersEntries;
- for ( PropertyEntry propertyEntry : extraParametersEntries )
- {
- this.addExtraParameter( propertyEntry.getKey(), propertyEntry.getValue() );
- }
- }
-
- public Map<String, String> getExtraHeaders()
- {
- if ( this.extraHeaders == null )
- {
- this.extraHeaders = new HashMap<String, String>();
- }
- return extraHeaders;
- }
-
- public void setExtraHeaders( Map<String, String> extraHeaders )
- {
- this.extraHeaders = extraHeaders;
- }
-
- public void addExtraHeader( String key, String value )
- {
- getExtraHeaders().put( key, value );
- }
-
- public List<PropertyEntry> getExtraHeadersEntries()
- {
- this.extraHeadersEntries = new ArrayList<>();
- for ( Map.Entry<String, String> entry : getExtraHeaders().entrySet() )
- {
- this.extraHeadersEntries.add( new PropertyEntry( entry.getKey(), entry.getValue() ) );
- }
- return this.extraHeadersEntries;
- }
-
- public void setExtraHeadersEntries( List<PropertyEntry> extraHeadersEntries )
- {
- if ( extraHeadersEntries == null )
- {
- return;
- }
-
- this.extraHeadersEntries = extraHeadersEntries;
- for ( PropertyEntry propertyEntry : extraHeadersEntries )
- {
- this.addExtraHeader( propertyEntry.getKey(), propertyEntry.getValue() );
- }
- }
-
-
- @Override
- public String toString()
- {
- final StringBuilder sb = new StringBuilder();
- sb.append( super.toString() );
- sb.append( "RemoteRepository" );
- sb.append( "{url='" ).append( url ).append( '\'' );
- sb.append( ", userName='" ).append( userName ).append( '\'' );
- sb.append( ", password='" ).append( password ).append( '\'' );
- sb.append( ", timeout=" ).append( timeout );
- sb.append( ", downloadRemoteIndex=" ).append( downloadRemoteIndex );
- sb.append( ", remoteIndexUrl='" ).append( remoteIndexUrl ).append( '\'' );
- sb.append( ", remoteDownloadNetworkProxyId='" ).append( remoteDownloadNetworkProxyId ).append( '\'' );
- sb.append( ", cronExpression='" ).append( cronExpression ).append( '\'' );
- sb.append( ", remoteDownloadTimeout=" ).append( remoteDownloadTimeout );
- sb.append( ", downloadRemoteIndexOnStartup=" ).append( downloadRemoteIndexOnStartup );
- sb.append( ", extraParameters=" ).append( extraParameters );
- sb.append( ", extraHeaders=" ).append( extraHeaders );
- sb.append( '}' );
- return sb.toString();
- }
-
-
- }
|