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.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.ecyrd.jspwiki.providers.AbstractFileProvider
AbstractFileProvider.WikiFileFilter
 
Field Summary
static String PROP_CHECKIN
          Property name for the checkin command.
static String PROP_CHECKOUT
          Property name for the checkout command.
static String PROP_CHECKOUTVERSION
          Property name for the checkout version command.
static String PROP_FULLLOG
          Property name for the full log command.
static String PROP_LOG
          Property name for the log command.
 
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
Property name for the checkin command. Value is "jspwiki.rcsFileProvider.checkinCommand".

See Also:
Constant Field Values

PROP_CHECKOUT

public static final String PROP_CHECKOUT
Property name for the checkout command. Value is "jspwiki.rcsFileProvider.checkoutCommand".

See Also:
Constant Field Values

PROP_LOG

public static final String PROP_LOG
Property name for the log command. Value is "jspwiki.rcsFileProvider.logCommand".

See Also:
Constant Field Values

PROP_FULLLOG

public static final String PROP_FULLLOG
Property name for the full log command. Value is "jspwiki.rcsFileProvider.fullLogCommand".

See Also:
Constant Field Values

PROP_CHECKOUTVERSION

public static final String PROP_CHECKOUTVERSION
Property name for the checkout version command. Value is "jspwiki.rcsFileProvider.checkoutVersionCommand".

See Also:
Constant Field Values
Constructor Detail

RCSFileProvider

public RCSFileProvider()
Method Detail

initialize

public void initialize(WikiEngine engine,
                       Properties props)
                throws NoRequiredPropertyException,
                       IOException
Initializes the page provider.

Specified by:
initialize in interface WikiProvider
Overrides:
initialize in class AbstractFileProvider
Parameters:
engine - WikiEngine to own this provider
props - A set of properties used to initialize this provider
Throws:
NoRequiredPropertyException - If the provider needs a property which is not found in the property set
FileNotFoundException - If the specified page directory does not exist.
IOException - In case the specified page directory is a file, not a directory.

getPageInfo

public WikiPage getPageInfo(String page,
                            int version)
                     throws ProviderException
Always returns the latest version, since FileSystemProvider does not support versioning.

Specified by:
getPageInfo in interface WikiPageProvider
Overrides:
getPageInfo in class AbstractFileProvider
Parameters:
page - The page name
version - The version number
Returns:
A filled WikiPage.
Throws:
ProviderException - If something goes wrong.

getPageText

public String getPageText(String page,
                          int version)
                   throws ProviderException
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 - If something goes wrong.

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
Parameters:
page - The WikiPage to save
text - The text to save.
Throws:
{@inheritDoc}
ProviderException - If something goes wrong.

getVersionHistory

public List getVersionHistory(String page)
The FileSystemProvider provides only one version.

Specified by:
getVersionHistory in interface WikiPageProvider
Overrides:
getVersionHistory in class AbstractFileProvider
Parameters:
page - The name of the page to get the history from.
Returns:
A collection of WikiPages.

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:
{@inheritDoc}
ProviderException - If the page could not be removed for some reason.

deleteVersion

public void deleteVersion(String page,
                          int version)
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
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.