From e046bb072391bd7ec06e5f4a310e60048b5fb58a Mon Sep 17 00:00:00 2001 From: "yihua.huang" Date: Wed, 6 Nov 2013 12:48:14 +0800 Subject: [PATCH] remove useless code --- .../ResultItemsCollectorPipeline.java | 2 +- .../model/annotation/UrlTemplate.java | 37 ------------------- .../webmagic/model/direct/Param.java | 15 -------- 3 files changed, 1 insertion(+), 53 deletions(-) delete mode 100644 webmagic-extension/src/main/java/us/codecraft/webmagic/model/annotation/UrlTemplate.java delete mode 100644 webmagic-extension/src/main/java/us/codecraft/webmagic/model/direct/Param.java diff --git a/webmagic-core/src/main/java/us/codecraft/webmagic/pipeline/ResultItemsCollectorPipeline.java b/webmagic-core/src/main/java/us/codecraft/webmagic/pipeline/ResultItemsCollectorPipeline.java index cf45ec8..abafa88 100644 --- a/webmagic-core/src/main/java/us/codecraft/webmagic/pipeline/ResultItemsCollectorPipeline.java +++ b/webmagic-core/src/main/java/us/codecraft/webmagic/pipeline/ResultItemsCollectorPipeline.java @@ -15,7 +15,7 @@ public class ResultItemsCollectorPipeline implements CollectorPipeline collector = new ArrayList(); @Override - public void process(ResultItems resultItems, Task task) { + public synchronized void process(ResultItems resultItems, Task task) { collector.add(resultItems); } diff --git a/webmagic-extension/src/main/java/us/codecraft/webmagic/model/annotation/UrlTemplate.java b/webmagic-extension/src/main/java/us/codecraft/webmagic/model/annotation/UrlTemplate.java deleted file mode 100644 index a940a64..0000000 --- a/webmagic-extension/src/main/java/us/codecraft/webmagic/model/annotation/UrlTemplate.java +++ /dev/null @@ -1,37 +0,0 @@ -package us.codecraft.webmagic.model.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Define the url patterns for class.
- * All urls matching the pattern will be crawled and extracted for new objects.
- * - * @author code4crafter@gmail.com
- * @since 0.3.3 - */ -@Retention(java.lang.annotation.RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE}) -public @interface UrlTemplate { - - /** - * The url patterns for class.
- * Use regex expression with some changes:
- * "." stand for literal character "." instead of "any character".
- * "*" stand for any legal character for url in 0-n length ([^"'#]*) instead of "any length".
- * - * @return the url patterns for class - */ - String value(); - - /** - * Define the region for url extracting.
- * Only support XPath.
- * When sourceRegion is set, the urls will be extracted only from the region instead of entire content.
- * - * @return the region for url extracting - */ - String encoding() default "utf8"; - -} diff --git a/webmagic-extension/src/main/java/us/codecraft/webmagic/model/direct/Param.java b/webmagic-extension/src/main/java/us/codecraft/webmagic/model/direct/Param.java deleted file mode 100644 index c66e854..0000000 --- a/webmagic-extension/src/main/java/us/codecraft/webmagic/model/direct/Param.java +++ /dev/null @@ -1,15 +0,0 @@ -package us.codecraft.webmagic.model.direct; - -import java.util.LinkedHashMap; - -/** - * @author code4crafter@gmail.com - */ -public class Param extends LinkedHashMap{ - - @Override - public Param put(String key, Object value) { - super.put(key, value); - return this; - } -}