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/04 15:26:14 UTC
svn commit: r411553 - in /cocoon/trunk/tools/cocoon-block-deployer:
cocoon-deployer-core/src/main/java/org/apache/cocoon/deployer/
cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/
Author: reinhard
Date: Sun Jun 4 06:26:14 2006
New Revision: 411553
URL: http://svn.apache.org/viewvc?rev=411553&view=rev
Log:
add support for spring bean definition files in blocks; small refactoring to start implementation of a 'cocoon:block-deploy' goal which will simplify the development of blocks
Modified:
cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-core/src/main/java/org/apache/cocoon/deployer/MonolithicCocoonDeployer.java
cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/AbstractDeployMojo.java
cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/DeployExplodedMojo.java
Modified: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-core/src/main/java/org/apache/cocoon/deployer/MonolithicCocoonDeployer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-core/src/main/java/org/apache/cocoon/deployer/MonolithicCocoonDeployer.java?rev=411553&r1=411552&r2=411553&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-core/src/main/java/org/apache/cocoon/deployer/MonolithicCocoonDeployer.java (original)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-core/src/main/java/org/apache/cocoon/deployer/MonolithicCocoonDeployer.java Sun Jun 4 06:26:14 2006
@@ -25,12 +25,13 @@
import org.apache.cocoon.deployer.monolithic.SingleFileDeployer;
/**
- * Deploy blocks to a monolithic Cocoon web application.
+ * Deploy blocks to a monolithic Cocoon web application. The files contained by a block are copied to the right places.
+ * based on rules.
*/
public class MonolithicCocoonDeployer {
public static void deploy(final Map libraries, final File basedir, final String blocksdir, final Logger logger) {
-
+
for(Iterator it = libraries.keySet().iterator(); it.hasNext();) {
Object id = it.next();
File lib = (File) libraries.get(id);
@@ -39,6 +40,7 @@
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);
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=411553&r1=411552&r2=411553&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 Sun Jun 4 06:26:14 2006
@@ -19,10 +19,13 @@
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;
@@ -193,30 +196,19 @@
blockDeployer.deploy(deploy, false, true);
- }
-
+ }
+
/**
* Deploy a monolithic Cocoon web application. This means it doesn't use
* the features that the blocks-fw offers.
*/
- protected void deployMonolithicCocoonApp(final String blocksdir) throws MojoExecutionException {
+ protected void deployMonolithicCocoonAppAsWebapp(final String blocksdir) throws MojoExecutionException {
File webappDirectory_ = getWebappDirectory();
// build the web application
this.buildExplodedWebapp(webappDirectory_);
- // loop over all artifacts and deploy them correctly
- Map files = new HashMap();
- for(Iterator it = this.getProject().getArtifacts().iterator(); it.hasNext(); ) {
- Artifact artifact = (Artifact) it.next();
- String id = artifact.getArtifactId();
- if(files.containsKey(id)) {
- throw new MojoExecutionException("There are at least two artifacts with the ID '" + id + "'.");
- }
- files.put(id, artifact.getFile());
- }
-
- MonolithicCocoonDeployer.deploy(files, webappDirectory_, blocksdir, new MavenLoggingWrapper(this.getLog()));
+ this.deployBlocksIntoMonotiticWebapp(blocksdir, webappDirectory_, new HashSet());
// make sure that all configuration files available in the webapp override block configuration files
try {
@@ -227,7 +219,44 @@
// take care of paranoid classloading
// TBD
- }
+ }
+
+ /**
+ * Deploy a particular block at development time.
+ *
+ * @param blocksdir
+ * @throws MojoExecutionException
+ */
+ protected void deployMonolithicCocoonAppAsBlockWebapp(final String blocksdir) throws MojoExecutionException {
+ File webappDirectory_ = getWebappDirectory();
+
+ File webinfDir = new File( webappDirectory, WEB_INF );
+ webinfDir.mkdirs();
+
+ this.deployBlocksIntoMonotiticWebapp(blocksdir, webappDirectory_, new HashSet());
+
+ // create a special root sitemap with <map:classloader> and <map:mount> elements
+ }
+
+ /**
+ * 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.
+ */
+ private void deployBlocksIntoMonotiticWebapp(final String blocksdir, final File webappDirectory, Set excludedArtifacts) throws MojoExecutionException {
+ // loop over all artifacts and deploy them correctly
+ Map files = new HashMap();
+ for(Iterator it = this.getProject().getArtifacts().iterator(); it.hasNext(); ) {
+ Artifact artifact = (Artifact) it.next();
+ String id = artifact.getArtifactId();
+ if(files.containsKey(id)) {
+ throw new MojoExecutionException("There are at least two artifacts with the ID '" + id + "'.");
+ }
+ files.put(id, artifact.getFile());
+ }
+
+ MonolithicCocoonDeployer.deploy(files, webappDirectory, blocksdir, new MavenLoggingWrapper(this.getLog()));
+
+ }
}
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=411553&r1=411552&r2=411553&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 Sun Jun 4 06:26:14 2006
@@ -40,7 +40,7 @@
public void execute() throws MojoExecutionException {
if(this.serverVersion.equals("2.2")) {
- this.deployMonolithicCocoonApp(blocksdir);
+ this.deployMonolithicCocoonAppAsWebapp(blocksdir);
} else {
this.deployBlocks();
}