[ 
https://issues.apache.org/jira/browse/DROIDS-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12843318#action_12843318
 ] 

Bertil Chapuis commented on DROIDS-58:
--------------------------------------

In my opinion the filter mecanism makes sense straight after the phase 1 and 
before the phase 4 you described. 
However, for the phase 2 and 3 the hierarchical approach of the Decorator 
pattern may provide a simpler solution. 

Let's see the following process:

1. taskQueue.poll():link
2. filter.isAllowed(link):boolean

3. fetcherDecorator.fetch(link):resource
    3 bis. fetcher.fetch(link):resource
4. parserDecorator.parse(link, resource)
    4 bis. parserDecorator.parse(link, resource)
        4 bis bis. parser.parse(link, resource)
5. extractorDecorator.extract(link, resource):outlinks
    5 bis. extractor.extract(link, resource):outlinks

6. filter.isAllowed(outlink)
7. taskQueue.add(outlink)

> Implement a filter mechanism that allow intecepting every stage of a crawling 
> process
> -------------------------------------------------------------------------------------
>
>                 Key: DROIDS-58
>                 URL: https://issues.apache.org/jira/browse/DROIDS-58
>             Project: Droids
>          Issue Type: New Feature
>    Affects Versions: 0.01
>            Reporter: Mingfai Ma
>
> refer to this:
> http://mail-archives.apache.org/mod_mbox/incubator-droids-dev/200906.mbox/%[email protected]%3e
> assume the process is 
> 1. poll a link from queue
> 2. fetch entity
> 3. parse entity
> 4. extract outlinks
> we provide a mechanism to intercept the process in every stage. e.g. a 
> LinkFilter has a  "public T polled(T link);" interface, any filter may reject 
> or transform a Link polled from the queue. similar logic applies to fetching, 
> parsing, and extracting (outlink) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to