[Arakhnę-Dev] [236] * javadoc-tag-replacer -> tag-replacer

[ Thread Index | Date Index | More arakhne.org/dev Archives ]


Revision: 236
Author:   galland
Date:     2011-08-05 18:51:45 +0200 (Fri, 05 Aug 2011)
Log Message:
-----------
* javadoc-tag-replacer -> tag-replacer

Modified Paths:
--------------
    trunk/tag-replacer/pom.xml

Added Paths:
-----------
    trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/javadoctagreplacer/ReplaceHtmlMojo.java

Removed Paths:
-------------
    trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/javadoctagreplacer/ReplaceMojo.java

Modified: trunk/tag-replacer/pom.xml
===================================================================
--- trunk/tag-replacer/pom.xml	2011-08-05 16:40:12 UTC (rev 235)
+++ trunk/tag-replacer/pom.xml	2011-08-05 16:51:45 UTC (rev 236)
@@ -6,12 +6,12 @@
 	<parent>
 		<artifactId>afc</artifactId>
 		<groupId>org.arakhne.afc</groupId>
-		<version>4.0-SNAPSHOT</version>
+		<version>4.0</version>
 	</parent>
 	
 	<groupId>org.arakhne.afc</groupId>
 	<artifactId>tag-replacer</artifactId>
-	<version>2.0-SNAPSHOT</version>
+	<version>2.0</version>
 	<packaging>maven-plugin</packaging>
 	<name>JavaDoc Tag Replacer Plugin</name>
 	<url>http://www.arakhne.org</url>

Copied: trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/javadoctagreplacer/ReplaceHtmlMojo.java (from rev 235, trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/javadoctagreplacer/ReplaceMojo.java)
===================================================================
--- trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/javadoctagreplacer/ReplaceHtmlMojo.java	                        (rev 0)
+++ trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/javadoctagreplacer/ReplaceHtmlMojo.java	2011-08-05 16:51:45 UTC (rev 236)
@@ -0,0 +1,355 @@
+/* 
+ * $Id$
+ * 
+ * Copyright (C) 2010-11 St&eacute;phane GALLAND
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * This program is free software; you can redistribute it and/or modify
+ */
+package org.arakhne.maven.plugins.javadoctagreplacer;
+
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
+import org.apache.maven.model.Contributor;
+import org.apache.maven.model.Organization;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.arakhne.maven.AbstractArakhneMojo;
+import org.arakhne.maven.ExtendedArtifact;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Replace all the Javadoc variables by the corresponding values.
+ * Supported variables are:<table>
+ * <thead>
+ * <tr><th>Name (case-sensitive)</th><th>Description</th></tr>
+ * </thead>
+ * <tbody>
+ * <tr><td>&dollar;ArtifactId&dollar;</td><td>The artifact id of the Maven module</td></tr>
+ * <tr><td>&dollar;Author: id&dollar;</td><td>The name and link to the author with the given id. The id is the
+ * identifier of the author or contributor defined the <code>pom.xml</code> file; or it is the
+ * email address of the author.</td></tr>
+ * <tr><td>&dollar;Date&dollar;</td><td>The date of the last compilation of the Maven module</td></tr>
+ * <tr><td>&dollar;GroupId&dollar;</td><td>The group id of the Maven module</td></tr>
+ * <tr><td>&dollar;Id&dollar;</td><td>The id of file</td></tr>
+ * <tr><td>&dollar;Name&dollar;</td><td>The name of the Maven module</td></tr>
+ * <tr><td>&dollar;Organization&dollar;</td><td>The name of organization that publishs the Maven module</td></tr>
+ * <tr><td>&dollar;Revision&dollar;</td><td>The version of the Maven module</td></tr>
+ * <tr><td>&dollar;Version&dollar;</td><td>The version of the Maven module</td></tr>
+ * <tr><td>&dollar;Website&dollar;</td><td>The link to the website of the Maven module</td></tr>
+ * </tbody>
+ * </table>
+ *
+ * @author St&eacute;phane GALLAND &lt;galland@xxxxxxxxxxx&gt;
+ * @version $Name$ $Revision$ $Date$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * 
+ * @goal replacehtml
+ * @phase site
+ * @requireProject true
+ */
+public class ReplaceHtmlMojo extends AbstractArakhneMojo {
+
+	/** @component
+	 */
+	private ArtifactHandlerManager artifactHandlerManager;
+	
+	/** @parameter expression="${project.build.directory}"
+	 */
+	private File outputDirectory;
+	 	
+    /**
+     * {@inheritDoc}
+     */
+	@Override
+    protected void executeMojo() throws MojoExecutionException {
+    	File[] javadocDirs = new File[] {
+    			new File(getOutputDirectory(), "site"+File.separator+"apidocs"), //$NON-NLS-1$ //$NON-NLS-2$
+    			new File(getOutputDirectory(), "apidocs") //$NON-NLS-1$
+    	};
+    	
+        for(File javadocDir : javadocDirs) {
+        	clearInternalBuffers();
+        	if ( javadocDir.isDirectory() ) {
+
+        		// Search for files
+        		Collection<File> htmlFiles = findFiles(javadocDir, new HTMLFileFilter());
+
+    			// Replace in files
+    			for(File file : htmlFiles) {
+    				String filename = file.toString().replace(javadocDir.toString(), EMPTY_STRING);
+    				replaceInFile(file, filename);
+    			}
+        	}
+        }
+    }
+                
+    /** Replace the Javadoc tags in the given file.
+     * 
+     * @param file is the name of the file on the local file system.
+     * @param filename is the name of the file in the javadoc hierarchy.
+     * @throws MojoExecutionException
+     */
+	protected void replaceInFile(File file, String filename) throws MojoExecutionException {
+    	
+    	ExtendedArtifact artifact = searchArtifact(file);
+    	
+    	if (artifact!=null) {
+        	getLog().info("Replacing in "+file.getAbsolutePath()+" with artifact "+ //$NON-NLS-1$ //$NON-NLS-2$
+        			ArtifactUtils.key(artifact));
+    	}
+    	else {
+        	getLog().info("Replacing in "+file.getAbsolutePath()+" without artifact"); //$NON-NLS-1$ //$NON-NLS-2$
+    	}
+    	
+    	File outputFile = null;
+    	try {
+    		outputFile = new File(file.getAbsolutePath()+".maven.tmp"); //$NON-NLS-1$
+    		BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile));
+    		BufferedReader reader = new BufferedReader(new FileReader(file));
+    		String line = reader.readLine();
+    		while (line!=null) {
+    			line = replaceInString(filename, artifact, line);
+    			writer.write(line);
+    			writer.write("\n"); //$NON-NLS-1$
+    			line = reader.readLine();
+    		}
+    		writer.close();
+    		reader.close();
+    		fileCopy(outputFile, file);
+    		outputFile.delete();
+    	}
+    	catch(IOException e) {
+    		throw new MojoExecutionException(e.getLocalizedMessage(), e);
+    	}
+    	finally {
+    		if (outputFile!=null && outputFile.exists()) outputFile.delete();
+    	}
+    }
+    
+	/** Uitility function that replace the macros by the replacement text in the given text.
+	 * 
+	 * @param macroName is the name of the macro to replace.
+	 * @param text is the text in which the replacement should occur
+	 * @param replacement is the replacement text.
+	 * @return the result of the replacement
+	 */
+    protected final String replaceMacro(String macroName, String text, String replacement) {
+    	StringBuffer b = new StringBuffer();
+    	b.append("\\Q$\\E"); //$NON-NLS-1$
+    	b.append(macroName);
+    	b.append("(?:\\Q:\\E[^\\$]*)?\\Q$\\E"); //$NON-NLS-1$
+    	Pattern p = Pattern.compile(b.toString(), Pattern.CASE_INSENSITIVE);
+    	Matcher m = p.matcher(text);
+    	return m.replaceAll(replacement);
+    }
+    
+    /** Replace the author information tags in the given text.
+     * 
+     * @param text is the text in which the author tags should be replaced
+     * @param artifact
+     * @return the result of the replacement.
+     * @throws MojoExecutionException
+     */
+    protected String replaceAuthor(String text, ExtendedArtifact artifact) throws MojoExecutionException {
+    	String result = text;
+    	Pattern p = Pattern.compile("[$]Author:([^$]+)[$]", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
+    	Matcher m = p.matcher(text);
+        boolean hasResult = m.find();
+
+        if (hasResult) {
+            StringBuffer sb = new StringBuffer();
+			StringBuffer replacement = new StringBuffer();
+            String login, link;
+            Contributor contributor;
+            do {
+            	login = m.group(1);
+            	if (login!=null) {
+            		login = login.trim();
+            		if (login.length()>0) {
+        				replacement.setLength(0);
+            			if (artifact!=null) {
+	            			contributor = artifact.getContributor(login);
+	            			if (contributor!=null) {
+	            				link = contributor.getUrl();
+	            				if (link==null || EMPTY_STRING.equals(link)) {
+	            					link = contributor.getEmail();
+	            				}
+	            				if (link==null || EMPTY_STRING.equals(link)) {
+	            					replacement.append(contributor.getName());
+	            				}
+	            				else {
+	            					replacement.append("<a target=\"_blank\" href=\""); //$NON-NLS-1$
+	            					replacement.append(link);
+	            					replacement.append("\">"); //$NON-NLS-1$
+	            					replacement.append(contributor.getName());
+	            					replacement.append("</a>"); //$NON-NLS-1$
+	            				}
+	            			}
+	            			else {
+	                    		throw new MojoExecutionException("unable to find a developer or a contributor with an id, a name or an email equal to: "+login); //$NON-NLS-1$
+	            			}
+            			}
+            			m.appendReplacement(sb, replacement.toString());
+            		}
+            		else {
+                		throw new MojoExecutionException("no login for Author tag: "+m.group(0)); //$NON-NLS-1$
+            		}
+            	}
+            	else {
+            		throw new MojoExecutionException("no login for Author tag: "+m.group(0)); //$NON-NLS-1$
+            	}
+                hasResult = m.find();
+            }
+            while (hasResult);
+
+            m.appendTail(sb);
+            
+            result = sb.toString();
+        }
+    	return result;
+    }
+
+    /** Replace Javadoc tags in a string.
+     * 
+     * @param file is the name of the file in the javadoc hierarchy from which the string was extracted.
+     * @param artifact is the artifact in which the file is located. If <code>null</code>
+     * the tags dedicated to the artifact will be replaced by the empty string.
+     * @param line is the line in which the tags should be replaced.
+     * @return the result of the replacement.
+     * @throws MojoExecutionException
+     */
+    protected String replaceInString(String file, ExtendedArtifact artifact, String line) throws MojoExecutionException {
+    	String nline = line;
+    	    	
+    	StringBuffer buffer = new StringBuffer();
+    	
+    	String replacementName = (artifact==null) ? EMPTY_STRING : artifact.getName();
+    	String replacementVersion = (artifact==null) ? EMPTY_STRING : artifact.getVersion();
+    	String replacementArtifactId = (artifact==null) ? EMPTY_STRING : artifact.getArtifactId();
+    	String replacementGroupId = (artifact==null) ? EMPTY_STRING : artifact.getGroupId();
+    	String replacementWebsite = (artifact==null) ? EMPTY_STRING : artifact.getWebsite();
+    	
+    	String replacementOrganization = EMPTY_STRING;
+    	
+    	if (artifact!=null) {
+    		Organization orga = artifact.getOrganization();
+    		if (orga!=null) {
+    			replacementOrganization = orga.getName();
+    		}
+    	}
+    	
+    	nline = replaceMacro("Name", nline, replacementName); //$NON-NLS-1$
+    	nline = replaceMacro("Revision", nline, replacementVersion); //$NON-NLS-1$
+    	nline = replaceMacro("Version", nline, replacementVersion); //$NON-NLS-1$
+    	nline = replaceMacro("ArtifactId", nline, replacementArtifactId); //$NON-NLS-1$
+    	nline = replaceMacro("GroupId", nline, replacementGroupId); //$NON-NLS-1$
+    	nline = replaceMacro("Website", nline, replacementWebsite); //$NON-NLS-1$
+    	nline = replaceMacro("Organization", nline, replacementOrganization); //$NON-NLS-1$
+
+		SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //$NON-NLS-1$
+		String currentDate = fmt.format(this.invocationDate);
+    	nline = replaceMacro("Date", nline, currentDate); //$NON-NLS-1$
+
+    	buffer.setLength(0);
+    	buffer.append("$Id: "); //$NON-NLS-1$
+    	buffer.append(file);
+    	buffer.append(' ');
+    	if (artifact!=null) {
+	    	buffer.append(replacementVersion);
+	    	buffer.append(' ');
+    	}
+    	buffer.append(currentDate);
+    	buffer.append("$"); //$NON-NLS-1$
+    	nline = replaceMacro("Id", nline, buffer.toString()); //$NON-NLS-1$
+
+    	nline = replaceAuthor(nline, artifact);
+    	
+    	return nline;
+    }
+    
+    /**
+     * File filter for HTML file.
+     *
+     * @author St&eacute;phane GALLAND &lt;galland@xxxxxxxxxxx&gt;
+     * @version $Name$ $Revision$ $Date$
+     * @mavengroupid $GroupId$
+     * @mavenartifactid $ArtifactId$
+     */
+    private class HTMLFileFilter implements FileFilter {
+
+    	/**
+    	 */
+    	public HTMLFileFilter() {
+    		//
+    	}
+
+		/**
+		 * {@inheritDoc}
+		 */
+		@Override
+		public boolean accept(File pathname) {
+			return pathname!=null &&
+					(pathname.isDirectory() ||
+					 pathname.getName().endsWith(".html")); //$NON-NLS-1$
+		}
+		
+		/**
+		 * {@inheritDoc}
+		 */
+		@Override
+		public String toString() {
+			return "Hypertext (.html)"; //$NON-NLS-1$
+		}
+    	
+    } // class HTMLFileFilter
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public void checkMojoAttributes() {
+		assertNotNull("outputDirectory", this.outputDirectory); //$NON-NLS-1$
+		assertNotNull("artifactHandlerManager", this.artifactHandlerManager); //$NON-NLS-1$
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	protected File getOutputDirectory() {
+		return this.outputDirectory;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	protected ArtifactHandlerManager getArtifactHandlerManager() {
+		return this.artifactHandlerManager;
+	}
+    
+}

Deleted: trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/javadoctagreplacer/ReplaceMojo.java
===================================================================
--- trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/javadoctagreplacer/ReplaceMojo.java	2011-08-05 16:40:12 UTC (rev 235)
+++ trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/javadoctagreplacer/ReplaceMojo.java	2011-08-05 16:51:45 UTC (rev 236)
@@ -1,351 +0,0 @@
-/* 
- * $Id$
- * 
- * Copyright (C) 2010-11 St&eacute;phane GALLAND
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * This program is free software; you can redistribute it and/or modify
- */
-package org.arakhne.maven.plugins.javadoctagreplacer;
-
-import org.apache.maven.artifact.ArtifactUtils;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
-import org.apache.maven.model.Contributor;
-import org.apache.maven.model.Organization;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.arakhne.maven.AbstractArakhneMojo;
-import org.arakhne.maven.ExtendedArtifact;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Collection;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Replace all the Javadoc variables by the corresponding values.
- * Supported variables are:<table>
- * <thead>
- * <tr><th>Name (case-sensitive)</th><th>Description</th></tr>
- * </thead>
- * <tbody>
- * <tr><td>&dollar;ArtifactId&dollar;</td><td>The artifact id of the Maven module</td></tr>
- * <tr><td>&dollar;Author: id&dollar;</td><td>The name and link to the author with the given id. The id is the
- * identifier of the author or contributor defined the <code>pom.xml</code> file; or it is the
- * email address of the author.</td></tr>
- * <tr><td>&dollar;Date&dollar;</td><td>The date of the last compilation of the Maven module</td></tr>
- * <tr><td>&dollar;GroupId&dollar;</td><td>The group id of the Maven module</td></tr>
- * <tr><td>&dollar;Id&dollar;</td><td>The id of file</td></tr>
- * <tr><td>&dollar;Name&dollar;</td><td>The name of the Maven module</td></tr>
- * <tr><td>&dollar;Organization&dollar;</td><td>The name of organization that publishs the Maven module</td></tr>
- * <tr><td>&dollar;Revision&dollar;</td><td>The version of the Maven module</td></tr>
- * <tr><td>&dollar;Version&dollar;</td><td>The version of the Maven module</td></tr>
- * <tr><td>&dollar;Website&dollar;</td><td>The link to the website of the Maven module</td></tr>
- * </tbody>
- * </table>
- *
- * @author St&eacute;phane GALLAND &lt;galland@xxxxxxxxxxx&gt;
- * @version $Name$ $Revision$ $Date$
- * @mavengroupid $GroupId$
- * @mavenartifactid $ArtifactId$
- * 
- * @goal replacehtml
- * @phase site
- * @requireProject true
- */
-public class ReplaceMojo extends AbstractArakhneMojo {
-
-	/** @component
-	 */
-	private ArtifactHandlerManager artifactHandlerManager;
-	
-	/** @parameter expression="${project.build.directory}"
-	 */
-	private File outputDirectory;
-	 	
-    /**
-     * {@inheritDoc}
-     */
-	@Override
-    protected void executeMojo() throws MojoExecutionException {
-    	File[] javadocDirs = new File[] {
-    			new File(getOutputDirectory(), "site"+File.separator+"apidocs"), //$NON-NLS-1$ //$NON-NLS-2$
-    			new File(getOutputDirectory(), "apidocs") //$NON-NLS-1$
-    	};
-    	
-        for(File javadocDir : javadocDirs) {
-        	clearInternalBuffers();
-        	if ( javadocDir.isDirectory() ) {
-
-        		// Search for files
-        		Collection<File> htmlFiles = findFiles(javadocDir, new HTMLFileFilter());
-
-    			// Replace in files
-    			for(File file : htmlFiles) {
-    				String filename = file.toString().replace(javadocDir.toString(), EMPTY_STRING);
-    				replaceInFile(file, filename);
-    			}
-        	}
-        }
-    }
-                
-    /** Replace the Javadoc tags in the given file.
-     * 
-     * @param file is the name of the file on the local file system.
-     * @param filename is the name of the file in the javadoc hierarchy.
-     * @throws MojoExecutionException
-     */
-	protected void replaceInFile(File file, String filename) throws MojoExecutionException {
-    	
-    	ExtendedArtifact artifact = searchArtifact(file);
-    	
-    	if (artifact!=null) {
-        	getLog().info("Replacing in "+file.getAbsolutePath()+" with artifact "+ //$NON-NLS-1$ //$NON-NLS-2$
-        			ArtifactUtils.key(artifact));
-    	}
-    	else {
-        	getLog().info("Replacing in "+file.getAbsolutePath()+" without artifact"); //$NON-NLS-1$ //$NON-NLS-2$
-    	}
-    	
-    	File outputFile = null;
-    	try {
-    		outputFile = new File(file.getAbsolutePath()+".maven.tmp"); //$NON-NLS-1$
-    		BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile));
-    		BufferedReader reader = new BufferedReader(new FileReader(file));
-    		String line = reader.readLine();
-    		while (line!=null) {
-    			line = replaceInString(filename, artifact, line);
-    			writer.write(line);
-    			writer.write("\n"); //$NON-NLS-1$
-    			line = reader.readLine();
-    		}
-    		writer.close();
-    		reader.close();
-    		fileCopy(outputFile, file);
-    		outputFile.delete();
-    	}
-    	catch(IOException e) {
-    		throw new MojoExecutionException(e.getLocalizedMessage(), e);
-    	}
-    	finally {
-    		if (outputFile!=null && outputFile.exists()) outputFile.delete();
-    	}
-    }
-    
-	/** Uitility function that replace the pattern by the replacement text in the given text.
-	 * 
-	 * @param pattern is the pattern to replace.
-	 * @param text is the text in which the replacement should occur
-	 * @param replacement is the replacement text.
-	 * @return the result of the replacement
-	 */
-    protected final String replace(String pattern, String text, String replacement) {
-    	Pattern p = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
-    	Matcher m = p.matcher(text);
-    	return m.replaceAll(replacement);
-    }
-    
-    /** Replace the author information tags in the given text.
-     * 
-     * @param text is the text in which the author tags should be replaced
-     * @param artifact
-     * @return the result of the replacement.
-     * @throws MojoExecutionException
-     */
-    protected String replaceAuthor(String text, ExtendedArtifact artifact) throws MojoExecutionException {
-    	String result = text;
-    	Pattern p = Pattern.compile("[$]Author:([^$]+)[$]", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
-    	Matcher m = p.matcher(text);
-        boolean hasResult = m.find();
-
-        if (hasResult) {
-            StringBuffer sb = new StringBuffer();
-			StringBuffer replacement = new StringBuffer();
-            String login, link;
-            Contributor contributor;
-            do {
-            	login = m.group(1);
-            	if (login!=null) {
-            		login = login.trim();
-            		if (login.length()>0) {
-        				replacement.setLength(0);
-            			if (artifact!=null) {
-	            			contributor = artifact.getContributor(login);
-	            			if (contributor!=null) {
-	            				link = contributor.getUrl();
-	            				if (link==null || EMPTY_STRING.equals(link)) {
-	            					link = contributor.getEmail();
-	            				}
-	            				if (link==null || EMPTY_STRING.equals(link)) {
-	            					replacement.append(contributor.getName());
-	            				}
-	            				else {
-	            					replacement.append("<a target=\"_blank\" href=\""); //$NON-NLS-1$
-	            					replacement.append(link);
-	            					replacement.append("\">"); //$NON-NLS-1$
-	            					replacement.append(contributor.getName());
-	            					replacement.append("</a>"); //$NON-NLS-1$
-	            				}
-	            			}
-	            			else {
-	                    		throw new MojoExecutionException("unable to find a developer or a contributor with an id, a name or an email equal to: "+login); //$NON-NLS-1$
-	            			}
-            			}
-            			m.appendReplacement(sb, replacement.toString());
-            		}
-            		else {
-                		throw new MojoExecutionException("no login for Author tag: "+m.group(0)); //$NON-NLS-1$
-            		}
-            	}
-            	else {
-            		throw new MojoExecutionException("no login for Author tag: "+m.group(0)); //$NON-NLS-1$
-            	}
-                hasResult = m.find();
-            }
-            while (hasResult);
-
-            m.appendTail(sb);
-            
-            result = sb.toString();
-        }
-    	return result;
-    }
-
-    /** Replace Javadoc tags in a string.
-     * 
-     * @param file is the name of the file in the javadoc hierarchy from which the string was extracted.
-     * @param artifact is the artifact in which the file is located. If <code>null</code>
-     * the tags dedicated to the artifact will be replaced by the empty string.
-     * @param line is the line in which the tags should be replaced.
-     * @return the result of the replacement.
-     * @throws MojoExecutionException
-     */
-    protected String replaceInString(String file, ExtendedArtifact artifact, String line) throws MojoExecutionException {
-    	String nline = line;
-    	    	
-    	StringBuffer buffer = new StringBuffer();
-    	
-    	String replacementName = (artifact==null) ? EMPTY_STRING : artifact.getName();
-    	String replacementVersion = (artifact==null) ? EMPTY_STRING : artifact.getVersion();
-    	String replacementArtifactId = (artifact==null) ? EMPTY_STRING : artifact.getArtifactId();
-    	String replacementGroupId = (artifact==null) ? EMPTY_STRING : artifact.getGroupId();
-    	String replacementWebsite = (artifact==null) ? EMPTY_STRING : artifact.getWebsite();
-    	
-    	String replacementOrganization = EMPTY_STRING;
-    	
-    	if (artifact!=null) {
-    		Organization orga = artifact.getOrganization();
-    		if (orga!=null) {
-    			replacementOrganization = orga.getName();
-    		}
-    	}
-    	
-    	nline = replace("[$]Name(:[^$]*)?[$]", nline, replacementName); //$NON-NLS-1$
-    	nline = replace("[$]Revision(:[^$]*)?[$]", nline, replacementVersion); //$NON-NLS-1$
-    	nline = replace("[$]Version(:[^$]*)?[$]", nline, replacementVersion); //$NON-NLS-1$
-    	nline = replace("[$]ArtifactId(:[^$]*)?[$]", nline, replacementArtifactId); //$NON-NLS-1$
-    	nline = replace("[$]GroupId(:[^$]*)?[$]", nline, replacementGroupId); //$NON-NLS-1$
-    	nline = replace("[$]Website(:[^$]*)?[$]", nline, replacementWebsite); //$NON-NLS-1$
-    	nline = replace("[$]Organization(:[^$]*)?[$]", nline, replacementOrganization); //$NON-NLS-1$
-
-		SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd-HHmmss:SSS"); //$NON-NLS-1$
-		String currentDate = fmt.format(this.invocationDate);
-    	nline = replace("[$]Date(:[^$]*)?[$]", nline, currentDate); //$NON-NLS-1$
-
-    	buffer.setLength(0);
-    	buffer.append("$Id: "); //$NON-NLS-1$
-    	buffer.append(file);
-    	buffer.append(' ');
-    	if (artifact!=null) {
-	    	buffer.append(replacementVersion);
-	    	buffer.append(' ');
-    	}
-    	buffer.append(currentDate);
-    	buffer.append("$"); //$NON-NLS-1$
-    	nline = replace("[$]Id(:[^$]*)?[$]", nline, buffer.toString()); //$NON-NLS-1$
-
-    	nline = replaceAuthor(nline, artifact);
-    	
-    	return nline;
-    }
-    
-    /**
-     * File filter for HTML file.
-     *
-     * @author St&eacute;phane GALLAND &lt;galland@xxxxxxxxxxx&gt;
-     * @version $Name$ $Revision$ $Date$
-     * @mavengroupid $GroupId$
-     * @mavenartifactid $ArtifactId$
-     */
-    private class HTMLFileFilter implements FileFilter {
-
-    	/**
-    	 */
-    	public HTMLFileFilter() {
-    		//
-    	}
-
-		/**
-		 * {@inheritDoc}
-		 */
-		@Override
-		public boolean accept(File pathname) {
-			return pathname!=null &&
-					(pathname.isDirectory() ||
-					 pathname.getName().endsWith(".html")); //$NON-NLS-1$
-		}
-		
-		/**
-		 * {@inheritDoc}
-		 */
-		@Override
-		public String toString() {
-			return "Hypertext (.html)"; //$NON-NLS-1$
-		}
-    	
-    } // class HTMLFileFilter
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public void checkMojoAttributes() {
-		assertNotNull("outputDirectory", this.outputDirectory); //$NON-NLS-1$
-		assertNotNull("artifactHandlerManager", this.artifactHandlerManager); //$NON-NLS-1$
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	protected File getOutputDirectory() {
-		return this.outputDirectory;
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	protected ArtifactHandlerManager getArtifactHandlerManager() {
-		return this.artifactHandlerManager;
-	}
-    
-}


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/