W3C home > Mailing lists > Public > www-validator-cvs@w3.org > June 2010

unicorn commit: added task messages to reload default messages

From: Mercurial notifier <nobody@w3.org>
Date: Fri, 18 Jun 2010 17:36:46 -0400
To: Unicorn Updates <www-validator-cvs@w3.org>
Message-Id: <E1OPjF0-0005rA-BB@blinky.w3.org>
changeset:   1279:9d44d4533347
tag:         tip
user:        Thomas Gambet <tgambet@w3.org>
date:        Fri Jun 18 17:39:03 2010 -0400
files:       WebContent/WEB-INF/resources/templates/init.vm src/org/w3c/unicorn/action/InitAction.java
description:
added task messages to reload default messages


diff -r 3374c09c0899 -r 9d44d4533347 WebContent/WEB-INF/resources/templates/init.vm
--- a/WebContent/WEB-INF/resources/templates/init.vm	Fri Jun 18 17:31:44 2010 -0400
+++ b/WebContent/WEB-INF/resources/templates/init.vm	Fri Jun 18 17:39:03 2010 -0400
@@ -9,7 +9,8 @@
 		<li><a href="init?task=all" class="init">Initialize all</a></li>
 		<li><a href="init?task=languages" class="init">Reload languages</a></li>
 		<li><a href="init?task=observers" class="init">Reload observers</a></li>
-		<li><a href="init?task=tasklist" class="init">Reload tasklist</a></li>
+		<li><a href="init?task=tasklist" class="init">Reload tasklist</a></li>
+		<li><a href="init?task=messages" class="init">Reload messages</a></li>
 	</ul>
 	<textarea name="result" id="result" rows="15" cols="32" disabled="disabled"></textarea>
 </div>
diff -r 3374c09c0899 -r 9d44d4533347 src/org/w3c/unicorn/action/InitAction.java
--- a/src/org/w3c/unicorn/action/InitAction.java	Fri Jun 18 17:31:44 2010 -0400
+++ b/src/org/w3c/unicorn/action/InitAction.java	Fri Jun 18 17:39:03 2010 -0400
@@ -14,6 +14,7 @@
 import org.w3c.unicorn.Framework;
 import org.w3c.unicorn.exceptions.InitializationFailedException;
 import org.w3c.unicorn.util.Language;
+import org.w3c.unicorn.util.MessageList;
 import org.w3c.unicorn.util.Templates;
 
 import com.ibm.icu.util.ULocale;
@@ -170,18 +171,26 @@
 				}
 			}
 				
-			out.write("Initializing Velocity: ");
-			response.flushBuffer();
-			try {
-				Framework.initVelocity();
+			if (task.equals("all") || task.equals("messages")) {
+				out.write("Loading default messages: ");
+				Framework.initDefaultMessages();
 				out.write("OK\n");
-			} catch (InitializationFailedException e) {
-				Framework.logger.fatal(e.getMessage(), e);
-				out.write("FAILED\n" + e);
-				Framework.isUcnInitialized = false;
-				return;
+				out.write("\t" + MessageList.getDefaultMessages().size() + " message(s) loaded.\n");
 			}
 			
+			if (!task.equals("messages")) {
+				out.write("Initializing Velocity: ");
+				response.flushBuffer();
+				try {
+					Framework.initVelocity();
+					out.write("OK\n");
+				} catch (InitializationFailedException e) {
+					Framework.logger.fatal(e.getMessage(), e);
+					out.write("FAILED\n" + e);
+					Framework.isUcnInitialized = false;
+					return;
+				}
+			}
 			out.close();
 		}
 	}
Received on Friday, 18 June 2010 21:39:31 GMT

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