devdaily home | apple | java | perl | unix | directory | blog

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

package tests;

import java.util.Properties;
import java.io.InputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import com.efsol.friki.*;

public class PropertiesFileRepository 
	extends InMemoryRepository
{
	public PropertiesFileRepository(File input)
	{
		super(new Properties());

		Properties props = (Properties)map;
		try
		{
			InputStream in = new FileInputStream(input);
			props.load(in);
			in.close();
		}
		catch(IOException ioe)
		{
			ioe.printStackTrace();
		}

	}

	public Page load(String name)
	{
		Page page = new Page(name);
		String content = (String)map.get(name);
		page.setContent(content);
		return page;
	}

}




Copyright 1998-2008 Alvin Alexander
All Rights Reserved.
 
devdaily.com is based in louisville, kentucky, and this web site is hosted by godaddy.com