|
|
This document is intended for both Users and Developers
and presents an overall picture of Apache Cocoon.
|
What You Should know:
- XML, XML Namespaces
- Basics of XPath, XSLT
- Java language
- Servlets, HTTP
What You need not know:
|
- Cocoon project was founded in Jan. 1999 by Stefano Mazzocchi as an open source project under Apache Software Foundation.
- Started as a simple servlet for XSL styling of XML content.
- Was based on DOM level 1 API. This choice turned out to be quite limiting for speed/memory efficiency.
- Used reactor pattern to connect components. This allowed the reaction instructions to be placed inside the documents. Though appealing, it caused difficulties in managing highly dynamic web-sites.
- Allowed context overlap to happen by having processing instructions in documents/stylesheets.
|
- A separate codebase to incorporate Cocoon 1 learnings.
- Designed for execution speed/memory efficiency and scalability to process very large documents by switching processing model from DOM to SAX.
- Centralizes the management functions by allowing processing pipeline specification in a sitemap (an XML file), replacing the embedded processing instruction model.
- Better support for pre-compilation, pre-generation and caching for better performance.
|
|
 |  |  |
 | What problem does Cocoon solve? |  |
 |  |  |
Basic mechanisms for processing XML documents:
- Dispatching based on Matchers.
- Generation of XML documents (from content, logic, Relation DB, objects or any combination) through Generators
- Transformation (to another XML, objects or any combination) of XML documents through Transformers
- Aggregation of XML documents through Aggregators
- Rendering XML through Serializers

Sequence of Interactions

Pipeline

|
|

- Avalon framework for logging, configuration, threading, context etc.
- Caching mechanism
- Pipeline handling
- Program generation, compilation, loading and execution.
- Base classes for generation, transformation, serialization, components.
- ...
|
- Specific generators
- Specific transformers
- Specific matchers
- Specific serializers
- ...
|
- sitemap.xsl
- xsp.xsl
- esql.xsl
- request.xsl
- response.xsl
- ...
|
 |  |  |
 | Site specific configuration, components, logicsheets and content |  |
 |  |  |
|
Cocoon produces execution log entries for debugging/auditing.
- The amount of data to be logged can be controlled by
log-level parameter in web.xml file. The default is DEBUG
(maximum data).
- By default, the log file is:
$TOMCAT_HOME/webapps/cocoon/WEB-INF/logs/cocoon.log .
Cocoon keeps the generated .java files in a directory tree
starting at (by default):
$TOMCAT_HOME/webapps/work/localhost_8080%2Fcocoon/org/apache/cocoon/www .
You can find sitemap_xmap.java here.
Files created by LogTransformer are kept (by default) in $TOMCAT_HOME directory.
|
Download Tomcat from Apache site.
Download Cocoon sources from Apache CVS. [Command assume UNIX Bourne shell]
 |  |  |
 |
export CVSROOT=:pserver:anoncvs@cvs.apache.org:/home/cvspublic
cvs login
Password: anoncvs
cvs checkout xml-cocoon2
|  |
 |  |  |
Build sources as per instruction in Install file.
Move the cocoon.war file to $TOMCAT_HOME/webapps directory.
Start the servlet engine. Type-in the URL http://localhost:8080/cocoon in your browser. You should see the Cocoon welcome message.
Consult Install file if you face problems.
|
|
|