You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2006/06/12 12:53:38 UTC

svn commit: r413629 [1/2] - in /cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/cocoon/ src/main/java/org/apache/cocoon/maven/ src/m...

Author: reinhard
Date: Mon Jun 12 03:53:34 2006
New Revision: 413629

URL: http://svn.apache.org/viewvc?rev=413629&view=rev
Log:
Make the cocoon:deploy task more powerful so that it supports configurations for locally available blocks and to run a single block at development time; move everything needed from the cocoon-block-deployer-core module into this module as the core module will be rewritten from scratch

Added:
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DeploymentException.java   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentBlock.java   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentProperty.java   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileAlreadyDeployedException.java   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileDeployer.java   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/NoRuleFoundException.java   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/SingleFileDeployer.java   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/FileUtils.java   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/WildcardHelper.java   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/cocoon.xconf   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/log4j.xconf   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/properties/   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/properties/core.properties   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/web.xml   (with props)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/sitemap.xmap   (with props)
Removed:
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/README.txt
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/MavenArtifactProvider.java
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/MavenLoggingWrapper.java
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/SingleBlockDeployMojo.java
Modified:
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/pom.xml   (contents, props changed)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/   (props changed)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/   (props changed)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/   (props changed)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/   (props changed)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/   (props changed)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/   (props changed)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/   (props changed)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/   (props changed)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java   (contents, props changed)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployExplodedMojo.java   (contents, props changed)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployWarMojo.java   (contents, props changed)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/test/   (props changed)
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/test/java/   (props changed)

Modified: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/pom.xml?rev=413629&r1=413628&r2=413629&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/pom.xml (original)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/pom.xml Mon Jun 12 03:53:34 2006
@@ -34,11 +34,25 @@
   <url>http://cocoon.apache.org</url>
   
   <dependencies>
+    
+    <!-- utility libs -->
     <dependency>
-      <groupId>org.apache.cocoon</groupId>
-      <artifactId>cocoon-deployer-core</artifactId>
-      <version>1.0.0-SNAPSHOT</version>  
-      </dependency>
+      <groupId>antlr</groupId>
+      <artifactId>stringtemplate</artifactId>
+      <version>2.2</version>      
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>1.2</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.1</version>      
+    </dependency>       
+    
+    <!-- Maven specific -->
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-plugin-api</artifactId>
@@ -69,6 +83,8 @@
       <artifactId>maven-war-plugin</artifactId>
       <version>2.0-beta-2</version>
     </dependency>
+    
+    <!-- test libs -->
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/pom.xml
------------------------------------------------------------------------------
--- eol:style (original)
+++ eol:style Mon Jun 12 03:53:34 2006
@@ -1 +1 @@
-native
+'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/pom.xml
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/
------------------------------------------------------------------------------
--- eol:style (original)
+++ eol:style Mon Jun 12 03:53:34 2006
@@ -1 +1 @@
-native
+'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/
------------------------------------------------------------------------------
--- eol:style (original)
+++ eol:style Mon Jun 12 03:53:34 2006
@@ -1 +1 @@
-native
+'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/
------------------------------------------------------------------------------
--- eol:style (original)
+++ eol:style Mon Jun 12 03:53:34 2006
@@ -1 +1 @@
-native
+'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/
------------------------------------------------------------------------------
--- eol:style (original)
+++ eol:style Mon Jun 12 03:53:34 2006
@@ -1 +1 @@
-native
+'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/
------------------------------------------------------------------------------
--- eol:style (original)
+++ eol:style Mon Jun 12 03:53:34 2006
@@ -1 +1 @@
-native
+'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/
------------------------------------------------------------------------------
--- eol:style (original)
+++ eol:style Mon Jun 12 03:53:34 2006
@@ -1 +1 @@
-native
+'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/
------------------------------------------------------------------------------
--- eol:style (original)
+++ eol:style Mon Jun 12 03:53:34 2006
@@ -1 +1 @@
-native
+'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/
------------------------------------------------------------------------------
--- eol:style (original)
+++ eol:style Mon Jun 12 03:53:34 2006
@@ -1 +1 @@
-native
+'native'

Modified: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java?rev=413629&r1=413628&r2=413629&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java (original)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java Mon Jun 12 03:53:34 2006
@@ -17,20 +17,15 @@
 
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
-import org.apache.cocoon.deployer.BlockDeployer;
-import org.apache.cocoon.deployer.MonolithicCocoonDeployer;
-import org.apache.cocoon.deployer.generated.deploy.x10.Deploy;
-import org.apache.cocoon.deployer.resolver.NullVariableResolver;
+import org.apache.cocoon.maven.deployer.monolithic.DevelopmentBlock;
+import org.apache.cocoon.maven.deployer.monolithic.DevelopmentProperty;
+import org.apache.cocoon.maven.deployer.monolithic.MonolithicCocoonDeployer;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -39,11 +34,11 @@
 import org.apache.maven.plugin.war.AbstractWarMojo;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.artifact.MavenMetadataSource;
-import org.exolab.castor.xml.MarshalException;
-import org.exolab.castor.xml.ValidationException;
 
 /**
  * Create a Cocoon web application based on a block deployment descriptor.
+ * 
+ * @version $Id$
  */
 abstract class AbstractDeployMojo extends AbstractWarMojo 
 {
@@ -141,62 +136,6 @@
      * @parameter expression="${maven.war.webxml}"
      */
     private String webXml;
-    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
-	
-    protected void deployBlocks() throws MojoExecutionException 
-    {
-    	File webappDirectory_ = getWebappDirectory();
-    	
-    	// build the web application without blocks
-        this.buildExplodedWebapp(webappDirectory_);
-        
-        // read the deployment descriptor
-    	Deploy deploy;
-    	try 
-    	{
-        	this.getLog().info("using deploymentDescriptor at " + deploymentDescriptor.getAbsolutePath());    		
-			deploy = (Deploy) Deploy.unmarshal(new FileReader(deploymentDescriptor));
-		} 
-    	catch (MarshalException e) 
-		{
-			throw new MojoExecutionException("The deployment descriptor at '" + deploymentDescriptor.getAbsolutePath() + "' can't be parsed.");
-		} 
-    	catch (ValidationException e) 
-    	{
-			throw new MojoExecutionException("The deployment descriptor at '" + deploymentDescriptor.getAbsolutePath() + "' is not valid XML.");
-		} 
-    	catch (FileNotFoundException e) 
-    	{
-			throw new MojoExecutionException("The deployment descriptor can't be found at '" + deploymentDescriptor.getAbsolutePath() + "'.");
-		}
-        
-    	// set the target directory 
-    	if(webappDirectory_ != null) {
-    		String targetUri = "file:///" + webappDirectory_.getAbsolutePath().replaceAll("\\\\", "/");
-    		this.getLog().debug("targetUrl: " + targetUri);
-    		
-    		deploy.getCocoon().setTargetUrl(targetUri);
-    		
-        	if(deploy.getCocoon().getTargetUrl() != null) {
-        		this.getLog().warn("The targetUrl set in the <cocoon> element of '" + deploymentDescriptor.getAbsolutePath() +
-        	        "' was overriden by '" + targetUri + "'");
-        	}    		
-    	}
-    	
-    	// finally use the block deployer to add blocks to the web app
-        BlockDeployer blockDeployer =
-            new BlockDeployer(new MavenArtifactProvider(this.artifactResolver, 
-            											this.artifactFactory,
-                                                        this.localRepository,
-                                                        this.remoteArtifactRepositories,
-                                                        this.metadataSource, 
-                                                        this.getLog()),
-                              new NullVariableResolver(),
-                              new MavenLoggingWrapper(this.getLog()));
-        
-        blockDeployer.deploy(deploy, false, true);
-        
-    }
     
 	/**
 	 * Deploy a monolithic Cocoon web application. This means it doesn't use
@@ -208,7 +147,9 @@
     	// build the web application
         this.buildExplodedWebapp(webappDirectory_);
         
-        this.deployBlocksIntoMonotiticWebapp(blocksdir, webappDirectory_, new HashSet());
+        MonolithicCocoonDeployer deployer = new MonolithicCocoonDeployer(this.getLog());        
+        deployer.deploy(getBlockArtifactsAsMap(null), webappDirectory_, 
+                blocksdir, new DevelopmentBlock[0], new DevelopmentProperty[0]);
         
         // make sure that all configuration files available in the webapp override block configuration files
         try {
@@ -225,24 +166,41 @@
      * Deploy a particular block at development time.
      * 
      * @param blocksdir
+     * @param blocks 
+     * @param properties 
      * @throws MojoExecutionException
      */
-    protected void deployMonolithicCocoonAppAsBlockWebapp(final String blocksdir) throws MojoExecutionException {
+    protected void blockDeploymentMonolithicCocoon(final String blocksdir, final DevelopmentBlock[] blocks, 
+            final DevelopmentProperty[] properties) throws MojoExecutionException {
         File webappDirectory_ = getWebappDirectory();        
         
-        File webinfDir = new File( webappDirectory, WEB_INF );
+        File webinfDir = new File(webappDirectory_, WEB_INF);
         webinfDir.mkdirs();
         
-        this.deployBlocksIntoMonotiticWebapp(blocksdir, webappDirectory_, new HashSet());
+        // add current block to the development properties
+        DevelopmentBlock curBlock = new DevelopmentBlock();
+        curBlock.artifactId = this.getProject().getArtifactId();
+        curBlock.groupId = this.getProject().getGroupId();
+        try {
+            curBlock.setLocalPath(this.getProject().getBasedir().getAbsolutePath());
+        } catch (FileNotFoundException e) {
+            throw new MojoExecutionException("Problems with setting the basedir of this block.", e);
+        }
+        DevelopmentBlock[] extBlocks = new DevelopmentBlock[blocks.length + 1];
+        System.arraycopy(blocks, 0, extBlocks, 0, blocks.length);
+        extBlocks[blocks.length] = curBlock;
         
-        // create a special root sitemap with <map:classloader> and <map:mount> elements
-    }
+        // deploy all blocks
+        MonolithicCocoonDeployer deployer = new MonolithicCocoonDeployer(this.getLog());
+        deployer.deploy(getBlockArtifactsAsMap(blocks), webappDirectory_, 
+                blocksdir, extBlocks, properties);
+    }      
     
+
     /**
-     * Deploy blocks into  a monolithic Cocoon web application. This means it doesn't use
-     * the features that the upcoming blocks-fw (aka Cocoon 3.0) offers.
+     * Create a <code>Map</code> of <code>java.io.File</code> objects pointing to artifacts.
      */
-    private void deployBlocksIntoMonotiticWebapp(final String blocksdir, final File webappDirectory, Set excludedArtifacts) throws MojoExecutionException {
+    private Map getBlockArtifactsAsMap(DevelopmentBlock[] excludedBlocks) throws MojoExecutionException {
         // loop over all artifacts and deploy them correctly
         Map files = new HashMap();
         for(Iterator it = this.getProject().getArtifacts().iterator(); it.hasNext(); ) {
@@ -251,12 +209,27 @@
             if(files.containsKey(id)) {
                 throw new MojoExecutionException("There are at least two artifacts with the ID '" + id + "'.");
             }
-            files.put(id, artifact.getFile());
+            if(containsArtifact(excludedBlocks, artifact.getArtifactId(), artifact.getGroupId())) {
+                this.getLog().debug("Skipping " + artifact.getArtifactId() + ":" + artifact.getGroupId());
+            } else {
+                files.put(id, artifact.getFile());
+            }
         }
-
-        MonolithicCocoonDeployer.deploy(files, webappDirectory, blocksdir, new MavenLoggingWrapper(this.getLog()));
-        
-    }         
-    
+        return files;
+    }     
     
+    /**
+     * @return true if the DevelopmentBlock array contains a block with the passed artifactId and groupId
+     */
+    private boolean containsArtifact(DevelopmentBlock[] blocks, String artifactId, String groupId) {
+        if(blocks != null) {
+            for(int i = 0; i < blocks.length; i++) {
+                if(blocks[i].artifactId.equals(artifactId) && blocks[i].groupId.equals(groupId)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
 }

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java
------------------------------------------------------------------------------
--- eol:style (original)
+++ eol:style Mon Jun 12 03:53:34 2006
@@ -1 +1 @@
-native
+'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Modified: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployExplodedMojo.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployExplodedMojo.java?rev=413629&r1=413628&r2=413629&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployExplodedMojo.java (original)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployExplodedMojo.java Mon Jun 12 03:53:34 2006
@@ -15,6 +15,8 @@
  */
 package org.apache.cocoon.maven.deployer;
 
+import org.apache.cocoon.maven.deployer.monolithic.DevelopmentBlock;
+import org.apache.cocoon.maven.deployer.monolithic.DevelopmentProperty;
 import org.apache.maven.plugin.MojoExecutionException;
 
 /**
@@ -37,13 +39,31 @@
      * @parameter expression="${blocksDirectory}" default-value="apps"	
      */
 	private String blocksdir;	
+    
+    /**
+     * All blocks that should't be deployed; a path reference is used instead.
+     * 
+     * @parameter
+     */
+    private DevelopmentBlock[] blocks;
+    
+    /**
+     * Custom Cocoon properties
+     * 
+     * @parameter
+     */
+    private DevelopmentProperty[] properties;        
 	
 	public void execute() throws MojoExecutionException {
 		if(this.serverVersion.equals("2.2")) {
-			this.deployMonolithicCocoonAppAsWebapp(blocksdir);
-		} else {
-			this.deployBlocks();
-		}
+            if(this.blocks == null) {
+                this.deployMonolithicCocoonAppAsWebapp(this.blocksdir);
+            } else {
+                this.blockDeploymentMonolithicCocoon(this.blocksdir, this.blocks, this.properties);
+            }
+        } else {
+            throw new MojoExecutionException("Only version 2.2 is supported.");
+        }
 	}
 
 }

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployExplodedMojo.java
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployExplodedMojo.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Modified: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployWarMojo.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployWarMojo.java?rev=413629&r1=413628&r2=413629&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployWarMojo.java (original)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployWarMojo.java Mon Jun 12 03:53:34 2006
@@ -38,6 +38,11 @@
  */
 public class DeployWarMojo extends AbstractDeployMojo {
 
+    /** 
+     * @parameter expression="${blocksDirectory}" default-value="apps"  
+     */
+    private String blocksdir;       
+    
 	/**
 	 * The directory for the generated WAR.
 	 * 
@@ -72,8 +77,9 @@
 	public void execute() throws MojoExecutionException {
 
 		File warFile = new File(outputDirectory, warName + ".war");
-		this.deployBlocks();
-
+		
+        this.deployMonolithicCocoonAppAsWebapp(this.blocksdir);
+        
 		try {
 			performPackaging(warFile);
 		} catch (Exception e) {

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployWarMojo.java
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployWarMojo.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/
------------------------------------------------------------------------------
    eol:style = 'native'

Added: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DeploymentException.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DeploymentException.java?rev=413629&view=auto
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DeploymentException.java (added)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DeploymentException.java Mon Jun 12 03:53:34 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.maven.deployer.monolithic;
+
+
+/**
+ * Unchecked exception that signals a problem at block deployment.
+ */
+public class DeploymentException extends RuntimeException {
+
+	public DeploymentException(String message) {
+		super(message);
+	}
+
+	public DeploymentException(String message, Exception ex) {
+		super(message, ex);
+	}
+
+}

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DeploymentException.java
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DeploymentException.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Added: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentBlock.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentBlock.java?rev=413629&view=auto
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentBlock.java (added)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentBlock.java Mon Jun 12 03:53:34 2006
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.maven.deployer.monolithic;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+/**
+ * A container for configuration parameters. Depending on the localPath parameter,
+ * all other 'path' parameters are set.
+ * 
+ * @version $Id$
+ */
+public class DevelopmentBlock {
+
+    private static final String RESOURCES_DIR = "src/main/resources/";
+    
+	public String artifactId;
+    public String groupId;
+    
+    public String springConfPath;
+    public String xconfConfPath; 
+    public String sitemapAdditionsConfPath;
+    public String targetClassesPath;
+    public String cobInfPath;
+    
+    public void setLocalPath(String localPath) throws FileNotFoundException {
+    	File localPathDir = new File(localPath);
+    	if(!localPathDir.exists()) {
+    		throw new FileNotFoundException("Directory '" + localPath + "' does not exist!");
+    	}
+    	
+    	springConfPath = checkDir(new File(localPath, RESOURCES_DIR + "META-INF/spring"));    	
+    	xconfConfPath = checkDir(new File(localPath, RESOURCES_DIR + "META-INF/legacy/xconf"));    	
+    	sitemapAdditionsConfPath = checkDir(new File(localPath, RESOURCES_DIR + "META-INF/legacy/sitemap-additions"));    	
+    	targetClassesPath = checkDir(new File(localPath, "target/classes"));    	
+    	cobInfPath = checkDir(new File(localPath, RESOURCES_DIR + "COB-INF"));    	    	
+    }
+
+	private String checkDir(File dir) {
+		if(dir.exists()) {
+    		return dir.toURI().toString();
+    	}
+		return null;
+	}
+	
+}

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentBlock.java
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentBlock.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Added: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentProperty.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentProperty.java?rev=413629&view=auto
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentProperty.java (added)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentProperty.java Mon Jun 12 03:53:34 2006
@@ -0,0 +1,26 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.maven.deployer.monolithic;
+
+/**
+ * A container for configuration parameters.
+ * 
+ * @version $Id$
+ */
+public class DevelopmentProperty {
+
+	public String name;
+	public String value;
+	
+}

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentProperty.java
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentProperty.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Added: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileAlreadyDeployedException.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileAlreadyDeployedException.java?rev=413629&view=auto
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileAlreadyDeployedException.java (added)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileAlreadyDeployedException.java Mon Jun 12 03:53:34 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.maven.deployer.monolithic;
+
+/**
+ * Use it to indicate that a file has already been deployed.
+ * 
+ * @version $Id$
+ */
+public class FileAlreadyDeployedException extends DeploymentException {
+
+	public FileAlreadyDeployedException(String message) {
+		super(message);
+	}
+
+}

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileAlreadyDeployedException.java
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileAlreadyDeployedException.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Added: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileDeployer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileDeployer.java?rev=413629&view=auto
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileDeployer.java (added)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileDeployer.java Mon Jun 12 03:53:34 2006
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.maven.deployer.monolithic;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Set;
+
+import org.apache.maven.plugin.logging.Log;
+
+/**
+ * Use this interface for classes that are used by the @link org.apache.cocoon.maven.deployer.monolithic.ZipExtractor
+ * to extract ZIP files. Classes implementing this interface can be added together with a rule to the
+ * @link org.apache.cocoon.maven.deployer.monolithic.ZipExtractor and when the rule matches, the execute method
+ * is called.
+ * 
+ * @version $Id$
+ */
+public interface FileDeployer {
+
+	public OutputStream writeResource(String documentName) throws IOException;
+
+	public void setBasedir(File file);
+
+	public void setLogger(Log logger);
+
+	public void setAlreadyDeployedFilesSet(Set alreadyDeployedFilesSet);
+	
+}

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileDeployer.java
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/FileDeployer.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Added: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java?rev=413629&view=auto
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java (added)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java Mon Jun 12 03:53:34 2006
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.maven.deployer.monolithic;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.antlr.stringtemplate.StringTemplate;
+import org.apache.cocoon.maven.deployer.monolithic.DevelopmentBlock;
+import org.apache.cocoon.maven.deployer.monolithic.DevelopmentProperty;
+import org.apache.cocoon.maven.deployer.monolithic.MonolithicServer22;
+import org.apache.cocoon.maven.deployer.monolithic.SingleFileDeployer;
+import org.apache.cocoon.maven.deployer.utils.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.maven.plugin.logging.Log;
+
+/**
+ * Deploy blocks to a monolithic Cocoon web application. The files contained by a block are copied to the right places.
+ * based on rules.
+ * 
+ * @version $Id$
+ */
+public class MonolithicCocoonDeployer {
+	
+	private Log logger;
+	
+	public MonolithicCocoonDeployer(Log logger) {
+		this.logger = logger;
+	}
+
+	public void deploy(final Map libraries, final File basedir, final String blocksdir, 
+		final DevelopmentBlock[] developmentBlocks, DevelopmentProperty[] developmentProperties) 
+		throws DeploymentException {
+		
+		// iterate over all blocks that need to be installed into a J2EE web application
+        for(Iterator it = libraries.keySet().iterator(); it.hasNext();) {
+        	Object id = it.next();
+        	File lib = (File) libraries.get(id);  	
+        	try {
+        		MonolithicServer22 zipExtractor = new MonolithicServer22(basedir, logger);
+                zipExtractor.addRule("**legacy/cocoon.xconf", new SingleFileDeployer("WEB-INF"));        		
+                zipExtractor.addRule("**legacy**.xconf", new SingleFileDeployer("WEB-INF/xconf"));
+                zipExtractor.addRule("**legacy**.xmap", new SingleFileDeployer("WEB-INF/sitemap-additions"));  
+                zipExtractor.addRule("**spring/**.xml", new SingleFileDeployer("WEB-INF/spring"));
+                zipExtractor.addRule("COB-INF**", new SingleFileDeployer(blocksdir + "/" + (String) id, true));  
+        		// extract all configurations files
+				zipExtractor.extract(lib);
+			} catch (IOException e) {
+				throw new DeploymentException("Can't deploy '" + lib.getAbsolutePath() + "'.", e);
+			}
+        }
+        
+        // deploy all blocks that are under development by adding their src/main/java (--> <map:classpath>), 
+        // src/main/resources/COB-INF (--> <map:mount>), and src/main/resources/META-INF/*
+        // (--> <map:include>) to the root sitemap.      
+        if(developmentBlocks != null && developmentBlocks.length > 0) {      	
+	        Map templateObjects = new HashMap();
+	        templateObjects.put("devblocks", developmentBlocks);
+	        writeStringTemplateToFile(basedir, "sitemap.xmap", templateObjects);
+	        writeStringTemplateToFile(basedir, "WEB-INF/cocoon.xconf", templateObjects);
+	        
+			copyFile(basedir, "WEB-INF/log4j.xconf");
+	        copyFile(basedir, "WEB-INF/web.xml");	        
+	        copyFile(basedir, "WEB-INF/properties/core.properties");
+        }
+        
+        // write properties
+        if(developmentProperties != null && developmentProperties.length > 0) {
+        	Properties properties = new Properties();
+        	for(int i = 0; i < developmentProperties.length; i++) {
+        		properties.setProperty(developmentProperties[0].name, developmentProperties[0].value);
+        	}
+        	writeProperties(basedir, "WEB-INF/properties/dev/core.properties", properties);
+        }
+	}
+	
+	private void writeProperties(final File basedir, final String propertiesFile, final Properties properties) {
+    	try {
+    		File outFile = new File(basedir, propertiesFile);
+			properties.save(new FileOutputStream(FileUtils.createDirectory(outFile)), null);
+			this.logger.info("Deploying dev properties to " + propertiesFile);
+		} catch (IOException e) {
+			throw new DeploymentException("Can't save properties to " + propertiesFile, e);
+		}
+	}
+
+	private void copyFile(final File basedir, final String fileName) {
+		try {
+			File outFile = FileUtils.createDirectory(new File(basedir, fileName));
+			IOUtils.copy(readResourceFromClassloader(fileName), new FileOutputStream(outFile));
+			this.logger.info("Deploying resource file to " + fileName);
+		} catch (FileNotFoundException e) {
+			throw new DeploymentException("Can't copy to " + fileName, e);
+		} catch (IOException e) {
+			throw new DeploymentException("Can't copy to " + fileName, e);
+		}
+	}
+
+	private void writeStringTemplateToFile(final File basedir, final String fileName, final Map templateObjects) {
+		FileOutputStream fos = null;
+        try {
+        	File outFile = FileUtils.createDirectory(new File(basedir, fileName));
+        	fos = new FileOutputStream(outFile);
+			InputStream fileIs = readResourceFromClassloader(fileName);
+			StringTemplate stringTemplate = new StringTemplate(IOUtils.toString(fileIs));
+			for(Iterator templateObjectsIt = templateObjects.keySet().iterator(); templateObjectsIt.hasNext();) {
+				Object key = templateObjectsIt.next();
+				stringTemplate.setAttribute((String) key, templateObjects.get(key));
+			}
+			IOUtils.write(stringTemplate.toString(), fos);
+			this.logger.info("Deploying string-template to " + fileName);
+		} catch (FileNotFoundException e) {
+			throw new DeploymentException(fileName + " not found.", e);
+		} catch (IOException e) {
+			throw new DeploymentException("Error while reading or writing.", e);
+		} finally {
+			try {
+				fos.close();
+			} catch (IOException e) {
+				throw new DeploymentException("Error while closing the output stream.", e);
+			}
+		}
+	}
+
+	private InputStream readResourceFromClassloader(String fileName) {
+		return MonolithicCocoonDeployer.class.getClassLoader().
+			getResourceAsStream("org/apache/cocoon/maven/deployer/monolithic/" + fileName);
+	}
+	
+}
\ No newline at end of file

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Added: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java?rev=413629&view=auto
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java (added)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java Mon Jun 12 03:53:34 2006
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.maven.deployer.monolithic;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.apache.cocoon.maven.deployer.utils.WildcardHelper;
+import org.apache.commons.lang.Validate;
+import org.apache.maven.plugin.logging.Log;
+
+/**
+ * This class performs the actual deployment based on rules. A rule is mapped to a 
+ * <code>FileDeployer</code> and when the rule is executed and returns true, the
+ * file deployer is executed.
+ * 
+ * @version $Id$
+ */
+public class MonolithicServer22 {
+
+	private Log logger;
+	private File basedir;
+	private List rules = new ArrayList();
+	private Set alreadyDeployedFilesSet =  new HashSet();
+	
+	public MonolithicServer22(File basedir, Log logger) {
+		Validate.notNull(basedir, "The basedir of the server mustn't be null.");
+		Validate.notNull(logger, "A logger must be set.");
+		this.basedir = basedir;
+		this.logger = logger;
+		this.logger.debug("Basedir: " + basedir.getAbsolutePath());
+	}
+
+	public void addRule(String pattern, FileDeployer fileDeployer) {
+		fileDeployer.setBasedir(this.basedir);
+		fileDeployer.setLogger(this.logger);
+		fileDeployer.setAlreadyDeployedFilesSet(alreadyDeployedFilesSet);
+		rules.add(new Rule(pattern, fileDeployer));
+	}
+	
+	public void extract(File zipFile) throws IOException {
+		ZipInputStream zipStream = new ZipInputStream(new FileInputStream(zipFile));
+        ZipEntry document = null;
+        try {
+            do {
+                document = zipStream.getNextEntry();
+                if (document != null) {
+                    // skip directories (only files have to be written)
+                    if (document.isDirectory()) {
+                    	zipStream.closeEntry();
+                        continue;
+                    }
+                    OutputStream out = null;
+	                    try {               	
+	                    	FileDeployer fileDeployer = findFileDeployer(document.getName());
+	                    	if(fileDeployer == null) {
+	                    		continue;
+	                    	}
+	                    	
+	                    	out = fileDeployer.writeResource(document.getName());
+		                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		                    // loop over ZIP entry stream
+		                    byte[] buffer = new byte[8192];
+		                    int length = -1;
+		                    while (zipStream.available() > 0) {
+		                        length = zipStream.read(buffer, 0, 8192);
+		                        if (length > 0) {
+		                            baos.write(buffer, 0, length);
+		                        }
+		                    }
+		                    // write it to the output stream provided by the file resource manager
+		                    out.write(baos.toByteArray());
+	                    } finally {
+	                    	if(out != null) {
+	                    		out.close();
+	                    	}
+	                    }
+                    // go to next entry
+                    zipStream.closeEntry();
+                }
+            } while (document != null);
+        } finally {
+        	zipStream.close();
+        }
+	}
+	
+	/**
+	 * Loop over all rules and if one matches, the corresponding @link FileDeployer is returned.
+	 */
+	protected FileDeployer findFileDeployer(String name) {
+		for(Iterator it = this.rules.iterator(); it.hasNext();) {
+			Rule rule = (Rule) it.next();
+			HashMap resultMap = new HashMap();
+			if(WildcardHelper.match(resultMap, name, rule.compiledPattern)) {
+				logger.debug("findFileDeployer: " + name + " matched with pattern '" + rule.patternString);
+				return rule.fileDeployer;
+			}
+		}
+		return null;
+	}
+
+	private static class Rule {
+		String patternString;
+		int[] compiledPattern;
+		FileDeployer fileDeployer;
+		
+		public Rule(String pattern, FileDeployer fileDeployer) {
+			this.patternString = pattern;
+			this.compiledPattern = WildcardHelper.compilePattern(pattern);
+			this.fileDeployer = fileDeployer;
+		}
+	}
+
+}

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Added: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/NoRuleFoundException.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/NoRuleFoundException.java?rev=413629&view=auto
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/NoRuleFoundException.java (added)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/NoRuleFoundException.java Mon Jun 12 03:53:34 2006
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.maven.deployer.monolithic;
+
+/**
+ * @version $Id$
+ */
+public class NoRuleFoundException extends RuntimeException {
+
+	public NoRuleFoundException(String message) {
+		super(message);
+	}
+
+}

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/NoRuleFoundException.java
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/NoRuleFoundException.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Added: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/SingleFileDeployer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/SingleFileDeployer.java?rev=413629&view=auto
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/SingleFileDeployer.java (added)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/SingleFileDeployer.java Mon Jun 12 03:53:34 2006
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.maven.deployer.monolithic;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Set;
+
+import org.apache.cocoon.maven.deployer.utils.FileUtils;
+import org.apache.commons.lang.Validate;
+import org.apache.maven.plugin.logging.Log;
+
+/**
+ * Deploy a single file. 
+ * 
+ * @version $Id$
+ */
+public class SingleFileDeployer implements FileDeployer {
+
+	private File basedir;
+	private Log logger;
+	private String outputDir;
+	private boolean skipRootDirectory;
+	private Set alreadyDeployedFilesSet;
+	
+	public SingleFileDeployer(final String outputDir, final boolean skipRootDirectory) {
+		Validate.notNull(outputDir, "An outputDir has to be set.");
+		this.outputDir = outputDir;
+		this.skipRootDirectory = skipRootDirectory;
+	}
+
+	public SingleFileDeployer(final String outputDir) {
+		this(outputDir, false);
+	}	
+	
+	public void setBasedir(final File basedir) {
+		this.basedir = basedir;
+	}
+
+	protected File getBasedir() {
+		return this.basedir;
+	}
+
+	public void setLogger(final Log logger) {
+		this.logger = logger;
+	}
+	
+	protected Log getLogger() {
+		return this.logger;
+	}
+	
+	public void setAlreadyDeployedFilesSet(Set alreadyDeployedFilesSet) {
+		this.alreadyDeployedFilesSet = alreadyDeployedFilesSet;
+	}	
+	
+	protected String getFileName(final String documentName) { 
+		return documentName.substring(documentName.lastIndexOf('/') + 1);
+	}
+
+	protected String getOutputDir() {
+		return this.outputDir;
+	}
+	
+	public OutputStream writeResource(final String documentName) throws IOException {	
+		File outDir = new File(this.getBasedir(), getOutputDir());
+		if(!outDir.exists()) {
+			outDir.mkdirs();
+		}
+		
+		String outputDocumentName = documentName;
+		// if the root directory is has to be skipped, the remaining path will be used
+		if(this.skipRootDirectory) {
+			outputDocumentName = removeRootDirectory(documentName);
+			this.logger.debug("Changing output document name from '" + documentName + "', to '" + outputDocumentName + "'.");			
+		} 
+		// only take the filename
+		else {
+			outputDocumentName = this.getFileName(documentName);
+		}
+		
+		File targetFile = FileUtils.createDirectory(new File(outDir, outputDocumentName));
+		
+		if(this.alreadyDeployedFilesSet.contains(targetFile.getCanonicalFile())) {
+			throw new FileAlreadyDeployedException("File '" + targetFile + "' already exists!");
+		}
+		
+		this.alreadyDeployedFilesSet.add(targetFile.getCanonicalFile());
+		
+		this.logger.info("Deploying block resource to " + getOutputDir() + "/" + outputDocumentName);
+		
+		return new FileOutputStream(FileUtils.createDirectory(targetFile));
+	}
+	
+	protected String removeRootDirectory(final String documentName) {
+		return documentName.substring(documentName.indexOf('/') + 1);
+	}
+
+
+}

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/SingleFileDeployer.java
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/SingleFileDeployer.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/
------------------------------------------------------------------------------
    eol:style = 'native'

Added: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/FileUtils.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/FileUtils.java?rev=413629&view=auto
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/FileUtils.java (added)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/FileUtils.java Mon Jun 12 03:53:34 2006
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.maven.deployer.utils;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.cocoon.maven.deployer.monolithic.DeploymentException;
+
+/**
+ * Utitily class to handle ZIP archives.
+ * 
+ * @version $Id$
+ */
+public class FileUtils {
+
+	/**
+	 * Delete a directory recursivly
+	 * @param directory
+	 * @return true if deletation went okay
+	 */
+    public static boolean deleteDirRecursivly(File directory) {
+        if (directory.isDirectory()) {
+            String[] children = directory.list();
+            for (int i=0; i < children.length; i++) {
+                boolean success = deleteDirRecursivly(new File(directory, children[i]));
+                if (!success) {
+                    return false;
+                }
+            }
+        }
+        return directory.delete();
+    }	
+
+	/**
+	 * Create the directories of a non-exisiting file.
+	 */
+	public static File createDirectory(File file) throws IOException {
+		if(file.isDirectory() || file.exists()) {
+			return file;
+		}
+		String absolutePath = file.getCanonicalPath();
+		String absolutePathDir = absolutePath.substring(0, absolutePath.lastIndexOf(File.separator));
+		File absolutePathDirFile = new File(absolutePathDir);
+		if(absolutePathDirFile.exists()) {
+			return file;
+		}
+		if(!new File(absolutePathDir).mkdirs()) {
+			throw new DeploymentException("Can't create directory '" + absolutePathDir + "'");
+		}
+		return file;
+	}
+
+
+	
+}

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/FileUtils.java
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/FileUtils.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Added: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/WildcardHelper.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/WildcardHelper.java?rev=413629&view=auto
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/WildcardHelper.java (added)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/WildcardHelper.java Mon Jun 12 03:53:34 2006
@@ -0,0 +1,382 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.maven.deployer.utils;
+
+import java.util.HashMap;
+
+/**
+ * This class is an utility class that perform wilcard-patterns matching and
+ * isolation.
+ *
+ * Copy from cocoon-core.
+ * 
+ * @version $Id$
+ */
+public class WildcardHelper {
+
+    /** The int representing '*' in the pattern <code>int []</code>. */
+    protected static final int MATCH_FILE = -1;
+    /** The int representing '**' in the pattern <code>int []</code>. */
+    protected static final int MATCH_PATH = -2;
+    /** The int representing begin in the pattern <code>int []</code>. */
+    protected static final int MATCH_BEGIN = -4;
+    /** The int representing end in pattern <code>int []</code>. */
+    protected static final int MATCH_THEEND = -5;
+    /** The int value that terminates the pattern <code>int []</code>. */
+    protected static final int MATCH_END = -3;
+
+
+    /**
+     * Translate the given <code>String</code> into a <code>int []</code>
+     * representing the pattern matchable by this class.
+     * <br>
+     * This function translates a <code>String</code> into an int array
+     * converting the special '*' and '\' characters.
+     * <br>
+     * Here is how the conversion algorithm works:
+     * <ul>
+     *   <li>The '*' character is converted to MATCH_FILE, meaning that zero
+     *        or more characters (excluding the path separator '/') are to
+     *        be matched.</li>
+     *   <li>The '**' sequence is converted to MATCH_PATH, meaning that zero
+     *       or more characters (including the path separator '/') are to
+     *        be matched.</li>
+     *   <li>The '\' character is used as an escape sequence ('\*' is
+     *       translated in '*', not in MATCH_FILE). If an exact '\' character
+     *       is to be matched the source string must contain a '\\'.
+     *       sequence.</li>
+     * </ul>
+     * When more than two '*' characters, not separated by another character,
+     * are found their value is considered as '**' (MATCH_PATH).
+     * <br>
+     * The array is always terminated by a special value (MATCH_END).
+     * <br>
+     * All MATCH* values are less than zero, while normal characters are equal
+     * or greater.
+     *
+     * @param data The string to translate.
+     * @return The encoded string as an int array, terminated by the MATCH_END
+     *         value (don't consider the array length).
+     * @exception NullPointerException If data is null.
+     */
+    public static int[] compilePattern(String data)
+    throws NullPointerException {
+
+        // Prepare the arrays
+        int expr[] = new int[data.length() + 2];
+        char buff[] = data.toCharArray();
+
+        // Prepare variables for the translation loop
+        int y = 0;
+        boolean slash = false;
+
+        // Must start from beginning
+        expr[y++] = MATCH_BEGIN;
+
+        if (buff.length > 0) {
+            if (buff[0]=='\\') {
+                slash = true;
+            } else if (buff[0] == '*') {
+                expr[y++] = MATCH_FILE;
+            }  else {
+                expr[y++] = buff[0];
+            }
+
+            // Main translation loop
+            for (int x = 1; x < buff.length; x++) {
+                // If the previous char was '\' simply copy this char.
+                if (slash) {
+                    expr[y++] = buff[x];
+                    slash = false;
+                // If the previous char was not '\' we have to do a bunch of checks
+                } else {
+                    // If this char is '\' declare that and continue
+                    if (buff[x] == '\\') {
+                        slash = true;
+                    // If this char is '*' check the previous one
+                    } else if (buff[x] == '*') {
+                        // If the previous character als was '*' match a path
+                        if (expr[y-1] <= MATCH_FILE) {
+                            expr[y-1] = MATCH_PATH;
+                        } else {
+                            expr[y++] = MATCH_FILE;
+                        }
+                    } else {
+                        expr[y++]=buff[x];
+                    }
+                }
+            }
+        }
+
+        // Must match end at the end
+        expr[y] = MATCH_THEEND;
+        return expr;
+    }
+
+    /**
+     * match a pattern agains a string and isolates wildcard replacement into a
+     * <code>Stack</code>.
+     */
+    public static boolean match (HashMap map, String data, int[] expr) 
+    throws NullPointerException {
+        if (data == null) {
+            throw new NullPointerException ("No data provided");
+        }
+        if (expr == null) {
+            throw new NullPointerException ("No pattern expression provided");
+        }
+
+
+        char buff[] = data.toCharArray();
+        // Allocate the result buffer
+        char rslt[] = new char[expr.length + buff.length];
+
+
+        // The previous and current position of the expression character
+        // (MATCH_*)
+        int charpos = 0;
+
+        // The position in the expression, input, translation and result arrays
+        int exprpos = 0;
+        int buffpos = 0;
+        int rsltpos = 0;
+        int offset = -1;
+
+        // The matching count
+        int mcount = 0;
+
+        if ( map != null ) {
+            // We want the complete data be in {0}
+            map.put(Integer.toString(mcount),data);
+        }
+
+        // First check for MATCH_BEGIN
+        boolean matchBegin = false;
+        if (expr[charpos] == MATCH_BEGIN) {
+            matchBegin = true;
+            exprpos = ++charpos;
+        }
+
+        // Search the fist expression character (except MATCH_BEGIN - already skipped)
+        while (expr[charpos] >= 0)
+            charpos++;
+
+        // The expression charater (MATCH_*)
+        int exprchr = expr[charpos];
+
+        while (true) {
+            // Check if the data in the expression array before the current
+            // expression character matches the data in the input buffer
+            if (matchBegin) {
+                if (!matchArray(expr, exprpos, charpos, buff, buffpos))
+                    return (false);
+                matchBegin = false;
+            } else {
+                offset = indexOfArray (expr, exprpos, charpos, buff,
+                        buffpos);
+                if (offset < 0)
+                    return (false);
+            }
+
+            // Check for MATCH_BEGIN
+            if (matchBegin) {
+                if (offset != 0)
+                    return (false);
+                matchBegin = false;
+            }
+
+            // Advance buffpos
+            buffpos += (charpos - exprpos);
+
+            // Check for END's
+            if (exprchr == MATCH_END) {
+                if (rsltpos > 0 && map != null) {
+                    map.put(Integer.toString(++mcount),new String(rslt, 0, rsltpos));
+                }
+                // Don't care about rest of input buffer
+                return (true);
+            } else if (exprchr == MATCH_THEEND) {
+                if (rsltpos > 0 && map != null ) {
+                    map.put (Integer.toString(++mcount),new String(rslt, 0, rsltpos));
+                }
+                // Check that we reach buffer's end
+                return (buffpos == buff.length);
+            }
+
+            // Search the next expression character
+            exprpos = ++charpos;
+            while (expr[charpos] >= 0)
+                charpos++;
+            int prevchr = exprchr;
+            exprchr = expr[charpos];
+
+            // We have here prevchr == * or **.
+            offset = (prevchr == MATCH_FILE) ?
+                    indexOfArray (expr, exprpos, charpos, buff, buffpos) :
+                    lastIndexOfArray (expr, exprpos, charpos, buff,
+                    buffpos);
+
+            if (offset < 0)
+                return (false);
+
+            // Copy the data from the source buffer into the result buffer
+            // to substitute the expression character
+            if (prevchr == MATCH_PATH) {
+                while (buffpos < offset)
+                    rslt[rsltpos++] = buff[buffpos++];
+            } else {
+                // Matching file, don't copy '/'
+                while (buffpos < offset) {
+                    if (buff[buffpos] == '/')
+                        return (false);
+                    rslt[rsltpos++] = buff[buffpos++];
+                }
+            }
+
+            if ( map != null ) {
+                map.put(Integer.toString(++mcount),new String (rslt, 0, rsltpos));
+            }
+            rsltpos = 0;
+        }
+    }
+
+    /**
+      * Get the offset of a part of an int array within a char array.
+      * <br>
+      * This method return the index in d of the first occurrence after dpos of
+      * that part of array specified by r, starting at rpos and terminating at
+      * rend.
+      *
+      * @param r The array containing the data that need to be matched in d.
+      * @param rpos The index of the first character in r to look for.
+      * @param rend The index of the last character in r to look for plus 1.
+      * @param d The array of char that should contain a part of r.
+      * @param dpos The starting offset in d for the matching.
+      * @return The offset in d of the part of r matched in d or -1 if that was
+      *         not found.
+      */
+    protected static int indexOfArray (int r[], int rpos, int rend,
+            char d[], int dpos) {
+        // Check if pos and len are legal
+        if (rend < rpos)
+            throw new IllegalArgumentException ("rend < rpos");
+        // If we need to match a zero length string return current dpos
+        if (rend == rpos)
+            return (d.length); //?? dpos?
+        // If we need to match a 1 char length string do it simply
+        if ((rend - rpos) == 1) {
+            // Search for the specified character
+            for (int x = dpos; x < d.length; x++)
+                if (r[rpos] == d[x])
+                    return (x);
+        }
+        // Main string matching loop. It gets executed if the characters to
+        // match are less then the characters left in the d buffer
+        while ((dpos + rend - rpos) <= d.length) {
+            // Set current startpoint in d
+            int y = dpos;
+            // Check every character in d for equity. If the string is matched
+            // return dpos
+            for (int x = rpos; x <= rend; x++) {
+                if (x == rend)
+                    return (dpos);
+                if (r[x] != d[y++])
+                    break;
+            }
+            // Increase dpos to search for the same string at next offset
+            dpos++;
+        }
+        // The remaining chars in d buffer were not enough or the string
+        // wasn't matched
+        return (-1);
+    }
+
+    /**
+      * Get the offset of a last occurance of an int array within a char array.
+      * <br>
+      * This method return the index in d of the last occurrence after dpos of
+      * that part of array specified by r, starting at rpos and terminating at
+      * rend.
+      *
+      * @param r The array containing the data that need to be matched in d.
+      * @param rpos The index of the first character in r to look for.
+      * @param rend The index of the last character in r to look for plus 1.
+      * @param d The array of char that should contain a part of r.
+      * @param dpos The starting offset in d for the matching.
+      * @return The offset in d of the last part of r matched in d or -1 if that was
+      *         not found.
+      */
+    protected static int lastIndexOfArray (int r[], int rpos, int rend,
+            char d[], int dpos) {
+        // Check if pos and len are legal
+        if (rend < rpos)
+            throw new IllegalArgumentException ("rend < rpos");
+        // If we need to match a zero length string return current dpos
+        if (rend == rpos)
+            return (d.length); //?? dpos?
+
+        // If we need to match a 1 char length string do it simply
+        if ((rend - rpos) == 1) {
+            // Search for the specified character
+            for (int x = d.length - 1; x > dpos; x--)
+                if (r[rpos] == d[x])
+                    return (x);
+        }
+
+        // Main string matching loop. It gets executed if the characters to
+        // match are less then the characters left in the d buffer
+        int l = d.length - (rend - rpos);
+        while (l >= dpos) {
+            // Set current startpoint in d
+            int y = l;
+            // Check every character in d for equity. If the string is matched
+            // return dpos
+            for (int x = rpos; x <= rend; x++) {
+                if (x == rend)
+                    return (l);
+                if (r[x] != d[y++])
+                    break;
+            }
+            // Decrease l to search for the same string at next offset
+            l--;
+        }
+        // The remaining chars in d buffer were not enough or the string
+        // wasn't matched
+        return (-1);
+    }
+
+    /**
+      * Matches elements of array r from rpos to rend with array d, starting from dpos.
+      * <br>
+      * This method return true if elements of array r from rpos to rend
+      * equals elements of array d starting from dpos to dpos+(rend-rpos).
+      *
+      * @param r The array containing the data that need to be matched in d.
+      * @param rpos The index of the first character in r to look for.
+      * @param d The array of char that should start from a part of r.
+      * @param dpos The starting offset in d for the matching.
+      * @return true if array d starts from portion of array r.
+      */
+    protected static boolean matchArray (int r[], int rpos, int rend,
+            char d[], int dpos) {
+        if (d.length - dpos < rend - rpos)
+            return (false);
+        for (int i = rpos; i < rend; i++)
+            if (r[i] != d[dpos++])
+                return (false);
+        return (true);
+    }
+}

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/WildcardHelper.java
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/utils/WildcardHelper.java
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/
------------------------------------------------------------------------------
    eol:style = 'native'

Added: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/cocoon.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/cocoon.xconf?rev=413629&view=auto
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/cocoon.xconf (added)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/cocoon.xconf Mon Jun 12 03:53:34 2006
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<cocoon version="2.2">
+
+  <!--+
+      | Include the core roles definitions. This is for the sake of clarity,
+      | as they are implicitely loaded at startup, but we may want to remove
+      | this implicit behaviour in the future now that we have the include
+      | mechanism. 
+      +-->
+  <include src="resource://org/apache/cocoon/cocoon.roles"/>
+
+  <!--+
+      | Include all configuration files ending with ".xconf" 
+      | from the xconf directory.
+      +-->
+  <include dir="context://WEB-INF/xconf" pattern="*.xconf"/>
+
+  <!--+
+      | Include all configuration files ending with ".xmap" 
+      | from the sitemap-additions directory.
+      +-->
+  <include dir="context://WEB-INF/sitemap-additions" pattern="*.xmap"/>
+  
+  <!--+
+      | Include Spring beans definition files ending with ".xml" from
+      | the spring directory.
+      +-->
+  <include-beans dir="context://WEB-INF/spring" pattern="*.xml"/>
+
+  $devblocks:{ devblock |
+    $if(devblock.springConfPath)$
+    <include-beans dir="$devblock.springConfPath$" pattern="*.xml"/>
+    $endif$
+    
+    $if(devblock.xconfConfPath)$
+    <include dir="$devblock.xconfConfPath$" pattern="*.xconf"/>
+    $endif$
+    
+    $if(devblock.sitemapAdditionsConfPath)$
+    <include dir="$devblock.sitemapAdditionsConfPath$" pattern="*.xmap"/>
+    $endif$
+  }$
+
+</cocoon>

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/cocoon.xconf
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/cocoon.xconf
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Added: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/log4j.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/log4j.xconf?rev=413629&view=auto
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/log4j.xconf (added)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/log4j.xconf Mon Jun 12 03:53:34 2006
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+    <!-- This is a sample configuration for log4j.
+         It simply just logs everything into a single
+         log file.
+         Note, that you can use properties for value substitution.
+    -->
+    <appender name="COCOON_DEFAULT" class="org.apache.log4j.FileAppender">
+        <param name="File"   value="${log-dir}/log4j.log" />
+        <param name="Append" value="false" />	    	
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/>
+        </layout>	    
+    </appender>
+
+    <root>
+      <priority value="error"/>
+      <appender-ref ref="COCOON_DEFAULT" />
+    </root>
+</log4j:configuration>

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/log4j.xconf
------------------------------------------------------------------------------
    eol:style = 'native'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/log4j.xconf
------------------------------------------------------------------------------
    svn:keywords = 'Id'

Propchange: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/resources/org/apache/cocoon/maven/deployer/monolithic/WEB-INF/properties/
------------------------------------------------------------------------------
    eol:style = 'native'