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
21 package net.sf.urlchecker.communication.configurers;
22
23 import org.apache.commons.configuration.XMLConfiguration;
24 import org.apache.commons.lang.StringUtils;
25 import org.apache.log4j.Logger;
26
27 /**
28 * The URLPattern Configurer Class .
29 *
30 * <p>
31 * <b> $Id: URLPatternConfigurer.java 182 2010-12-13 22:51:53Z georgosn $</b>
32 * </p>
33 *
34 * @author $LastChangedBy: georgosn $
35 * @version $LastChangedRevision: 182 $
36 */
37 public class URLPatternConfigurer implements Configurer<String> {
38
39 /** The Constant LOGGER. */
40 private static final Logger LOGGER = Logger.getLogger(URLPatternConfigurer.class
41 .getName());
42
43 /*
44 * (non-Javadoc)
45 *
46 * @see
47 * net.sf.urlchecker.communication.configurers.Configurer#configureWith(
48 * org.apache.commons.configuration.XMLConfiguration)
49 */
50 /** {@inheritDoc} */
51 public String configureWith(XMLConfiguration config) {
52 final String urlpattern = config.getString("urlpattern");
53 if (!StringUtils.isEmpty(urlpattern)) {
54 LOGGER.debug("Url Pattern used in this client configuration:"
55 + urlpattern);
56 return urlpattern;
57 }
58 return null;
59 }
60
61 }