home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / install.xsp < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  2.8 KB  |  74 lines

  1. <?xml version="1.0"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17.  
  18. <!--
  19.     XSP event-based cache sample.
  20.  
  21.     Cvs $Id: install.xsp,v 1.3 2004/04/05 12:25:30 antonio Exp $
  22.  -->
  23.  
  24.  
  25. <xsp:page language="java"
  26.           xmlns:xsp="http://apache.org/xsp"
  27.           xmlns:esql="http://apache.org/cocoon/SQL/v2"
  28.           xmlns:xsp-request="http://apache.org/xsp/request/2.0">
  29.  
  30.     <page>
  31.         <title>Install Database Triggers with HSQLDB</title>
  32.         <para>This page tries to install triggers with the demo database that
  33.               comes with Apache Cocoon.</para>
  34.  
  35.         <para>Source for the triggers can be found in the eventcache block in your Cocoon
  36.               source distribution: src/blocks/eventcache/java/org/apache/cocoon/samples/eventcache/</para>
  37.  
  38.         <esql:connection>
  39.             <esql:pool>personnel</esql:pool>
  40.         <xsp:logic>
  41.             String trigClass = <xsp-request:get-parameter name="what" default="http"/>;
  42.             if (trigClass.equals("http")){
  43.                 trigClass = "org.apache.cocoon.samples.jms.HTTPTrigger";
  44.             } else {
  45.                 trigClass = "org.apache.cocoon.samples.jms.JMSTrigger";
  46.             }
  47.             String what = null;
  48.             for (int i = 0; i < 3; i++) {
  49.                 switch(i) {
  50.                 case 0: what="update"; break;
  51.                 case 1: what="insert"; break;
  52.                 case 2: what="delete"; break;
  53.                 }
  54.  
  55.                 <para>Installing <xsp:expr>trigClass</xsp:expr> for <xsp:expr>what</xsp:expr> on table "user".</para>
  56.  
  57.                 <esql:execute-query>
  58.                     <esql:query>create trigger myTrigger<xsp:expr>i</xsp:expr>
  59.                                 after <xsp:expr>what</xsp:expr> on user
  60.                                 call \"<xsp:expr>trigClass</xsp:expr>\"</esql:query>
  61.                     <esql:error-results>
  62.                         <para>Failed installing myTrigger<xsp:expr>i</xsp:expr>: <esql:get-message/></para>
  63.                         <para>Trigger already installed?</para>
  64.                     </esql:error-results>
  65.                 </esql:execute-query>
  66.             }
  67.          </xsp:logic>
  68.         </esql:connection>
  69.  
  70.         <para><a href="remove">Uninstall triggers</a> or go back to <a href="eventcache">sample page.</a></para>
  71.     </page>
  72.  
  73. </xsp:page>
  74.