com.ecyrd.jspwiki.providers
Class RCSFileProvider

java.lang.Object
  extended by com.ecyrd.jspwiki.providers.AbstractFileProvider
      extended by com.ecyrd.jspwiki.providers.RCSFileProvider
All Implemented Interfaces:
WikiPageProvider, WikiProvider

public class RCSFileProvider
extends AbstractFileProvider

This class implements a simple RCS file provider. NOTE: You MUST have the RCS package installed for this to work. They must also be in your path...

The RCS file provider extends from the FileSystemProvider, which means that it provides the pages in the same way. The only difference is that it implements the version history commands, and also in each checkin it writes the page to the RCS repository as well.

If you decide to dabble with the default commands, please make sure that you do not check the default archive suffix ",v". File deletion depends on it.

Author:
Janne Jalkanen

Nested Class Summary
 
Nested classes/interfaces inherited from class com.ecyrd.jspwiki.providers.AbstractFileProvider
AbstractFileProvider.WikiFileFilter
 
Field Summary
static String PROP_CHECKIN
           
static String PROP_CHECKOUT
           
static String PROP_CHECKOUTVERSION
           
static String PROP_FULLLOG
           
static String PROP_LOG
           
 
Fields inherited from class com.ecyrd.jspwiki.providers.AbstractFileProvider
DEFAULT_ENCODING, FILE_EXT, m_encoding, m_engine, PROP_PAGEDIR
 
Fields inherited from interface com.ecyrd.jspwiki.WikiProvider
LATEST_VERSION
 
Constructor Summary
RCSFileProvider()
           
 
Method Summary
 void deletePage(String page)
          Removes the page file and the RCS archive from the repository.
 void deleteVersion(String page, int version)
          Removes a specific version from the repository.
 WikiPage getPageInfo(String page, int version)
          Always returns the latest version, since FileSystemProvider does not support versioning.
 String getPageText(String page, int version)
          This implementation just returns the current version, as filesystem does not provide versioning information for now.
 List getVersionHistory(String page)
          The FileSystemProvider provides only one version.
 void initialize(WikiEngine engine, Properties props)
          Initializes the page provider.
 void movePage(String from, String to)
          Move a page
 void putPageText(WikiPage page, String text)
          Puts the page into RCS and makes sure there is a fresh copy in the directory as well.
 
Methods inherited from class com.ecyrd.jspwiki.providers.AbstractFileProvider
findPage, findPages, getAllChangedSince, getAllPages, getPageCount, getProviderInfo, mangleName, pageExists, unmangleName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_CHECKIN

public static final String PROP_CHECKIN
See Also:
Constant Field Values

PROP_CHECKOUT

public static final String PROP_CHECKOUT
See Also:
Constant Field Values

PROP_LOG

public static final String PROP_LOG
See Also:
Constant Field Values

PROP_FULLLOG

public static final String PROP_FULLLOG
See Also:
Constant Field Values

PROP_CHECKOUTVERSION

public static final String PROP_CHECKOUTVERSION
See Also:
Constant Field Values
Constructor Detail

RCSFileProvider

public RCSFileProvider()
Method Detail

initialize

public void initialize(WikiEngine engine,
                       Properties props)
                throws NoRequiredPropertyException,
                       IOException
Description copied from interface: WikiProvider
Initializes the page provider.

Specified by:
initialize in interface WikiProvider
Overrides:
initialize in class AbstractFileProvider
Throws:
FileNotFoundException - If the specified page directory does not exist.
IOException - In case the specified page directory is a file, not a directory.
NoRequiredPropertyException

getPageInfo

public WikiPage getPageInfo(String page,
                            int version)
                     throws ProviderException
Description copied from class: AbstractFileProvider
Always returns the latest version, since FileSystemProvider does not support versioning.

Specified by:
getPageInfo in interface WikiPageProvider
Overrides:
getPageInfo in class AbstractFileProvider
Throws:
ProviderException

getPageText

public String getPageText(String page,
                          int version)
                   throws ProviderException
Description copied from class: AbstractFileProvider
This implementation just returns the current version, as filesystem does not provide versioning information for now.

Specified by:
getPageText in interface WikiPageProvider
Overrides:
getPageText in class AbstractFileProvider
Parameters:
page - Name of the page to fetch.
version - Version of the page to fetch.
Returns:
The content of the page, or null, if the page does not exist.
Throws:
ProviderException

putPageText

public void putPageText(WikiPage page,
                        String text)
                 throws ProviderException
Puts the page into RCS and makes sure there is a fresh copy in the directory as well.

Specified by:
putPageText in interface WikiPageProvider
Overrides:
putPageText in class AbstractFileProvider
Throws:
ProviderException

getVersionHistory

public List getVersionHistory(String page)
Description copied from class: AbstractFileProvider
The FileSystemProvider provides only one version.

Specified by:
getVersionHistory in interface WikiPageProvider
Overrides:
getVersionHistory in class AbstractFileProvider
Returns:
A collection of wiki pages.

deletePage

public void deletePage(String page)
                throws ProviderException
Removes the page file and the RCS archive from the repository. This method assumes that the page archive ends with ",v".

Specified by:
deletePage in interface WikiPageProvider
Overrides:
deletePage in class AbstractFileProvider
Parameters:
page - Name of the page to be removed completely.
Throws:
ProviderException - If the page could not be removed for some reason.

deleteVersion

public void deleteVersion(String page,
                          int version)
Description copied from interface: WikiPageProvider
Removes a specific version from the repository. The implementations should really do no more security checks, since that is the domain of the PageManager. Just delete it as efficiently as you can.

Specified by:
deleteVersion in interface WikiPageProvider
Overrides:
deleteVersion in class AbstractFileProvider
Parameters:
page - Name of the page to be removed.
version - Version of the page to be removed. May be LATEST_VERSION.

movePage

public void movePage(String from,
                     String to)
              throws ProviderException
Description copied from interface: WikiPageProvider
Move a page

Parameters:
from - Name of the page to move.
to - New name of the page.
Throws:
ProviderException - If the page could not be moved for some reason.