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

2006/unicorn/org/w3c/unicorn/util MergeProperties.java,1.1,1.2

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 27 Jul 2009 11:18:10 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1MVODa-0007RL-Ka@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/org/w3c/unicorn/util
In directory hutz:/tmp/cvs-serv28553/org/w3c/unicorn/util

Modified Files:
	MergeProperties.java 
Log Message:
Refactored some code

Index: MergeProperties.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/util/MergeProperties.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- MergeProperties.java	24 Jul 2009 13:47:46 -0000	1.1
+++ MergeProperties.java	27 Jul 2009 11:18:08 -0000	1.2
@@ -9,6 +9,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.velocity.VelocityContext;
 
 
 /** 
@@ -20,7 +21,7 @@
 { 
 	public static final Log logger = LogFactory.getLog("org.w3c.unicorn.until");
   
-	public Properties getMergeProperties(File defaultPropFile, File sourcePropFile) { 
+	public static Properties getMergeProperties(File defaultPropFile, File sourcePropFile) { 
 		Properties defaultProps = new Properties();
 		Properties sourceProps = new Properties();
 		try { 
@@ -46,4 +47,14 @@
 		
 		return propMerge;
 	}
+	
+	public static void loadInVelocityContext(Properties props, VelocityContext context) {
+	    Set<Object> keys = props.keySet();
+	    Iterator<Object> itr = keys.iterator();
+	    String key;
+	    while (itr.hasNext()) {
+			key = itr.next().toString();
+			context.put(key, props.get(key));
+	    }
+	}
 } 
Received on Monday, 27 July 2009 11:18:20 GMT

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