Apache Cocoon, usually abbreviated as Cocoon, is a
web application framework
A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build and ...
built around the concepts of
Pipeline
Pipeline may refer to:
Electronics, computers and computing
* Pipeline (computing), a chain of data-processing stages or a CPU optimization found on
** Instruction pipelining, a technique for implementing instruction-level parallelism within a s ...
,
separation of concerns
In computer science, separation of concerns is a design principle for separating a computer program into distinct sections. Each section addresses a separate '' concern'', a set of information that affects the code of a computer program. A concern ...
, and component-based web development. The framework focuses on
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. ...
and
XSLT
XSLT (Extensible Stylesheet Language Transformations) is a language originally designed for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may subse ...
publishing and is built using the
Java programming language
Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let programmers ''write once, run an ...
. Cocoon's use of XML is intended to improve compatibility of publishing formats, such as
HTML
The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScri ...
and
PDF
Portable Document Format (PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. ...
. The
content management system
A content management system (CMS) is computer software used to manage the creation and modification of digital content ( content management).''Managing Enterprise Content: A Unified Content Strategy''. Ann Rockley, Pamela Kostur, Steve Manning. New ...
s
Apache Lenya
Apache Lenya is a Java/ XML open-source content management system
A content management system (CMS) is computer software used to manage the creation and modification of digital content (content management).''Managing Enterprise Content: A Unifi ...
and
Daisy have been created on top of the framework. Cocoon is also commonly used as a
data warehousing
In computing, a data warehouse (DW or DWH), also known as an enterprise data warehouse (EDW), is a system used for reporting and data analysis and is considered a core component of business intelligence. DWs are central repositories of integra ...
ETL tool or as
middleware
Middleware is a type of computer software that provides services to software applications beyond those available from the operating system. It can be described as "software glue".
Middleware makes it easier for software developers to implement c ...
for transporting data between systems.
Sitemap
Apache Cocoon uses sitemaps to allow users to control a variety of components in the Cocoon software, as well as define the
client-server interactions in what Cocoon refers to as the ''
Pipelines.''
Components
The components within Cocoon are grouped by function.
Matchers
Matchers are used to match user requests such as
URL
A Uniform Resource Locator (URL), colloquially termed as a web address, is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifi ...
s or
cookie, cookies against
wildcard
Wild card most commonly refers to:
* Wild card (cards), a playing card that substitutes for any other card in card games
* Wild card (sports), a tournament or playoff place awarded to an individual or team that has not qualified through normal pla ...
or
regular expression
A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" ...
patterns. Each user request is tested against matchers in the sitemap until a match is made. It is within a matcher that the response to a particular request is specified.
Generators
Generators create a
stream of data for further processing. This stream can be generated from an existing XML document or there are generators that can create XML from scratch to represent something on the server, such as a directory structure or image data.
XSP
One type of generator is an XML Server Page (XSP), an XML document containing tag-based directives that specify how to generate dynamic content at request time. Upon Cocoon processing, these directives are replaced by generated content so that the resulting, augmented XML document can be subject to further processing (typically an XSLT transformation). XSPs are transformed into Cocoon producers, typically as Java classes, though any scripting language for which a Java-based processor exists could also be used.
Directives can be either built-in ("XSP") or user-defined processing tags, both of which are defined in ''logic sheets''. Tags are defined using XSLT templates that describe how the tags (represented as XML nodes) are transformed into other XML nodes or into procedural code such as Java. The tags are used to embed procedural logic, substitute expressions, retrieve information from the webserver environment, and other operations.
Note that XSP is deprecated in recent releases of Cocoon.
Transformers
Transformers take a stream of data and change it in some way. The most common transformations are performed with XSLT to change one
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. ...
format into another. But there are also transformers that take other forms of data (
SQL commands for example).
Serializers
A serializer turns an XML event stream into a sequence of bytes (such as HTML) that can be returned to the client. Some serializers allow you to send the data in many different formats including
HTML
The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScri ...
,
XHTML
Extensible HyperText Markup Language (XHTML) is part of the family of XML markup languages. It mirrors or extends versions of the widely used HyperText Markup Language (HTML), the language in which Web pages are formulated.
While HTML, prior ...
,
PDF
Portable Document Format (PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. ...
,
RTF
RTF may refer to:
Organisations
* African Union Regional Task Force, the military operation of the RCI-LRA, 2011–2018.
* Radiodiffusion-Télévision Française, a broadcaster in France, 1949–1964
* Russian Tennis Federation, the national go ...
,
SVG
Scalable Vector Graphics (SVG) is an XML-based vector image format for defining two-dimensional graphics, having support for interactivity and animation. The SVG specification is an open standard developed by the World Wide Web Consortium sinc ...
,
WML and
plain text
In computing, plain text is a loose term for data (e.g. file contents) that represent only characters of readable material but not its graphical representation nor other objects ( floating-point numbers, images, etc.). It may also include a limi ...
, for example.
Selectors
Selectors offer the same capabilities as a
switch statement
In computer programming languages, a switch statement is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via search and map.
Switch statements function som ...
. They are able to select particular elements of a request and choose the correct pipeline part to use.
Views
Views are mainly used for testing. A view is an exit point in a pipeline. You can put out the XML-Stream which is produced till this point. So you can see if the application is working right.
Readers
Publish content without parsing it (no
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. ...
processing). Used for images and such.
Actions
Actions are Java classes that execute some business logic or manage new content production.
The Pipeline
A ''
pipeline
Pipeline may refer to:
Electronics, computers and computing
* Pipeline (computing), a chain of data-processing stages or a CPU optimization found on
** Instruction pipelining, a technique for implementing instruction-level parallelism within a s ...
'' is used to specify how the different Cocoon components interact with a given request to produce a
response
Response may refer to:
*Call and response (music), musical structure
*Reaction (disambiguation)
*Request–response
**Output (computing), Output or response, the result of telecommunications input
*Response (liturgy), a line answering a versicle
...
.
A typical pipeline consists of a generator, followed by zero or more transformers, and finally a serializer.
See also
*
Reactor pattern
The reactor design pattern is an event handling pattern for handling service requests delivered concurrently to a service handler by one or more inputs. The service handler then demultiplexes the incoming requests and dispatches them synchrono ...
- the design pattern that Cocoon is based on.
*
XProc - a W3C Standard for modelising of XML pipeline.
References
External links
*
/cocoon.apache.org/ The Apache Cocoon Project
{{DEFAULTSORT:Apache Cocoon
Cocoon
Cocoon may refer to:
*Cocoon (silk), a pupal casing made by moth caterpillars and other insect larvae
*Apache Cocoon, web development software
* ''Cocoon'' (film), a 1985 science fiction-fantasy film
**'' Cocoon: The Return'', 1988 sequel to ''Coco ...
Web frameworks
Java platform software