You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gr...@locus.apache.org on 2000/11/07 23:35:45 UTC

cvs commit: xml-cocoon/xdocs connection-pool.xml fptaglib.xml sqltaglib.xml

greenrd     00/11/07 14:35:43

  Modified:    xdocs    connection-pool.xml fptaglib.xml sqltaglib.xml
  Log:
  made docs less wide for smaller screens, thanks to Ovidiu Predescu
  
  Revision  Changes    Path
  1.5       +30 -30    xml-cocoon/xdocs/connection-pool.xml
  
  Index: connection-pool.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/xdocs/connection-pool.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- connection-pool.xml	2000/09/22 22:56:51	1.4
  +++ connection-pool.xml	2000/11/07 22:35:30	1.5
  @@ -56,42 +56,42 @@
           for help or try on your own. It is quite easy to add support for your favorite
           database.</p>
        <source>
  -        # These are your database settings, look in the
  -        # org.apache.turbine.util.db.pool.* package for more information.
  -        processor.xsp.pool.database.default.driver=oracle.jdbc.driver.OracleDriver
  -        processor.xsp.pool.database.default.url=jdbc:oracle:thin:@localhost:1521:ORCL
  -        processor.xsp.pool.database.default.username=dbUser
  -        processor.xsp.pool.database.default.password=dbPass
  -        processor.xsp.pool.database.default.maxConnections=3
  -        processor.xsp.pool.database.default.expiryTime=3600000
  -        # These are the supported jdbc-drivers and their adaptors.
  -        # These properties are used by the DBFactory.
  -        processor.xsp.pool.database.adaptor=DBWeblogic,DBOracle,DBInstantDB,DBPostgres,DBSybase,DBInformix
  -        processor.xsp.pool.database.adaptor.DBWeblogic=weblogic.jdbc.pool.Driver
  -        processor.xsp.pool.database.adaptor.DBOracle=oracle.jdbc.driver.OracleDriver
  -        processor.xsp.pool.database.adaptor.DBInstantDB=org.enhydra.instantdb.jdbc.idbDriver
  -        processor.xsp.pool.database.adaptor.DBPostgres=postgresql.Driver
  -        processor.xsp.pool.database.adaptor.DBInformix=com.informix.jdbc.IfxDriver
  -        processor.xsp.pool.database.adaptor.DBSybase=com.sybase.jdbc.SybDriver
  -        # The full path name to a pool log file
  -        # if not given, commands to log events using org.apache.turbine.util.Log will be ignored.
  -        # This file must already exist and be writable.
  -        # Default: none
  -        #
  -        processor.xsp.pool.logfile=/opt/apache/var/log/dbPool.log
  -     </source>
  +# These are your database settings, look in the
  +# org.apache.turbine.util.db.pool.* package for more information.
  +processor.xsp.pool.database.default.driver=oracle.jdbc.driver.OracleDriver
  +processor.xsp.pool.database.default.url=jdbc:oracle:thin:@localhost:1521:ORCL
  +processor.xsp.pool.database.default.username=dbUser
  +processor.xsp.pool.database.default.password=dbPass
  +processor.xsp.pool.database.default.maxConnections=3
  +processor.xsp.pool.database.default.expiryTime=3600000
  +# These are the supported jdbc-drivers and their adaptors.
  +# These properties are used by the DBFactory.
  +processor.xsp.pool.database.adaptor=DBWeblogic,DBOracle,DBInstantDB,DBPostgres,DBSybase,DBInformix
  +processor.xsp.pool.database.adaptor.DBWeblogic=weblogic.jdbc.pool.Driver
  +processor.xsp.pool.database.adaptor.DBOracle=oracle.jdbc.driver.OracleDriver
  +processor.xsp.pool.database.adaptor.DBInstantDB=org.enhydra.instantdb.jdbc.idbDriver
  +processor.xsp.pool.database.adaptor.DBPostgres=postgresql.Driver
  +processor.xsp.pool.database.adaptor.DBInformix=com.informix.jdbc.IfxDriver
  +processor.xsp.pool.database.adaptor.DBSybase=com.sybase.jdbc.SybDriver
  +# The full path name to a pool log file
  +# if not given, commands to log events using org.apache.turbine.util.Log will be ignored.
  +# This file must already exist and be writable.
  +# Default: none
  +#
  +processor.xsp.pool.logfile=/opt/apache/var/log/dbPool.log
  +</source>
   
        <p> The <strong>default</strong> is by convention the default connection used
            by the Turbine Connection Pool.  To define a Named connection, add new entries
            with the word "default" replaced with the name you want.  Here is an example
            for defining a connection to an Oracle database called "helpdesk":</p>
        <source>
  -        processor.xsp.pool.database.helpdesk.driver=oracle.jdbc.driver.OracleDriver
  -        processor.xsp.pool.database.helpdesk.url=jdbc:oracle:thin:@localhost:1521:ORCL
  -        processor.xsp.pool.database.helpdesk.username=dbUser
  -        processor.xsp.pool.database.helpdesk.password=dbPass
  -        processor.xsp.pool.database.helpdesk.maxConnections=3
  -        processor.xsp.pool.database.helpdesk.expiryTime=3600000
  +processor.xsp.pool.database.helpdesk.driver=oracle.jdbc.driver.OracleDriver
  +processor.xsp.pool.database.helpdesk.url=jdbc:oracle:thin:@localhost:1521:ORCL
  +processor.xsp.pool.database.helpdesk.username=dbUser
  +processor.xsp.pool.database.helpdesk.password=dbPass
  +processor.xsp.pool.database.helpdesk.maxConnections=3
  +processor.xsp.pool.database.helpdesk.expiryTime=3600000
        </source>
   
        <p>The maxConnections setting is the maximum number
  
  
  
  1.4       +23 -23    xml-cocoon/xdocs/fptaglib.xml
  
  Index: fptaglib.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/xdocs/fptaglib.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- fptaglib.xml	2000/09/27 23:31:10	1.3
  +++ fptaglib.xml	2000/11/07 22:35:31	1.4
  @@ -115,12 +115,12 @@
   		
   		<p>This is how to set up a file resource that you want to modify.</p>
   		<source><![CDATA[
  -	<fp:resource id="external-item">
  -		<fp:resource-file>../index.xml</fp:resource-file>
  -		<fp:resource-node>item[position()=<request:get-parameter name="item"/>]</fp:resource-node>
  -		<fp:default-mode>insert-before</fp:default-mode>
  -	</fp:resource>
  -	]]></source>
  +<fp:resource id="external-item">
  +  <fp:resource-file>../index.xml</fp:resource-file>
  +  <fp:resource-node>item[position()=<request:get-parameter name="item"/>]</fp:resource-node>
  +  <fp:default-mode>insert-before</fp:default-mode>
  +</fp:resource>
  +]]></source>
   		
   		<p>We are nesting an element from the Request TagLib inside an FP element to build an XPath on the fly from the "item" request parameter. Now you can use <code>fp:read</code> and <code>fp:write</code> elements to read and/or write to this file, inserting a new "item" Node before the current one, from text in a Form field.</p>
   
  @@ -131,10 +131,10 @@
   
   		<p>Here, I want to get the Title of all onf the Items, to build a Menu.</p>
   		<source><![CDATA[
  -	<menu action="item-add.xml?item=">
  -		<fp:read select="../item/title" from="external-item" as="node"/>
  -	</menu>
  -	]]></source>		
  +<menu action="item-add.xml?item=">
  +  <fp:read select="../item/title" from="external-item" as="node"/>
  +</menu>
  +]]></source>		
   
   		<p>The <code>fp:read</code> element is replaced by the contents of the read.</p>
   		<p>The <code>from</code> attribute is the name of the resource you want to read.</p>
  @@ -155,19 +155,19 @@
   		<p>Here we make a Form <code>input</code> Field, so the name is important, but it does not need to relate to the name of the location where the data is to be stored. The parent deos not have to be <code>input</code>, use whatever you want.</p>
   
   		<source><![CDATA[
  -	<input name="title">
  -		<xsp:attribute name="label"><fp:read select="title/label" from="default-item"/></xsp:attribute>
  -		<fp:if-post>
  -			<fp:write to="external-item" select="title">
  -				<request:get-parameter name="title"/>
  -			</fp:write>
  -			<fp:read select="title" from="external-item"/>
  -		</fp:if-post>
  -		<fp:if-get>
  -			<fp:read select="title/value" from="default-item"/>
  -		</fp:if-get>
  -	</input>
  -	]]></source>			
  +<input name="title">
  +  <xsp:attribute name="label"><fp:read select="title/label" from="default-item"/></xsp:attribute>
  +  <fp:if-post>
  +    <fp:write to="external-item" select="title">
  +      <request:get-parameter name="title"/>
  +    </fp:write>
  +    <fp:read select="title" from="external-item"/>
  +  </fp:if-post>
  +  <fp:if-get>
  +    <fp:read select="title/value" from="default-item"/>
  +  </fp:if-get>
  +</input>
  +]]></source>			
   
   		<p>I create a <code>label</code> attribute in the <code>input</code> element, using XSP, but the content comes from reading Text from the defaults file (I would have had to set this file up previously as a <code>fp:resource</code>). The default value for the <code>as</code> attribute is "string", so I am leaving it out. I understand Xerces prefers you to write attributes before elements.</p>
   		<p>Next I write, only if someone is POSTing a Form.</p>
  
  
  
  1.11      +42 -42    xml-cocoon/xdocs/sqltaglib.xml
  
  Index: sqltaglib.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/xdocs/sqltaglib.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- sqltaglib.xml	2000/09/19 23:01:45	1.10
  +++ sqltaglib.xml	2000/11/07 22:35:33	1.11
  @@ -94,53 +94,53 @@
           <p>Let's step through an example of using a connection defined to be "helpdesk"
              that uses oracle. In the cocoon.properties have something simular to this:</p>
   		<source>
  -           #### ORACLE
  -           processor.xsp.pool.database.helpdesk.driver=oracle.jdbc.driver.OracleDriver
  -           processor.xsp.pool.database.helpdesk.url=jdbc:oracle:thin:@localhost:1521:dldf
  -           processor.xsp.pool.database.helpdesk.username=dnUser
  -           processor.xsp.pool.database.helpdesk.password=dbPass
  -           # The number of database connections to cache in the ConnectionPool.
  -           processor.xsp.pool.database.helpdesk.maxConnections=3
  +#### ORACLE
  +processor.xsp.pool.database.helpdesk.driver=oracle.jdbc.driver.OracleDriver
  +processor.xsp.pool.database.helpdesk.url=jdbc:oracle:thin:@localhost:1521:dldf
  +processor.xsp.pool.database.helpdesk.username=dnUser
  +processor.xsp.pool.database.helpdesk.password=dbPass
  +# The number of database connections to cache in the ConnectionPool.
  +processor.xsp.pool.database.helpdesk.maxConnections=3
           </source>
            <p>then in my xml file, I would use the connection pool name "helpdesk" as:</p>
   		<source><![CDATA[
  -         <sql:execute-query>
  -            <sql:use-connection>helpdesk</sql:use-connection>
  -            <sql:skip-rows>0</sql:skip-rows>
  -            <sql:max-rows>50</sql:max-rows>
  -            <sql:null-indicator>y</sql:null-indicator>
  -            <sql:count-attribute>BOB</sql:count-attribute>
  -            <sql:doc-element>ROWSET</sql:doc-element>
  -            <sql:row-element>ROW</sql:row-element>
  -            <sql:tag-case>preserve</sql:tag-case>
  -            <sql:id-attribute>ID</sql:id-attribute>
  -            <sql:query>
  -               SELECT last_name, first_name, initials
  -               FROM EMPLOYEE
  -           </sql:query>
  -        </sql:execute-query>
  -   ]]></source>
  +<sql:execute-query>
  +  <sql:use-connection>helpdesk</sql:use-connection>
  +  <sql:skip-rows>0</sql:skip-rows>
  +  <sql:max-rows>50</sql:max-rows>
  +  <sql:null-indicator>y</sql:null-indicator>
  +  <sql:count-attribute>BOB</sql:count-attribute>
  +  <sql:doc-element>ROWSET</sql:doc-element>
  +  <sql:row-element>ROW</sql:row-element>
  +  <sql:tag-case>preserve</sql:tag-case>
  +  <sql:id-attribute>ID</sql:id-attribute>
  +  <sql:query>
  +    SELECT last_name, first_name, initials
  +    FROM EMPLOYEE
  +  </sql:query>
  +</sql:execute-query>
  +]]></source>
      <p>Notice that for the connection pool, you do <strong>not</strong> use the <strong>driver</strong>, 
         <strong>dburl</strong>, <strong>username</strong>,
          nor <strong>password</strong> tags. 
        Lets look at an example that does not use the connection pool:</p>
   		<source><![CDATA[
  -          <sql:execute-query>
  -             <sql:driver>com.informix.jdbc.IfxDriver</sql:driver>
  -             <sql:dburl>jdbc:informix-sqli://localhost:1526/database:informixserver=server</sql:dburl>
  -             <sql:username>dbUser</sql:username>
  -             <sql:password>dbPass</sql:password>
  -             <sql:skip-rows>0</sql:skip-rows>
  -             <sql:max-rows>50</sql:max-rows>
  -             <sql:tag-case>preserve</sql:tag-case>
  -             <sql:count-attribute>count</sql:count-attribute>
  -             <sql:doc-element>ROWSET</sql:doc-element>
  -             <sql:row-element>ROW</sql:row-element>
  -             <sql:null-indicator>omit</sql:null-indicator>
  -             <sql:id-attribute>ID</sql:id-attribute>
  -             <sql:query>SELECT * FROM CUSTOMER;</sql:query>
  -           </sql:execute-query>
  -   ]]></source>
  +<sql:execute-query>
  +  <sql:driver>com.informix.jdbc.IfxDriver</sql:driver>
  +  <sql:dburl>jdbc:informix-sqli://localhost:1526/database:informixserver=server</sql:dburl>
  +  <sql:username>dbUser</sql:username>
  +  <sql:password>dbPass</sql:password>
  +  <sql:skip-rows>0</sql:skip-rows>
  +  <sql:max-rows>50</sql:max-rows>
  +  <sql:tag-case>preserve</sql:tag-case>
  +  <sql:count-attribute>count</sql:count-attribute>
  +  <sql:doc-element>ROWSET</sql:doc-element>
  +  <sql:row-element>ROW</sql:row-element>
  +  <sql:null-indicator>omit</sql:null-indicator>
  +  <sql:id-attribute>ID</sql:id-attribute>
  +  <sql:query>SELECT * FROM CUSTOMER;</sql:query>
  +</sql:execute-query>
  +]]></source>
      </s1>
   
   	<s1 title="Column Names and Formatting">
  @@ -159,9 +159,9 @@
   		<p>For each sql:column-format element, a new instance of the Format subclass specified by the sql:class element is constructed using the construction parameters specified by the sql:parameter elements. The constructor must accept only Strings as parameters; if other datatypes are required for a class you wish to use, you must provide your own decorator wrapper for that class. Values from the named column are formatting using the format method. Here is an example:</p>
   		<source><![CDATA[
   <sql:column-format>
  -	<sql:name>my_date</sql:name>
  -	<sql:class>java.text.SimpleDateFormat</sql:class>
  -	<sql:parameter>MM/dd/yyyy</sql:parameter>
  +  <sql:name>my_date</sql:name>
  +  <sql:class>java.text.SimpleDateFormat</sql:class>
  +  <sql:parameter>MM/dd/yyyy</sql:parameter>
   </sql:column-format>
   ]]></source>
   	</s1>