home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Friki example source code file (PropertiesFileRepository.java)

This example Friki source code file (PropertiesFileRepository.java) 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.

Java - Friki tags/keywords

fileinputstream, inmemoryrepository, inmemoryrepository, inputstream, io, page, page, properties, properties, propertiesfilerepository, propertiesfilerepository, string, util

The Friki PropertiesFileRepository.java 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;
	}

}

Other Friki examples (source code examples)

Here is a short list of links related to this Friki PropertiesFileRepository.java source code file:

new blog posts

 

Other websites by Alvin Alexander:  
Life/living in Alaska (OneMansAlaska.com)
How I Sold My Business (HowISoldMyBusiness.com)

Copyright 1998-2011 Alvin Alexander, devdaily.com
All Rights Reserved.