1 /* 2 * (C)opyright 2010, Nikolaos Georgosopoulos 3 * 4 * This file is part of URLChecker. 5 6 URLChecker is free software: you can redistribute it and/or modify 7 it under the terms of the Lesser General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 URLChecker is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the Lesser General Public License 17 along with URLChecker. If not, see <http://www.gnu.org/licenses/>. 18 19 */ 20 package net.sf.urlchecker.communication; 21 22 import org.apache.commons.configuration.ConfigurationException; 23 import org.apache.commons.httpclient.HttpClient; 24 25 /** 26 * The CommunicationBuilder Class . 27 * 28 * <p> 29 * <b> $Id: CommunicationBuilder.java 182 2010-12-13 22:51:53Z georgosn $</b> 30 * </p> 31 * 32 * @author $LastChangedBy: georgosn $ 33 * @version $LastChangedRevision: 182 $ 34 */ 35 public class CommunicationBuilder { 36 37 /** 38 * Gets the multithreaded client. 39 * 40 * @return the multithreaded client 41 * @throws org.apache.commons.configuration.ConfigurationException 42 * the configuration exception 43 */ 44 public HttpClient getMultithreadedClient() throws ConfigurationException { 45 return CommunicationFactory.getInstance().configureClient(true); 46 } 47 48 /** 49 * Gets the multithreaded client. 50 * 51 * @param fileName 52 * the file name 53 * @return the multithreaded client 54 * @throws org.apache.commons.configuration.ConfigurationException 55 * the configuration exception 56 */ 57 public HttpClient getMultithreadedClient(String fileName) 58 throws ConfigurationException { 59 return CommunicationFactory.getInstance().configureClient(true, 60 fileName); 61 } 62 63 /** 64 * Gets the singlethreaded client. 65 * 66 * @return the singlethreaded client 67 * @throws org.apache.commons.configuration.ConfigurationException 68 * the configuration exception 69 */ 70 public HttpClient getSinglethreadedClient() throws ConfigurationException { 71 return CommunicationFactory.getInstance().configureClient(false); 72 } 73 74 /** 75 * Gets the singlethreaded client. 76 * 77 * @param fileName 78 * the file name 79 * @return the singlethreaded client 80 * @throws org.apache.commons.configuration.ConfigurationException 81 * the configuration exception 82 */ 83 public HttpClient getSinglethreadedClient(String fileName) 84 throws ConfigurationException { 85 return CommunicationFactory.getInstance().configureClient(false, 86 fileName); 87 } 88 89 /** 90 * Shutdown communication. 91 */ 92 public void shutdownCommunication() { 93 CommunicationFactory.getInstance().shutdown(); 94 } 95 }