You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by rg...@apache.org on 2006/11/18 02:32:43 UTC
svn commit: r476405 - in
/forrest/trunk/whiteboard/forrest2/core/org/apache/forrest:
core/Controller.java reader/FileReader.java reader/HTTPReader.java
reader/IReader.java
Author: rgardler
Date: Fri Nov 17 17:32:42 2006
New Revision: 476405
URL: http://svn.apache.org/viewvc?view=rev&rev=476405
Log:
Add context param to read method, this allows readers to be chained.
Modified:
forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/core/Controller.java
forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/FileReader.java
forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/HTTPReader.java
forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/IReader.java
Modified: forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/core/Controller.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/core/Controller.java?view=diff&rev=476405&r1=476404&r2=476405
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/core/Controller.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/core/Controller.java Fri Nov 17 17:32:42 2006
@@ -244,7 +244,7 @@
IReader reader;
reader = (IReader) this.context.getBean(location.getSourceURI()
.getScheme());
- results.add(reader.read(location));
+ results.add(reader.read(this.context, location));
}
return results;
}
Modified: forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/FileReader.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/FileReader.java?view=diff&rev=476405&r1=476404&r2=476405
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/FileReader.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/FileReader.java Fri Nov 17 17:32:42 2006
@@ -24,6 +24,7 @@
import org.apache.forrest.core.document.DocumentFactory;
import org.apache.forrest.core.exception.SourceException;
import org.apache.forrest.core.locationMap.Location;
+import org.springframework.context.support.AbstractXmlApplicationContext;
/**
* An File reader reads a resource using the file protocol, i.e. it will read
@@ -37,7 +38,7 @@
*
* @see org.apache.forrest.reader.IReader#read(org.apache.forrest.test.core.locationMap.Location)
*/
- public AbstractSourceDocument read(final Location location) {
+ public AbstractSourceDocument read(AbstractXmlApplicationContext context, final Location location) {
AbstractSourceDocument result = null;
try {
final InputStream is = new FileInputStream(new File(location
Modified: forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/HTTPReader.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/HTTPReader.java?view=diff&rev=476405&r1=476404&r2=476405
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/HTTPReader.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/HTTPReader.java Fri Nov 17 17:32:42 2006
@@ -27,6 +27,7 @@
import org.apache.forrest.core.document.DefaultSourceDocument;
import org.apache.forrest.core.exception.SourceException;
import org.apache.forrest.core.locationMap.Location;
+import org.springframework.context.support.AbstractXmlApplicationContext;
import org.w3c.tidy.Tidy;
/**
@@ -52,7 +53,7 @@
*
* @see org.apache.forrest.reader.IReader#read(org.apache.forrest.test.core.locationMap.Location)
*/
- public AbstractSourceDocument read(final Location location)
+ public AbstractSourceDocument read(AbstractXmlApplicationContext context, final Location location)
throws MalformedURLException {
InputStream is;
DefaultSourceDocument result = null;
Modified: forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/IReader.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/IReader.java?view=diff&rev=476405&r1=476404&r2=476405
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/IReader.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/org/apache/forrest/reader/IReader.java Fri Nov 17 17:32:42 2006
@@ -20,6 +20,7 @@
import org.apache.forrest.core.document.AbstractSourceDocument;
import org.apache.forrest.core.locationMap.Location;
+import org.springframework.context.support.AbstractXmlApplicationContext;
public interface IReader {
@@ -34,12 +35,13 @@
* 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 context
*
* @param location
* @return
* @throws MalformedURLException
*/
- public abstract AbstractSourceDocument read(Location location)
+ public abstract AbstractSourceDocument read(AbstractXmlApplicationContext context, Location location)
throws MalformedURLException;
}