package org.tsugi.util;

import java.util.Properties;

import java.io.InputStream;
import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class TsugiUtils {

    private static Log log = LogFactory.getLog(TsugiUtils.class);

    public static Properties loadProperties(String filename)
    {

        Properties prop = new Properties();
        InputStream in = TsugiUtils.class.getResourceAsStream(filename);
        if ( in == null ) {
            log.error("Properties file not found: "+filename);
            return null;
        } else {
            try {
                prop.load(in);
                in.close();
                log.error("Loaded "+prop.size()+" properties from: "+filename);
                return prop;
            } catch (IOException ex) {
                log.warn("Failed loading properties from: "+filename,ex);
                return null;
            }
        }
    }

}


@@ -46,16 +46,77 @@
 perties;
+%0Aimport java.util.Enumeration;%0Aimport java.lang.StringBuffer;
 %0A%0Aimport
@@ -575,21 +575,21 @@
     log.
-error
+debug
 (%22Proper
@@ -765,13 +765,13 @@
 log.
-error
+debug
 (%22Lo
@@ -1002,24 +1002,24 @@
           %7D%0A
-
         %7D%0A  
@@ -1023,11 +1023,482 @@
 %0A    %7D%0A%0A
+    public static String dumpProperties(Properties p)%0A    %7B%0A        StringBuffer sb = new StringBuffer();%0A%0A        Enumeration keys = p.keys();%0A        while (keys.hasMoreElements()) %7B%0A            String key = (String)keys.nextElement();%0A            String value = (String)p.get(key);%0A            if ( sb.length() %3E 0 ) sb.append(%22%5Cn%22);%0A            sb.append(key);%0A            sb.append(%22: %22);%0A            sb.append(value);%0A        %7D%0A        return sb.toString();%0A    %7D%0A%0A
 %7D%0A%0A

Add a dump properties