001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.wiki.engines;
016    
017    import com.liferay.portlet.wiki.PageContentException;
018    import com.liferay.portlet.wiki.model.WikiPage;
019    
020    import java.util.Map;
021    
022    import javax.portlet.PortletURL;
023    
024    /**
025     * @author Jorge Ferrer
026     */
027    public interface WikiEngine {
028    
029            /**
030             * Convert the content of the given page to HTML using the view and edit
031             * URLs to build links.
032             *
033             * @return HTML string
034             */
035            public String convert(
036                            WikiPage page, PortletURL viewPageURL, PortletURL editPageURL,
037                            String attachmentURLPrefix)
038                    throws PageContentException;
039    
040            /**
041             * Get a map with the links included in the given page. The key of each map
042             * entry is the title of the linked page. The value is a Boolean object that
043             * indicates if the linked page exists or not.
044             *
045             * @return a map of links
046             */
047            public Map<String, Boolean> getOutgoingLinks(WikiPage page)
048                    throws PageContentException;
049    
050            /**
051             * Set the configuraton to support quick links to other wikis. The format of
052             * the configuration is specific to the wiki engine.
053             */
054            public void setInterWikiConfiguration(String interWikiConfiguration);
055    
056            /**
057             * Set the main wiki configuraiton as a String. The format of the
058             * configuration is specific to the wiki engine.
059             */
060            public void setMainConfiguration(String mainConfiguration);
061    
062            /**
063             * Validate the content of a wiki page for this engine.
064             *
065             * @return <code>true</code> if the content is valid
066             */
067            public boolean validate(long nodeId, String content);
068    
069    }