001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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 portletURL to
031             * build links.
032             *
033             * @return HTML string
034             */
035            public String convert(WikiPage page, PortletURL portletURL)
036                    throws PageContentException;
037    
038            /**
039             * Get a map with the links included in the given page. The key of each map
040             * entry is the title of the linked page. The value is a Boolean object that
041             * indicates if the linked page exists or not.
042             *
043             * @return a map of links
044             */
045            public Map<String, Boolean> getOutgoingLinks(WikiPage page)
046                    throws PageContentException;
047    
048            /**
049             * Set the configuraton to support quick links to other wikis. The format of
050             * the configuration is specific to the wiki engine.
051             */
052            public void setInterWikiConfiguration(String interWikiConfiguration);
053    
054            /**
055             * Set the main wiki configuraiton as a String. The format of the
056             * configuration is specific to the wiki engine.
057             */
058            public void setMainConfiguration(String mainConfiguration);
059    
060            /**
061             * Validate the content of a wiki page for this engine.
062             *
063             * @return <code>true</code> if the content is valid
064             */
065            public boolean validate(long nodeId, String content);
066    
067    }