forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r489794 - in /forrest/trunk/whiteboard/forrest2/core/src/docs: createAPlugin.html createAReader.html
Date Fri, 22 Dec 2006 22:58:59 GMT
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.
-
-<p>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 <code>org.apache.forrest.reader.AbstractReader</code>. This abstract
class
-requires the following methods to be implemented:</p>
-
-<code><![CDATA[
-    /**
-	 * Initialise the reader. This method is called by the readers
-	 * constructors and should prepare the reader for operation.
-	 *
-	 */
-	abstract void init();
-
-	/**
-	 * Read a resource from a given location. If the resource
-	 * cannot be read, but it is an optional location then return null,
-	 * if it cannot be read and it is a required location throw
-	 * SourceException.
-	 * 
-	 * @param location
-	 * @return
-	 */
-	public abstract AbstractSourceDocument read(Location location);
-
-	/**
-	 * Get the scheme that this reader handles.
-	 * @return
-	 */
-	public abstract String getscheme();
-]]></code>
-
-<p>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.</p>
-
-<p>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: </p>
-
-<code><![CDATA[
-  <location regexp="http://localhost:8888/test/product.html">
-    <source href="product:/1"/>
-  </location>
-]]></code>
-
-<p>This entry means that a request for <code>http://localhost:8888/test/product.html</code>
-will result in a request to the reader assigned the <code>product</code> scheme.
To
-actually read the document Forrest will call the <code>read(Location location)</code>
-method.</p>
-
-<p>The <code>read(Location location)</code> 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.</p>
-
-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 <code>applicationContext-readers.xml</code>. The entry
should
-look something like this:
-
-<code><![CDATA[
-  <bean id="product" 
-    class="org.foo.forrest.reader.ProductReader">
-  </bean>
-]]></code>
-
-<p>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.</p>
 </body>
 </html>

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 @@
 <body>
 <h1>Overview</h1>
 
-<p>Readers are te first stage in the processing pipeline. They read
+<p>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.</p>
 
+<p>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.</p>
+
 <h2>Chained Readers</h2>
 
 <p>Chained readers are the type of reader you will most often use.
@@ -84,8 +89,43 @@
 
 <p>If your reader needs to do some initialisation before it executes
 the read method you should override <span class="code">public
-void init()</span>.</p>
+void init()</span>. This method is called once during
+creation of the reader object.</p>
+
+<h3>Register The Reader</h3>
 
+<p>Once you have built your reader then you need to register it with Forrest. This
is done
+by adding an entry to the <code>forrestContext.xml</code>. The entry should
+look something like this:
+
+<code><![CDATA[
+  <bean id="product" 
+    class="org.foo.forrest.reader.ProductReader">
+  </bean>
+]]></code>
+
+<p>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.</p>
+
+<p>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: </p>
+
+<code><![CDATA[
+  <location regexp="http://localhost:8888/test/product.html">
+    <source href="product:/1"/>
+  </location>
+]]></code>
+
+<p>This entry means that a request for <code>http://localhost:8888/test/product.html</code>
+will result in a request to the reader assigned the <code>product</code> scheme.
To
+actually read the document Forrest will call the <code>read(...)</code>
+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.</p>
 
 
 </body>



Mime
View raw message