You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ha...@apache.org on 2002/03/15 16:25:22 UTC
cvs commit: xml-cocoon2/src/scratchpad/webapp/mount/mod-db database.xml sitemap.xmap user-list.xsp
haul 02/03/15 07:25:22
Modified: src/scratchpad/webapp/mount/mod-db database.xml sitemap.xmap
user-list.xsp
Log:
Reflect move of ModularDatabase*Action to new home
Revision Changes Path
1.2 +45 -39 xml-cocoon2/src/scratchpad/webapp/mount/mod-db/database.xml
Index: database.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/mod-db/database.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- database.xml 3 Jan 2002 12:31:38 -0000 1.1
+++ database.xml 15 Mar 2002 15:25:22 -0000 1.2
@@ -16,21 +16,21 @@
<!-- functionality, although this is not enforced. -->
<keys>
<key name="uid" type="int" autoincrement="true">
- <!-- @name is the column's name -->
- <!-- @type is the column's jdbc type -->
+ <!-- @name is the column's name -->
+ <!-- @type is the column's jdbc type -->
<!-- @autoincrement : column value is determined by special component -->
- <mode name="auto" type="autoincr"/>
- <!-- this entry says:
- when inserting a new column into a autoincrement column
- (@type="autoincr"), use the helper named "auto" to find out about
+ <mode name="auto" type="autoincr"/>
+ <!-- this entry says:
+ when inserting a new column into a autoincrement column
+ (@type="autoincr"), use the module named "auto" to find out about
how to handle this column. All other operations use the default
mode.
- There are two distinct mode types: "autoincr" for insert
- operations on autoincrement columns and "others" for all other
+ There are two distinct mode types: "autoincr" for insert
+ operations on autoincrement columns and "others" for all other
(delete, update, select) operations on autoincrement columns and
all operations on other columns.
-->
- </key>
+ </key>
</keys>
<values>
<value name="name" type="string"></value>
@@ -42,44 +42,50 @@
<table name="user_groups">
<keys>
<key name="uid" type="int">
- <!-- Next we have two different modes: "request" and
- "attrib". See below for explanation. -->
- <mode name="request" parameter="user_groups.uid" type="request"/>
- <mode name="attribute" parameter="org.apache.cocoon.acting.ModularDatabaseAccess.OutputHelper:user.uid[0]" type="attrib"/>
- <!-- note here, that the actual parameter has a row index
- to it. We don't expect to insert more than one user plus
- her groups at any time, so we append just "[0]". However,
- if that would be the case, we could let this column be
- part of a set and ask for "[*]" instead. Might be tricky
- to find the associated groups, though, if we insert x
- users plus y_1, y_2, ... , y_x groups.... -->
- </key>
- <key name="gid" type="int" set="master">
- <!-- now, this is tricky: when we need to insert multiple
- rows, those attributes that differ in these rows are
- marked to belong to a "set". One column is marked to be
- the "master" while all others need to be "slaves". A
- master is used to obtain a sorted set of index values for
- these rows. These will then be used to get the actual
- values for the master and slave columns. Note that it is
- not necessary to have the master be a key column. Note too, that an
+ <!-- Next we have two different modes: "request" and
+ "attrib". See below for explanation. -->
+ <mode name="request" parameter="user_groups.uid" type="request"/>
+ <mode name="attribute" parameter="org.apache.cocoon.components.modules.output.OutputModule:user.uid[0]" type="attrib"/>
+ <!-- note here, that the actual parameter has a row index
+ to it. We don't expect to insert more than one user plus
+ her groups at any time, so we append just "[0]". However,
+ if that would be the case, we could let this column be
+ part of a set and ask for "[*]" instead. Might be tricky
+ to find the associated groups, though, if we insert x
+ users plus y_1, y_2, ... , y_x groups.... -->
+ </key>
+ <key name="gid" type="int" set="master">
+ <!-- now, this is tricky: when we need to insert multiple
+ rows, those attributes that differ in these rows are
+ marked to belong to a "set". One column is marked to be
+ the "master" while all others need to be "slaves". A
+ master is used to obtain a sorted set of index values for
+ these rows. These will then be used to get the actual
+ values for the master and slave columns. Note that it is
+ not necessary to have the master be a key column. Note too, that an
autoincrement column may not serve as a master here.
- This attribute may be specified on a column level or on a
- mode level to allow different behavious. Mode level @set
- is only considered if @set is not present on column level.
- -->
- <!-- special mode type "all" is used for all operations -->
- <mode name="request" parameter="user_groups.gid" type="all"/>
- </key>
+ This attribute may be specified on a column level or on a
+ mode level to allow different behavious. Mode level @set
+ is only considered if @set is not present on column level.
+
+ Plus, as deletes and selects consider only key attributes while
+ updates consider values as well, there's no harm having a single
+ set for these three actions. In this case the set master needs to
+ be a key column, though.
+
+ -->
+ <!-- special mode type "all" is used for all operations -->
+ <mode name="request" parameter="user_groups.gid" type="all"/>
+ </key>
</keys>
</table>
<table name="groups">
<keys>
<key name="gid" type="int" autoincrement="true">
- <mode name="auto" type="autoincr"/>
- </key>
+ <mode name="auto" type="autoincr"/>
+ </key>
</keys>
<values>
<value name="gname" type="string"/>
1.2 +72 -41 xml-cocoon2/src/scratchpad/webapp/mount/mod-db/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/mod-db/sitemap.xmap,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sitemap.xmap 3 Jan 2002 12:31:38 -0000 1.1
+++ sitemap.xmap 15 Mar 2002 15:25:22 -0000 1.2
@@ -18,56 +18,87 @@
<map:selectors default="browser"/>
- <map:matchers default="wildcard"/>
+ <map:matchers default="wildcard">
+ <map:matcher logger="sitemap.matcher.modular.non-cached" name="uri" src="org.apache.cocoon.matching.modular.WildcardMatcher">
+ <input-module name="URI"/>
+ </map:matcher>
+ <map:matcher logger="sitemap.matcher.modular.cached" name="cached-uri" src="org.apache.cocoon.matching.modular.CachingWildcardMatcher">
+ <input-module name="URI"/>
+ </map:matcher>
+ </map:matchers>
<map:actions>
<!-- these action are in addition to the ones inherited -->
+
+
+ <!-- declare actions for database operations -->
+ <map:action name="mod-db-add" src="org.apache.cocoon.acting.modular.DatabaseAddAction">
+ <descriptor>context://mount/mod-db/database.xml</descriptor>
+ <!-- shall we throw an exception in addition to rolling back
+ the transaction when encountering an error during
+ database ops?
+ -->
+ <throw-exception>false</throw-exception>
+ </map:action>
+
+ <map:action name="mod-db-del" src="org.apache.cocoon.acting.modular.DatabaseDeleteAction">
+ <descriptor>context://mount/mod-db/database.xml</descriptor>
+ <throw-exception>false</throw-exception>
+ </map:action>
+
+ <map:action name="mod-db-upd" src="org.apache.cocoon.acting.modular.DatabaseUpdateAction">
+ <descriptor>context://mount/mod-db/database.xml</descriptor>
+ <throw-exception>false</throw-exception>
+ </map:action>
+
+
+ <map:action name="req-params" src="org.apache.cocoon.acting.RequestParameterExistsAction"/>
+
+<!--
<map:action name="mod-db-add" src="org.apache.cocoon.acting.ModularDatabaseAddAction">
- <descriptor>context://mount/mod-db/database.xml</descriptor>
- <throw-exception>false</throw-exception>
- <!-- shall we throw an exception in addition to rolling back
- the transaction when encountering an error during
- database ops?
- -->
- <!-- <mode name="auto" src="org.apache.cocoon.acting.ModularDatabaseAccess.IfxSerialAutoIncrementHelper"/> -->
- <mode name="auto" src="org.apache.cocoon.acting.ModularDatabaseAccess.HsqlIdentityAutoIncrementHelper"/>
- <mode name="request" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestParameterHelper"/>
- <mode name="attribute" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestAttributeHelper"/>
- <output name="request" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestAttributeOutputHelper"/>
+ <descriptor>context://mount/mod-db/database.xml</descriptor>
+ <throw-exception>false</throw-exception>
+ <mode name="auto" src="org.apache.cocoon.acting.ModularDatabaseAccess.HsqlIdentityAutoIncrementHelper"/>
+ <mode name="request" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestParameterHelper"/>
+ <mode name="attribute" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestAttributeHelper"/>
+ <output name="request" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestAttributeOutputHelper"/>
</map:action>
+-->
+ <!--
<map:action name="mod-db-del" src="org.apache.cocoon.acting.ModularDatabaseDeleteAction">
- <descriptor>context://mount/mod-db/database.xml</descriptor>
- <throw-exception>false</throw-exception>
- <!--
- It doesn't make sense to declare AutoIncrementHelpers for
- this action, but until component handling is removed from
- ModularDatabaseAction and done e.g. in sitemap,
- ModularDatabaseAction will complain if such a helper is
- missing.
- -->
- <!-- <mode name="auto" src="org.apache.cocoon.acting.ModularDatabaseAccess.IfxSerialAutoIncrementHelper"/> -->
- <mode name="auto" src="org.apache.cocoon.acting.ModularDatabaseAccess.HsqlIdentityAutoIncrementHelper"/>
- <mode name="request" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestParameterHelper"/>
- <mode name="attribute" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestAttributeHelper"/>
- <output name="request" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestAttributeOutputHelper"/>
+ <descriptor>context://mount/mod-db/database.xml</descriptor>
+ <throw-exception>false</throw-exception>
+
+ It doesn't make sense to declare AutoIncrementHelpers for
+ this action, but until component handling is removed from
+ ModularDatabaseAction and done e.g. in sitemap,
+ ModularDatabaseAction will complain if such a helper is
+ missing.
+
+ <mode name="auto" src="org.apache.cocoon.acting.ModularDatabaseAccess.HsqlIdentityAutoIncrementHelper"/>
+ <mode name="request" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestParameterHelper"/>
+ <mode name="attribute" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestAttributeHelper"/>
+ <output name="request" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestAttributeOutputHelper"/>
</map:action>
- <map:action name="mod-db-upd" src="org.apache.cocoon.acting.ModularDatabaseUpdateAction">
- <descriptor>context://mount/mod-db/database.xml</descriptor>
- <throw-exception>false</throw-exception>
+ -->
+
<!--
- It doesn't make sense to declare AutoIncrementHelpers for
- this action, but until component handling is removed from
- ModularDatabaseAction and done e.g. in sitemap,
- ModularDatabaseAction will complain if such a helper is
- missing.
- -->
- <!-- <mode name="auto" src="org.apache.cocoon.acting.ModularDatabaseAccess.IfxSerialAutoIncrementHelper"/> -->
- <mode name="auto" src="org.apache.cocoon.acting.ModularDatabaseAccess.HsqlIdentityAutoIncrementHelper"/>
- <mode name="request" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestParameterHelper"/>
- <mode name="attribute" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestAttributeHelper"/>
- <output name="request" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestAttributeOutputHelper"/>
+ <map:action name="mod-db-upd" src="org.apache.cocoon.acting.ModularDatabaseUpdateAction">
+ <descriptor>context://mount/mod-db/database.xml</descriptor>
+ <throw-exception>false</throw-exception>
+
+ It doesn't make sense to declare AutoIncrementHelpers for
+ this action, but until component handling is removed from
+ ModularDatabaseAction and done e.g. in sitemap,
+ ModularDatabaseAction will complain if such a helper is
+ missing.
+
+ <mode name="auto" src="org.apache.cocoon.acting.ModularDatabaseAccess.HsqlIdentityAutoIncrementHelper"/>
+ <mode name="request" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestParameterHelper"/>
+ <mode name="attribute" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestAttributeHelper"/>
+ <output name="request" src="org.apache.cocoon.acting.ModularDatabaseAccess.RequestAttributeOutputHelper"/>
</map:action>
- <map:action name="req-params" src="org.apache.cocoon.acting.RequestParameterExistsAction"/>
+ -->
</map:actions>
</map:components>
1.2 +23 -23 xml-cocoon2/src/scratchpad/webapp/mount/mod-db/user-list.xsp
Index: user-list.xsp
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/mod-db/user-list.xsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- user-list.xsp 3 Jan 2002 12:31:38 -0000 1.1
+++ user-list.xsp 15 Mar 2002 15:25:22 -0000 1.2
@@ -1,13 +1,11 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-<xsp:page
- language="java"
- xmlns:xsp="http://apache.org/xsp"
- xmlns:esql="http://apache.org/cocoon/SQL/v2"
- xmlns:xsp-request="http://apache.org/xsp/request/2.0"
- >
- <!--
- -->
+<xsp:page language="java"
+ xmlns:xsp="http://apache.org/xsp"
+ xmlns:esql="http://apache.org/cocoon/SQL/v2"
+ xmlns:xsp-request="http://apache.org/xsp/request/2.0"
+>
+
<xsp:structure>
<xsp:include>java.util.Enumeration</xsp:include>
</xsp:structure>
@@ -25,14 +23,20 @@
<p>The intention is to factor out those parts that are dependent on
the utilised DBMS as well as the methods used to obtain the values
- and communicate results. Therefore three classes of adaptors
+ and communicate results. Therefore three classes of modules
exist:</p>
<ol>
- <li>Attribute Helpers read data from some source (e.g. the request
+ <li>Input Modules read data from some source (e.g. the request
object or session attributes or whatever)</li>
- <li>Auto Increment Helpers determine the value of a key attribute
+ <li>Output Modules send the data to an arbitrary
+ destination. Again, this could be request attributes or
+ anything else. When the database transaction finishes, it is
+ signalled to them whether the transaction succeeded or
+ failed.</li>
+
+ <li>Database Modules determine the value of a key attribute
column in a database if it's is of auto increment type. This
could be by querying the database, reading from an arbitrary
source (e.g. request object) or just skipping the column when
@@ -40,26 +44,21 @@
needs to be done e.g. for Informix's SERIAL or HSQLDB's
IDENTITY column types.</li>
- <li>Output Helpers send the data to an arbitrary
- destination. Again, this could be request attributes or
- anything else. When the database transaction finishes, it is
- signalled to them whether the transaction succeeded or
- failed.</li>
</ol>
<hr/>
<h2>Current database content</h2>
- <esql:connection>
+ <esql:connection>
<esql:pool>personnel</esql:pool>
-
+
<p>
<sqltbl>
<esql:execute-query>
<esql:query>select * from user order by name, firstname, uname, uid</esql:query>
<esql:results>
<esql:row-results>
-
+
<sqltblrow>
<name>
<esql:get-string column="name"/>
@@ -85,7 +84,7 @@
</form>
</action>
</sqltblrow>
-
+
</esql:row-results>
</esql:results>
<esql:error-results>
@@ -115,7 +114,7 @@
<esql:query>select gid, gname from groups order by gname</esql:query>
<esql:results>
<esql:row-results>
- <option>
+ <option>
<xsp:attribute name="value"><esql:get-string column="gid"/></xsp:attribute>
<esql:get-string column="gname"/>
</option>
@@ -203,6 +202,9 @@
<hr/>
+
+ <p><h2>Status Information</h2></p>
+
<p><h3>Request Attributes</h3></p>
<p>
<table border="0">
@@ -221,8 +223,6 @@
</tbody>
</table>
</p>
-
- <hr/>
<p><h3>Request Parameters</h3></p>
<p>
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org