2006/unicorn/src/org/w3c/unicorn Framework.java,1.1.2.13,1.1.2.14

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

Modified Files:
      Tag: dev2
	Framework.java 
Log Message:
added the possibility to define the default task (selected task when ucn_task parameter is not specified) by adding ucn:default="true" to the task metadata in the corresponding rdf file. If ucn:default is to be found nowhere, the default task will be the first one found until next initialization (in this case an error is logged).

Index: Framework.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/Attic/Framework.java,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -u -d -r1.1.2.13 -r1.1.2.14
--- Framework.java	19 Aug 2009 18:49:34 -0000	1.1.2.13
+++ Framework.java	20 Aug 2009 14:06:22 -0000	1.1.2.14
@@ -43,6 +43,7 @@
 import org.w3c.unicorn.tasklist.RDFUnmarshallerJena;
 import org.w3c.unicorn.tasklist.Task;
 import org.w3c.unicorn.tasklist.TaskListUnmarshallerBeans;
+import org.w3c.unicorn.tasklist.Tasklist;
 import org.w3c.unicorn.tasklist.TasksListUnmarshaller;
 import org.w3c.unicorn.util.ListFiles;
 import org.w3c.unicorn.util.Property;
@@ -66,7 +67,8 @@
 	/**
 	 * Data structure for the tasks
 	 */
-	public static Map<String, Task> mapOfTask;
+	//public static Map<String, Task> mapOfTask;
+	public static Tasklist<String, Task> mapOfTask;
 
 	/**
 	 * List of available output languages in PATH_TO_OUTPUT_TEMPLATES
@@ -261,6 +263,8 @@
 				namespace + "parameter"));
 		RDFUnmarshallerJena.setPROPERTY_REFERENCE(model.getProperty(
 				namespace + "reference"));
+		RDFUnmarshallerJena.setPROPERTY_DEFAULT(model.getProperty(
+				namespace + "default"));
 		RDFUnmarshallerJena.setPROPERTY_TYPE(model.getProperty(
 				"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"));
 		RDFUnmarshallerJena.setPROPERTY_VALUE(model.getProperty(
@@ -411,11 +415,11 @@
 			}
 		}
 		mapOfTask = aTaskListUnmarshaller.getMapOfTask();
-		for (String key : mapOfTask.keySet()) {
-			Task task = mapOfTask.get(key);
+		for (Object key : mapOfTask.keySet()) {
+			Task task = mapOfTask.get(key.toString());
 			String defaultLang = Property.get("DEFAULT_LANGUAGE");
 			if (task.getLongName().getLocalization(defaultLang) == null) {
-				task.getLongName().addLocalization(defaultLang, key);
+				task.getLongName().addLocalization(defaultLang, key.toString());
 				logger.warn("Missing default language long name for task: " + key + ". Long name will be the task id.");
 			}
 		}
@@ -424,10 +428,11 @@
 			return;
 		} else {
 			String s = "Map of tasks:";
-			for (String key : mapOfTask.keySet()) {
+			/*for (String key : mapOfTask.keySet()) {
 				s += "\n\t" + key + " => " + mapOfTask.get(key).getLongName() + " - " + mapOfTask.get(key).getDescription();
-			}
-			logger.debug(s);
+			}*/
+			
+			logger.debug(s + mapOfTask);
 			logger.info("OK - " + mapOfTask.size() + " task(s) successfully loaded.");
 		}
 	}

Received on Thursday, 20 August 2009 14:06:42 UTC