forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r476406 - in /forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src: forrestContext.xml org/apache/forrest/examples/affiliateProductCatalogue/reader/TradeDoublerReader.java
Date Sat, 18 Nov 2006 01:34:26 GMT
Author: rgardler
Date: Fri Nov 17 17:34:25 2006
New Revision: 476406

URL: http://svn.apache.org/viewvc?view=rev&rev=476406
Log:
Use the new reader chaining feature to allow readers to build upon one another
[partial fix for FOR-943]

Modified:
    forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/forrestContext.xml
    forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/org/apache/forrest/examples/affiliateProductCatalogue/reader/TradeDoublerReader.java

Modified: forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/forrestContext.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/forrestContext.xml?view=diff&rev=476406&r1=476405&r2=476406
==============================================================================
--- forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/forrestContext.xml
(original)
+++ forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/forrestContext.xml
Fri Nov 17 17:34:25 2006
@@ -23,6 +23,7 @@
 	<!--                 Readers					   -->
 	<!-- ============================================= -->
 
+	<bean id="file" class="org.apache.forrest.reader.FileReader"></bean>
 	<bean id="tradeDoubler"
 		class="org.apache.forrest.examples.affiliateProductCatalogue.reader.TradeDoublerReader"
/>
 	

Modified: forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/org/apache/forrest/examples/affiliateProductCatalogue/reader/TradeDoublerReader.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/org/apache/forrest/examples/affiliateProductCatalogue/reader/TradeDoublerReader.java?view=diff&rev=476406&r1=476405&r2=476406
==============================================================================
--- forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/org/apache/forrest/examples/affiliateProductCatalogue/reader/TradeDoublerReader.java
(original)
+++ forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/org/apache/forrest/examples/affiliateProductCatalogue/reader/TradeDoublerReader.java
Fri Nov 17 17:34:25 2006
@@ -16,18 +16,21 @@
  */
 package org.apache.forrest.examples.affiliateProductCatalogue.reader;
 
+import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 
 import org.apache.forrest.core.document.AbstractSourceDocument;
 import org.apache.forrest.core.document.DefaultSourceDocument;
 import org.apache.forrest.core.locationMap.Location;
-import org.apache.forrest.reader.FileReader;
+import org.apache.forrest.reader.AbstractReader;
+import org.apache.forrest.reader.IReader;
+import org.springframework.context.support.AbstractXmlApplicationContext;
 
-public class TradeDoublerReader extends FileReader {
+public class TradeDoublerReader extends AbstractReader {
 
-	@Override
-	public AbstractSourceDocument read(final Location location) {
+	public AbstractSourceDocument read(AbstractXmlApplicationContext context,
+			final Location location) {
 		DefaultSourceDocument doc = null;
 		final URI psudeoURI = location.getSourceURI();
 		final String ssp = psudeoURI.getSchemeSpecificPart();
@@ -35,10 +38,17 @@
 		try {
 			uri = new URI(ssp);
 			location.setSourceURI(uri);
-			doc = (DefaultSourceDocument) super.read(location);
-			doc
-					.setType("org.apache.forrest.example.affiliateProductCatalogue.TradeDoublerProductFeed");
+			IReader reader;
+			reader = (IReader) context.getBean(uri.getScheme());
+			doc = (DefaultSourceDocument) reader.read(context, location);
+			if (doc != null) {
+				doc
+						.setType("org.apache.forrest.example.affiliateProductCatalogue.TradeDoublerProductFeed");
+			}
 		} catch (final URISyntaxException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (MalformedURLException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}



Mime
View raw message