The Jakarta Project The Jakarta Slide Project

Main

User's Guide

Administrator's Guide

Programmer's Corner

Configuring Slide

In order to use the J2EE stores, the Domain.xml file needs to contain the following configuration for the store:

<definition>
    <store name="j2ee">
        <nodestore classname="org.apache.slide.store.impl.rdbms.J2EEStore">
            <parameter name="datasource">jdbc/mtx</parameter>
            <parameter name="adapter">org.apache.slide.store.impl.rdbms.MySqlRDBMSAdapter</parameter>
            <parameter name="compress">false</parameter>
        </nodestore>
        <securitystore>
            <reference store="nodestore"/>
        </securitystore>
        <lockstore>
            <reference store="nodestore"/>
        </lockstore>
        <revisiondescriptorsstore>
            <reference store="nodestore"/>
        </revisiondescriptorsstore>
        <revisiondescriptorstore>
            <reference store="nodestore"/>
        </revisiondescriptorstore>
        <contentstore>
            <reference store="nodestore"/>
        </contentstore>
    </store>
    <scope match="/" store="j2ee"/>
</definition>
where the adapter determines which database adapter you want to use. In this case you configured the MySQL adapter. Most adapters have a parameter to decide whether the content shall be compressed (zipped) before storing to the database. This might be fast in some enviroments. This option is switched off here.

You have to create the tables of the database schema manually. Schemata are available in src/conf/schema if you have the source distribution or in slide/db-schema if you have the Tomcat bundled or binary distribution.

If your store is not configured using a datasource looked up using JNDI you will have to provide more information to Slide like this for example:

<definition>
<store name="MySqlStore">
  <nodestore classname="org.apache.slide.store.impl.rdbms.JDBCStore">
    <parameter name="adapter">org.apache.slide.store.impl.rdbms.MySqlRDBMSAdapter</parameter>
    <parameter name="driver">com.mysql.jdbc.Driver</parameter>
    <parameter name="url">jdbc:mysql://localhost/Slide</parameter>
    <parameter name="user">root</parameter>
    <parameter name="isolation">SERIALIZABLE</parameter>
    <parameter name="compress">false</parameter>
    <parameter name="dbcpPooling">true</parameter>
    <parameter name="dbcp.maxActive">10</parameter>
    <parameter name="dbcp.validationQuery">SELECT 1</parameter>
    <parameter name="dbcp.maxWait">5000</parameter>
    <!-- Set arbitrary (semicolon-separated) properties for the JDBC-driver:
        <parameter name="dbcp.connectionProperties">cachePrepStmts=true;prepStmtCacheSqlLimit=512</parameter> -->
  </nodestore>
  <contentstore>
    <reference store="nodestore" />
  </contentstore>
  <securitystore>
    <reference store="nodestore" />
  </securitystore>
  <lockstore>
    <reference store="nodestore" />
  </lockstore>
  <revisiondescriptorsstore>
    <reference store="nodestore" />
  </revisiondescriptorsstore>
  <revisiondescriptorstore>
    <reference store="nodestore" />
  </revisiondescriptorstore>
 </store>
 <scope match="/" store="MySqlStore"/>
</definition>
You can see you will have to configure you driver, the connection url and the user for the database. You can optionally configure if connection pooling using DBCP is enabled or not and if enabled how many connections shall be pooled. If you want you can also choose the isolation level of your database. SERIALIZABLE is a safe choice, but - depending on you database - at least READ COMMITTED is recommended.

Configuring Tomcat 4.x

In order to use this with Tomcat you need to setup the datasource. Instructions for this are at http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html.

If you follow the above instructions you will make changes similar to the following in web.xml and server.xml.

web.xml
<resource-ref>
    <description>Testing Tomcat-wide datasource usage</description>
    <res-ref-name>jdbc/mtx</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>

server.xml
<DefaultContext debug="99">
    <Resource name="jdbc/mtx" auth="Container" type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/mtx">
        <parameter>
            <name>user</name>
            <value>bar</value>
        </parameter>
        <parameter>
            <name>password</name>
            <value>foo</value>
        </parameter>
        <parameter>
            <name>driverClassName</name>
            <value>org.hsqldb.jdbcDriver</value>
        </parameter>
        <parameter>
            <name>driverName</name>
            <value>jdbc:hsqldb:slide</value>
        </parameter>
    </ResourceParams>
</DefaultContext>


Copyright © 1999-2004, Apache Software Foundation