alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Friki example source code file (InMemoryRepository.java)

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

inmemoryrepository, inmemoryrepository, iterator, maptractrepository, repositorydriver, repositorydriver, string, string, tract, tract, util

The Friki InMemoryRepository.java source code

package tests;

import java.util.Map;
import java.util.Iterator;

import org.stringtree.factory.memory.MapTractRepository;
import org.stringtree.util.tract.Tract;

import com.efsol.friki.*;

public class InMemoryRepository 
	extends MapTractRepository
	implements RepositoryDriver
{
	public InMemoryRepository(Map map)
	{
		super(map);
	}

	public InMemoryRepository()
	{
		super();
	}

	public boolean isWritable(String name)
	{
		return true;
	}

	public boolean isReadable(String name)
	{
		return true;
	}

	public Tract get(String name)
	{
		return (Page)map.get(name);
	}

	public void put(String name, Tract page)
	{
		map.put(name, page);
	}

	public String backup(String name)
	{
		return name;
	}

	public boolean contains(String name)
	{
		return map.containsKey(name);
	}

	public Iterator allPageNames()
	{
		return map.keySet().iterator();
	}
	
	public String escape(String name)
	{
		return name;
	}
	
	public String unescape(String name)
	{
		return name;
	}
}

Other Friki examples (source code examples)

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

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.