rubys 2005/04/15 12:54:54
Modified: rdc build.xml
rdc/examples/web alpha-test.jsp alphanum-test.jsp
country-test.jsp currency-test.jsp date-test.jsp
digits-test.jsp duration-test.jsp
dyna-select1-test.jsp equipment-type-test.jsp
getcart.jsp group-test.jsp hello.jsp isbn-test.jsp
mortgage-test.jsp mortgageType-test.jsp
nested-group-test.jsp number-test.jsp
payment-method-test.jsp percent-test.jsp
regression-test.jsp rulebased-conditions.jsp
rulebased-nested.jsp rulebased-order.jsp
select1-test.jsp simple-template-test.jsp
ssn-test.jsp task-test.jsp time-test.jsp
usMajorCity-test.jsp usState-test.jsp
zipCode-test.jsp
rdc/examples/web/config/mortgage-app member-number.xml
mls-number.xml
rdc/examples/web/config/musicstore-app amazon-menu.xml
rdc/examples/web/config/rule-based-dialog rulebased.dtd
rdc/examples/web/grammar/musicstore-app
genre_or_category.grxml
rdc/examples/web/mortgage-app goodbye.jsp login.jsp
mortgage-rate.jsp mortgage.jsp
transaction-confirm.jsp
rdc/examples/web/musicstore-app/voice error.jsp footer.jsp
goodbye.jsp header.jsp listalbums.jsp
mainmenu-fsm.jsp mainmenu.jsp reviewalbum-fsm.jsp
reviewalbum.jsp reviewcart.jsp
rdc/src/META-INF/tags/rdc alpha.tag alphanum.tag
configure.tag creditcardType.tag date.tag
duration.tag fsm-confirm.tag fsm-input.tag
fsm-run.tag number.tag set-config-composite.tag
setup-results.tag task.tag template.tag time.tag
usMajorCity.tag usState.tag zipCode.tag
rdc/src/META-INF/tags/rdc/schemas config10.mod
config10.mod.rnc config10.mod.rng config10.mod.xsd
rdc-config.dtd rdc-config.rnc rdc-config.rng
rdc-config.xsd sample-config.xml
rdc/src/org/apache/taglibs/rdc Date.java GrammarServlet.java
RDCUtils.java
rdc/src/org/apache/taglibs/rdc/core Constants.java
DialogManager.java ExpandTag.java GroupTag.java
IncludeFSMFragmentTag.java StrutsErrorsTag.java
StrutsSubmitTag.java
rdc/src/org/apache/taglibs/rdc/dm Conditions.java
DMUtils.java DialogManagerImpl.java
RuleBasedDirectedDialog.java
SimpleDirectedDialog.java
rdc/src/util taglibs20-doc.xsl tld20.xsl
rdc/xml rdc.xml
Log:
Beta 1.0
Revision Changes Path
1.8 +2 -2 jakarta-taglibs-sandbox/rdc/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-taglibs-sandbox/rdc/build.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- build.xml 27 Feb 2005 16:02:03 -0000 1.7
+++ build.xml 15 Apr 2005 19:54:52 -0000 1.8
@@ -35,7 +35,7 @@
servlet24.jar jsp-api.jar
jstl.jar standard.jar struts12.jar
commons-digester.jar commons-beanutils.jar
- commons-el.jar commons-logging.jar commons-el.jar
+ commons-el.jar commons-logging.jar
-->
<property file="../build.properties"/>
<property name="classpath"
@@ -164,7 +164,7 @@
<pathelement location="${commons-logging.jar}"/>
<pathelement location="${standard.jar}"/>
<pathelement location="${jstl.jar}"/>
- <pathelement location="${struts12.jar}"/>
+ <pathelement location="${struts12.jar}"/>
</classpath>
</taskdef>
<jasper2 validateXml="false" uriroot="${build.examples}"
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/alpha-test.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/alphanum-test.jsp
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/country-test.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/currency-test.jsp
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/date-test.jsp
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/digits-test.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/duration-test.jsp
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/dyna-select1-test.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/equipment-type-test.jsp
1.3 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/getcart.jsp
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/group-test.jsp
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/hello.jsp
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/isbn-test.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/mortgage-test.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/mortgageType-test.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/nested-group-test.jsp
1.4 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/number-test.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/payment-method-test.jsp
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/percent-test.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/regression-test.jsp
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/rulebased-conditions.jsp
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/rulebased-nested.jsp
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/rulebased-order.jsp
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/select1-test.jsp
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/simple-template-test.jsp
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/ssn-test.jsp
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/task-test.jsp
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/time-test.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/usMajorCity-test.jsp
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/usState-test.jsp
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/examples/web/zipCode-test.jsp
1.2 +11 -0
jakarta-taglibs-sandbox/rdc/examples/web/config/mortgage-app/member-number.xml
Index: member-number.xml
===================================================================
RCS file:
/home/cvs/jakarta-taglibs-sandbox/rdc/examples/web/config/mortgage-app/member-number.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- member-number.xml 14 Feb 2005 12:30:57 -0000 1.1
+++ member-number.xml 15 Apr 2005 19:54:53 -0000 1.2
@@ -16,6 +16,17 @@
limitations under the License.
-->
<input>
+ <events>
+ <link next="pause.jsp?resumeURI=login.jsp">
+ <grammar mode="voice" version="1.0" root="pause">
+ <rule id="pause" scope="public">
+ <one-of>
+ <item>pause</item>
+ </one-of>
+ </rule>
+ </grammar>
+ </link>
+ </events>
<property-list>
<property name="incompletetimeout" value="1s"/>
<property name="completetimeout" value="1s"/>
1.2 +11 -0
jakarta-taglibs-sandbox/rdc/examples/web/config/mortgage-app/mls-number.xml
Index: mls-number.xml
===================================================================
RCS file:
/home/cvs/jakarta-taglibs-sandbox/rdc/examples/web/config/mortgage-app/mls-number.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mls-number.xml 14 Feb 2005 12:30:57 -0000 1.1
+++ mls-number.xml 15 Apr 2005 19:54:53 -0000 1.2
@@ -16,6 +16,17 @@
limitations under the License.
-->
<input>
+ <events>
+ <link next="pause.jsp?resumeURI=login.jsp">
+ <grammar mode="voice" version="1.0" root="pause">
+ <rule id="pause" scope="public">
+ <one-of>
+ <item>pause</item>
+ </one-of>
+ </rule>
+ </grammar>
+ </link>
+ </events>
<property-list>
<property name="incompletetimeout" value="1s"/>
<property name="completetimeout" value="1s"/>
1.2 +9 -0
jakarta-taglibs-sandbox/rdc/examples/web/config/musicstore-app/amazon-menu.xml
Index: amazon-menu.xml
===================================================================
RCS file:
/home/cvs/jakarta-taglibs-sandbox/rdc/examples/web/config/musicstore-app/amazon-menu.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- amazon-menu.xml 14 Feb 2005 12:30:57 -0000 1.1
+++ amazon-menu.xml 15 Apr 2005 19:54:53 -0000 1.2
@@ -55,6 +55,15 @@
</prompt>
<reprompt/>
</catch>
+ <link next="pause.jsp?resumeURI=mainmenu.do">
+ <grammar mode="voice" version="1.0" root="pause">
+ <rule id="pause" scope="public">
+ <one-of>
+ <item>pause</item>
+ </one-of>
+ </rule>
+ </grammar>
+ </link>
</events>
<prompt-list>
<prompt>Choose a music genre or select one of the V-Store
categories.</prompt>
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/config/rule-based-dialog/rulebased.dtd
1.2 +2 -1
jakarta-taglibs-sandbox/rdc/examples/web/grammar/musicstore-app/genre_or_category.grxml
Index: genre_or_category.grxml
===================================================================
RCS file:
/home/cvs/jakarta-taglibs-sandbox/rdc/examples/web/grammar/musicstore-app/genre_or_category.grxml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- genre_or_category.grxml 14 Feb 2005 12:30:57 -0000 1.1
+++ genre_or_category.grxml 15 Apr 2005 19:54:53 -0000 1.2
@@ -3,7 +3,8 @@
<grammar version="1.0" xmlns="http://www.w3.org/2001/06/grammar"
tag-format="semantics/1.0"
- mode="voice"
+ mode="voice"
+ xml:lang="en-US"
root="genre_or_category">
<!--
Copyright 2004 The Apache Software Foundation.
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/mortgage-app/goodbye.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/mortgage-app/login.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/mortgage-app/mortgage-rate.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/mortgage-app/mortgage.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/mortgage-app/transaction-confirm.jsp
1.3 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/musicstore-app/voice/error.jsp
1.3 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/musicstore-app/voice/footer.jsp
1.3 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/musicstore-app/voice/goodbye.jsp
1.3 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/musicstore-app/voice/header.jsp
1.3 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/musicstore-app/voice/listalbums.jsp
1.3 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/musicstore-app/voice/mainmenu-fsm.jsp
1.3 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/musicstore-app/voice/mainmenu.jsp
1.3 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/musicstore-app/voice/reviewalbum-fsm.jsp
1.3 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/musicstore-app/voice/reviewalbum.jsp
1.3 +0 -0
jakarta-taglibs-sandbox/rdc/examples/web/musicstore-app/voice/reviewcart.jsp
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/alpha.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/alphanum.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/configure.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/creditcardType.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/date.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/duration.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/fsm-confirm.tag
1.6 +15 -11
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/fsm-input.tag
Index: fsm-input.tag
===================================================================
RCS file:
/home/cvs/jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/fsm-input.tag,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- fsm-input.tag 27 Feb 2005 16:02:05 -0000 1.5
+++ fsm-input.tag 15 Apr 2005 19:54:53 -0000 1.6
@@ -18,20 +18,23 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+
<%@ tag body-content="empty" %>
<%@ attribute name="model" required="true" type="java.lang.Object" %>
<%@ attribute name="state" type="java.lang.String" %>
-->
<c:set var="stateNode" value="${(empty state) ? 'input' : state}" />
-<rdc:get-configuration xml="${model.configuration}"
- locator="/config/${stateNode}/events/link"/>
-<rdc:get-configuration xml="${model.configuration}"
- locator="/config/${stateNode}/events/catch"/>
+<rdc:expand>
+ <rdc:get-configuration xml="${model.configuration}"
+ locator="/config/${stateNode}/events/link"/>
+ <rdc:get-configuration xml="${model.configuration}"
+ locator="/config/${stateNode}/events/catch"/>
+</rdc:expand>
<field name="${model.id}Input">
<rdc:expand>
<rdc:get-configuration xml="${model.configuration}"
- locator="/config/${stateNode}/prompt-list/prompt"/>
+ locator="/config/${stateNode}/prompt-list/prompt"/>
</rdc:expand>
<c:forEach items="${model.grammars}" var="currentGrammar">
<c:choose>
@@ -40,13 +43,14 @@
</c:when>
<c:otherwise>
<grammar xml:lang="en-US" src="${currentGrammar.grammar}"
- <c:if test="${currentGrammar.isDTMF ==
true}">mode="dtmf"</c:if> />
+ mode="${(currentGrammar.isDTMF == true) ? 'dtmf' :
'voice'}" />
</c:otherwise>
</c:choose>
</c:forEach>
<property name="maxnbest" value="${model.numNBest}"/>
+ <property name="confidencelevel" value="${model.minConfidence}"/>
<rdc:get-configuration xml="${model.configuration}"
- locator="/config/${stateNode}/property-list/property"/>
+ locator="/config/${stateNode}/property-list/property"/>
<catch event= "repeat" >
<reprompt/>
</catch>
@@ -59,11 +63,11 @@
</c:if>
</c:if>
<rdc:get-configuration xml="${model.configuration}"
- locator="/config/${stateNode}/noinput-list/noinput"/>
+ locator="/config/${stateNode}/noinput-list/noinput"/>
<rdc:get-configuration xml="${model.configuration}"
- locator="/config/${stateNode}/nomatch-list/nomatch"/>
+ locator="/config/${stateNode}/nomatch-list/nomatch"/>
<rdc:get-configuration xml="${model.configuration}"
- locator="/config/${stateNode}/help-list/help"/>
+ locator="/config/${stateNode}/help-list/help"/>
<filled>
<c:if test="${!model.skipSubmit}">
<script src="${pageContext.request.contextPath}/.grammar/nbest.js"/>
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/fsm-run.tag
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/number.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/set-config-composite.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/setup-results.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/task.tag
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/template.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/time.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/usMajorCity.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/usState.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/zipCode.tag
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/schemas/config10.mod
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/schemas/config10.mod.rnc
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/schemas/config10.mod.rng
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/schemas/config10.mod.xsd
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/schemas/rdc-config.dtd
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/schemas/rdc-config.rnc
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/schemas/rdc-config.rng
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/schemas/rdc-config.xsd
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/META-INF/tags/rdc/schemas/sample-config.xml
1.3 +1 -1
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/Date.java
Index: Date.java
===================================================================
RCS file:
/home/cvs/jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/Date.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Date.java 28 Jan 2005 16:43:00 -0000 1.2
+++ Date.java 15 Apr 2005 19:54:54 -0000 1.3
@@ -185,7 +185,7 @@
return inputDate;
}
}
- } // end normalize()
+ } // end canonicalize()
/**
* Validates the received input against the validation constraints
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/GrammarServlet.java
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/RDCUtils.java
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/core/Constants.java
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/core/DialogManager.java
1.7 +0 -0
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/core/ExpandTag.java
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/core/GroupTag.java
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/core/IncludeFSMFragmentTag.java
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/core/StrutsErrorsTag.java
1.6 +134 -34
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/core/StrutsSubmitTag.java
Index: StrutsSubmitTag.java
===================================================================
RCS file:
/home/cvs/jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/core/StrutsSubmitTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- StrutsSubmitTag.java 27 Feb 2005 16:02:06 -0000 1.5
+++ StrutsSubmitTag.java 15 Apr 2005 19:54:54 -0000 1.6
@@ -20,7 +20,10 @@
package org.apache.taglibs.rdc.core;
import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.Map;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.StringTokenizer;
import javax.servlet.ServletException;
import javax.servlet.jsp.JspWriter;
@@ -32,10 +35,13 @@
import java.lang.reflect.InvocationTargetException;
import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMessage;
+import org.apache.taglibs.rdc.RDCUtils;
/**
* <p>Tag implementation of the <rdc:struts-submit> tag
* Collects data from the RDC layer and posts it according to the RDC-struts
@@ -47,27 +53,55 @@
public class StrutsSubmitTag
extends SimpleTagSupport {
- // Attribute name of map that will store form data from
- // multiple submits this session
+ /**
+ * Attribute name of map that will store form data from
+ * multiple submits this session
+ */
public static final String ATTR_VIEWS_MAP = "viewsMap";
- // Attribute name of key that will be used to retrieve
- // form data for this submission
+ /**
+ * Attribute name of key that will be used to retrieve
+ * form data for this submission
+ */
public static final String ATTR_VIEWS_MAP_KEY = "key";
+
// URI to be submitted to the struts ActionServlet
- String submit;
+ private String submit;
// Namelist to be forwarded to the struts layer
- String namelist;
+ private String namelist;
+ // The list of RDCs to be whose state will be "cleared"
+ // from the existing session. Must be a space-separated list
+ // of "dialogMap" keys.
+ private String clearlist;
// Page context for the RDC data collection
- PageContext context;
-
+ private PageContext context;
+ // The "dialogMap" object from the host JSP
+ private LinkedHashMap dialogMap;
+
+ // Error messages (to be i18n'zed)
+ private static final String ERR_NO_DIALOGMAP = "<rdc:struts-submit>:
The" +
+ "\"dialogMap\" attribute must accompany the \"clearlist\"" +
+ " attribute; and refer to the dialogMap of the host JSP.";
+ private static final String ERR_CANNOT_CLEAR = "Could not clear " +
"token \"{0}\" specified in <rdc:struts-submit> clearlist. " +
+ "Check the clearlist.\n";
+ private static final String ERR_POP_FORM_BEAN = "Struts Submit" +
" Populating Form Bean";
+ private static final String ERR_FORWARD_FAILED = "<!-- Error after " +
"struts submit forward to: \"{0}\" with namelist \"{1}\" -->\n";
+
+ private static final String MSG_ILLEGAL_ACCESS =
"IllegalAccessException" +
" while populating form bean";
+ private static final String MSG_ILLEGAL_INVOC =
"InvocationTargetException" +
" while populating form bean";
+
+ // Logging
+ private static Log log = LogFactory.getLog(StrutsSubmitTag.class);
+
/*
* Constructor
*/
public StrutsSubmitTag() {
super();
- submit = null;
- namelist = null;
- context = null;
+ this.submit = null;
+ this.namelist = null;
+ this.clearlist = null;
+ this.context = null;
+ this.dialogMap = null;
}
/**
@@ -79,7 +113,6 @@
this.submit = submit;
}
-
/**
* Set the namelist
*
@@ -90,6 +123,15 @@
}
/**
+ * Set the clearlist
+ *
+ * @param String clearlist
+ */
+ public void setClearlist(String clearlist) {
+ this.clearlist = clearlist;
+ }
+
+ /**
* Set the page context
*
* @param PageContext context the supplied page context
@@ -99,6 +141,15 @@
}
/**
+ * Set the "dialogMap" object [of the host JSP]
+ *
+ * @param LinkedHashMap the dialogMap object from the host JSP
+ */
+ public void setDialogMap(LinkedHashMap dialogMap) {
+ this.dialogMap = dialogMap;
+ }
+
+ /**
* Collect data from the RDC layer and post it into the viewsMap
* according to the RDC-struts interface contract
*
@@ -108,28 +159,77 @@
JspWriter out = context.getOut();
- HashMap viewsMap =
(HashMap)context.getSession().getAttribute(ATTR_VIEWS_MAP);
- if (viewsMap == null) {
- viewsMap = new HashMap();
- context.getSession().setAttribute(ATTR_VIEWS_MAP,
viewsMap);
+ if (!RDCUtils.isStringEmpty(namelist)) {
+ // (1) Access/create the views map
+ HashMap viewsMap = (HashMap)context.getSession().
+ getAttribute(ATTR_VIEWS_MAP);
+ if (viewsMap == null) {
+ viewsMap = new HashMap();
+
context.getSession().setAttribute(ATTR_VIEWS_MAP, viewsMap);
+ }
+
+ // (2) Populate form data
+ HashMap formData = new HashMap();
+ StringTokenizer nameToks = new
StringTokenizer(namelist, " ");
+ while (nameToks.hasMoreTokens()) {
+ String name = nameToks.nextToken();
+ formData.put(name, context.getAttribute(name));
+ }
+
+ // (3) Store the form data according to the RDC-struts
+ // interface contract
+ String key = "" + context.hashCode();
+ viewsMap.put(key, formData);
+ context.getRequest().setAttribute(ATTR_VIEWS_MAP_KEY,
key);
}
- HashMap formData = new HashMap();
- StringTokenizer strTok = new StringTokenizer(namelist, " ");
- while (strTok.hasMoreTokens()) {
- String tok = strTok.nextToken();
- formData.put(tok, context.getAttribute(tok));
+
+ if (!RDCUtils.isStringEmpty(clearlist)) {
+ // (4) Clear session state based on the clearlist
+ if (dialogMap == null) {
+ throw new
IllegalArgumentException(ERR_NO_DIALOGMAP);
+ }
+ StringTokenizer clearToks = new
StringTokenizer(clearlist, " ");
+ outer:
+ while (clearToks.hasMoreTokens()) {
+ String clearMe = clearToks.nextToken();
+ String errMe = clearMe;
+ Map targetMap = dialogMap;
+ int dot = clearMe.indexOf('.');
+ while (dot != -1) {
+ try {
+ targetMap = (Map)
dialogMap.get(clearMe.
+ substring(0,dot));
+ clearMe =
clearMe.substring(dot+1);
+ dot = clearMe.indexOf('.');
+ } catch (Exception e) {
+ MessageFormat msgFormat =
+ new
MessageFormat(ERR_CANNOT_CLEAR);
+ log.warn(msgFormat.format(new
Object[] {errMe}));
+ continue outer;
+ }
+ }
+ if (targetMap != null &&
targetMap.containsKey(clearMe)) {
+ targetMap.remove(clearMe);
+ } else {
+ MessageFormat msgFormat =
+ new
MessageFormat(ERR_CANNOT_CLEAR);
+ log.warn(msgFormat.format(new Object[]
{errMe}));
+ }
+ }
}
- String key = "" + context.hashCode();
- viewsMap.put(key, formData);
- context.getRequest().setAttribute(ATTR_VIEWS_MAP_KEY, key);
+
+ // (5) Forward request
try {
context.forward(submit);
} catch (ServletException e) {
// Need to investigate whether refactoring this
- // try to provide blanket coverage makes sense -Rahul
- out.write("<!-- Error after struts submit forward to: " + submit
+
- " with namelist " + namelist + "-->\n");
+ // try to provide blanket coverage makes sense
e.printStackTrace();
+ MessageFormat msgFormat =
+ new MessageFormat(ERR_FORWARD_FAILED);
+ // Log error *and* send error message to JspWriter
+ out.write(msgFormat.format(new Object[] {submit,
namelist}));
+ log.error(msgFormat.format(new Object[] {submit,
namelist}));
} // end of try-catch
}
@@ -142,19 +242,19 @@
public static void populate(ActionForm formBean, HttpServletRequest req,
ActionErrors errors) {
- HashMap viewsMap = (HashMap)
req.getSession().getAttribute(ATTR_VIEWS_MAP);
- HashMap formData = (HashMap)
viewsMap.get(req.getAttribute(ATTR_VIEWS_MAP_KEY));
+ HashMap viewsMap = (HashMap) req.getSession().
+ getAttribute(ATTR_VIEWS_MAP);
+ HashMap formData = (HashMap) viewsMap.get(req.
+ getAttribute(ATTR_VIEWS_MAP_KEY));
try {
BeanUtils.populate(formBean, formData);
} catch (IllegalAccessException iae) {
iae.printStackTrace();
- errors.add("Struts Submit Populating Form Bean", new
ActionMessage(
- "IllegalAccessException while
populating form bean"));
+ errors.add(ERR_POP_FORM_BEAN, new
ActionMessage(MSG_ILLEGAL_ACCESS));
} catch (InvocationTargetException ite) {
ite.printStackTrace();
- errors.add("Struts Submit Populating Form Bean", new
ActionMessage(
- "InvocationTargetException while
populating form bean"));
+ errors.add(ERR_POP_FORM_BEAN, new
ActionMessage(MSG_ILLEGAL_INVOC));
}
}
}
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/dm/Conditions.java
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/dm/DMUtils.java
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/dm/DialogManagerImpl.java
1.4 +0 -0
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/dm/RuleBasedDirectedDialog.java
1.6 +0 -0
jakarta-taglibs-sandbox/rdc/src/org/apache/taglibs/rdc/dm/SimpleDirectedDialog.java
1.4 +0 -0 jakarta-taglibs-sandbox/rdc/src/util/taglibs20-doc.xsl
1.6 +0 -0 jakarta-taglibs-sandbox/rdc/src/util/tld20.xsl
1.7 +98 -9 jakarta-taglibs-sandbox/rdc/xml/rdc.xml
Index: rdc.xml
===================================================================
RCS file: /home/cvs/jakarta-taglibs-sandbox/rdc/xml/rdc.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- rdc.xml 27 Feb 2005 16:02:07 -0000 1.6
+++ rdc.xml 15 Apr 2005 19:54:54 -0000 1.7
@@ -31,7 +31,7 @@
-->
<taglib>
<!-- Version number of this tagib -->
- <tlib-version>Pre Beta 1.2</tlib-version>
+ <tlib-version>Beta 1.0</tlib-version>
<!-- Minimum version of JSP spec required -->
<jsp-version>2.0</jsp-version>
<!-- jakarta-taglib name of this tag library -->
@@ -588,26 +588,27 @@
<name>id</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
+ <description>The unique identifier for this group.</description>
</attribute>
<attribute>
<name>strategy</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
+ <description>The fully qualified class name for the
+ pluggable dialog management strategy.</description>
</attribute>
<attribute>
<name>config</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
+ <description>The strategy specific config attribute.</description>
</attribute>
<attribute>
<name>submit</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <name>confirm</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
+ <description>The URI where this container will submit its
*intermediate*
+ results to.</description>
</attribute>
<example>
<![CDATA[
@@ -678,11 +679,13 @@
<name>var</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
+ <description>Variable holding value that will get
popped.</description>
</attribute>
<attribute>
<name>stack</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
+ <description>Variable holding target stack.</description>
</attribute>
<variable>
<name-from-attribute>var</name-from-attribute>
@@ -706,11 +709,13 @@
<name>var</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
+ <description>Variable holding result of the peek
operation.</description>
</attribute>
<attribute>
<name>stack</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
+ <description>Variable holding target stack.</description>
</attribute>
<variable>
<name-from-attribute>var</name-from-attribute>
@@ -740,6 +745,17 @@
</example>
</tag-file>
<tag-file>
+ <name>pause</name>
+ <path>/META-INF/tags/rdc/pause.tag</path>
+ <description>A possible handler for pausing an
application</description>
+ <display-name>pause tag</display-name>
+ <example>
+ <![CDATA[
+ <rdc:pause id="myPause" />
+ ]]>
+ </example>
+ </tag-file>
+ <tag-file>
<name>hello</name>
<path>/META-INF/tags/rdc/hello.tagx</path>
<description>A RDC hello world tag</description>
@@ -890,11 +906,13 @@
<name>template</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
+ <description>The data model of this template
instance.</description>
</attribute>
<attribute>
<name>context</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
+ <description>The pageContext of the host tag file.</description>
</attribute>
<example>
<![CDATA[
@@ -915,16 +933,32 @@
<name>submit</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
+ <description>The URI to submit the results to (a struts
mapping).</description>
</attribute>
<attribute>
- <name>namelist</name>
+ <name>context</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
+ <description>The pageContext of the host JSP.</description>
</attribute>
<attribute>
- <name>context</name>
- <required>true</required>
+ <name>namelist</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <description>The list of the RDCs whose values should be
submitted.</description>
+ </attribute>
+ <attribute>
+ <name>clearlist</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <description>The list of the RDCs whose values should be cleared.
Item in the list
+ can be a component or container.</description>
+ </attribute>
+ <attribute>
+ <name>dialogMap</name>
+ <required>false</required>
<rtexprvalue>true</rtexprvalue>
+ <description>The RDC dialog map used by the host JSP.</description>
</attribute>
<example>
<![CDATA[
@@ -958,11 +992,13 @@
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
+ <description>The URI for the default configuration file for this
component.</description>
</attribute>
<attribute>
<name>model</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
+ <description>The data model of this component.</description>
</attribute>
<example>
<![CDATA[
@@ -973,6 +1009,59 @@
</tag>
</tagtoc></taglib>
+ <revision release="Beta 1.0" date="03/08/2005">
+ <description>
+ This is a new features and sample apps release.
+ </description>
+ <section name="Major Additions:">
+ <item>
+ <b>Defining Custom Event tuples</b> - It is possible
+ to leverage the VoiceXML support for user defined event
+ (name, grammar, handler) tuples. These tuples are
+ added to the RDC config file.<br/>
+ </item>
+ <item>
+ <b>Dialog Context Switching</b> - A recipe for switching
+ dialog contexts using the RDC framework i.e. having the ability
+ to leave a task undone, initiate and complete another task and
+ then come back to the earlier one, has been demonstrated.<br/>
+ <dir>
+ Example in rdc-examples.war is login.jsp of the mortgage
application.
+ The following steps were taken:<br/>
+ <ul>
+ <li>A custom "pause" event was defined on the digits
components
+ (via their config files, as mentioned above)</li>
+ <li>A pause.jsp handler was authored (simple JSP hosting
+ <rdc:pause>)</li>
+ <li>The "clearlist" attribute of <rdc:struts-submit>
was
+ used with appropriate values</li>
+ </ul>
+ </dir>
+ </item>
+ <item>
+ <b>Multi-channel amazon application</b> - This sample
application
+ uses the Amazon Web Services to provide users with a <b>Small
Device GUI
+ -or- Voice User Interface</b> for browsing through and buying
+ music albums. See revision history for Pre Beta 1.1 and Pre
Beta 1.2<br/>
+ </item>
+ <item>
+ More <b>documentation</b> in rdc-doc.war
+ </item>
+ </section>
+ <section name="New RDC Tags:">
+ <item>
+ <a href="index.html#pause"><rdc:pause></a> - Pauses
until the user resumes the
+ application.
+ </item>
+ </section>
+ <section name="Modified RDC Tags:">
+ <item>
+ <a
href="index.html#struts-submit"><rdc:struts-submit></a> - Added the
ability to
+ selectively clear some or all of the RDC session state.
+ </item>
+ </section>
+ </revision>
+
<revision release="Pre Beta 1.2" date="02/25/2005">
<description>
Added GUI channel to Music Store sample application.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]