/*
 * Created on Jul 19, 2004
 *
 */
package edu.wustl.catissuecore.util.global;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;

/**
 * This class is used to retrieve values of keys from the ApplicationResources.properties file.
 * @author kapil_kaveeshwar
 */
public class HibernateProperties
{
	private static Properties p;
    
    public static void initBundle(String baseName)
    {
    	try
		{
			File file = new File(baseName);
			BufferedInputStream stram = new BufferedInputStream(new FileInputStream(file));  
			p = new Properties();
			p.load(stram);
			stram.close();
		}
		catch(Exception exe)
		{
			exe.printStackTrace();
			throw new RuntimeException(
				"Exception building HibernateProperties: " + exe.getMessage(), exe);
		}
    	
    	//ResourceBundle.
    }
	
	public static String getValue(String theKey)
	{
		return p.getProperty(theKey);
	}
}
/*
 * Created on Jul 19, 2004
 *
 */
package edu.wustl.catissuecore.util.global;

import java.util.ResourceBundle;

/**
 * This class is used to retrieve values of keys from the ApplicationResources.properties file.
 * @author kapil_kaveeshwar
 */
public class HibernateProperties
{
    private static ResourceBundle bundle; 
    
    public static void initBundle(String baseName)
    {
    	bundle = ResourceBundle.getBundle(baseName);
    }
	
	public static String getValue(String theKey)
	{
		return bundle.getString(theKey);
	}
}
--- 
+++ 
@@ -4,7 +4,10 @@
  */
 package edu.wustl.catissuecore.util.global;
 
-import java.util.ResourceBundle;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Properties;
 
 /**
  * This class is used to retrieve values of keys from the ApplicationResources.properties file.
@@ -12,15 +15,30 @@
  */
 public class HibernateProperties
 {
-    private static ResourceBundle bundle; 
+	private static Properties p;
     
     public static void initBundle(String baseName)
     {
-    	bundle = ResourceBundle.getBundle(baseName);
+    	try
+		{
+			File file = new File(baseName);
+			BufferedInputStream stram = new BufferedInputStream(new FileInputStream(file));  
+			p = new Properties();
+			p.load(stram);
+			stram.close();
+		}
+		catch(Exception exe)
+		{
+			exe.printStackTrace();
+			throw new RuntimeException(
+				"Exception building HibernateProperties: " + exe.getMessage(), exe);
+		}
+    	
+    	//ResourceBundle.
     }
 	
 	public static String getValue(String theKey)
 	{
-		return bundle.getString(theKey);
+		return p.getProperty(theKey);
 	}
 }
Use of properties class for reading resources


SVN-Revision: 864
