001    package org.apache.archiva.admin.model.beans;
002    /*
003     * Licensed to the Apache Software Foundation (ASF) under one
004     * or more contributor license agreements.  See the NOTICE file
005     * distributed with this work for additional information
006     * regarding copyright ownership.  The ASF licenses this file
007     * to you under the Apache License, Version 2.0 (the
008     * "License"); you may not use this file except in compliance
009     * with the License.  You may obtain a copy of the License at
010     *
011     *   http://www.apache.org/licenses/LICENSE-2.0
012     *
013     * Unless required by applicable law or agreed to in writing,
014     * software distributed under the License is distributed on an
015     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016     * KIND, either express or implied.  See the License for the
017     * specific language governing permissions and limitations
018     * under the License.
019     */
020    
021    import javax.xml.bind.annotation.XmlRootElement;
022    import java.io.Serializable;
023    
024    /**
025     * @author Olivier Lamy
026     * @since 1.4-M1
027     */
028    @XmlRootElement( name = "networkConfiguration" )
029    public class NetworkConfiguration
030        implements Serializable
031    {
032        /**
033         * maximum total external http connections.
034         */
035        private int maxTotal = 30;
036    
037        /**
038         * maximum total external http connections per host.
039         */
040        private int maxTotalPerHost = 30;
041    
042        private boolean usePooling = true;
043    
044        public NetworkConfiguration()
045        {
046            // no op
047        }
048    
049        public NetworkConfiguration( int maxTotal, int maxTotalPerHost, boolean usePooling )
050        {
051            this.maxTotal = maxTotal;
052            this.maxTotalPerHost = maxTotalPerHost;
053            this.usePooling = usePooling;
054        }
055    
056        public int getMaxTotal()
057        {
058            return maxTotal;
059        }
060    
061        public void setMaxTotal( int maxTotal )
062        {
063            this.maxTotal = maxTotal;
064        }
065    
066        public int getMaxTotalPerHost()
067        {
068            return maxTotalPerHost;
069        }
070    
071        public void setMaxTotalPerHost( int maxTotalPerHost )
072        {
073            this.maxTotalPerHost = maxTotalPerHost;
074        }
075    
076        public boolean isUsePooling()
077        {
078            return usePooling;
079        }
080    
081        public void setUsePooling( boolean usePooling )
082        {
083            this.usePooling = usePooling;
084        }
085    
086        @Override
087        public String toString()
088        {
089            final StringBuilder sb = new StringBuilder();
090            sb.append( "NetworkConfiguration" );
091            sb.append( "{maxTotal=" ).append( maxTotal );
092            sb.append( ", maxTotalPerHost=" ).append( maxTotalPerHost );
093            sb.append( ", usePooling=" ).append( usePooling );
094            sb.append( '}' );
095            return sb.toString();
096        }
097    }