- From: Jean-Guilhem Rouel via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 11 Aug 2009 13:43:03 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/org/w3c/unicorn/index
In directory hutz:/tmp/cvs-serv6157/org/w3c/unicorn/index
Modified Files:
IndexGenerator.java
Log Message:
Code cleanup
Index: IndexGenerator.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/index/IndexGenerator.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- IndexGenerator.java 31 Jul 2009 11:16:26 -0000 1.14
+++ IndexGenerator.java 11 Aug 2009 13:43:01 -0000 1.15
@@ -11,7 +11,7 @@
import java.util.Properties;
import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;;
+import org.apache.commons.logging.LogFactory;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
@@ -20,7 +20,7 @@
import org.w3c.unicorn.tasklist.parameters.ParameterType;
import org.w3c.unicorn.util.ListFiles;
import org.w3c.unicorn.util.Property;
-import org.w3c.unicorn.util.TemplateHelper;;
+import org.w3c.unicorn.util.TemplateHelper;
/**
* IndexGenerator<br />
@@ -41,11 +41,6 @@
private static VelocityContext aVelocityContext;
/**
- * Properties of the index generator framework
- */
- private static Properties aProperties = new Properties();
-
- /**
* Load the properties and initialize apache velocity
*/
static {
@@ -54,11 +49,13 @@
IndexGenerator.aVelocityContext.put("dropdown", ParameterType.DROPDOWN);
IndexGenerator.aVelocityContext.put("checkbox", ParameterType.CHECKBOX);
- IndexGenerator.aVelocityContext.put("checkboxlist", ParameterType.CHECKBOXLIST);
+ IndexGenerator.aVelocityContext.put("checkboxlist",
+ ParameterType.CHECKBOXLIST);
IndexGenerator.aVelocityContext.put("radio", ParameterType.RADIO);
IndexGenerator.aVelocityContext.put("textarea", ParameterType.TEXTAREA);
- IndexGenerator.aVelocityContext.put("textfield", ParameterType.TEXTFIELD);
-
+ IndexGenerator.aVelocityContext.put("textfield",
+ ParameterType.TEXTFIELD);
+
IndexGenerator.aVelocityContext.put("simple", TUi.SIMPLE);
IndexGenerator.aVelocityContext.put("advanced", TUi.ADVANCED);
IndexGenerator.aVelocityContext.put("none", TUi.NONE);
@@ -77,31 +74,37 @@
public static void generateIndexes() throws ResourceNotFoundException,
ParseErrorException, Exception {
IndexGenerator.logger.trace("generateIndexes");
-
+
// Get the list of the language properties files
- File[] langFiles = ListFiles.listFiles(Property.get("PATH_TO_LANGUAGE_FILES"), "index");
-
- // Get all the languages and their associated code (defined in the name of the properties file) in a hashtable
+ File[] langFiles = ListFiles.listFiles(Property
+ .get("PATH_TO_LANGUAGE_FILES"), "index");
+
+ // Get all the languages and their associated code (defined in the name
+ // of the properties file) in a hashtable
Map<String, String> languages = new Hashtable<String, String>();
- for (File langFile : langFiles) {
+ for (File langFile : langFiles) {
Properties props = new java.util.Properties();
- props.load(langFile.toURL().openStream());
- languages.put(langFile.getName().split("\\.")[1], props.getProperty("language"));
+ props.load(langFile.toURI().toURL().openStream());
+ languages.put(langFile.getName().split("\\.")[1], props
+ .getProperty("language"));
}
-
+
IndexGenerator.logger.info("Found Languages : " + languages.toString());
aVelocityContext.put("languages", languages);
- aVelocityContext.put("param_prefix", Property.get("UNICORN_PARAMETER_PREFIX"));
-
+ aVelocityContext.put("param_prefix", Property
+ .get("UNICORN_PARAMETER_PREFIX"));
+
for (File langFile : langFiles) {
String langCode = langFile.getName().split("\\.")[1];
- //aVelocityContext.put("lang", langCode);
- TemplateHelper.generateFileFromTemplate("index", langCode, Property.get("PATH_TO_INDEX_OUTPUT"), "html", aVelocityContext);
+ // aVelocityContext.put("lang", langCode);
+ TemplateHelper.generateFileFromTemplate("index", langCode, Property
+ .get("PATH_TO_INDEX_OUTPUT"), "html", aVelocityContext);
}
-
- TemplateHelper.generateFileFromTemplate("index/en_parameters", null, Property.get("PATH_TO_INDEX_OUTPUT"), "js", aVelocityContext);
+
+ TemplateHelper.generateFileFromTemplate("index/en_parameters", null,
+ Property.get("PATH_TO_INDEX_OUTPUT"), "js", aVelocityContext);
}
-
+
/**
* Launch the creation of the indexes
*
Received on Tuesday, 11 August 2009 13:43:45 UTC