cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@cocoon.zones.apache.org
Subject [DAISY] Updated: BD: Tutorial: Creating, extending and running a block
Date Sat, 11 Feb 2006 12:58:48 GMT
A document has been updated:

http://cocoon.zones.apache.org/daisy/documentation/796.html

Document ID: 796
Branch: main
Language: default
Name: BD: Tutorial: Creating, extending and running a block (unchanged)
Document Type: Cocoon Document (unchanged)
Updated on: 2/11/06 12:58:32 PM
Updated by: Reinhard Pötz

A new version has been created, state: publish

Parts
=====
Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 7445 bytes (previous version: 6600 bytes)
Content diff:
(96 equal lines skipped)
    
    <pre>http://localhost:8888/test</pre>
    
--- <h1>Use other blocks from within your block</h1>
+++ <h1>Develop your block with your IDE</h1>
    
--- <h2>Configure your block to use other blocks</h2>
+++ <p>If you want to use Eclipse or IDEA, Maven already provides the necessary
+++ goals to create the project files. Call</p>
    
--- <p>The main configuration file of a block is block.xml. It contains</p>
+++ <pre>mvn eclipse:eclipse</pre>
    
--- <ul>
--- <li>general information about the block (name, author, licencse, state, ...)
--- </li>
--- <li>path to the block's base sitemap</li>
--- <li>properties</li>
--- <li>requirements of other blocks (dependencies)</li>
--- <li>implemented contracts</li>
--- </ul>
+++ <p>or</p>
    
--- <p>If you want, that your block depends on another block, it has to point to it:
--- </p>
+++ <pre>mvn idea:idea</pre>
    
+++ <p>from the base directory of your block.</p>
+++ 
+++ <h1>Use another block's pipelines from within your block</h1>
+++ 
+++ <p>If you want, that your block uses pipelines of another block, it has to point
+++ to it. You have to alter <strong>/META-INF/block.xml</strong> of your block:</p>
+++ 
    <pre>&lt;block xmlns="http://apache.org/cocoon/blocks/cob/1.0"&gt; 
      ...
      &lt;requirements&gt;
---     &lt;requires 
---       interface="http://the-contract-URI"
---       name="xyz"
---       default="my-group:my-artifact:1.0.2"/&gt;
---    &lt;/requires&gt;
---   &lt;requirements&gt;
+++ 
+++     &lt;requires interface="http://cocoon.apache.org/blocks/tutorial-1/1.0" name="otherBlock"
+++       default="<strong>org.apache.cocoon:cocoon-tutorial-simple-block:1.0-SNAPSHOT</strong>"/&gt;
   
+++ 
+++     &lt;requires interface="http://cocoon.apache.org/blocks/core-components/1.0" 
+++       name="core" default="org.apache.cocoon:cocoon-core-components:1.0-SNAPSHOT"/&gt;
+++ 
+++   &lt;/requirements&gt;
      ...
--- &lt;/block&gt;
---  </pre>
+++ &lt;/block&gt;</pre>
    
--- <p>If you have compile-time dependencies on the required blocks, you also have
--- to add the dependency to pom.xml:</p>
+++ <p>Now your are able to call a pipeline of "<strong>otherBlock</strong>"
from
+++ within your block's <strong>sitemap</strong> (/COB-INF/sitemap.xmap):</p>
    
+++ <pre>&lt;map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"&gt;
+++   &lt;map:pipelines&gt;
+++     &lt;map:pipeline&gt;
+++       &lt;map:match pattern="test"&gt;
+++         &lt;map:generate src="test.xml"/&gt;
+++         &lt;map:serialize type="xml"/&gt;
+++       &lt;/map:match&gt;
+++ <strong>      &lt;map:match pattern="test1"&gt;
+++         &lt;map:generate src="block:otherBlock:/test"/&gt;
+++         &lt;map:serialize/&gt;       
+++       &lt;/map:match&gt;</strong>
+++     &lt;/map:pipeline&gt;
+++   &lt;/map:pipelines&gt;
+++ &lt;/map:sitemap&gt;
+++ </pre>
+++ 
+++ <p>The block protocol gives you access to the pipelines declared in
+++ <strong>otherBlock</strong>.</p>
+++ 
+++ <h1>Use sitemap components of another block</h1>
+++ 
+++ <p class="fixme">[TBD]</p>
+++ 
+++ <h1>Provide components so that they can be used from other blocks</h1>
+++ 
+++ <p class="fixme">[TBD]</p>
+++ 
+++ <h2>Install your block into your local Maven 2 repository</h2>
+++ 
+++ <p>In order to make your block locally available, you have to install it into
+++ your local Maven 2 repository:</p>
+++ 
+++ <pre>mvn install</pre>
+++ 
+++ <p>This step is necessary, if you want to continue with the second tutorial
+++ <a href="daisy:797">Using the block deployer to create a Cocoon web
+++ application</a></p>
+++ 
+++ <h1>Use components of another block from within Java code</h1>
+++ 
+++ <p class="fixme">[TBD]</p>
+++ 
+++ <p>So far you have only been using the block skeleton provided by the Maven
+++ archetype. That's fine but I'm sure you want to do more. So let's extend the
+++ existing block a bit and also implement a Cocoon action.<br/>
+++ If you have compile-time dependencies on the required blocks, you also have to
+++ add the dependency to pom.xml:</p>
+++ 
    <pre>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
      ...
(13 equal lines skipped)
    <p class="note">If your block doesn't have a compile-time dependency, you don't
    need to add it as Maven dependency.</p>
    
--- <h2>Create project descriptors for Eclipse and IDEA</h2>
--- 
--- <p>So far you have only been using the block skeleton provided by the Maven
--- archetype. That's fine but I'm sure you want to do more. So let's extend the
--- existing block a bit and also implement a Cocoon action.</p>
--- 
--- <p>If you want to use Eclipse or IDEA, Maven already provides the necessary
--- goals to create the project files:</p>
--- 
--- <pre>mvn eclipse:eclipse</pre>
--- 
--- <p>or</p>
--- 
--- <pre>mvn idea:idea</pre>
--- 
--- <h2>Use a pipeline of another block</h2>
--- 
--- <p>TBD</p>
--- 
--- <h2>Use a component of another block</h2>
--- 
--- <p>TBD</p>
--- 
--- <h2>Write your own component that can be used from another block</h2>
--- 
--- <p>TBD</p>
--- 
--- <h1>Install your block into your local Maven 2 repository</h1>
--- 
--- <p>In order to make your block locally available, you have to install it into
--- your local Maven 2 repository:</p>
--- 
--- <pre>mvn install</pre>
--- 
--- <p>This step is necessary, if you want to continue with the second tutorial
--- <a href="daisy:797">Using the block deployer to create a Cocoon web
--- application</a></p>
--- 
    <h1>Further readings</h1>
    
    <p>If you want to know more about Maven 2 than this document explains, have a
(10 equal lines skipped)


Fields
======
no changes

Links
=====
no changes

Custom Fields
=============
no changes

Collections
===========
no changes

Mime
View raw message