* 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;
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> _urlConfig;
- private List<PageTypeConfig> _pageTypeConfig;
-
- public ConfigurationImpl(List<UrlConfig> aUrlConfig, List<PageTypeConfig> aPageTypeConfig) {
- _urlConfig = aUrlConfig;
- _pageTypeConfig = aPageTypeConfig;
+
+ private List<PageTypeConfig> _pageTypeConfig;
+
+ /**
+ * Constructs the configuration.
+ * @param aUrlConfig List of URL configuration elements.
+ * @param aPageTypeConfig List of page type configuration elements.
+ */
+ public ConfigurationImpl(List<UrlConfig> aUrlConfig,
+ List<PageTypeConfig> 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
+ + "'");
}
}