X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=crawler%2Fbasic%2Fsrc%2Forg%2Fwamblee%2Fcrawler%2Fimpl%2FConfigurationImpl.java;h=2b2680b5feb4ab39ac358e76f8cb58a77789d472;hb=07cedd3f0730646ea35a7f668b3e1e872a4605d9;hp=54874559b81e19429453f68f08fb1e1547faedde;hpb=30671b398473b876e5c42d063f0c8e169ad3163c;p=utils diff --git a/crawler/basic/src/org/wamblee/crawler/impl/ConfigurationImpl.java b/crawler/basic/src/org/wamblee/crawler/impl/ConfigurationImpl.java index 54874559..2b2680b5 100644 --- a/crawler/basic/src/org/wamblee/crawler/impl/ConfigurationImpl.java +++ b/crawler/basic/src/org/wamblee/crawler/impl/ConfigurationImpl.java @@ -12,7 +12,7 @@ * 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. - */ + */ package org.wamblee.crawler.impl; @@ -22,44 +22,56 @@ import org.wamblee.crawler.Configuration; import org.wamblee.crawler.PageRequest; import org.wamblee.crawler.PageType; - /** - * Implementation of the configuration for the crawler. + * Implementation of the configuration for the crawler. */ public class ConfigurationImpl implements Configuration { - + private List _urlConfig; - private List _pageTypeConfig; - - public ConfigurationImpl(List aUrlConfig, List aPageTypeConfig) { - _urlConfig = aUrlConfig; - _pageTypeConfig = aPageTypeConfig; + + private List _pageTypeConfig; + + /** + * Constructs the configuration. + * @param aUrlConfig List of URL configuration elements. + * @param aPageTypeConfig List of page type configuration elements. + */ + public ConfigurationImpl(List aUrlConfig, + List aPageTypeConfig) { + _urlConfig = aUrlConfig; + _pageTypeConfig = aPageTypeConfig; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.wamblee.crawler.Configuration#getRequest(java.lang.String) */ public PageRequest getRequest(String aUrl) { - - for (UrlConfig config: _urlConfig) { - PageRequest request = config.getRequest(aUrl); - if ( request != null ) { - return request; + + for (UrlConfig config : _urlConfig) { + PageRequest request = config.getRequest(aUrl); + if (request != null) { + return request; } } - throw new RuntimeException("No configuration matched the URL '" + aUrl + "'"); + throw new RuntimeException("No configuration matched the URL '" + aUrl + + "'"); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see org.wamblee.crawler.Configuration#getRequest(org.wamblee.crawler.PageType) */ public PageRequest getRequest(PageType aType) { - for (PageTypeConfig config: _pageTypeConfig) { - PageRequest request = config.getRequest(aType.getType()); - if ( request != null ) { - return request; + for (PageTypeConfig config : _pageTypeConfig) { + PageRequest request = config.getRequest(aType.getType()); + if (request != null) { + return request; } } - throw new RuntimeException("No configuration matched type '" + aType + "'"); + throw new RuntimeException("No configuration matched type '" + aType + + "'"); } }