| <?xml version="1.0"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You 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. |
| --> |
| |
| <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> |
| |
| <!-- ========================= Components ============================== --> |
| |
| <map:components> |
| <!-- most components are inherited from parent sitemap --> |
| <!-- just make sure that defaults suit our needs --> |
| |
| <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>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> |
| <!-- if results should be directed to another destination than the |
| default request attributes, use e.g. |
| |
| <output>session</output> |
| |
| this can also be specified on the fly through a map:parameter |
| named "output" |
| remember, that input-/output-modules need to be declared in your |
| cocoon.xconf in order to be used here. |
| --> |
| </map:action> |
| |
| <map:action name="mod-db-del" src="org.apache.cocoon.acting.modular.DatabaseDeleteAction"> |
| <descriptor>database.xml</descriptor> |
| <throw-exception>false</throw-exception> |
| </map:action> |
| |
| <map:action name="mod-db-upd" src="org.apache.cocoon.acting.modular.DatabaseUpdateAction"> |
| <descriptor>database.xml</descriptor> |
| <throw-exception>false</throw-exception> |
| </map:action> |
| |
| </map:actions> |
| |
| </map:components> |
| |
| |
| <!-- ======================= Views ================================= --> |
| |
| <map:views> |
| <map:view name="content" from-label="content"> |
| <map:serialize type="xml"/> |
| </map:view> |
| |
| <map:view from-label="content" name="pretty-content"> |
| <map:transform src="context://stylesheets/system/xml2html.xslt"/> |
| <map:serialize type="html"/> |
| </map:view> |
| |
| <map:view name="links" from-position="last"> |
| <map:serialize type="links"/> |
| </map:view> |
| </map:views> |
| |
| <!-- ======================= Pipelines ================================= --> |
| |
| <map:pipelines> |
| <map:pipeline> |
| |
| <map:match pattern="database.xml"> |
| <map:generate src="{0}"/> |
| <map:serialize type="xml"/> |
| </map:match> |
| <map:match pattern="schema.sql"> |
| <map:read src="{0}" mime-type="text/plain"/> |
| </map:match> |
| <!-- ========================== Modular DB ================================= --> |
| |
| <map:match pattern=""> |
| <map:redirect-to uri="user-list"/> |
| </map:match> |
| |
| <map:match pattern="file-upload-test"> |
| <map:generate type="serverpages" src="file-upload-blob.xsp"/> |
| <map:serialize type="xml"/> |
| </map:match> |
| |
| <!-- Deliver images from database --> |
| <map:match pattern="image/*"> |
| <map:read type="databasereader" src="{1}" mime-type="image/jpg"> |
| <!-- option sitemap parameters --> |
| <map:parameter name="table" value="media"/> |
| <map:parameter name="image" value="image"/> |
| <map:parameter name="key" value="id"/> |
| <map:parameter name="type-column" value="mimetype"/> |
| </map:read> |
| </map:match> |
| |
| |
| <map:match pattern="*"> |
| |
| <!-- |
| First, the logic to do all the database operations. Note, |
| that we do no parameter validation here, just see if some |
| parameters are present. For a real application, you'd |
| want to check their values as well. Note too, that in a |
| more complex setup you'd want to use an action set for |
| this rather than spell it out everywhere. |
| Or even better, call these actions from the flow layer! |
| That way it is easier to react to error conditions. |
| --> |
| |
| <!-- ______________________________ inserts ______________________________ --> |
| |
| <!-- add new groups to a user's groups --> |
| <map:act type="req-params"> |
| <map:parameter name="parameters" value="add-groups user_groups.uid user_groups.gid"/> |
| <map:act type="mod-db-add"> |
| <map:parameter name="table-set" value="user_groups"/> |
| </map:act> |
| </map:act> |
| |
| <!-- add one new group --> |
| <map:act type="req-params"> |
| <map:parameter name="parameters" value="add-group groups.gname"/> |
| <map:act type="mod-db-add"> |
| <map:parameter name="table-set" value="groups"/> |
| </map:act> |
| </map:act> |
| |
| <!-- add one new user --> |
| <!-- Actually, this one is not used anymore. The one below |
| works well when no groups are supplied. |
| --> |
| <map:act type="req-params"> |
| <map:parameter name="parameters" value="add-user user.name user.firstname user.uname"/> |
| <map:act type="mod-db-add"> |
| <map:parameter name="table-set" value="user"/> |
| </map:act> |
| </map:act> |
| |
| <!-- add one new user plus groups --> |
| <map:act type="req-params"> |
| <map:parameter name="parameters" value="add-user-groups user.name user.firstname user.uname"/> |
| <map:act type="mod-db-add"> |
| <map:parameter name="table-set" value="user+groups"/> |
| </map:act> |
| </map:act> |
| |
| <!-- upload binary data --> |
| <map:act type="req-params"> |
| <map:parameter name="parameters" value="add-image"/> <!-- media.image media.id --> |
| <map:act type="mod-db-add"> |
| <map:parameter name="table-set" value="media"/> |
| </map:act> |
| </map:act> |
| |
| <!-- ______________________________ updates ______________________________ --> |
| |
| <!-- update one user --> |
| <map:act type="req-params"> |
| <map:parameter name="parameters" value="upd-user user.uid user.name user.firstname user.uname"/> |
| <map:act type="mod-db-upd"> |
| <map:parameter name="table-set" value="user"/> |
| </map:act> |
| </map:act> |
| |
| |
| <!-- update one group --> |
| <map:act type="req-params"> |
| <map:parameter name="parameters" value="upd-group groups.gid groups.gname"/> |
| <map:act type="mod-db-upd"> |
| <map:parameter name="table-set" value="groups"/> |
| </map:act> |
| </map:act> |
| |
| <!-- ______________________________ deletes ______________________________ --> |
| |
| <!-- delete one user --> |
| <map:act type="req-params"> |
| <map:parameter name="parameters" value="del-user user.uid"/> |
| <map:act type="mod-db-del"> |
| <map:parameter name="table-set" value="user"/> |
| </map:act> |
| </map:act> |
| |
| <!-- delete one group --> |
| <map:act type="req-params"> |
| <map:parameter name="parameters" value="del-group groups.gid"/> |
| <map:act type="mod-db-del"> |
| <map:parameter name="table-set" value="groups"/> |
| </map:act> |
| </map:act> |
| |
| <!-- delete groups from a user's groups --> |
| <map:act type="req-params"> |
| <map:parameter name="parameters" value="remove-groups user_groups.uid user_groups.gid"/> |
| <map:act type="mod-db-del"> |
| <map:parameter name="table-set" value="user_groups"/> |
| </map:act> |
| </map:act> |
| |
| <!-- ______________________________ content ______________________________ --> |
| |
| <map:generate type="serverpages" src="{1}.xsp"/> |
| <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl"> |
| <map:parameter name="servletPath" value="{request:servletPath}"/> |
| <map:parameter name="sitemapURI" value="{request:sitemapURI}"/> |
| <map:parameter name="contextPath" value="{request:contextPath}"/> |
| <map:parameter name="file" value=".xsp"/> |
| </map:transform> |
| <map:transform src="stupid.xsl"/> |
| <map:serialize/> |
| |
| </map:match> |
| |
| </map:pipeline> |
| </map:pipelines> |
| |
| </map:sitemap> |