forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r485904 - /forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/Controller.java
Date Mon, 11 Dec 2006 22:07:01 GMT
Author: rgardler
Date: Mon Dec 11 14:07:00 2006
New Revision: 485904

URL: http://svn.apache.org/viewvc?view=rev&rev=485904
Log:
We can only have a single source document (we use AggregateSourceDocument now)

Modified:
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/Controller.java

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/Controller.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/Controller.java?view=diff&rev=485904&r1=485903&r2=485904
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/Controller.java
(original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/Controller.java
Mon Dec 11 14:07:00 2006
@@ -159,7 +159,7 @@
 				.resolveSourceLocations(requestURI);
 		this.sourceLocationsCache.put(requestURI, sourceLocs);
 
-		final List<AbstractSourceDocument> sourceDocs = this
+		final AbstractSourceDocument sourceDocs = this
 				.loadAllSourceDocuments(requestURI, sourceLocs);
 
 		final InternalDocument internalDoc = this.processInputPlugins(
@@ -183,22 +183,19 @@
 	 * @throws ProcessingException
 	 */
 	private InternalDocument processInputPlugins(URI requestURI,
-			final List<AbstractSourceDocument> sourceDocuments)
+			final AbstractSourceDocument sourceDocument)
 			throws IOException, ProcessingException {
 		InternalDocument result = null;
-		if (sourceDocuments.size() == 0) {
-			result = new InternalErrorDocument(requestURI,
+		if (sourceDocument == null) {
+			result = new InternalErrorDocument(sourceDocument,
 					"Unable to load source document");
 		} else {
-			for (int i = 0; i < sourceDocuments.size(); i++) {
-				final AbstractSourceDocument doc = sourceDocuments.get(i);
-				if (doc == null) {
+				if (sourceDocument == null) {
 					throw new ProcessingException(
 							"No source document is available.");
 				}
-				AbstractInputPlugin plugin = getInputPlugin(doc);
-				result = (InternalDocument) plugin.process(this, doc);
-			}
+				AbstractInputPlugin plugin = getInputPlugin(sourceDocument);
+				result = (InternalDocument) plugin.process(this, sourceDocument);
 		}
 		return result;
 	}
@@ -272,19 +269,18 @@
 	 * @fixme handle document types other than HTML
 	 * @fixme resource handlers should be provided from a factory class
 	 */
-	private List<AbstractSourceDocument> loadAllSourceDocuments(URI requestURI,
+	private AbstractSourceDocument loadAllSourceDocuments(URI requestURI,
 			final List<LocationNode> sourceLocations) throws MalformedURLException,
 			ProcessingException {
-		final List<AbstractSourceDocument> results = new ArrayList<AbstractSourceDocument>(
-				sourceLocations.size());
+		AbstractSourceDocument result = null;
 
 		for (int i = 0; i < sourceLocations.size(); i++) {
 			final LocationNode location = sourceLocations.get(i);
-			AbstractSourceDocument doc = loadSourceDocument(requestURI,
+			result = loadSourceDocument(requestURI,
 					location);
-			results.add(doc);
+			if (result != null) break;
 		}
-		return results;
+		return result;
 	}
 
 	private AbstractSourceDocument loadSourceDocument(URI requestURI,



Mime
View raw message