001: /*
002: JSPWiki - a JSP-based WikiWiki clone.
003:
004: Copyright (C) 2001-2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)
005:
006: This program is free software; you can redistribute it and/or modify
007: it under the terms of the GNU Lesser General Public License as published by
008: the Free Software Foundation; either version 2.1 of the License, or
009: (at your option) any later version.
010:
011: This program is distributed in the hope that it will be useful,
012: but WITHOUT ANY WARRANTY; without even the implied warranty of
013: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: GNU Lesser General Public License for more details.
015:
016: You should have received a copy of the GNU Lesser General Public License
017: along with this program; if not, write to the Free Software
018: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: */
020: package com.ecyrd.jspwiki.providers;
021:
022: import java.util.List;
023: import java.util.Collection;
024: import java.util.Date;
025:
026: import com.ecyrd.jspwiki.*;
027:
028: /**
029: * Each Wiki page provider should implement this interface.
030: * <P>
031: * You can build whatever page providers based on this, just
032: * leave the unused methods do something useful.
033: * <P>
034: * WikiPageProvider uses Strings and ints to refer to pages. This may
035: * be a bit odd, since WikiAttachmentProviders all use Attachment
036: * instead of name/version. We will perhaps modify these in the
037: * future. In the mean time, name/version is quite sufficient.
038: * <P>
039: * FIXME: In reality we should have an AbstractWikiPageProvider,
040: * which would provide intelligent backups for subclasses.
041: *
042: * @author Janne Jalkanen
043: */
044: public interface WikiPageProvider extends WikiProvider {
045: /**
046: * Attempts to save the page text for page "page".
047: */
048: public void putPageText(WikiPage page, String text)
049: throws ProviderException;
050:
051: /**
052: * Return true, if page exists.
053: */
054:
055: public boolean pageExists(String page);
056:
057: /**
058: * Finds pages based on the query.
059: */
060: public Collection findPages(QueryItem[] query);
061:
062: /**
063: * Returns info about the page.
064: */
065: public WikiPage getPageInfo(String page, int version)
066: throws ProviderException;
067:
068: /**
069: * Returns all pages. Each element in the returned
070: * Collection should be a WikiPage.
071: */
072:
073: public Collection getAllPages() throws ProviderException;
074:
075: /**
076: * Gets a list of recent changes.
077: * @since 1.6.4
078: */
079:
080: public Collection getAllChangedSince(Date date);
081:
082: /**
083: * Gets the number of pages.
084: * @since 1.6.4
085: */
086:
087: public int getPageCount() throws ProviderException;
088:
089: /**
090: * Returns version history. Each element should be
091: * a WikiPage.
092: *
093: * @return A collection of wiki pages.
094: */
095:
096: public List getVersionHistory(String page) throws ProviderException;
097:
098: /**
099: * Gets a specific version out of the repository.
100: *
101: * @param page Name of the page to fetch.
102: * @param version Version of the page to fetch.
103: *
104: * @return The content of the page, or null, if the page does not exist.
105: */
106:
107: public String getPageText(String page, int version)
108: throws ProviderException;
109:
110: /**
111: * Removes a specific version from the repository. The implementations
112: * should really do no more security checks, since that is the domain
113: * of the PageManager. Just delete it as efficiently as you can.
114: *
115: * @since 2.0.17.
116: *
117: * @param pageName Name of the page to be removed.
118: * @param version Version of the page to be removed. May be LATEST_VERSION.
119: *
120: * @throws ProviderException If the page cannot be removed for some reason.
121: */
122:
123: public void deleteVersion(String pageName, int version)
124: throws ProviderException;
125:
126: /**
127: * Removes an entire page from the repository. The implementations
128: * should really do no more security checks, since that is the domain
129: * of the PageManager. Just delete it as efficiently as you can. You should also
130: * delete any auxiliary files that belong to this page, IF they were created
131: * by this provider.
132: *
133: * <P>The reason why this is named differently from
134: * deleteVersion() (logically, this method should be an
135: * overloaded version) is that I want to be absolutely sure I
136: * don't accidentally use the wrong method. With overloading
137: * something like that happens sometimes...
138: *
139: * @since 2.0.17.
140: *
141: * @param pageName Name of the page to be removed completely.
142: *
143: * @throws ProviderException If the page could not be removed for some reason.
144: */
145: public void deletePage(String pageName) throws ProviderException;
146:
147: /**
148: * Move a page
149: *
150: * @param from Name of the page to move.
151: * @param to New name of the page.
152: *
153: * @throws ProviderException If the page could not be moved for some reason.
154: */
155: public void movePage(String from, String to)
156: throws ProviderException;
157:
158: }
|