W3C home > Mailing lists > Public > www-validator-cvs@w3.org > September 2009

2006/unicorn/src/org/w3c/unicorn/output MailOutputModule.java,1.7,1.8

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 24 Sep 2009 15:33:05 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1MqqJd-0007cg-FG@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/output
In directory hutz:/tmp/cvs-serv29265/src/org/w3c/unicorn/output

Modified Files:
	MailOutputModule.java 
Log Message:
displays a message on Index when a mail is sent

Index: MailOutputModule.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/output/MailOutputModule.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- MailOutputModule.java	23 Sep 2009 16:59:53 -0000	1.7
+++ MailOutputModule.java	24 Sep 2009 15:33:03 -0000	1.8
@@ -8,12 +8,11 @@
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
-import java.util.Date;
 import java.util.Map;
+import java.util.ArrayList;
+import java.util.Properties;
 import javax.mail.*;
 import javax.mail.internet.*;
-
-import java.util.*; 
 import org.w3c.unicorn.UnicornCall;
 import org.w3c.unicorn.util.Property;
 import org.w3c.unicorn.util.UnicornAuthenticator;
@@ -23,7 +22,7 @@
  * 
  * @author Thomas GAMBET
  */
-public class MailOutputModule implements OutputModule {
+public class MailOutputModule extends OutputModule {
 	
 	private OutputFormater firstOutputFormater;
 	
@@ -33,11 +32,8 @@
 	
 	private String recipient;
 	
-	private Map<String, String> mapOfOutputParameters;
-	
 	public MailOutputModule(Map<String, String> mapOfOutputParameters, Map<String, String> mapOfSpecificParameters) {
-		this.mapOfOutputParameters = mapOfOutputParameters;
-		//this.mapOfSpecificParameters = mapOfSpecificParameters;
+		super(mapOfOutputParameters, mapOfSpecificParameters);
 		
 		recipient = mapOfSpecificParameters.get("email");
 		mimeType = mapOfOutputParameters.get("mimetype");
@@ -54,16 +50,14 @@
 	}
 	
 	public void produceFirstOutput(Map<String, Object> mapOfStringObject, Writer aWriter) {
-		try {
-			aWriter.append("mail en cours d'envoi.");
-			aWriter.close();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
+		//mapOfStringObject.put("baseUri", "http://qa-dev.w3.org/unicorn/");
+		
+		((ArrayList<org.w3c.unicorn.util.Message>) mapOfStringObject.get("messages")). add(new org.w3c.unicorn.util.Message(org.w3c.unicorn.util.Message.Level.INFO, "Le rapport est en cours d'envoi à l'adresse: " + recipient));
+		displayOnIndex(mapOfStringObject, aWriter);
 	}
 	
 	public void produceOutput(Map<String, Object> mapOfStringObject, final Writer aWriter) {
-	    
+		
 		try {
 			
 			mapOfStringObject.put("baseUri", "http://qa-dev.w3.org:8001/unicorn/");
@@ -92,7 +86,7 @@
 				subject += "SUCCEEDED: ";
 			else 
 				subject += "FAILED: ";
-			subject += "Task \"" + uniCall.getTask().getLongName(mapOfOutputParameters.get("lang")) + "\" for \"" + uniCall.getDocumentName() + "\"";
+			subject += "Task \"" + uniCall.getTask().getLongName(outputParameters.get("lang")) + "\" for \"" + uniCall.getDocumentName() + "\"";
 			
 			msg.setSubject(subject);
 			
@@ -118,8 +112,4 @@
 		firstOutputFormater.produceError(mapOfStringObject, aWriter);
 	}
 
-	public String getOutputParameter(String string) {
-		return mapOfOutputParameters.get(string);
-	}
-
 }
\ No newline at end of file
Received on Thursday, 24 September 2009 15:33:14 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:14 GMT