You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cr...@apache.org on 2005/03/23 05:01:12 UTC
svn commit: r158725 [3/4] - in cocoon/branches/BRANCH_2_1_X/src/blocks:
forms/java/org/apache/cocoon/forms/samples/dreamteam/
forms/samples/dreamteam/content/ forms/samples/dreamteam/flow/
forms/samples/dreamteam/messages/ forms/samples/dreamteam/resources/styles/
jms/conf/ jms/java/org/apache/cocoon/acting/
jms/java/org/apache/cocoon/components/jms/
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/content/teamTemplate.jx
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/content/teamTemplate.jx?view=diff&r1=158724&r2=158725
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/content/teamTemplate.jx (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/content/teamTemplate.jx Tue Mar 22 20:01:09 2005
@@ -13,231 +13,231 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--->
-<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0" xmlns:cinclude="http://apache.org/cocoon/include/1.0"
- xmlns:i18n="http://apache.org/cocoon/i18n/2.1" xmlns:ft="http://apache.org/cocoon/forms/1.0#template" xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
- <!-- Import the macros that define CForms template elements -->
- <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <link href="local-resources/dreamteam.css" type="text/css" rel="stylesheet"/>
- <title>The Dream Team</title>
- </head>
- <body>
- <h1>The Dream Team</h1>
- <p>Now is the time to choose your dream team.</p>
- <div class="legend">
- <table>
- <tr>
- <td>
- <img src="resources/move_up.gif"/>
- </td>
- <td>Move this row 1 up</td>
- </tr>
- <tr>
- <td>
- <img src="resources/move_down.gif"/>
- </td>
- <td>Move this row 1 down</td>
- </tr>
- <tr>
- <td>
- <img src="resources/delete.gif"/>
- </td>
- <td>Delete this row</td>
- </tr>
- <tr>
- <td>
- <img src="resources/new.gif"/>
- </td>
- <td>Add a new row below this row</td>
- </tr>
- </table>
- </div>
- <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST">
- <jx:choose>
- <jx:when test="${form.getChild('teammembers').getSize() == 0}">
- <p>
- <strong> There is no team yet. </strong>
- </p>
- </jx:when>
- <jx:otherwise>
- <table>
- <thead>
- <tr>
- <td class="tableheader">
- <ft:repeater-widget-label id="teammembers" widget-id="position"/>
- </td>
- <td class="tableheader">
- <ft:repeater-widget-label id="teammembers" widget-id="memberId"/>
- </td>
- <td class="tableheader">
- <ft:repeater-widget-label id="teammembers" widget-id="country"/>
- </td>
- <td class="tableheader">
- <ft:repeater-widget-label id="teammembers" widget-id="select"/>
- </td>
- </tr>
- </thead>
- <tbody>
+-->
+<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0" xmlns:cinclude="http://apache.org/cocoon/include/1.0"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1" xmlns:ft="http://apache.org/cocoon/forms/1.0#template" xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+ <!-- Import the macros that define CForms template elements -->
+ <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
+ <html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <link href="local-resources/dreamteam.css" type="text/css" rel="stylesheet"/>
+ <title>The Dream Team</title>
+ </head>
+ <body>
+ <h1>The Dream Team</h1>
+ <p>Now is the time to choose your dream team.</p>
+ <div class="legend">
+ <table>
+ <tr>
+ <td>
+ <img src="resources/move_up.gif"/>
+ </td>
+ <td>Move this row 1 up</td>
+ </tr>
+ <tr>
+ <td>
+ <img src="resources/move_down.gif"/>
+ </td>
+ <td>Move this row 1 down</td>
+ </tr>
+ <tr>
+ <td>
+ <img src="resources/delete.gif"/>
+ </td>
+ <td>Delete this row</td>
+ </tr>
+ <tr>
+ <td>
+ <img src="resources/new.gif"/>
+ </td>
+ <td>Add a new row below this row</td>
+ </tr>
+ </table>
+ </div>
+ <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST">
+ <jx:choose>
+ <jx:when test="${form.getChild('teammembers').getSize() == 0}">
+ <p>
+ <strong> There is no team yet. </strong>
+ </p>
+ </jx:when>
+ <jx:otherwise>
+ <table>
+ <thead>
+ <tr>
+ <td class="tableheader">
+ <ft:repeater-widget-label id="teammembers" widget-id="position"/>
+ </td>
+ <td class="tableheader">
+ <ft:repeater-widget-label id="teammembers" widget-id="memberId"/>
+ </td>
+ <td class="tableheader">
+ <ft:repeater-widget-label id="teammembers" widget-id="country"/>
+ </td>
+ <td class="tableheader">
+ <ft:repeater-widget-label id="teammembers" widget-id="select"/>
+ </td>
+ </tr>
+ </thead>
+ <tbody>
<!-- The contents of the repeater-widget element
is a template that will be applied to each
row in the repeater.
- -->
- <ft:repeater-widget id="teammembers">
- <tr>
- <td>
- <ft:widget id="position">
- <fi:styling submit-on-change="true"/>
- </ft:widget>
- </td>
- <td>
- <ft:widget id="memberId">
- <fi:styling submit-on-change="true"/>
- </ft:widget>
- </td>
- <td>
- <i18n:text>
- <ft:widget id="country"/>
- </i18n:text>
- </td>
- <td>
+ -->
+ <ft:repeater-widget id="teammembers">
+ <tr>
+ <td>
+ <ft:widget id="position">
+ <fi:styling submit-on-change="true"/>
+ </ft:widget>
+ </td>
+ <td>
+ <ft:widget id="memberId">
+ <fi:styling submit-on-change="true"/>
+ </ft:widget>
+ </td>
+ <td>
+ <i18n:text>
+ <ft:widget id="country"/>
+ </i18n:text>
+ </td>
+ <td>
<!-- Don't display the "move up" button
on the first row
- -->
- <jx:choose>
- <jx:when test="${repeaterLoop.first}">
- <img src="resources/blank_btn.gif"/>
- </jx:when>
- <jx:otherwise>
- <ft:widget id="up">
- <fi:styling type="image" src="resources/move_up.gif"/>
- </ft:widget>
- </jx:otherwise>
- </jx:choose>
+ -->
+ <jx:choose>
+ <jx:when test="${repeaterLoop.first}">
+ <img src="resources/blank_btn.gif"/>
+ </jx:when>
+ <jx:otherwise>
+ <ft:widget id="up">
+ <fi:styling type="image" src="resources/move_up.gif"/>
+ </ft:widget>
+ </jx:otherwise>
+ </jx:choose>
<!-- Don't display the "move down" button
on the last row
- -->
- <jx:choose>
- <jx:when test="${repeaterLoop.last}">
- <img src="resources/blank_btn.gif"/>
- </jx:when>
- <jx:otherwise>
- <ft:widget id="down">
- <fi:styling type="image" src="resources/move_down.gif"/>
- </ft:widget>
- </jx:otherwise>
- </jx:choose>
- <ft:widget id="delete">
- <fi:styling type="image" src="resources/delete.gif"/>
- </ft:widget>
- <ft:widget id="add">
- <fi:styling type="image" src="resources/new.gif"/>
- </ft:widget>
- <ft:widget id="select"/>
- </td>
- </tr>
- </ft:repeater-widget>
- </tbody>
- </table>
- </jx:otherwise>
- </jx:choose>
- <table>
- <tr>
- <td style="border: 0px solid;">
- <ft:widget id="addmember"/>
- </td>
- <td style="border: 0px solid;">
- <jx:if test="${widget.getChild('teammembers').getSize() > 0}">
- <ft:widget id="removemember"/>
- </jx:if>
- </td>
- </tr>
- <tr>
- <td style="border: 0px solid;">
- <input type="submit" value="Submit"/>
- </td>
- <td style="border: 0px solid;"/>
- </tr>
- </table>
- </ft:form-template>
- <p class="developer-header"> Developer Notes </p>
- <h2>Page definition</h2>
- <p class="developer-note"> This page is defined in <ul class="developer-note">
- <li>
- <b>teamTemplate.jx</b>, the form template, </li>
- <li>
- <b>teamDef.xml</b>, the widget definitions and</li>
- <li>
- <b>teamBind.xml</b>, the widget binding to Java Beans.</li>
- </ul>
- <p class="developer-note"> The pipeline calls the function <i>prot_buildTeam</i> in <b>team.js</b>. There is no
- naming rule for flow functions, but adding a prefix ('prot_') as a simple kind of security measure to prevent
- outsiders from directly calling the function. Security by obscurity you might call it. </p>
- <h2>What happens?</h2>
- <p class="developer-note"> In <i>prot_buildTeam</i> a list of 'positions' is generated from the information in
- the Manager class and passed onto the form. </p>
- <p class="developer-note"> Below is the definition of the <i>position</i> widget. </p>
- <div class="code">
- <div class="codeIndent"> <fd:field id="position"> <div class="codeIndent">
- <fd:label>Position</fd:label> </div>
- <div class="codeIndent"> <fd:datatype base="string"/> </div>
- <div class="codeIndent"> <fd:selection-list dynamic="true" type="flow-jxpath"
- list-path="positionList" value-path="value" label-path="label"/> </div>
- <div class="codeIndent"> <fd:on-value-changed> <div class="codeIndent">
- <fd:javascript> <div class="codeIndent"> // this script can be found in team.js<br/>
- updateNameWidget(event); </div> </fd:javascript> </div>
- </fd:on-value-changed> </div> </fd:field> </div>
- </div>
- <p class="developer-note"> The widget <i>position</i> has a selection-list of type <i>flow-jxpath</i>. The other
- attributes define the list to use: </p>
- <ul class="developer-note">
- <li>
- <i>list-path</i> holds the name of the list that is passed in the "viewData" attribute </li>
- <li>
- <i>value-path</i> holds the name of the variable or method that returns the value to use </li>
- <li>
- <i>label-path</i> holds the name of the variable or method that returns the label for the value </li>
- </ul>
- </p>
- <h2>Internationalization</h2>
- <p class="developer-note"> The function also shows how to build this list with localized (i.e. i18n) labels. </p>
- <div class="code">
- <div class="codeIndent"> ...<br/> // key = key code for position<br/> // set the label to the localized message
- using i18n<br/> positionList[i + 1] = {value: key, label: new I18nMessage(key)};<br/> ... </div>
- </div>
- <p class="developer-note"> Adding the appropriate code to switch locale is left as an exercise. :-) </p>
- <h2>Dependency between widgets</h2>
- <p class="developer-note"> The section <i>on-value-changed</i> holds the javascript that handles the dependency.
- When the value of the <i>positionlist</i> changes, the <i>memberId</i> widget should get a new list of
- names.<br/> The script that handles this update can be entered directly between the <i>javascript</i> tags, but
- adding a descriptive function name there and moving the function to a separate javascript file keeps the widget
- definition file clearer. Note the <i>event</i> parameter.<br/> Remember to add the
- <i>submit-on-change="true"</i> attribute to the styling tag! </p>
- <h2>Repeater validation</h2>
- <p class="developer-note"> This repeater also has a repeater validation section, which prevents using duplicate
- names. Again, the script can be entered directly in the widget definition file, but it can also be added to a
- function that is placed in a separate javascript file. <b>Note:</b> this function takes <i>widget</i> (the
- current repeater) as parameter and <b>MUST</b> return a boolean value (true = success).<br/> The repeater
- validation function is called when the <i>Submit</i> button is pressed. If a validation error occurs, the first
- invalid row will be marked with a blue <font style="color: blue">!</font>. </p>
- <h2>Some observations</h2>
- <p class="developer-note"> The samples provide a great set of XSL files to convert the template and styling tags
- of the widgets into HTML. They start with <b>forms-samples-styling.xsl</b> and can be found in the
- <i>samples/blocks/forms/resources</i> folders. </p>
- <p class="developer-note">
- <b>Note:</b> when you use these XSL files, remember to use them as the last transformation in your pipeline, or
- make sure they find the appropriate tags to add some scripts to the html <i><head></i> and
- <i><body></i> tags. Especially without a reference to the <b>forms-lib.js</b> file, the
- on-value-changed event will not be sent to the server and therefore no script is executed. </p>
- <p class="developer-note">
- <b>Note:</b> At this moment (2004/10/20) a bug exists that throws a NullPointerException when the javascript in
- the validation section is executed with the Rhino debugger enabled! </p>
- <h2>When everything is valid</h2>
- <p class="developer-note"> When <i>Submit</i> is pressed, and all rows validate, the <i>prot_buildTeam</i>
- function takes over and hands the selected team to the Manager class for further processing. Finally the
- function passes flow onto the <i>showteam</i> pipeline. </p>
- </body>
- </html>
-</jx:template>
+ -->
+ <jx:choose>
+ <jx:when test="${repeaterLoop.last}">
+ <img src="resources/blank_btn.gif"/>
+ </jx:when>
+ <jx:otherwise>
+ <ft:widget id="down">
+ <fi:styling type="image" src="resources/move_down.gif"/>
+ </ft:widget>
+ </jx:otherwise>
+ </jx:choose>
+ <ft:widget id="delete">
+ <fi:styling type="image" src="resources/delete.gif"/>
+ </ft:widget>
+ <ft:widget id="add">
+ <fi:styling type="image" src="resources/new.gif"/>
+ </ft:widget>
+ <ft:widget id="select"/>
+ </td>
+ </tr>
+ </ft:repeater-widget>
+ </tbody>
+ </table>
+ </jx:otherwise>
+ </jx:choose>
+ <table>
+ <tr>
+ <td style="border: 0px solid;">
+ <ft:widget id="addmember"/>
+ </td>
+ <td style="border: 0px solid;">
+ <jx:if test="${widget.getChild('teammembers').getSize() > 0}">
+ <ft:widget id="removemember"/>
+ </jx:if>
+ </td>
+ </tr>
+ <tr>
+ <td style="border: 0px solid;">
+ <input type="submit" value="Submit"/>
+ </td>
+ <td style="border: 0px solid;"/>
+ </tr>
+ </table>
+ </ft:form-template>
+ <p class="developer-header"> Developer Notes </p>
+ <h2>Page definition</h2>
+ <p class="developer-note"> This page is defined in <ul class="developer-note">
+ <li>
+ <b>teamTemplate.jx</b>, the form template, </li>
+ <li>
+ <b>teamDef.xml</b>, the widget definitions and</li>
+ <li>
+ <b>teamBind.xml</b>, the widget binding to Java Beans.</li>
+ </ul>
+ <p class="developer-note"> The pipeline calls the function <i>prot_buildTeam</i> in <b>team.js</b>. There is no
+ naming rule for flow functions, but adding a prefix ('prot_') as a simple kind of security measure to prevent
+ outsiders from directly calling the function. Security by obscurity you might call it. </p>
+ <h2>What happens?</h2>
+ <p class="developer-note"> In <i>prot_buildTeam</i> a list of 'positions' is generated from the information in
+ the Manager class and passed onto the form. </p>
+ <p class="developer-note"> Below is the definition of the <i>position</i> widget. </p>
+ <div class="code">
+ <div class="codeIndent"> <fd:field id="position"> <div class="codeIndent">
+ <fd:label>Position</fd:label> </div>
+ <div class="codeIndent"> <fd:datatype base="string"/> </div>
+ <div class="codeIndent"> <fd:selection-list dynamic="true" type="flow-jxpath"
+ list-path="positionList" value-path="value" label-path="label"/> </div>
+ <div class="codeIndent"> <fd:on-value-changed> <div class="codeIndent">
+ <fd:javascript> <div class="codeIndent"> // this script can be found in team.js<br/>
+ updateNameWidget(event); </div> </fd:javascript> </div>
+ </fd:on-value-changed> </div> </fd:field> </div>
+ </div>
+ <p class="developer-note"> The widget <i>position</i> has a selection-list of type <i>flow-jxpath</i>. The other
+ attributes define the list to use: </p>
+ <ul class="developer-note">
+ <li>
+ <i>list-path</i> holds the name of the list that is passed in the "viewData" attribute </li>
+ <li>
+ <i>value-path</i> holds the name of the variable or method that returns the value to use </li>
+ <li>
+ <i>label-path</i> holds the name of the variable or method that returns the label for the value </li>
+ </ul>
+ </p>
+ <h2>Internationalization</h2>
+ <p class="developer-note"> The function also shows how to build this list with localized (i.e. i18n) labels. </p>
+ <div class="code">
+ <div class="codeIndent"> ...<br/> // key = key code for position<br/> // set the label to the localized message
+ using i18n<br/> positionList[i + 1] = {value: key, label: new I18nMessage(key)};<br/> ... </div>
+ </div>
+ <p class="developer-note"> Adding the appropriate code to switch locale is left as an exercise. :-) </p>
+ <h2>Dependency between widgets</h2>
+ <p class="developer-note"> The section <i>on-value-changed</i> holds the javascript that handles the dependency.
+ When the value of the <i>positionlist</i> changes, the <i>memberId</i> widget should get a new list of
+ names.<br/> The script that handles this update can be entered directly between the <i>javascript</i> tags, but
+ adding a descriptive function name there and moving the function to a separate javascript file keeps the widget
+ definition file clearer. Note the <i>event</i> parameter.<br/> Remember to add the
+ <i>submit-on-change="true"</i> attribute to the styling tag! </p>
+ <h2>Repeater validation</h2>
+ <p class="developer-note"> This repeater also has a repeater validation section, which prevents using duplicate
+ names. Again, the script can be entered directly in the widget definition file, but it can also be added to a
+ function that is placed in a separate javascript file. <b>Note:</b> this function takes <i>widget</i> (the
+ current repeater) as parameter and <b>MUST</b> return a boolean value (true = success).<br/> The repeater
+ validation function is called when the <i>Submit</i> button is pressed. If a validation error occurs, the first
+ invalid row will be marked with a blue <font style="color: blue">!</font>. </p>
+ <h2>Some observations</h2>
+ <p class="developer-note"> The samples provide a great set of XSL files to convert the template and styling tags
+ of the widgets into HTML. They start with <b>forms-samples-styling.xsl</b> and can be found in the
+ <i>samples/blocks/forms/resources</i> folders. </p>
+ <p class="developer-note">
+ <b>Note:</b> when you use these XSL files, remember to use them as the last transformation in your pipeline, or
+ make sure they find the appropriate tags to add some scripts to the html <i><head></i> and
+ <i><body></i> tags. Especially without a reference to the <b>forms-lib.js</b> file, the
+ on-value-changed event will not be sent to the server and therefore no script is executed. </p>
+ <p class="developer-note">
+ <b>Note:</b> At this moment (2004/10/20) a bug exists that throws a NullPointerException when the javascript in
+ the validation section is executed with the Rhino debugger enabled! </p>
+ <h2>When everything is valid</h2>
+ <p class="developer-note"> When <i>Submit</i> is pressed, and all rows validate, the <i>prot_buildTeam</i>
+ function takes over and hands the selected team to the Manager class for further processing. Finally the
+ function passes flow onto the <i>showteam</i> pipeline. </p>
+ </body>
+ </html>
+</jx:template>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/flow/team.js
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/flow/team.js?view=diff&r1=158724&r2=158725
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/flow/team.js (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/flow/team.js Tue Mar 22 20:01:09 2005
@@ -1,34 +1,34 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/v3/Form.js");
-importClass (Packages.org.apache.cocoon.forms.util.I18nMessage);
-
-var manager = Packages.org.apache.cocoon.forms.samples.dreamteam.Manager.getManager();
-
-function initDreamTeamChooser() {
- var documentURI = cocoon.parameters["documentURI"];
- // parse the document to a DOM-tree
- var document = loadDocument(documentURI);
- // initialise the Manager
- manager.readPlayers(document);
- cocoon.sendPage("home.form");
-}
-
-function prot_showTeam() {
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/v3/Form.js");
+importClass (Packages.org.apache.cocoon.forms.util.I18nMessage);
+
+var manager = Packages.org.apache.cocoon.forms.samples.dreamteam.Manager.getManager();
+
+function initDreamTeamChooser() {
+ var documentURI = cocoon.parameters["documentURI"];
+ // parse the document to a DOM-tree
+ var document = loadDocument(documentURI);
+ // initialise the Manager
+ manager.readPlayers(document);
+ cocoon.sendPage("home.form");
+}
+
+function prot_showTeam() {
var persons = manager.getDreamTeam();
if(persons == null || persons == undefined) {
var size = 0;
@@ -41,60 +41,60 @@
list : persons,
size : size
};
- cocoon.sendPage("showTeam.form", viewData);
-} // showTeam
-
-function prot_buildTeam() {
- var formDisplay = "team.form";
- var formDef = "content/teamDef.xml";
- var formBind = "content/teamBind.xml"
-
- var allPersons = manager.getAllPersonsByPosition();
- var list = new Packages.org.apache.cocoon.forms.samples.dreamteam.Team();
-
- var keys = allPersons.keySet().toArray();
- var key;
- var positionList = new Array();
- positionList[0] = {value:"", label: " "};
- for (var i = 0; i < keys.length; i++) {
- key = keys[i];
- // set the label to the localized message using i18n
- positionList[i + 1] = {value: key, label: new I18nMessage(key)};
- }
- /*
- // add the first player to the team
- var firstPlayer = allPersons.get(keys[0]).getTeam().get(0);
- var member = new Packages.org.apache.cocoon.samples.dreamteam.TeamMember();
- member.position = firstPlayer.position;
- member.memberId = firstPlayer.memberId;
- member.name = firstPlayer.name;
- member.country = firstPlayer.country;
- list.addMember(member);
- */
-
+ cocoon.sendPage("showTeam.form", viewData);
+} // showTeam
+
+function prot_buildTeam() {
+ var formDisplay = "team.form";
+ var formDef = "content/teamDef.xml";
+ var formBind = "content/teamBind.xml"
+
+ var allPersons = manager.getAllPersonsByPosition();
+ var list = new Packages.org.apache.cocoon.forms.samples.dreamteam.Team();
+
+ var keys = allPersons.keySet().toArray();
+ var key;
+ var positionList = new Array();
+ positionList[0] = {value:"", label: " "};
+ for (var i = 0; i < keys.length; i++) {
+ key = keys[i];
+ // set the label to the localized message using i18n
+ positionList[i + 1] = {value: key, label: new I18nMessage(key)};
+ }
+ /*
+ // add the first player to the team
+ var firstPlayer = allPersons.get(keys[0]).getTeam().get(0);
+ var member = new Packages.org.apache.cocoon.samples.dreamteam.TeamMember();
+ member.position = firstPlayer.position;
+ member.memberId = firstPlayer.memberId;
+ member.name = firstPlayer.name;
+ member.country = firstPlayer.country;
+ list.addMember(member);
+ */
+
var form = new Form(formDef);
form.setAttribute("counter", new java.lang.Long(0));
- form.setAttribute("everyone", allPersons);
-
- form.createBinding(formBind);
- form.load(list);
-
+ form.setAttribute("everyone", allPersons);
+
+ form.createBinding(formBind);
+ form.load(list);
+
var viewData = {
list : list,
positionList: positionList
- };
- form.showForm(formDisplay, viewData);
- form.save(list);
- manager.buildDreamTeam(list);
- // next page presenting the team
- cocoon.sendPage("showteam.html");
-}
-
-
-// function used in the 'position' widget to change the selection-list of the 'memberId' widget
-// that displays the names
-
-function updateNameWidget(event) {
+ };
+ form.showForm(formDisplay, viewData);
+ form.save(list);
+ manager.buildDreamTeam(list);
+ // next page presenting the team
+ cocoon.sendPage("showteam.html");
+}
+
+
+// function used in the 'position' widget to change the selection-list of the 'memberId' widget
+// that displays the names
+
+function updateNameWidget(event) {
var value = event.source.value;
var memberIdwidget = event.source.lookupWidget("../memberId");
if (value != null) {
@@ -116,10 +116,10 @@
// Note that it will also fire an event on the
// "name" widget if it already had a value.
memberIdwidget.setValue(null);
- }
-}
-
-function updateCountryWidget(event) {
+ }
+}
+
+function updateCountryWidget(event) {
print("memberId changed from " + event.oldValue + " to " + event.newValue);
var value = event.source.value;
var form = event.source.form;
@@ -131,26 +131,26 @@
var country = member.getCountry();
var countrywidget = event.source.lookupWidget("../country");
countrywidget.setValue(country);
- }
-}
-
-function updateRowIDcounter(event) {
- // Increment the row creation ID counter
- // (it has been initialized in the flowscript when the
- // form was created).
- // This shows how attributes can be used as a communication
- // means between application logic and widget event handlers.
-
- var form = event.source.form;
- var count = new java.lang.Long(form.getAttribute("counter").longValue() + 1);
- form.setAttribute("counter", count);
- var repeater = form.getChild("teammembers");
- repeater.getRow(repeater.getSize() - 1).getChild("ID").setValue(count);
-}
-
-function validateRepeater(widget) {
- // This demonstrates validating a repeater: we check here if all
- // teammembers are distinct.
+ }
+}
+
+function updateRowIDcounter(event) {
+ // Increment the row creation ID counter
+ // (it has been initialized in the flowscript when the
+ // form was created).
+ // This shows how attributes can be used as a communication
+ // means between application logic and widget event handlers.
+
+ var form = event.source.form;
+ var count = new java.lang.Long(form.getAttribute("counter").longValue() + 1);
+ form.setAttribute("counter", count);
+ var repeater = form.getChild("teammembers");
+ repeater.getRow(repeater.getSize() - 1).getChild("ID").setValue(count);
+}
+
+function validateRepeater(widget) {
+ // This demonstrates validating a repeater: we check here if all
+ // teammembers are distinct.
// A repeater cannot itself display a validation error, and therefore
// sets a validation error on a field in the offending row.
var list = new java.util.ArrayList();
@@ -175,14 +175,14 @@
}
// Must return true/false
- return success;
-}
-
-
-/*
- This function is only used to read in an XML file and pass it on as DOM Document for further processing.
-*/
-function loadDocument(uri) {
+ return success;
+}
+
+
+/*
+ This function is only used to read in an XML file and pass it on as DOM Document for further processing.
+*/
+function loadDocument(uri) {
var parser = null;
var source = null;
var resolver = null;
@@ -198,5 +198,5 @@
resolver.release(source);
cocoon.releaseComponent(parser);
cocoon.releaseComponent(resolver);
- }
-}
+ }
+}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/DreamTeamMessages.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/DreamTeamMessages.xml?view=diff&r1=158724&r2=158725
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/DreamTeamMessages.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/DreamTeamMessages.xml Tue Mar 22 20:01:09 2005
@@ -1,38 +1,38 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- Copyright 1999-2004 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<catalogue>
- <message key="GK">Goalkeeper</message>
- <message key="MD">Midfielder</message>
- <message key="FW">Forward</message>
- <message key="DF">Defense</message>
- <message key="EN">England</message>
- <message key="NL">Netherlands</message>
- <message key="DK">Denmark</message>
- <message key="DE">Germany</message>
- <message key="SE">Sweden</message>
- <message key="LV">Latvia</message>
- <message key="CZ">Czech Republic</message>
- <message key="RU">Russia</message>
- <message key="BG">Bulgaria</message>
- <message key="GR">Greece</message>
- <message key="HR">Croatia</message>
- <message key="CH">Switzerland</message>
- <message key="IT">Italy</message>
- <message key="ES">Spain</message>
- <message key="FR">France</message>
- <message key="PT">Portugal</message>
-</catalogue>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<catalogue>
+ <message key="GK">Goalkeeper</message>
+ <message key="MD">Midfielder</message>
+ <message key="FW">Forward</message>
+ <message key="DF">Defense</message>
+ <message key="EN">England</message>
+ <message key="NL">Netherlands</message>
+ <message key="DK">Denmark</message>
+ <message key="DE">Germany</message>
+ <message key="SE">Sweden</message>
+ <message key="LV">Latvia</message>
+ <message key="CZ">Czech Republic</message>
+ <message key="RU">Russia</message>
+ <message key="BG">Bulgaria</message>
+ <message key="GR">Greece</message>
+ <message key="HR">Croatia</message>
+ <message key="CH">Switzerland</message>
+ <message key="IT">Italy</message>
+ <message key="ES">Spain</message>
+ <message key="FR">France</message>
+ <message key="PT">Portugal</message>
+</catalogue>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/DreamTeamMessages_de.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/DreamTeamMessages_de.xml?view=diff&r1=158724&r2=158725
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/DreamTeamMessages_de.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/DreamTeamMessages_de.xml Tue Mar 22 20:01:09 2005
@@ -1,38 +1,38 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- Copyright 1999-2004 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<catalogue>
- <message key="GK">Torwart</message>
- <message key="MD">Mittelfeld Spieler</message>
- <message key="FW">Stürmer</message>
- <message key="DF">Verteidiger</message>
- <message key="EN">England</message>
- <message key="NL">Niederlande</message>
- <message key="DK">Dänemark</message>
- <message key="DE">Deutschland</message>
- <message key="SE">Schweden</message>
- <message key="LV">Lettland</message>
- <message key="CZ">Tschechische Republik</message>
- <message key="RU">Russland</message>
- <message key="BG">Bulgarien</message>
- <message key="GR">Griechenland</message>
- <message key="HR">Kroation</message>
- <message key="CH">Schweiz</message>
- <message key="IT">Italien</message>
- <message key="ES">Spanien</message>
- <message key="FR">Frankreich</message>
- <message key="PT">Portugal</message>
-</catalogue>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<catalogue>
+ <message key="GK">Torwart</message>
+ <message key="MD">Mittelfeld Spieler</message>
+ <message key="FW">Stürmer</message>
+ <message key="DF">Verteidiger</message>
+ <message key="EN">England</message>
+ <message key="NL">Niederlande</message>
+ <message key="DK">Dänemark</message>
+ <message key="DE">Deutschland</message>
+ <message key="SE">Schweden</message>
+ <message key="LV">Lettland</message>
+ <message key="CZ">Tschechische Republik</message>
+ <message key="RU">Russland</message>
+ <message key="BG">Bulgarien</message>
+ <message key="GR">Griechenland</message>
+ <message key="HR">Kroation</message>
+ <message key="CH">Schweiz</message>
+ <message key="IT">Italien</message>
+ <message key="ES">Spanien</message>
+ <message key="FR">Frankreich</message>
+ <message key="PT">Portugal</message>
+</catalogue>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/DreamTeamMessages_it.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/DreamTeamMessages_it.xml?view=diff&r1=158724&r2=158725
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/DreamTeamMessages_it.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/DreamTeamMessages_it.xml Tue Mar 22 20:01:09 2005
@@ -1,39 +1,39 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- Copyright 1999-2004 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- This catalogue file contains translations for DreamTeam messages. -->
-<catalogue>
- <message key="GK">Portiere</message>
- <message key="MD">Centrocampista</message>
- <message key="FW">Attaccante</message>
- <message key="DF">Difensore</message>
- <message key="EN">Inghilterra</message>
- <message key="NL">Paesi Bassi</message>
- <message key="DK">Danimarca</message>
- <message key="DE">Germania</message>
- <message key="SE">Svezia</message>
- <message key="LV">Lettonia</message>
- <message key="CZ">Repubblica Ceca</message>
- <message key="RU">Russia</message>
- <message key="BG">Bulgaria</message>
- <message key="GR">Grecia</message>
- <message key="HR">Croazia</message>
- <message key="CH">Svizzera</message>
- <message key="IT">Italia</message>
- <message key="ES">Spagna</message>
- <message key="FR">Francia</message>
- <message key="PT">Portogallo</message>
-</catalogue>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- This catalogue file contains translations for DreamTeam messages. -->
+<catalogue>
+ <message key="GK">Portiere</message>
+ <message key="MD">Centrocampista</message>
+ <message key="FW">Attaccante</message>
+ <message key="DF">Difensore</message>
+ <message key="EN">Inghilterra</message>
+ <message key="NL">Paesi Bassi</message>
+ <message key="DK">Danimarca</message>
+ <message key="DE">Germania</message>
+ <message key="SE">Svezia</message>
+ <message key="LV">Lettonia</message>
+ <message key="CZ">Repubblica Ceca</message>
+ <message key="RU">Russia</message>
+ <message key="BG">Bulgaria</message>
+ <message key="GR">Grecia</message>
+ <message key="HR">Croazia</message>
+ <message key="CH">Svizzera</message>
+ <message key="IT">Italia</message>
+ <message key="ES">Spagna</message>
+ <message key="FR">Francia</message>
+ <message key="PT">Portogallo</message>
+</catalogue>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/FormsMessages.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/FormsMessages.xml?view=diff&r1=158724&r2=158725
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/FormsMessages.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/FormsMessages.xml Tue Mar 22 20:01:09 2005
@@ -1,49 +1,49 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- Copyright 1999-2004 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- This catalogue file contains translations for built-in CForms messages. -->
-<catalogue>
- <message key="general.field-required">This field is required.</message>
-
- <message key="datatype.conversion-failed">Not a valid {0}.</message>
- <message key="datatype.long">integer number</message>
- <message key="datatype.date">date</message>
-
- <message key="validation.string.exact-length">Should be exactly {0} characters.</message>
- <message key="validation.string.range-length">Should contain from {0} to {1} characters.</message>
- <message key="validation.string.min-length">Should be at least {0} characters.</message>
- <message key="validation.string.max-length">Should be at most {0} characters.</message>
- <message key="validation.string.regexp">Does not match the following regular expression: {0}</message>
-
- <message key="validation.string.invalidemail">This field does not contain a valid email address</message>
-
- <message key="validation.array.exact-valuecount">Exactly {0} item(s) should be selected.</message>
- <message key="validation.array.range-valuecount">At least {0} item(s) and at most {1} items should be selected.</message>
- <message key="validation.array.min-valuecount">At least {0} item(s) should be selected.</message>
- <message key="validation.array.max-valuecount">At most {0} items should be selected.</message>
-
- <message key="multivaluefield.conversionfailed">One of the selected values is of an incorrect type.</message>
-
- <message key="validation.numeric.range">Number should be in the range from {0} to {1}.</message>
- <message key="validation.numeric.min">Number should be greater than or equal to {0}.</message>
- <message key="validation.numeric.max">Number should be less than or equal to {0}.</message>
-
- <message key="validation.mod10">Mod 10 check failed.</message>
-
-
- <message key="aggregatedfield.split-failed">Content of this field does not match the following regular expression: {0}</message>
-
-</catalogue>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- This catalogue file contains translations for built-in CForms messages. -->
+<catalogue>
+ <message key="general.field-required">This field is required.</message>
+
+ <message key="datatype.conversion-failed">Not a valid {0}.</message>
+ <message key="datatype.long">integer number</message>
+ <message key="datatype.date">date</message>
+
+ <message key="validation.string.exact-length">Should be exactly {0} characters.</message>
+ <message key="validation.string.range-length">Should contain from {0} to {1} characters.</message>
+ <message key="validation.string.min-length">Should be at least {0} characters.</message>
+ <message key="validation.string.max-length">Should be at most {0} characters.</message>
+ <message key="validation.string.regexp">Does not match the following regular expression: {0}</message>
+
+ <message key="validation.string.invalidemail">This field does not contain a valid email address</message>
+
+ <message key="validation.array.exact-valuecount">Exactly {0} item(s) should be selected.</message>
+ <message key="validation.array.range-valuecount">At least {0} item(s) and at most {1} items should be selected.</message>
+ <message key="validation.array.min-valuecount">At least {0} item(s) should be selected.</message>
+ <message key="validation.array.max-valuecount">At most {0} items should be selected.</message>
+
+ <message key="multivaluefield.conversionfailed">One of the selected values is of an incorrect type.</message>
+
+ <message key="validation.numeric.range">Number should be in the range from {0} to {1}.</message>
+ <message key="validation.numeric.min">Number should be greater than or equal to {0}.</message>
+ <message key="validation.numeric.max">Number should be less than or equal to {0}.</message>
+
+ <message key="validation.mod10">Mod 10 check failed.</message>
+
+
+ <message key="aggregatedfield.split-failed">Content of this field does not match the following regular expression: {0}</message>
+
+</catalogue>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/FormsMessages_nl_NL.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/FormsMessages_nl_NL.xml?view=diff&r1=158724&r2=158725
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/FormsMessages_nl_NL.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/messages/FormsMessages_nl_NL.xml Tue Mar 22 20:01:09 2005
@@ -1,59 +1,59 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- Copyright 1999-2004 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- This catalogue file contains translations for built-in CForms messages. -->
-<catalogue xml:lang="nl_NL">
- <message key="general.field-required">Dit veld moet ingevuld zijn.</message>
-
- <message key="datatype.conversion-failed">Ongeldig {0}.</message>
- <message key="datatype.long">integer getal</message>
- <message key="datatype.date">datum</message>
-
- <message key="validation.string.exact-length">Dit veld moet precies {0} tekens lang
- zijn.</message>
- <message key="validation.string.range-length">Het aantal tekens moet tussen de {0} en
- {1} liggen.</message>
- <message key="validation.string.min-length">Dit veld moet minimaal {0} tekens lang
- zijn.</message>
- <message key="validation.string.max-length">Dit veld mag maximaal {0} tekens lang
- zijn.</message>
- <message key="validation.string.regexp">De waarde komt niet overeen met deze reg.
- exp.: {0}</message>
-
- <message key="validation.string.invalidemail">Dit is geen geldig email adres</message>
-
- <message key="validation.array.exact-valuecount">Kies precies {0} elementen.</message>
- <message key="validation.array.range-valuecount">Kies tussen de {0} en {1}
- elementen.</message>
- <message key="validation.array.min-valuecount">Kies minimaal {0} elementen.</message>
- <message key="validation.array.max-valuecount">Kies maximaal {0}
- elementen.</message>
-
- <message key="multivaluefield.conversionfailed">Een van de gekozen waarden is
- ongeldig.</message>
-
- <message key="validation.numeric.range">De waarde moet liggen tussen {0} en
- {1}.</message>
- <message key="validation.numeric.min">De waarde is minimaal {0}.</message>
- <message key="validation.numeric.max">De waarde is maximaal {0}.</message>
-
- <message key="validation.mod10">De Mod 10 verificatie is mislukt.</message>
-
-
- <message key="aggregatedfield.split-failed">De waarde komt niet overeen met deze reg.
- exp.: {0}</message>
-
-</catalogue>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- This catalogue file contains translations for built-in CForms messages. -->
+<catalogue xml:lang="nl_NL">
+ <message key="general.field-required">Dit veld moet ingevuld zijn.</message>
+
+ <message key="datatype.conversion-failed">Ongeldig {0}.</message>
+ <message key="datatype.long">integer getal</message>
+ <message key="datatype.date">datum</message>
+
+ <message key="validation.string.exact-length">Dit veld moet precies {0} tekens lang
+ zijn.</message>
+ <message key="validation.string.range-length">Het aantal tekens moet tussen de {0} en
+ {1} liggen.</message>
+ <message key="validation.string.min-length">Dit veld moet minimaal {0} tekens lang
+ zijn.</message>
+ <message key="validation.string.max-length">Dit veld mag maximaal {0} tekens lang
+ zijn.</message>
+ <message key="validation.string.regexp">De waarde komt niet overeen met deze reg.
+ exp.: {0}</message>
+
+ <message key="validation.string.invalidemail">Dit is geen geldig email adres</message>
+
+ <message key="validation.array.exact-valuecount">Kies precies {0} elementen.</message>
+ <message key="validation.array.range-valuecount">Kies tussen de {0} en {1}
+ elementen.</message>
+ <message key="validation.array.min-valuecount">Kies minimaal {0} elementen.</message>
+ <message key="validation.array.max-valuecount">Kies maximaal {0}
+ elementen.</message>
+
+ <message key="multivaluefield.conversionfailed">Een van de gekozen waarden is
+ ongeldig.</message>
+
+ <message key="validation.numeric.range">De waarde moet liggen tussen {0} en
+ {1}.</message>
+ <message key="validation.numeric.min">De waarde is minimaal {0}.</message>
+ <message key="validation.numeric.max">De waarde is maximaal {0}.</message>
+
+ <message key="validation.mod10">De Mod 10 verificatie is mislukt.</message>
+
+
+ <message key="aggregatedfield.split-failed">De waarde komt niet overeen met deze reg.
+ exp.: {0}</message>
+
+</catalogue>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/resources/styles/dreamteam.css
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/resources/styles/dreamteam.css?view=diff&r1=158724&r2=158725
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/resources/styles/dreamteam.css (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/dreamteam/resources/styles/dreamteam.css Tue Mar 22 20:01:09 2005
@@ -1,99 +1,99 @@
-/** CSS stylesheet for the dreamteam sample, adjusted to match the supersonic tour example app */
-
-body {
- font-family: Georgia, Verdana, Arial;
- font-style:normal;
- font-variant:normal;
- background-color: white;
- background-image: none;
- color: black;
- padding-top:10px;
- padding-bottom:10px;
- padding-left:10px;
- padding-right:10px;
- }
-h1 {
- font-size: 120%
- font-weight: bold;
- padding-left: 20px;
- border-bottom: solid red 1px;
-}
-h2 {
- border-bottom: solid #CCCCCC 1px;
-}
-
-img {
- border: 0px solid;
-}
-table {
- border: 0px solid;
- margin:0px;
- padding-top:10px;
- padding-bottom:10px;
- padding-left:10px;
- padding-right:10px;
- border-top: solid 0px #ccc;
-}
-
-.tableheader {
- font-size:100%;
- font-style:normal;
- font-variant:normal;
- font-weight:bold;
- color:#000000;
- padding: 5px;
- border-bottom: 1px solid #ccc;
-}
-td {
- font-size:100%;
- font-style:normal;
- font-variant:normal;
- font-weight:normal;
- color:#00000;
- padding: 3px;
- border-bottom: 1px solid #f0f0f0;
-}
-
-.legend {
- border: 1px solid #ccc;
- font-size: 70%;
- width: 50%;
-}
-
-.developer-header {
- border-bottom: solid #CCCCCC 1px;
- background-color: #FFFFCC;
- font-weight:bold;
-}
-
-.developer-note {
- font-height: 80%;
-}
-
-.code {
- font-family: courier, monospaced;
- font-size: 70%;
- background: #FFFFCC;
- margin-top: 1em;
- padding: 2px;
-}
-
-.codeIndent {
- margin-left: 1em;
-}
-
-
-.sort-arrow.descending {
- background-image: url("images/sort_down.gif");
-}
-
-.sort-arrow.ascending {
- background-image: url("images/sort_up.gif");
-}
-
-.sort-arrow {
- width: 11px;
- height: 11px;
- margin: 0 2px;
- cursor: hand;
-}
+/** CSS stylesheet for the dreamteam sample, adjusted to match the supersonic tour example app */
+
+body {
+ font-family: Georgia, Verdana, Arial;
+ font-style:normal;
+ font-variant:normal;
+ background-color: white;
+ background-image: none;
+ color: black;
+ padding-top:10px;
+ padding-bottom:10px;
+ padding-left:10px;
+ padding-right:10px;
+ }
+h1 {
+ font-size: 120%
+ font-weight: bold;
+ padding-left: 20px;
+ border-bottom: solid red 1px;
+}
+h2 {
+ border-bottom: solid #CCCCCC 1px;
+}
+
+img {
+ border: 0px solid;
+}
+table {
+ border: 0px solid;
+ margin:0px;
+ padding-top:10px;
+ padding-bottom:10px;
+ padding-left:10px;
+ padding-right:10px;
+ border-top: solid 0px #ccc;
+}
+
+.tableheader {
+ font-size:100%;
+ font-style:normal;
+ font-variant:normal;
+ font-weight:bold;
+ color:#000000;
+ padding: 5px;
+ border-bottom: 1px solid #ccc;
+}
+td {
+ font-size:100%;
+ font-style:normal;
+ font-variant:normal;
+ font-weight:normal;
+ color:#00000;
+ padding: 3px;
+ border-bottom: 1px solid #f0f0f0;
+}
+
+.legend {
+ border: 1px solid #ccc;
+ font-size: 70%;
+ width: 50%;
+}
+
+.developer-header {
+ border-bottom: solid #CCCCCC 1px;
+ background-color: #FFFFCC;
+ font-weight:bold;
+}
+
+.developer-note {
+ font-height: 80%;
+}
+
+.code {
+ font-family: courier, monospaced;
+ font-size: 70%;
+ background: #FFFFCC;
+ margin-top: 1em;
+ padding: 2px;
+}
+
+.codeIndent {
+ margin-left: 1em;
+}
+
+
+.sort-arrow.descending {
+ background-image: url("images/sort_down.gif");
+}
+
+.sort-arrow.ascending {
+ background-image: url("images/sort_up.gif");
+}
+
+.sort-arrow {
+ width: 11px;
+ height: 11px;
+ margin: 0 2px;
+ cursor: hand;
+}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/jms/conf/jms-connection-manager.xconf
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/jms/conf/jms-connection-manager.xconf?view=diff&r1=158724&r2=158725
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/jms/conf/jms-connection-manager.xconf (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/jms/conf/jms-connection-manager.xconf Tue Mar 22 20:01:09 2005
@@ -1,48 +1,48 @@
-<?xml version="1.0"?>
-<!--
- Copyright 1999-2004 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<xconf xpath="/cocoon" unless="jms-connection-manager">
- <!-- +
- | Configuration of a set JMS Connections.
- | Three types of connections can be configured:
- | - general <connection>s: created by a call to ConnectionFactory.createConnection()
- | - <topic-connection>s: created by a call to TopicConnectionFactory.createTopicConnection()
- | - <queue-connection>s: created by a call to QeueuConnectionFactory.createQueueConnection()
- |
- | Each connection must have a unique name. This is the name other components
- | use to retrieve it.
- |
- | All connection types support the same set of parameters:
- | - javax.naming.*: properties used to create the initial JNDI context.
- | JNDI parameters must be specified with their literal values here.
- | For example, javax.naming.Context.INITIAL_CONTEXT_FACTORY is
- | equivalent to "java.naming.factory.initial".
- | - connection-factory: the JNDI lookup name of the javax.jms.ConnectionFactory service.
- | - username / password: optional connection credentials
- + -->
- <jms-connection-manager logger="core.jms">
- <topic-connection name="local-topics">
- <parameter name="java.naming.factory.initial" value="org.exolab.jms.jndi.InitialContextFactory"/>
- <parameter name="java.naming.provider.url" value="rmi://localhost:1099/"/>
- <!-- OpenJMS RMI topic connection factory -->
- <parameter name="connection-factory" value="JmsTopicConnectionFactory"/>
- <!--
- <parameter name="username" value="user"/>
- <parameter name="password" value="secret"/>
- -->
- </topic-connection>
- </jms-connection-manager>
-</xconf>
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xconf xpath="/cocoon" unless="jms-connection-manager">
+ <!-- +
+ | Configuration of a set JMS Connections.
+ | Three types of connections can be configured:
+ | - general <connection>s: created by a call to ConnectionFactory.createConnection()
+ | - <topic-connection>s: created by a call to TopicConnectionFactory.createTopicConnection()
+ | - <queue-connection>s: created by a call to QeueuConnectionFactory.createQueueConnection()
+ |
+ | Each connection must have a unique name. This is the name other components
+ | use to retrieve it.
+ |
+ | All connection types support the same set of parameters:
+ | - javax.naming.*: properties used to create the initial JNDI context.
+ | JNDI parameters must be specified with their literal values here.
+ | For example, javax.naming.Context.INITIAL_CONTEXT_FACTORY is
+ | equivalent to "java.naming.factory.initial".
+ | - connection-factory: the JNDI lookup name of the javax.jms.ConnectionFactory service.
+ | - username / password: optional connection credentials
+ + -->
+ <jms-connection-manager logger="core.jms">
+ <topic-connection name="local-topics">
+ <parameter name="java.naming.factory.initial" value="org.exolab.jms.jndi.InitialContextFactory"/>
+ <parameter name="java.naming.provider.url" value="rmi://localhost:1099/"/>
+ <!-- OpenJMS RMI topic connection factory -->
+ <parameter name="connection-factory" value="JmsTopicConnectionFactory"/>
+ <!--
+ <parameter name="username" value="user"/>
+ <parameter name="password" value="secret"/>
+ -->
+ </topic-connection>
+ </jms-connection-manager>
+</xconf>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/jms/conf/jms-connection-manager.xroles
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/jms/conf/jms-connection-manager.xroles?view=diff&r1=158724&r2=158725
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/jms/conf/jms-connection-manager.xroles (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/jms/conf/jms-connection-manager.xroles Tue Mar 22 20:01:09 2005
@@ -1,23 +1,23 @@
-<?xml version="1.0"?>
-<!--
- Copyright 1999-2004 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<xroles xpath="/role-list" unless="role[@shorthand='jms-connection-manager']">
-
- <role name="org.apache.cocoon.components.jms.JMSConnectionManager"
- shorthand="jms-connection-manager"
- default-class="org.apache.cocoon.components.jms.JMSConnectionManagerImpl"/>
-
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xroles xpath="/role-list" unless="role[@shorthand='jms-connection-manager']">
+
+ <role name="org.apache.cocoon.components.jms.JMSConnectionManager"
+ shorthand="jms-connection-manager"
+ default-class="org.apache.cocoon.components.jms.JMSConnectionManagerImpl"/>
+
</xroles>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/jms/java/org/apache/cocoon/acting/JMSPublisherAction.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/jms/java/org/apache/cocoon/acting/JMSPublisherAction.java?view=diff&r1=158724&r2=158725
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/jms/java/org/apache/cocoon/acting/JMSPublisherAction.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/jms/java/org/apache/cocoon/acting/JMSPublisherAction.java Tue Mar 22 20:01:09 2005
@@ -1,88 +1,88 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.acting;
-
-import java.util.Collections;
-import java.util.Map;
-
-import javax.jms.Message;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.SourceResolver;
-
-import org.apache.cocoon.components.jms.AbstractMessagePublisher;
-
-/**
- * Action to publish TextMessages to a JMS Topic. For description of static
- * parameter configuration see {@link org.apache.cocoon.components.jms.AbstractMessagePublisher}
- *
- * <p>Sitemap parameters:</p>
- * <table border="1">
- * <tbody>
- * <tr>
- * <th align="left">parameter</th>
- * <th align="left">required</th>
- * <th align="left">default</th>
- * <th align="left">description</th>
- * </tr>
- * <tbody>
- * <tr>
- * <td>message</td>
- * <td>required</td>
- * <td> </td>
- * <td>Content of TextMessage to publish</td>
- * </tr>
- * </tbody>
- * </table>
- */
-public class JMSPublisherAction extends AbstractMessagePublisher implements Action, ThreadSafe {
-
- // ---------------------------------------------------- Constants
-
- private static final String MESSAGE_PARAM = "message";
-
- // ---------------------------------------------------- Lifecycle
-
- public JMSPublisherAction () {
- }
-
- // ---------------------------------------------------- Action
-
- public Map act(Redirector redirector,
- SourceResolver resolver,
- Map objectModel,
- String source,
- Parameters parameters) throws Exception {
-
- Map result = null;
- try {
- // publish the message
- final String event = parameters.getParameter(MESSAGE_PARAM);
- final Message message = m_session.createTextMessage(event);
- publishMessage(message);
- result = Collections.EMPTY_MAP;
- } catch (Exception e) {
- if (getLogger().isWarnEnabled()) {
- getLogger().warn("Error delivering message.", e);
- }
- }
-
- return result;
- }
-
-}
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.acting;
+
+import java.util.Collections;
+import java.util.Map;
+
+import javax.jms.Message;
+
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.environment.Redirector;
+import org.apache.cocoon.environment.SourceResolver;
+
+import org.apache.cocoon.components.jms.AbstractMessagePublisher;
+
+/**
+ * Action to publish TextMessages to a JMS Topic. For description of static
+ * parameter configuration see {@link org.apache.cocoon.components.jms.AbstractMessagePublisher}
+ *
+ * <p>Sitemap parameters:</p>
+ * <table border="1">
+ * <tbody>
+ * <tr>
+ * <th align="left">parameter</th>
+ * <th align="left">required</th>
+ * <th align="left">default</th>
+ * <th align="left">description</th>
+ * </tr>
+ * <tbody>
+ * <tr>
+ * <td>message</td>
+ * <td>required</td>
+ * <td> </td>
+ * <td>Content of TextMessage to publish</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ */
+public class JMSPublisherAction extends AbstractMessagePublisher implements Action, ThreadSafe {
+
+ // ---------------------------------------------------- Constants
+
+ private static final String MESSAGE_PARAM = "message";
+
+ // ---------------------------------------------------- Lifecycle
+
+ public JMSPublisherAction () {
+ }
+
+ // ---------------------------------------------------- Action
+
+ public Map act(Redirector redirector,
+ SourceResolver resolver,
+ Map objectModel,
+ String source,
+ Parameters parameters) throws Exception {
+
+ Map result = null;
+ try {
+ // publish the message
+ final String event = parameters.getParameter(MESSAGE_PARAM);
+ final Message message = m_session.createTextMessage(event);
+ publishMessage(message);
+ result = Collections.EMPTY_MAP;
+ } catch (Exception e) {
+ if (getLogger().isWarnEnabled()) {
+ getLogger().warn("Error delivering message.", e);
+ }
+ }
+
+ return result;
+ }
+
+}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/jms/java/org/apache/cocoon/components/jms/AbstractMessageListener.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/jms/java/org/apache/cocoon/components/jms/AbstractMessageListener.java?view=diff&r1=158724&r2=158725
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/jms/java/org/apache/cocoon/components/jms/AbstractMessageListener.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/jms/java/org/apache/cocoon/components/jms/AbstractMessageListener.java Tue Mar 22 20:01:09 2005
@@ -1,183 +1,183 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.components.jms;
-
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.MessageListener;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.parameters.ParameterException;
-import org.apache.avalon.framework.parameters.Parameterizable;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-
-/**
- * Abstract JMS MessageListener. Use this as a basis for concrete
- * MessageListener implementations.
- *
- * <p>Parameters:</p>
- * <table border="1">
- * <tbody>
- * <tr>
- * <th align="left">parameter</th>
- * <th align="left">required/default</th>
- * <th align="left">description</th>
- * </tr>
- * <tr>
- * <td valign="top">connection</td>
- * <td valign="top">required</td>
- * <td valign="top">
- * Name of the connection registered with
- * {@link org.apache.cocoon.components.jms.JMSConnectionManager}.
- * This must be a topic connection.
- * </td>
- * </tr>
- * <tr>
- * <td>topic</td>
- * <td>required</td>
- * <td>The name of the topic to subscribe to.</td>
- * </tr>
- * <tr>
- * <td>subscription-id</td>
- * <td>(<code>null</code>)</td>
- * <td>An optional durable subscription id.</td>
- * </tr>
- * <tr>
- * <td>message-selector</td>
- * <td>(<code>null</code>)</td>
- * <td>An optional message selector.</td>
- * </tr>
- * </tbody>
- * </table>
- *
- * @version CVS $Id: AbstractMessageListener.java 30941 2004-07-29 19:56:58Z vgritsenko $
- */
-public abstract class AbstractMessageListener extends AbstractLogEnabled
-implements MessageListener, ExceptionListener, Serviceable, Parameterizable, Initializable, Disposable {
-
- // ---------------------------------------------------- Constants
-
- private static final String CONNECTION_PARAM = "connection";
- private static final String TOPIC_PARAM = "topic";
- private static final String SUBSCRIPTION_ID_PARAM = "subscription-id";
- private static final String MESSAGE_SELECTOR_PARAM = "message-selector";
-
- // ---------------------------------------------------- Instance variables
-
- protected ServiceManager m_manager;
-
- /* configuration */
- private String m_connectionName;
- private String m_topicName;
- private String m_subscriptionId;
- private String m_selector;
-
- protected int m_acknowledgeMode;
-
- /* connection manager component */
- private JMSConnectionManager m_jmsConnectionManager;
-
- /* our session */
- private TopicSession m_session;
-
- /* our subscriber */
- private TopicSubscriber m_subscriber;
-
- // ---------------------------------------------------- Lifecycle
-
- public AbstractMessageListener () {
- }
-
- public void service(ServiceManager manager) throws ServiceException {
- m_manager = manager;
- m_jmsConnectionManager = (JMSConnectionManager) m_manager.lookup(JMSConnectionManager.ROLE);
- }
-
- public void parameterize(Parameters parameters) throws ParameterException {
-
- m_connectionName = parameters.getParameter(CONNECTION_PARAM);
- m_topicName = parameters.getParameter(TOPIC_PARAM);
-
- m_subscriptionId = parameters.getParameter(SUBSCRIPTION_ID_PARAM, null);
- m_selector = parameters.getParameter(MESSAGE_SELECTOR_PARAM, null);
-
- }
-
- /**
- * Registers this MessageListener as a TopicSubscriber to the configured Topic.
- */
- public void initialize() throws Exception {
-
- // set the default acknowledge mode to dups
- // concrete implementations may want to override this
- m_acknowledgeMode = Session.DUPS_OK_ACKNOWLEDGE;
-
- // register this MessageListener with a TopicSubscriber
- final TopicConnection connection = (TopicConnection) m_jmsConnectionManager.getConnection(m_connectionName);
- if (connection != null) {
- m_session = connection.createTopicSession(false, m_acknowledgeMode);
- final Topic topic = m_session.createTopic(m_topicName);
- if (m_subscriptionId != null) {
- m_subscriber = m_session.createDurableSubscriber(topic, m_subscriptionId, m_selector, false);
- }
- else {
- m_subscriber = m_session.createSubscriber(topic, m_selector, false);
- }
- m_subscriber.setMessageListener(this);
- }
- else {
- if (getLogger().isWarnEnabled()) {
- getLogger().warn("Could not obtain JMS connection '" + m_connectionName + "'");
- }
- }
-
- }
-
- public void dispose() {
- if (m_subscriber != null) {
- try {
- m_subscriber.close();
- } catch (JMSException e) {
- getLogger().error("Error closing subscriber", e);
- }
- }
- if (m_session != null) {
- try {
- m_session.close();
- }
- catch (JMSException e) {
- getLogger().error("Error closing session", e);
- }
- }
- this.m_manager.release(m_jmsConnectionManager);
- }
-
- public void onException(JMSException exception) {
- if (getLogger().isWarnEnabled()) {
- getLogger().warn("JMS problem detected", exception);
- }
- }
-}
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.components.jms;
+
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.MessageListener;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.parameters.ParameterException;
+import org.apache.avalon.framework.parameters.Parameterizable;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+
+/**
+ * Abstract JMS MessageListener. Use this as a basis for concrete
+ * MessageListener implementations.
+ *
+ * <p>Parameters:</p>
+ * <table border="1">
+ * <tbody>
+ * <tr>
+ * <th align="left">parameter</th>
+ * <th align="left">required/default</th>
+ * <th align="left">description</th>
+ * </tr>
+ * <tr>
+ * <td valign="top">connection</td>
+ * <td valign="top">required</td>
+ * <td valign="top">
+ * Name of the connection registered with
+ * {@link org.apache.cocoon.components.jms.JMSConnectionManager}.
+ * This must be a topic connection.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>topic</td>
+ * <td>required</td>
+ * <td>The name of the topic to subscribe to.</td>
+ * </tr>
+ * <tr>
+ * <td>subscription-id</td>
+ * <td>(<code>null</code>)</td>
+ * <td>An optional durable subscription id.</td>
+ * </tr>
+ * <tr>
+ * <td>message-selector</td>
+ * <td>(<code>null</code>)</td>
+ * <td>An optional message selector.</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ *
+ * @version CVS $Id: AbstractMessageListener.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public abstract class AbstractMessageListener extends AbstractLogEnabled
+implements MessageListener, ExceptionListener, Serviceable, Parameterizable, Initializable, Disposable {
+
+ // ---------------------------------------------------- Constants
+
+ private static final String CONNECTION_PARAM = "connection";
+ private static final String TOPIC_PARAM = "topic";
+ private static final String SUBSCRIPTION_ID_PARAM = "subscription-id";
+ private static final String MESSAGE_SELECTOR_PARAM = "message-selector";
+
+ // ---------------------------------------------------- Instance variables
+
+ protected ServiceManager m_manager;
+
+ /* configuration */
+ private String m_connectionName;
+ private String m_topicName;
+ private String m_subscriptionId;
+ private String m_selector;
+
+ protected int m_acknowledgeMode;
+
+ /* connection manager component */
+ private JMSConnectionManager m_jmsConnectionManager;
+
+ /* our session */
+ private TopicSession m_session;
+
+ /* our subscriber */
+ private TopicSubscriber m_subscriber;
+
+ // ---------------------------------------------------- Lifecycle
+
+ public AbstractMessageListener () {
+ }
+
+ public void service(ServiceManager manager) throws ServiceException {
+ m_manager = manager;
+ m_jmsConnectionManager = (JMSConnectionManager) m_manager.lookup(JMSConnectionManager.ROLE);
+ }
+
+ public void parameterize(Parameters parameters) throws ParameterException {
+
+ m_connectionName = parameters.getParameter(CONNECTION_PARAM);
+ m_topicName = parameters.getParameter(TOPIC_PARAM);
+
+ m_subscriptionId = parameters.getParameter(SUBSCRIPTION_ID_PARAM, null);
+ m_selector = parameters.getParameter(MESSAGE_SELECTOR_PARAM, null);
+
+ }
+
+ /**
+ * Registers this MessageListener as a TopicSubscriber to the configured Topic.
+ */
+ public void initialize() throws Exception {
+
+ // set the default acknowledge mode to dups
+ // concrete implementations may want to override this
+ m_acknowledgeMode = Session.DUPS_OK_ACKNOWLEDGE;
+
+ // register this MessageListener with a TopicSubscriber
+ final TopicConnection connection = (TopicConnection) m_jmsConnectionManager.getConnection(m_connectionName);
+ if (connection != null) {
+ m_session = connection.createTopicSession(false, m_acknowledgeMode);
+ final Topic topic = m_session.createTopic(m_topicName);
+ if (m_subscriptionId != null) {
+ m_subscriber = m_session.createDurableSubscriber(topic, m_subscriptionId, m_selector, false);
+ }
+ else {
+ m_subscriber = m_session.createSubscriber(topic, m_selector, false);
+ }
+ m_subscriber.setMessageListener(this);
+ }
+ else {
+ if (getLogger().isWarnEnabled()) {
+ getLogger().warn("Could not obtain JMS connection '" + m_connectionName + "'");
+ }
+ }
+
+ }
+
+ public void dispose() {
+ if (m_subscriber != null) {
+ try {
+ m_subscriber.close();
+ } catch (JMSException e) {
+ getLogger().error("Error closing subscriber", e);
+ }
+ }
+ if (m_session != null) {
+ try {
+ m_session.close();
+ }
+ catch (JMSException e) {
+ getLogger().error("Error closing session", e);
+ }
+ }
+ this.m_manager.release(m_jmsConnectionManager);
+ }
+
+ public void onException(JMSException exception) {
+ if (getLogger().isWarnEnabled()) {
+ getLogger().warn("JMS problem detected", exception);
+ }
+ }
+}