2006/unicorn/src/org/w3c/unicorn/action InitAction.java,1.3,1.4

Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action
In directory hutz:/tmp/cvs-serv2187/src/org/w3c/unicorn/action

Modified Files:
	InitAction.java 
Log Message:
sets Framework.isUcnInitialized to false if an error occurs
+ does not try to perform a specific init task (language, observers, tasklist) if unicorn is not previously successfully initialized.

Index: InitAction.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/InitAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- InitAction.java	31 Aug 2009 11:35:55 -0000	1.3
+++ InitAction.java	31 Aug 2009 12:02:38 -0000	1.4
@@ -40,6 +40,9 @@
 			String task = request.getParameter("task"); 
 			
 			if (task == null || task.equals("all")) {
+				
+				Framework.reset();
+				
 				out.write("Initializing core: ");
 				response.flushBuffer();
 				try {
@@ -48,6 +51,7 @@
 				} catch (InitializationFailedException e) {
 					Framework.logger.fatal(e.getMessage(), e);
 					out.write("FAILED\n" + e);
+					Framework.isUcnInitialized = false;
 					return;
 				}
 				
@@ -59,6 +63,7 @@
 				} catch (InitializationFailedException e) {
 					Framework.logger.fatal(e.getMessage(), e);
 					out.write("FAILED\n" + e);
+					Framework.isUcnInitialized = false;
 					return;
 				}
 				
@@ -75,11 +80,20 @@
 				} catch (InitializationFailedException e) {
 					Framework.logger.fatal(e.getMessage(), e);
 					out.write("FAILED\n" + e);
+					Framework.isUcnInitialized = false;
 					return;
 				}
 			}
 			
 			if (task == null || task.equals("all") || task.equals("observers")) {
+				
+				if (!Framework.isUcnInitialized && task.equals("observers")) {
+					out.write("Unable to reload the observers because Unicorn is not initialized.\n" +
+							"You should initialize Unicorn fully and successfully one time before trying to perform this task (/init?task=all).");
+					out.close();
+					return;
+				}
+					
 				out.write("Loading observers: ");
 				response.flushBuffer();
 				try {
@@ -88,11 +102,20 @@
 				} catch (InitializationFailedException e) {
 					Framework.logger.fatal(e.getMessage(), e);
 					out.write("FAILED\n" + e);
+					Framework.isUcnInitialized = false;
 					return;
 				}
 			}
 			
 			if (task == null || task.equals("all") || task.equals("tasklist")) {
+				
+				if (!Framework.isUcnInitialized && task.equals("tasklist")) {
+					out.write("Unable to reload the tasklist because Unicorn is not initialized.\n" +
+							"You should initialize Unicorn fully and successfully one time before trying to perform this task (/init?task=all).");
+					out.close();
+					return;
+				}
+				
 				out.write("Loading tasklist: ");
 				response.flushBuffer();
 				try {
@@ -101,11 +124,20 @@
 				} catch (InitializationFailedException e) {
 					Framework.logger.fatal(e.getMessage(), e);
 					out.write("FAILED\n" + e);
+					Framework.isUcnInitialized = false;
 					return;
 				}
 			}
 			
 			if (task == null || task.equals("all") || task.equals("language")) {
+				
+				if (!Framework.isUcnInitialized && task.equals("language")) {
+					out.write("Unable to reload the language files because Unicorn is not initialized.\n" +
+							"You should initialize Unicorn fully and successfully one time before trying to perform this task (/init?task=all).");
+					out.close();
+					return;
+				}
+				
 				out.write("Loading language files: ");
 				response.flushBuffer();
 				try {
@@ -114,6 +146,7 @@
 				} catch (InitializationFailedException e) {
 					Framework.logger.fatal(e.getMessage(), e);
 					out.write("FAILED\n" + e);
+					Framework.isUcnInitialized = false;
 					return;
 				}
 				
@@ -125,6 +158,7 @@
 				} catch (InitializationFailedException e) {
 					Framework.logger.fatal(e.getMessage(), e);
 					out.write("FAILED\n" + e);
+					Framework.isUcnInitialized = false;
 					return;
 				}
 			}
@@ -135,8 +169,4 @@
 			response.sendError(403, "You are not allowed to execute this action.");
 	}
 	
-	private void initCore() {
-		
-	}
-	
 }

Received on Monday, 31 August 2009 12:02:49 UTC