vgritsenko 01/08/11 11:27:20
Modified: src/org/apache/cocoon/components/language/markup/sitemap/java
sitemap.xsl
Log:
Release actions
Revision Changes Path
1.33 +25 -12
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.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- sitemap.xsl 2001/07/25 01:31:22 1.32
+++ sitemap.xsl 2001/08/11 18:27:20 1.33
@@ -124,7 +124,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.32 2001/07/25 01:31:22 vgritsenko
Exp $
+ * @version CVS $Id: sitemap.xsl,v 1.33 2001/08/11 18:27:20 vgritsenko
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"/>";
@@ -885,9 +885,9 @@
</xsl:call-template>
</xsl:variable>
- <!-- gets the string how the action is to be invoked in java code -->
+ <!-- gets the action java variable -->
<xsl:variable name="action-name">
- <xsl:text>((Action)this.actions.select("</xsl:text><xsl:value-of
select="$action-type"/><xsl:text>")).act</xsl:text>
+ <xsl:text>action_</xsl:text><xsl:value-of select="generate-id(.)"/>
</xsl:variable>
<!-- break on error when old parameter syntax exists -->
@@ -920,13 +920,15 @@
</xsl:apply-templates>
<!-- generate the invocation of the act method of the action component
-->
+ Action <xsl:value-of select="$action-name"/> =
(Action)this.actions.select("<xsl:value-of select="$action-type"/>");
+ try {
<xsl:choose>
<xsl:when
test="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and
local-name() != 'parameter']">
- if ((map = <xsl:value-of select="$action-name"/> (redirector,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>)) !=
null) {
+ if ((map = <xsl:value-of select="$action-name"/>.act(redirector,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>)) !=
null) {
if (redirector.hasRedirected()) {
return true;
}
- getLogger().debug("Action <xsl:value-of
select="translate($action-name,'"',' ')"/>");
+ getLogger().debug("Action <xsl:value-of select="$action-type"/>");
listOfMaps.add (map);
<xsl:apply-templates
select="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and
local-name() != 'parameter']"/>
listOfMaps.remove(listOfMaps.size()-1);
@@ -936,13 +938,15 @@
}
</xsl:when>
<xsl:otherwise>
- map = <xsl:value-of select="$action-name"/> (redirector,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>);
-
+ map = <xsl:value-of select="$action-name"/>.act(redirector,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>);
if (redirector.hasRedirected()) {
return true;
}
</xsl:otherwise>
</xsl:choose>
+ } finally {
+ this.actions.release(<xsl:value-of select="$action-name"/>);
+ }
</xsl:template> <!-- match="map:[EMAIL PROTECTED]" -->
<!-- processing of an act element having a type attribute -->
@@ -964,13 +968,15 @@
</xsl:call-template>
</xsl:variable>
- <!-- gets the string how the action is to be invoked in java code -->
+ <!-- gets the action java variable -->
<xsl:variable name="action-name">
- <xsl:text>((Action)this.actions.select("</xsl:text><xsl:value-of
select="$action-type"/><xsl:text>")).act</xsl:text>
+ <xsl:text>action_</xsl:text><xsl:value-of select="generate-id(.)"/>
</xsl:variable>
+ <xsl:text>
<!-- test if we have to define parameters for this action -->
nparam = new Parameters ();
+ </xsl:text>
<!-- generate the value used for the parameter argument in the
invocation of the act method of this action -->
<xsl:variable name="component-param">nparam</xsl:variable>
@@ -980,22 +986,29 @@
<xsl:with-param name="param" select="$component-param"/>
</xsl:apply-templates>
+ <xsl:text>
nparam.merge(param);
+ </xsl:text>
<!-- generate the invocation of the act method of the action component
-->
+ Action <xsl:value-of select="$action-name"/> =
(Action)this.actions.select("<xsl:value-of select="$action-type"/>");
+ try {
<xsl:choose>
<xsl:when
test="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and
local-name() != 'parameter']">
- if ((map = <xsl:value-of select="$action-name"/> (redirector,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>)) !=
null) {
- getLogger().debug("Action <xsl:value-of
select="translate($action-name,'"',' ')"/>");
+ if ((map = <xsl:value-of select="$action-name"/>.act(redirector,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>)) !=
null) {
+ getLogger().debug("Action <xsl:value-of select="$action-type"/>");
listOfMaps.add (map);
<xsl:apply-templates
select="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and
local-name() != 'parameter']" mode="set"/>
listOfMaps.remove(listOfMaps.size()-1);
}
</xsl:when>
<xsl:otherwise>
- map = <xsl:value-of select="$action-name"/> (redirector,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>);
+ map = <xsl:value-of select="$action-name"/>.act(redirector,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>);
</xsl:otherwise>
</xsl:choose>
+ } finally {
+ this.actions.release(<xsl:value-of select="$action-name"/>);
+ }
</xsl:template> <!-- match="map:[EMAIL PROTECTED]" mode="set" -->
<!-- processing of an act element having a set attribute -->
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]