|
13 | 13 | import org.apache.hadoop.mapreduce.Mapper; |
14 | 14 | import org.apache.log4j.Logger; |
15 | 15 |
|
16 | | -public class WebFinderMapper |
17 | | - extends Mapper<LongWritable, Text, Text, Text> { |
| 16 | +/** |
| 17 | + * This is the Mapper component of the Web Finder example. Its input are |
| 18 | + * text lines, where each line stands for a website URL. It finds all |
| 19 | + * resources that are loaded by a given website URL and emits tuples of |
| 20 | + * kind {@code <resource URL, website URL>}. |
| 21 | + */ |
| 22 | +public class WebFinderMapper extends |
| 23 | + Mapper<LongWritable, Text, Text, Text> { |
18 | 24 |
|
19 | 25 | /** the logger we use */ |
20 | 26 | private static Logger LOGGER = Logger.getLogger(WebFinderMapper.class); |
21 | 27 |
|
| 28 | + /** |
| 29 | + * Map tuples of type {@code <line number, website url text>} to tuples |
| 30 | + * of kind {@code <resource url text, website url text>}. |
| 31 | + */ |
22 | 32 | @Override |
23 | 33 | protected void map(final LongWritable offset, final Text line, |
24 | 34 | final Context context) throws IOException, InterruptedException { |
@@ -171,8 +181,8 @@ private static final void __load(final int remainingDepth, |
171 | 181 | error.addSuppressed(error2); |
172 | 182 | error.addSuppressed(error3); |
173 | 183 | if (WebFinderMapper.LOGGER != null) { |
174 | | - WebFinderMapper.LOGGER |
175 | | - .warn("Error while trying to build URL with string '" |
| 184 | + WebFinderMapper.LOGGER.warn( |
| 185 | + "Error while trying to build URL with string '" |
176 | 186 | + test + "' under load URL '" |
177 | 187 | + loadUrl.toString() + "' for base URL '" |
178 | 188 | + baseUrl.toString() + "'.", error2); |
@@ -215,8 +225,8 @@ private static final void __load(final int remainingDepth, |
215 | 225 | } |
216 | 226 | } catch (final Throwable error) { |
217 | 227 | if (WebFinderMapper.LOGGER != null) { |
218 | | - WebFinderMapper.LOGGER.warn( |
219 | | - "Error while trying to load URL '" + loadUrl + "'.", error); |
| 228 | + WebFinderMapper.LOGGER.warn("Error while trying to load URL '" |
| 229 | + + loadUrl + "'.", error); |
220 | 230 | } |
221 | 231 | } |
222 | 232 |
|
@@ -314,7 +324,7 @@ public static final void main(final String[] args) throws Throwable { |
314 | 324 |
|
315 | 325 | /** the link descriptions */ |
316 | 326 | static final __LinkDesc[] DESCS = { // |
317 | | - new __LinkDesc(false, "<link rel=\"stylesheet\"", "href="), // |
| 327 | + new __LinkDesc(false, "<link rel=\"stylesheet\"", "href="), // |
318 | 328 | new __LinkDesc(false, "<link rel='stylesheet'", "href="), // |
319 | 329 | new __LinkDesc(false, "<img", "src="), // |
320 | 330 | new __LinkDesc(false, "<script", "src="), // |
|
0 commit comments