All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.bliki.wiki.model.IConfiguration Maven / Gradle / Ivy

The newest version!
package info.bliki.wiki.model;

import info.bliki.htmlcleaner.TagToken;
import info.bliki.wiki.tags.code.SourceCodeFormatter;
import info.bliki.wiki.template.ITemplateFunction;

import java.util.Map;
import java.util.Set;

/**
 * Configuration interface for extensions similar to the Mediawiki
 * HTML styled tag extension,
 * template parser functions
 * and interwiki links
 *
 * @see info.bliki.wiki.model.Configuration
 */
public interface IConfiguration {
    /**
     * @see Case-sensitivity
     */
    enum Casing {
        CaseSensitive,
        FirstLetter
    }

    /**
     * Add a new
     * source code formatter
     * to the configuration
     */
    SourceCodeFormatter addCodeFormatter(String key, SourceCodeFormatter value);

    /**
     * Add another Interwiki link to the configuration. The value string must
     * contain the $1 placeholder for the used wiki article
     * link.
     *
     * @param key   the prefix used in the interwiki link (i.e. [[prefix:...]] )
     * @param value the external link which should be generated from the interwiki
     *              link
     */
    String addInterwikiLink(String key, String value);

    /**
     * Add a new interwiki
     * link to the configuration
     */
    ITemplateFunction addTemplateFunction(String key, ITemplateFunction value);

    /**
     * Add a new
     * HTML styled tag to the configuration
     */
    TagToken addTokenTag(String key, TagToken value);

    /**
     * Get the source code formatter map of built-in source code formatters
     */
    Map getCodeFormatterMap();

    /**
     * Get the currently configured cache implementation for template calls.
     *
     * @return null if no cache implementation is set.
     * @see IConfiguration#setTemplateCallsCache(Map)
     */
    Map getTemplateCallsCache();

    /**
     * Get the template
     * parser functions map of built-in template functions
     */
    Map getTemplateMap();

    /**
     * Get the HTML
     * styled tag map for built-in tags
     */
    Map getTokenMap();

    /**
     * Get the set of all allowed URI scheme shortcuts like http, https, ftp,...
     *
     * See URI scheme
     */
    Set getUriSchemeSet();

    /**
     * Set a cache map implementation. For example based on JSR 107. Template calls
     * which use the same parameters over and over again do lookup this cache and
     * use the preparsed result if available.
     *
     * Note: don't use a simple java.util.HashMap implementation because it's not thread-safe an grows infinitly.
     *
     * @param map
     *          the cache implementation
     */
    void setTemplateCallsCache(Map map);

    /**
     * @return the default casing, defaults to {@link Casing#FirstLetter}.
     */
    Casing casing();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy