Turbine

Essentials

Models

Get Involved

Documentation

Database

Before you Begin

Before reading the rest of this install document, please take a moment to read these disclaimers:

  • Turbine is still under development. Although many parts of Turbine may be production-ready, the project as a whole is not, and there is no production-ready release of Turbine. If you check out the latest Turbine from CVS at any given point, do not expect that it will compile or that all members of the framework will function as expected.
  • Because Turbine is being constantly improved, much of the documentation on the site is out-of-sync with what is in CVS. Please be patient with us, or join the mailing list to learn how to contribute to the documentation.
  • Please note, Turbine probably won't build or run on MacOS 9 boxes. You should use MacOS X or Linux or *BSD on your Apple hardware instead.

The TDK

All of the necessary packages required to use Turbine (except the JDBC drivers) now come in the Turbine Developer's Kit (TDK). The latest announced version of the TDK is always available at http://jakarta.apache.org/turbine/tdk/.

JDBC Database Drivers

  • MM MySQL JDBC Drivers are here. However, they come installed in the TDK by default.
  • Oracle JDBC Drivers are here.
  • Postgres JDBC Drivers are here.
  • InstantDB JDBC Drivers are here.

If your database is not listed here, please subscribe to the Turbine mailing list and send us the link to the drivers so that we can add it here.

Installing the TDK

Unpack the TDK distribution into a directory of your choosing. Be certain to check the target path of the files as the root folder for the TDK distribution sometimes changes. On Windows, just use WinZip to determine if the files are going to be installed into a 'tdk' root directory, or if you'll need to create it. On Unix, something like:


gzip -dc tdk1.1a10.tar.gz |tar tvf -

Should to the trick.

Building the Application Structure

The TDK comes with Ant and Ant build scripts to create the core directory structures and enough template files to get most applications started quickly. The TDK can build two types of applications - "simple" for applications not requiring a database schema or Object Relational (OR) model, or "peer" for applications using the Peer tool for OR.

You should first check and modify as necessary the newapp.props file in the root of the TDK distribution. The turbine.app.name is the name that you want your application to have. A servlet context will be created with this name, and (if you're using a Peer application), a database by this name will be created. The turbine.app.view is the template system that will be used for your application. The recommended value here is velocity. The turbine.app.type can be either simple or peer. The target.package is the package that all of your Java classes (all the OR classes, and modules) will go in, and the target.directory is the directory structure they will go under. This should PROBABLY match the package structure, except use '/' as the delimeter.

Once the newapp.props file has been built, run the newapp script in the root of the TDK distribution directory - either newapp.sh on Unix, or newapp.bat on Win32. The Ant script will create the necessary directory structure and configuration files to get your application started. Be sure to read any directions at the end of the script processing - especially if you're creating a peer application.

Starting Catalina/Viewing Your Application

Once your application has been created, you should be able to view it by changing directories to the root of the TDK distribution and running bin\startup.bat on Win32, or bin/startup.sh on Unix. Once Catalina has started, point your browser to http://SERVERNAME:8080/APPNAME/servlet/APPNAME where SERVERNAME is the hostname of the machine running Catalina, and APPNAME is the name of the application you created.

Servlet Container Specifics

With Apache JServ

#1. Specify the path to the necessary packages

Place the packages that you will not be changing into the wrapper.classpath (in jserv.properties). Please see this FAQ entry (line wrapped) for more information on determining what will change and what won't change look here.

Here is an example:


wrapper.classpath=<path to>/ECS.jar
wrapper.classpath=<path to>/Village.jar
wrapper.classpath=<path to>/jndi.jar
wrapper.classpath=<path to>/mail.jar
wrapper.classpath=<path to>/activation.jar

Place the rest of the classes that you will be using, such as your Turbine classes into the repositories path that is defined in your zone.properties file.

#2. Run the appropriate SQL script for your database. If a script for your specific database is not present, the SQL can easily be adapted. We appreciate your contributions here. If your database is not supported by the connection pooling code, please subscribe to the mailing list and ask for help there. Include the type of database and the driver information in your posting.


mysqladmin create turbine
mysql turbine < tables.schema

Please note that the tables.schema file is not actually a single file. The various schema files exist in the src/sql/ directory. You will need to choose the appropriate .sql file for your needs according to what database you are using. We currently have .sql files for Oracle, MySQL, DB2, Hypersonic, Sybase, InstantDB, and Postgres. The ones that are the most tested and reliable are the MySQL files because this is our database of choice. Contributions for more databases is most appreciated.

#3. Edit TurbineResources.properties file (in the conf directory), define your database types and make sure that the database adaptor for your database is uncommented, and place this file in a directory accessible to your servlet engine.

#4. Specify an initial parameter named "properties" (without the quotes) with the pathname to the TurbineResources.properties file as its value. This can be accomplished by placing the following line in your [zone].properties file:


servlet.Turbine.initArgs=properties=/path/to/TurbineResources.properties

With Tomcat

Note that the TDK includes Catalina, which is Tomcat 4.0. All the necessary JAR files for Turbine are included in the target application when you use the TDK, and this is the recommended method of using Tomcat. If you need to deploy a TDK application to another Tomcat installation, you should be able to make a WAR file of the application and drop it into the webapps directory on the target platform.

The following instructions assume that you have followed the above instructions for either source compilation or release distribution. This also assumes that you have working Tomcat installation which can be found here.

  • TOMCAT_HOME=/path/to/tomcat
  • Put all necessary Turbine-related jars (Turbine, ECS, Village, JNDI) into $TOMCAT_HOME/lib.
  • Add the path to the jars to the existing Tomcat CLASSPATH found in $TOMCAT_HOME/bin/tomcat.sh
  • Make necessary adjustments to TurbineResources.properties and copy into $TOMCAT_HOME/webapps/YOUR_APP_CONTEXT/WEB-INF/conf
  • Add the following xml to $TOMCAT_HOME/$TOMCAT_HOME/webapps/YOUR_APP_CONTEXT/WEB-INF/web.xml. It will be a child of the web-app element.


<servlet>
    <servlet-name>Turbine</servlet-name>
    <servlet-class>org.apache.turbine.Turbine</servlet-class>
    <init-param>
        <param-name>properties</param-name>
        <param-value>WEB-INF/conf/TurbineResources.properties</param-value>
    </init-param>
    </servlet>

  • Restart Tomcat.

Testing Your Installation

The following examples assume your servlet zone is configured at http://your.host.com/servlets. If this is not the case, please substitute your zone name for /servlets (Tomcat uses /servlet for its default servlet zone).

  • Point your web browser at http://your.host.com/servlets/Turbine
  • Login using username 'turbine' and password 'turbine'
  • You should see a Welcome screen with basic request information.

If you have problems or receive exceptions when following these steps, please subscribe to the mailing list and ask for help. Be sure to include the specific steps you followed, where the error occurred, and what the exact text of the error message is.

Ant Tasks available in build-turbine.xml

The build-turbine.xml contains many Ant tasks. These are run by typing from the command line;

    build-turbine taskname
for example, to run the task which generates the turbine-pool.jar type;
    build-turbine pool

Other Ant tasks in build-turbine.xml include;

    usage - Shows a list of Ant Tasks available.
    compile - Compiles the source code.
    jar - Generates the turbine.jar file ( default ).
    jarsrc - Generates the turbine.src.jar file with source only.
    pool - Generates the Turbine Connection Pool jar.
    docs - Generates the HTML documentation from the XML files in xdocs.
    javadocs - Generates the API Information.
    package-zip - Generates the Turbine distribution as a ZIP archive.
    package-tgz - Generates the Turbine distribution as a TAR.GZ archive.
    run-tests - Runs all available testcases.
    torque - Generates a torque.jar for stand-alone use.
    clean - Cleans up the build directory.


Copyright © 1999-2001, Apache Software Foundation