dims 01/05/18 04:04:27
Modified: src/org/apache/cocoon/components/language/markup/sitemap/java
sitemap.xsl
src/org/apache/cocoon/sitemap AbstractSitemap.java
Log:
Patch in message "redirect-to resource" and substitution of the List of Maps
from Jiri Luzny ([EMAIL PROTECTED])
Revision Changes Path
1.4 +5 -2
xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
Index: sitemap.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- sitemap.xsl 2001/05/18 10:45:19 1.3
+++ sitemap.xsl 2001/05/18 11:04:17 1.4
@@ -99,7 +99,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo
Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin
Loritsch</a>
- * @version CVS $Id: sitemap.xsl,v 1.3 2001/05/18 10:45:19 dims Exp $
+ * @version CVS $Id: sitemap.xsl,v 1.4 2001/05/18 11:04:17 dims Exp $
*/
public class <xsl:value-of select="@file-name"/> extends AbstractSitemap
{
static final String LOCATION = "<xsl:value-of
select="translate(@file-path, '/', '.')"/>.<xsl:value-of select="@file-name"/>";
@@ -995,7 +995,10 @@
<!-- redirect to a internal resource definition -->
<xsl:when test="@resource">
- if(true)return resource_<xsl:value-of select="translate(@resource,
'- ', '__')"/>(pipeline, eventPipeline, listOfMaps, environment, cocoon_view,
internalRequest);
+ Class[] argTypes = new Class[] {StreamPipeline.class,
EventPipeline.class, List.class, Environment.class, String.class, Boolean.TYPE};
+ Object[] argValues = new Object[] {pipeline, eventPipeline,
listOfMaps, environment, cocoon_view, new Boolean(internalRequest)};
+ String methodName = "resource_" + substitute(listOfMaps,
"<xsl:value-of select="translate(@resource, '- ', '__')"/>");
+ if(true)return invokeMethod(methodName, argTypes, argValues);
</xsl:when>
<!-- redirect to a external resource definition with optional session
mode attribute. Let the environment do the redirect -->
1.2 +20 -1
xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java
Index: AbstractSitemap.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractSitemap.java 2001/05/09 20:49:36 1.1
+++ AbstractSitemap.java 2001/05/18 11:04:23 1.2
@@ -44,7 +44,7 @@
* Base class for generated <code>Sitemap</code> classes
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/05/09 20:49:36 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/05/18 11:04:23 $
*/
public abstract class AbstractSitemap extends AbstractLoggable implements
Sitemap, Disposable, ThreadSafe {
private Context context;
@@ -250,6 +250,25 @@
*/
public abstract boolean process (Environment environment, StreamPipeline
pipeline, EventPipeline eventPipeline)
throws Exception;
+
+
+ /**
+ * Invokes a method of this class using Java Reflection
+ *
+ * @param methodName The name of the method to be invoked
+ * @param argTypes The array of class types of the method attributes
+ * @param argTypes The array of values of the method attributes
+ *
+ * @exception Exception If an error occurs during method invocation
+ */
+ protected boolean invokeMethod(String methodName, Class[] argTypes,
Object[] argValues) throws Exception {
+ try {
+ java.lang.reflect.Method method =
this.getClass().getDeclaredMethod(methodName, argTypes);
+ return ((Boolean) method.invoke(this, argValues)).booleanValue();
+ } catch (Exception e) {
+ throw new Exception ("Sitemap: " + methodName + " not found");
+ }
+ }
/**
* dispose
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]