forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r488483 - in /forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap: AbstractSourceNode.java LocationNode.java SourceNode.java
Date Tue, 19 Dec 2006 01:26:00 GMT
Author: rgardler
Date: Mon Dec 18 17:25:59 2006
New Revision: 488483

URL: http://svn.apache.org/viewvc?view=rev&rev=488483
Log:
Allow the creation of potentail source locations without a config document element

Modified:
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/AbstractSourceNode.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/LocationNode.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/SourceNode.java

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/AbstractSourceNode.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/AbstractSourceNode.java?view=diff&rev=488483&r1=488482&r2=488483
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/AbstractSourceNode.java
(original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/AbstractSourceNode.java
Mon Dec 18 17:25:59 2006
@@ -47,6 +47,11 @@
 			setRequired(required.getNodeValue().toLowerCase().equals("true"));
 		}
 	}
+	
+	public AbstractSourceNode(final URI uri, final Boolean isRequired) {
+		setSourceURI(uri);
+		setRequired(isRequired);
+	}
 
 	public AbstractSourceNode() {
 	}
@@ -69,7 +74,7 @@
 	private URL resolveClasspathURI(final URI sourceURI)
 			throws ProcessingException {
 		URL resourceURL;
-		resourceURL = this.getClass().getResource(sourceURI.getPath());
+		resourceURL = this.getClass().getResource(sourceURI.getSchemeSpecificPart());
 		if (resourceURL == null)
 			throw new ProcessingException(
 					"Cannot find the classpath resource: " + sourceURI);

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/LocationNode.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/LocationNode.java?view=diff&rev=488483&r1=488482&r2=488483
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/LocationNode.java
(original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/LocationNode.java
Mon Dec 18 17:25:59 2006
@@ -41,6 +41,10 @@
 	private AbstractMatcher matcher;
 	
 	private List<AbstractSourceNode> sourceNodes;
+	
+	public LocationNode(final AbstractMatcher matcher, final List<AbstractSourceNode>
srcNodes) throws URISyntaxException {
+		init(matcher, srcNodes);
+	}
 
 	/**
 	 * Construct a new LocationNode from an XML node.
@@ -68,14 +72,22 @@
 		this.init(pattern, nodes);
 	}
 
-	private void init(final String pattern, final List<AbstractSourceNode> nodes) throws
URISyntaxException {
-		if (pattern == null)
+	private void init(final AbstractMatcher matcher, final List<AbstractSourceNode> nodes)
throws URISyntaxException {
+		if (nodes == null || nodes.size() == 0)
+			throw new IllegalArgumentException(
+					"There must be at least one source node for a location");
+		this.setMatcher(matcher);
+		this.setSourceNodes(nodes);
+	}
+	
+	private void init(final String rePattern, final List<AbstractSourceNode> nodes) throws
URISyntaxException {
+		if (rePattern == null)
 			throw new IllegalArgumentException(
 					"requestURIPattern cannot be null");
 		if (nodes == null || nodes.size() == 0)
 			throw new IllegalArgumentException(
 					"There must be at least one source node for a location");
-		this.setMatcher(new REMatcher(pattern));
+		this.setMatcher(new REMatcher(rePattern));
 		this.setSourceNodes(nodes);
 	}
 

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/SourceNode.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/SourceNode.java?view=diff&rev=488483&r1=488482&r2=488483
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/SourceNode.java
(original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/locationMap/SourceNode.java
Mon Dec 18 17:25:59 2006
@@ -17,6 +17,7 @@
 package org.apache.forrest.core.locationMap;
 
 import java.io.IOException;
+import java.net.URI;
 import java.net.URISyntaxException;
 
 import org.w3c.dom.Node;
@@ -31,6 +32,10 @@
 
 	public SourceNode(Node element) throws URISyntaxException, IOException {
 		super(element);
+	}
+
+	public SourceNode(URI requestURI, Boolean isRequired) {
+		super(requestURI, isRequired);
 	}
 	
 }



Mime
View raw message