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

Friki example source code file (

This example Friki source code file ( is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Friki tags/keywords

classictohtmlfilter, classictohtmlfilter, externalformatter, file, hashmap, io, map, map, mapstringrepository, string, string, stringtokenizer, tractfetcher, tractfetcher, transformfilter, util

The Friki source code

package com.efsol.friki;

import java.util.Map;
import java.util.HashMap;
import java.util.StringTokenizer;

import org.stringtree.factory.Fetcher;
import org.stringtree.factory.StorerHelper;
import org.stringtree.factory.TractFetcher;
import org.stringtree.factory.memory.MapStringRepository;
import org.stringtree.juicer.formatter.ExternalFormatter;
import org.stringtree.util.FileReadingUtils;

public class ClassicToHTMLFilter 
	extends TransformFilter
	protected void setContext(Fetcher context, TractFetcher pages, Map remoteNames)
		StorerHelper.put(context, "wiki.pages", pages);
		StorerHelper.put(context, "wiki.remoteNames", new MapStringRepository(remoteNames));

	public ClassicToHTMLFilter(Fetcher context, TractFetcher pages, Map remoteNames, String spec)
		setContext(context, pages, remoteNames);
		setConverter(new ExternalFormatter(spec, context));

	public ClassicToHTMLFilter(Fetcher context, TractFetcher pages, Map remoteNames, File file)
		this(context, pages, remoteNames, FileReadingUtils.readFile(file));

	protected static Map loadRemoteDetails(File file)
		Map remoteNames = new HashMap();
		String spec = FileReadingUtils.readFile(file);
		StringTokenizer tok = new StringTokenizer(spec, "\n");
		while (tok.hasMoreTokens())
			String line = tok.nextToken().trim();
			int sep = line.indexOf(" ");
			if (sep > 0)
				String name = line.substring(0,sep);
				String url = line.substring(sep+1);
				remoteNames.put(name, url);

		return remoteNames;

	public String makeLinkSource(String name)
		return "<a href='view?" + name + "'>" + name + "";	

Other Friki examples (source code examples)

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

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

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
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.