cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lgaw...@apache.org
Subject svn commit: r440682 - in /cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer: ./ monolithic/
Date Wed, 06 Sep 2006 10:48:23 GMT
Author: lgawron
Date: Wed Sep  6 03:48:22 2006
New Revision: 440682

URL: http://svn.apache.org/viewvc?view=rev&rev=440682
Log:
minor cleanup

Added:
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/RuleBasedZipExtractor.java
      - copied, changed from r439768, cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java
Removed:
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java
Modified:
    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/monolithic/MonolithicCocoonDeployer.java
    cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/XPatchDeployer.java

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?view=diff&rev=440682&r1=440681&r2=440682
==============================================================================
--- 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
Wed Sep  6 03:48:22 2006
@@ -306,8 +306,6 @@
      * except cocoon-bootstrap which remains in WEB-INF/lib.
      */
     private void shieldCocoonWebapp() throws MojoExecutionException {
-        File webappDirectory_ = getWebappDirectory();
-
         String webInfSlashWebXml = "WEB-INF" + File.separatorChar + "web.xml";
 
         String webXmlLocation = this.getWebXml();
@@ -320,8 +318,8 @@
             getLog().debug("no web.xml in source location. checking for generated web.xml
in target location.");
             if (!new File(targetWebXmlLocation).exists()) {
                 this.getLog().info("No web.xml supplied. Will install default web.xml");
-                File outFile = org.apache.cocoon.maven.deployer.utils.FileUtils.createPath(new
File(webappDirectory_,
-                        webInfSlashWebXml));
+                File outFile = org.apache.cocoon.maven.deployer.utils.FileUtils.createPath(new
File(
+                        getWebappDirectory(), webInfSlashWebXml));
 
                 try {
                     CopyUtils.copy(readResourceFromClassloader("WEB-INF/web.xml"), new FileOutputStream(outFile));
@@ -358,7 +356,7 @@
 
         if (this.useShieldingRepository) {
             this.getLog().info("Moving classes and libs to shielded location.");
-            final String webInfDir = webappDirectory_.getAbsolutePath() + File.separatorChar
+ "WEB-INF";
+            final String webInfDir = getWebappDirectory().getAbsolutePath() + File.separatorChar
+ "WEB-INF";
             try {
                 this.move(webInfDir, "lib", COCOON_LIB);
                 this.move(webInfDir, "classes", COCOON_CLASSES);

Modified: 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?view=diff&rev=440682&r1=440681&r2=440682
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java
(original)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicCocoonDeployer.java
Wed Sep  6 03:48:22 2006
@@ -69,7 +69,7 @@
             File lib = (File) entry.getValue();
             try {
                 this.logger.info("Deploying " + id);
-                MonolithicServer22 zipExtractor = new MonolithicServer22(basedir, logger);
+                RuleBasedZipExtractor zipExtractor = new RuleBasedZipExtractor(basedir, logger);
                 zipExtractor.addRule("META-INF/legacy/cocoon.xconf", new SingleFileDeployer("WEB-INF/cocoon"));
                 zipExtractor.addRule("META-INF/legacy/xconf/**", new SingleFileDeployer("WEB-INF/cocoon/xconf"));
                 zipExtractor.addRule("META-INF/legacy/sitemap-additions/**", new SingleFileDeployer(

Copied: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/RuleBasedZipExtractor.java
(from r439768, 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/RuleBasedZipExtractor.java?view=diff&rev=440682&p1=cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java&r1=439768&p2=cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/RuleBasedZipExtractor.java&r2=440682
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/MonolithicServer22.java
(original)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/RuleBasedZipExtractor.java
Wed Sep  6 03:48:22 2006
@@ -35,35 +35,35 @@
 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.
+ * 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));
+public class RuleBasedZipExtractor {
+    private Log logger;
+    private File basedir;
+    private List rules = new ArrayList();
+    private Set alreadyDeployedFilesSet = new HashSet();
+
+    public RuleBasedZipExtractor(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 {
@@ -71,7 +71,7 @@
                 if (document != null) {
                     // skip directories (only files have to be written)
                     if (document.isDirectory()) {
-                    	zipStream.closeEntry();
+                        zipStream.closeEntry();
                         continue;
                     }
                     OutputStream out = null;
@@ -93,35 +93,37 @@
                 }
             } while (document != null);
         } finally {
-        	zipStream.close();
+            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;
         }
-	}
-	
-	/**
-	 * 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;
-		}
-	}
+    }
 
 }

Modified: cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/XPatchDeployer.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/XPatchDeployer.java?view=diff&rev=440682&r1=440681&r2=440682
==============================================================================
--- cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/XPatchDeployer.java
(original)
+++ cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/XPatchDeployer.java
Wed Sep  6 03:48:22 2006
@@ -70,8 +70,8 @@
         }
         try {
             getLogger().info("Applying patches to: " + fileName);
-            File outFile = FileUtils.createPath(new File(getBasedir(), fileName));
             Document original = XMLUtils.parseXml(source);
+            File outFile = FileUtils.createPath(new File(getBasedir(), fileName));
 
             Iterator it = patches.iterator();
             while (it.hasNext()) {



Mime
View raw message