Return-Path: Delivered-To: apmail-forrest-svn-archive@www.apache.org Received: (qmail 25304 invoked from network); 22 Dec 2006 22:59:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Dec 2006 22:59:50 -0000 Received: (qmail 82715 invoked by uid 500); 22 Dec 2006 22:59:57 -0000 Delivered-To: apmail-forrest-svn-archive@forrest.apache.org Received: (qmail 82684 invoked by uid 500); 22 Dec 2006 22:59:57 -0000 Mailing-List: contact svn-help@forrest.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Forrest Developers List" List-Id: Delivered-To: mailing list svn@forrest.apache.org Received: (qmail 82673 invoked by uid 99); 22 Dec 2006 22:59:57 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Dec 2006 14:59:57 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Dec 2006 14:59:49 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 2FB951A981A; Fri, 22 Dec 2006 14:58:59 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r489794 - in /forrest/trunk/whiteboard/forrest2/core/src/docs: createAPlugin.html createAReader.html Date: Fri, 22 Dec 2006 22:58:59 -0000 To: svn@forrest.apache.org From: rgardler@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061222225859.2FB951A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rgardler Date: Fri Dec 22 14:58:58 2006 New Revision: 489794 URL: http://svn.apache.org/viewvc?view=rev&rev=489794 Log: Move some of the reader from the input plugin doc into the reader doc. Update the reader docs to reflect the current state of the code. Modified: forrest/trunk/whiteboard/forrest2/core/src/docs/createAPlugin.html forrest/trunk/whiteboard/forrest2/core/src/docs/createAReader.html Modified: forrest/trunk/whiteboard/forrest2/core/src/docs/createAPlugin.html URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/docs/createAPlugin.html?view=diff&rev=489794&r1=489793&r2=489794 ============================================================================== --- forrest/trunk/whiteboard/forrest2/core/src/docs/createAPlugin.html (original) +++ forrest/trunk/whiteboard/forrest2/core/src/docs/createAPlugin.html Fri Dec 22 14:58:58 2006 @@ -140,97 +140,5 @@ How to create an Output Plugin ============================== -TODO - -====================== -How to create a Reader -====================== - -A reader is respponsible for creating the initial source content. Forrest provides -a set of generic readers that can retrieve a document from the network or from the -filesystem. These documents will oftern need to be processed by an input plugin to -create a document in Forrests internal format. - -

To read a document from a non-standard resource, for example, to read a document -from a relational database, we will need to implement a custom reader. To do this -we extend org.apache.forrest.reader.AbstractReader. This abstract class -requires the following methods to be implemented:

- - - -

The init() method provides any necessary configuration. This method is called once during -creation of the reader object. The read(Location location) method performs the actual "read" -of the document. The getscheme() method defines a scheme or psuedo scheme that this -reader will respond to. It is used by Forrest core to select the correct reader for a given -location. We will discuss this method in more detail first, then we will look at the read -method.

- -

The scheme can be any string that represents the type of reader we are building. For -example, if we are building a reader that will provide documents representing products in -a catalogue database then we may choose a scheme of "product" (note that we don't -include the ':'). This will then be used -in the locationmap to indicate a product document. For example, we may have a location -defined as:

- - - - -]]> - -

This entry means that a request for http://localhost:8888/test/product.html -will result in a request to the reader assigned the product scheme. To -actually read the document Forrest will call the read(Location location) -method.

- -

The read(Location location) method will process the request in whatever -way is appropriate for that particular scheme. In this case it will communicate with -the database to retrieve the product with ID 1.

- -Register Reader ---------------- - ----- -NOTE ----- -At present a plugin needs to add itself by editing the core config documents. This will -change shortly. - -Once you have built your reader then you need to register it with Forrest. This is done -by adding an entry to the applicationContext-readers.xml. The entry should -look something like this: - - - -]]> - -

Note that the beans id is the same as the scheme defined in the reader. This -is how Forrest will lookup the correct reader for any given location.

Modified: forrest/trunk/whiteboard/forrest2/core/src/docs/createAReader.html URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/docs/createAReader.html?view=diff&rev=489794&r1=489793&r2=489794 ============================================================================== --- forrest/trunk/whiteboard/forrest2/core/src/docs/createAReader.html (original) +++ forrest/trunk/whiteboard/forrest2/core/src/docs/createAReader.html Fri Dec 22 14:58:58 2006 @@ -23,11 +23,16 @@

Overview

-

Readers are te first stage in the processing pipeline. They read +

Readers are the first stage in the processing pipeline. They read the source document for subsequent processing. It is worth noting that a reader may no actually read a file, it may generate the files content dynamically. This document describes how to create a new reader.

+

A reader is responsible for creating the initial source content. Forrest provides +a set of generic readers that can retrieve a document from the network or from the +filesystem. These documents will often need to be processed by an input plugin to +create a document in Forrests internal format.

+

Chained Readers

Chained readers are the type of reader you will most often use. @@ -84,8 +89,43 @@

If your reader needs to do some initialisation before it executes the read method you should override public -void init().

+void init(). This method is called once during +creation of the reader object.

+ +

Register The Reader

+

Once you have built your reader then you need to register it with Forrest. This is done +by adding an entry to the forrestContext.xml. The entry should +look something like this: + + + +]]> + +

Note that the beans id is the same as the scheme used in the locationmap to identify a source +location. This is used by Forrest to lookup the correct reader for any given location.

+ +

The scheme can be any string that represents the type of reader we are building. For +example, if we are building a reader that will provide documents representing products in +a catalogue database then we may choose a scheme of "product" (note that we don't +include the ':'). This will then be used +in the locationmap to indicate a product document. For example, we may have a location +defined as:

+ + + + +]]> + +

This entry means that a request for http://localhost:8888/test/product.html +will result in a request to the reader assigned the product scheme. To +actually read the document Forrest will call the read(...) +method. This method will process the request in whatever +way is appropriate for that particular scheme. In this case it will communicate with +the database to retrieve the product with ID 1.