blob: 19560aceb22f31d8df7d4a57fa4cdc17e786e140 [file] [log] [blame]
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 2.0.0 from src/site/xdoc/turbine-concepts.xml at 17 Jun 2025
| Rendered using Apache Maven Fluido Skin 2.1.0
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0" />
<title>Turbine Concepts – Apache Turbine</title>
<link rel="stylesheet" href="./css/apache-maven-fluido-2.1.0.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script src="./js/apache-maven-fluido-2.1.0.min.js"></script>
<style>.github-fork-ribbon:before { background-color: orange; }</style>
</head>
<body>
<a class="github-fork-ribbon right-top" href="https://github.com/apache/turbine-site" data-ribbon="Fork me on GitHub">Fork me on GitHub</a>
<div class="container-fluid container-fluid-top">
<header>
<div id="banner">
<div class="pull-left"><div id="bannerLeft"><h1><a href="./"><img src="images/turbine-project.png" alt="Apache Turbine" /></a></h1></div></div>
<div class="pull-right"><div id="bannerRight"><h1><a href="./"><img src="images/logo.gif" /></a></h1></div></div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li id="publishDate">Last Published: 01 Apr 2025<span class="divider">|</span>
</li>
<li id="projectVersion">Version: 7.0</li>
<li class="pull-right"><span class="divider">|</span>
<a href="fulcrum/">Fulcrum</a></li>
<li class="pull-right"><span class="divider">|</span>
<a href="./">Turbine</a></li>
<li class="pull-right"><span class="divider">|</span>
<a href="https://www.apache.org/">Apache</a></li>
<li class="pull-right"><span class="divider">|</span>
<a href="fulcrum/">Fulcrum</a></li>
<li class="pull-right"><a href="https://www.apache.org">Apache</a></li>
</ul>
</div>
</header>
<div class="row-fluid">
<header id="leftColumn" class="span2">
<nav class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">General Information</li>
<li><a href="index.html">Overview</a></li>
<li class="active"><a>Turbine Concepts</a></li>
<li><a href="fsd.html">Specification</a></li>
<li><a href="further-reading/index.html">Further Reading</a></li>
<li><a href="news.html">News and Status</a></li>
<li><a href="common/powered.html">Sites Using Turbine</a></li>
<li><a href="common/related.html">Sites Related to Turbine</a></li>
<li><a href="common/license.html">License</a></li>
<li><a href="download.html">Download</a></li>
<li><a href="examples.html">Example Apps</a></li>
<li class="nav-header">Shortcuts to Turbine Documentation</li>
<li><a href="https://blogs.apache.org/turbine/">Turbine Blog</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/TURBINE/">Turbine Wiki Home</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/TURBINE/Turbine2+FAQ">Frequently Asked Questions (FAQ)</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/TURBINE/Turbine2+Tutorial">Tutorial</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/TURBINE/Turbine2+UsersGuide">User&apos;s Guide</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/TURBINE/Turbine5">Development</a></li>
<li class="nav-header">Events</li>
<li><a href="https://www.apache.org/events/current-event.html" target="_blank"><img class="imageLink" src="https://www.apache.org/events/current-event-125x125.png" /> Apache Conferences</a></li>
<li class="nav-header">Turbine Releases</li>
<li><a href="turbine/index.html">Overview</a></li>
<li><a href="turbine/turbine-2-3-3/index.html">Turbine 2.3.3</a></li>
<li><a href="turbine/turbine-4-0/index.html">Turbine 4.0 (M2)</a></li>
<li><a href="turbine/turbine-5-0/index.html">Turbine 5.0</a></li>
<li><a href="turbine/turbine-5-1/index.html">Turbine 5.1</a></li>
<li><a href="turbine/turbine-6-0/index.html">Turbine 6.0</a></li>
<li><a href="turbine/turbine-7-0/index.html">Turbine 7.0</a></li>
<li class="nav-header">Turbine Development</li>
<li><a href="turbine/index.html">Current Turbine Development Tree</a></li>
<li class="nav-header">Turbine Sub Projects</li>
<li><a href="fulcrum/index.html">Fulcrum</a></li>
<li class="nav-header">Turbine + Fulcrum Parent POM</li>
<li><a href="turbine-parent/index.html">Turbine Parent</a></li>
<li class="nav-header">Closed projects</li>
<li><a href="stratum/index.html">Stratum</a></li>
<li><a href="tdk/index.html">TDK</a></li>
<li><a href="meta/index.html">META</a></li>
<li class="nav-header">Community</li>
<li><a href="who-we-are.html">Who we are</a></li>
<li><a href="contact.html">Contact us</a></li>
<li><a href="how-to-help.html">How to help</a></li>
<li><a href="how-it-works.html">How it works</a></li>
<li><a href="board-reports.html">Board reports</a></li>
<li class="nav-header">General Development Information</li>
<li><a href="common/code-standards.html">Coding Specification</a></li>
<li><a href="common/developer-links.html">Developer Links</a></li>
<li><a href="common/documentation.html">Improving Documentation</a></li>
<li class="nav-header">ASF</li>
<li><a href="https://apache.org/">Main</a></li>
<li><a href="https://www.apache.org/licenses/">License</a></li>
<li><a href="https://apache.org/foundation/sponsorship">Sponsorship</a></li>
<li><a href="https://www.apache.org/foundation/sponsors">Thanks</a></li>
<li><a href="https://www.apache.org/foundation/policies/conduct">Conduct</a></li>
<li><a href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy</a></li>
<li><a href="https://www.apache.org/security/">Security</a></li>
<li class="nav-header">Project Documentation</li>
<li><a href="project-info.html"><span class="icon-chevron-right"></span>Project Information</a></li>
<li><a href="project-reports.html"><span class="icon-chevron-right"></span>Project Reports</a></li>
<li class="nav-header">Apache</li>
<li><a href="https://www.apache.org/">Apache Website</a></li>
<li><a href="https://www.apache.org/licenses/">License</a></li>
<li><a href="https://www.apache.org/foundation/how-it-works.html">How the ASF works</a></li>
<li><a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
<li><a href="https://www.apache.org/foundation/thanks.html">Thanks</a></li>
<li><a href="https://www.apache.org/security/">Security</a></li>
</ul>
</nav>
<div class="well sidebar-nav">
<form id="search-form" action="https://www.google.com/search" method="get" >
<input value="https://turbine.apache.org/" name="sitesearch" type="hidden" />
<input class="search-query" name="q" id="query" type="text" placeholder="Search with Google..." />
</form>
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<a href="https://maven.apache.org/" class="builtBy" target="_blank"><img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" /></a>
</div>
</div>
</header>
<main id="bodyColumn" class="span10">
<section><a id="Turbine_Concepts_-_Introduction"></a>
<h1>Turbine Concepts - Introduction</h1>
<p>Looking for a modern web application architecture for your Java
development? Turbine is an open source server-side Java framework from
the Apache Software Foundation. Any servlet container supporting Servlet
Specification 2.4 or better can be used to run your Turbine
application.</p>
<p>We offer an easy-to use development environment using some <a href="http://maven.apache.org/" class="externalLink">Maven</a>-Archetypes to quickly
start developing Turbine applications. See the
<a href="https://blogs.apache.org/turbine/entry/maven_archetypes_for_apache_turbine" class="externalLink">blog post</a>
in the <a href="https://blogs.apache.org/turbine/" class="externalLink">Turbine Blog</a> for usage information or <a href="https://github.com/apache/turbine-archetypes/" class="externalLink">Turbine Archetype Readme on GitHub</a>.. If you want use Docker as developing environment, checkout <a href="https://github.com/apache/turbine-archetypes/tree/docker" class="externalLink"> docker branch</a>, which is currently in experimental stage.</p>
<p>We offer an easy-to use development environment using some <a href="http://maven.apache.org/" class="externalLink">Maven</a>-Archetypes to quickly
start developing Turbine applications. See the
<a href="https://blogs.apache.org/turbine/entry/maven_archetypes_for_apache_turbine" class="externalLink">blog post</a>
in the <a href="https://blogs.apache.org/turbine/" class="externalLink">Turbine Blog</a> for
usage information.</p>
<p>Of course, the biggest advantage of Turbine is that it is free, and
all of the source code is available to you, the application
developer.</p>
<p>A quick guide to Turbine technologies:</p>
<ul>
<li>Presentation layer - <a href="http://velocity.apache.org/engine/" class="externalLink">Velocity</a> or JSP</li>
<li>Database layer - Turbine uses <a href="http://db.apache.org/torque/" class="externalLink">Torque</a>, but different OM
layers like <a href="http://db.apache.org/ojb/" class="externalLink">OJB</a> or <a href="http://www.hibernate.org/" class="externalLink">Hibernate</a> are also
supported.</li>
<li>HTML Form Validation using the Turbine provided &quot;Intake&quot;-Service.</li>
<li>Logging - Turbine 5.0 uses <a href="https://logging.apache.org/log4j/2.x/" class="externalLink">Log4J2</a> with activated <a href="https://logging.apache.org/log4j/2.x/log4j-slf4j-impl/index.html" class="externalLink">SLF4J-Binding</a>. Internal <a href="http://commons.apache.org/logging/" class="externalLink">Commons Logging</a> is propagated using <a href="https://www.slf4j.org/legacy.html" class="externalLink">jcl-over-slf4j</a>. Turbine 4.x and previous versions supported a wide range of logging
frameworks like <a href="http://logging.apache.org/log4j/docs/" class="externalLink">Log4J</a>, jdk14 or simple file logging</li>
<li>Service based framework, using <a href="http://avalon.apache.org/" class="externalLink">Avalon</a> compatible components in Turbine 2.4 and beyond. Although this framework is stable it's not yet maintained anymore, and we may change it in the near future.</li>
</ul>
<p>
Applications built with Turbine are encouraged to follow the
Model-View-Controller (MVC) architecture. In the Model-View-Controller
design pattern, the Model is the business logic and stored data, the
View is the user interface, and the Controller handles application
flow and manages the Model and the Views.
</p>
<p>
The Turbine architecture encourages developers to separate business
logic from presentation and application flow. If you use the Turbine
framework, your code will be much easier to maintain as a result.
</p>
</section>
<section><a id="How_does_Turbine_fit_in_with_other_server_side_Java_technologies"></a>
<h1>How does Turbine fit in with other server side Java technologies</h1>
<p>
The Turbine framework is a normal Java application that uses servlets
for handling web users. It is meant to be run under a servlet
container, and you can write your own custom servlets that load
Turbine objects and access Turbine singletons.
</p>
<p>
Turbine's presentation layer can be used with Java Server Pages (JSP)
or <a href="http://velocity.apache.org/engine/" class="externalLink">Velocity</a>. Most
Java developers working with web applications have some experience
with JSP already. We discuss how to choose between <a href="http://velocity.apache.org/engine/" class="externalLink">Velocity</a> and JSP for
your project later on this page.
</p>
<p>
Turbine can be used with Enterprise Java Beans (EJB).Turbine would be
a client of an EJB system, just like a Swing application. This is
most useful if there is already a system that uses Enterprise
Java Beans, or if parts of this system need to be distributed on
different servers. A developer can build a new Turbine service to
access the EJB system. Turbine does not require the use of EJB
session or entity beans.
</p>
</section>
<section><a id="Turbine_Services"></a>
<h1>Turbine Services</h1>
<p>
Turbine Services are the back-end of the application framework. Each
Turbine Service is implemented as a singleton class that can use
Turbine's central configuration utility. These Services only have one
state that all requesting clients share.
</p>
<p>
Because each Service is used through an interface, Service
implementations are pluggable. This is extremely useful if extension
of an existing Service with new functionality is needed . All classes
that use that built-in Service will be able to use your new Service.
</p>
<p>
Starting with <a href="turbine-2.4/">Turbine 2.4</a>, the services are
based on the <a href="http://avalon.apache.org/" class="externalLink">Avalon</a> framework. An
avalon-based component can be plugged into the Turbine framework without
any changes.
</p>
<p>
Turbine comes with a number of Services. These are bundled when using greater
<a href="turbine-2.3/">Turbine-2.3</a>. Find out more about <a href="fulcrum/">Fulcrum</a> project!
</p>
<p>Here is a brief overview of the some of the Services:</p>
<ul>
<li>IntakeService - Provides web form validation and automatic
mapping of data to a bean. All of your input forms can be easily
validated, and all of the mapping of HTML form parameters to
setter methods on a Bean is done automatically. Intake is configured with
XML files.</li>
<li>UploadService - Manages file uploads from HTML widgets.</li>
<li>SecurityService - Manages users and permissions for
Turbine. Turbine has a user, group, role, permission system which uses
a database layer or LDAP as its backend.</li>
<li>JSONService - Provides a layer to Jackson 2 or Gson JSON bindings, which might be used for filtering or application wide settings.</li>
<li>XSLTService - Transforms XML documents with XSLT
stylesheets. This service can cache compiled stylesheets for extra
performance.</li>
</ul>
</section>
<section><a id="Model_View_Controller_.28MVC.29"></a>
<h1>Model View Controller (MVC)</h1>
<p>
The Model View Controller (MVC) architecture allows the developer to
separate presentation from business logic, which makes for more
maintainable code. MVC has been used in traditional GUI programming
for years, but most of the early web application architectures didn't
take advantage of this separation.
</p>
<p>
Applications that use Java servlets can mix HTML into the Java code,
requiring a recompile of the application if there are any look and
feel changes. Sun corrected this problem by creating Java Server Pages
(JSP), which are similar to Microsoft's Active Server Pages (ASP). An
HTML designer can change the GUI without touching the Java code
embedded into the JSP. Unfortunately, JSP doesn't have to conform to
the MVC paradigm, so many applications were developed with business
logic in the JSP pages. Several web application frameworks were
created to bring MVC to the J2EE world, including Struts and
Turbine. More information on Struts can be found <a href="http://struts.apache.org/" class="externalLink">on its web site</a>.
</p>
<p>
One web application version of MVC is called Model 2. Sun created this
term to describe J2EE applications that are built with a Controller
servlet that manages interaction with the View JSPs and the back-end
Model.
</p>
<p>
With Turbine, the Controller is the core TurbineServlet and the Action
Event Handlers. Actions are used within Turbine to handle any user
input that requires interaction with the Model. Turbine developers can
assign different Actions to each input element in an HTML
form. Actions aren't tied to a specific web page - if you have a
common element such as a search form on multiple pages, you can use
the same Action for each.
</p>
<p>
The View in Turbine is the presentation layer, either <a href="http://velocity.apache.org/engine/" class="externalLink">Velocity</a> or JSP. In
either case, no business logic should be embedded in the View.
</p>
<p>
The Model contains the Peers or Services that you use for your data
source.
</p>
<section><a id="Pull_model_of_MVC"></a>
<h2>Pull model of MVC</h2>
<p>
Turbine supports the Pull Model for moving data between the Model
and the View. The Java programmers that work on the Model can create
Tool objects that expose the business logic and objects of the
Model to the View. Every page or screen in the View will have access
to the Tools. If the UI programmers that work on the <a href="http://velocity.apache.org/engine/" class="externalLink">Velocity</a> or JSP files
in the View want to move functionality inside the page or between
pages, they don't need to get the Model developers to change any
code. This is an extremely effective method of separating presentation
from data.
</p>
<p>
Tool objects can follow the Facade design pattern of providing a
single unified API for a complicated or disparate set of Model
functionality. This provides a level of decoupling between the View
and the underlying Model. If the Model definition changes, only the
Tool will need to be modified, instead of every presentation page that
uses that Model.
</p>
</section>
<section><a id="Velocity_or_JSP"></a>
<h2>Velocity or JSP</h2>
<p>
Turbine gives developers a choice for which presentation language to
use. Often times, this can be part of the requirements given to a
development team. JSP is an established standard from Sun
Microsystems, and there is a lot of momentum in the marketplace for
JSP. From reading many anecdotal posts on the Turbine mailing lists,
most developers that use Turbine prefer <a href="http://velocity.apache.org/engine/" class="externalLink">Velocity</a>.
</p>
</section>
</section>
<section><a id="Getting_Started"></a>
<h1>Getting Started</h1>
<p>
Turbine has a learning curve for new developers, but don't let that
discourage you from using it for your own projects.
</p>
<p>
A typical Turbine development environment consists of <a href="http://maven.apache.org/" class="externalLink">Apache Maven</a> and the <a href="meta/">Maven Environment for Turbine Applications
(META)</a>. This helps you setting up, compiling and deploying your
Turbine application to a web container. We recommend using <a href="http://tomcat.apache.org/" class="externalLink">Apache Tomcat</a> as web
container. If you want to use the database features of Turbine for
security and scheduler, you also need a JDBC compliant database,
e.g. <a href="http://www.mysql.com/" class="externalLink">MySQL</a>, <a href="http://www.postgresql.org/" class="externalLink">PostgreSQL</a> or <a href="http://www.hsqldb.org/" class="externalLink">HSQL</a>.
</p>
<p>
For deployment integration in an application server, a couple of tools exist, e.g. you may use the
<a href="https://codehaus-cargo.github.io/cargo/Maven2+plugin.html" class="externalLink">Cargo-Plugin</a>.
</p>
<p>
After working with Turbine for a few minutes, a few hours, or a few
days = you might get stuck. The best thing to do is to
check out the <a href="mail-lists.html">Turbine mailing list
archives</a>. These are available for browsing using a web browser. If
you are using Turbine on a regular base as developer or user, you
should subscribe to one of the mailing lists.
</p>
<p>The Turbine development team hopes, that you have fun working with Turbine!</p>
</section>
<section><a id="Further_Reading"></a>
<h1>Further Reading</h1>
<p>
The Turbine web site is at <a href="http://turbine.apache.org/" class="externalLink">http://turbine.apache.org/</a>.
</p>
<p>
A very good tutorial on using Torque is also on the Turbine web site,
here <a href="http://db.apache.org/torque/torque-5.1/documentation/tutorial/index.html" class="externalLink">http://db.apache.org/torque/torque-5.1/documentation/tutorial/</a>.
</p>
<p>Velocity is available from <a href="http://velocity.apache.org/engine/" class="externalLink">http://velocity.apache.org/engine/</a>. There is also
extensive documentation about the Syntax and Usage of the Velocity Template Language available.
</p>
<p>
<a href="mail-lists.html">The Turbine mailing lists.</a>
</p>
<section><a id="This_page"></a>
<h2>This page</h2>
<p>
The original version of this page has been written by Jeff Linwood. He
has been using Turbine to build a web services infrastructure
application. He is a co-author of <a href="http://www.amazon.com/gp/product/1861007817/" class="externalLink">Professional
Struts Applications</a>, which covers Velocity. He'd like to thank
Jason van Zyl, Troy Mutter, Skip Walker, David Minter, Jason Pettiss,
and his brother Rob Linwood for reviewing this article.
</p>
<p>
The article has been revised for Turbine 2.3 and Turbine 2.4 by <a href="mailto:henning@apache.org" class="externalLink">Henning Schmiedehausen</a>. All
errors and omissions from Jeffs' original article are mine.
</p>
<p>More Changes since Turbine version 4 are done by
</p>
</section>
</section>
</main>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row-fluid">
<p>© 2000–2025
<a href="https://turbine.apache.org/">Apache Software Foundation</a>
</p>
</div>
</div>
</footer>
</body>
</html>