Author: jalkanen
Date: Sat Jun 7 03:36:31 2008
New Revision: 664311
URL: http://svn.apache.org/viewvc?rev=664311&view=rev
Log:
Various Javadoc, Java5, checkstyle, and comment fixes.
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/PageTimeComparator.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/SearchResultComparator.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/AbstractFileProvider.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/BasicAttachmentProvider.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingAttachmentProvider.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingProvider.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/FileSystemProvider.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/NoSuchVersionException.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/ProviderException.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/RCSFileProvider.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/RepositoryModifiedException.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningFileProvider.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningProvider.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/WikiPageProvider.java
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/PageTimeComparator.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/PageTimeComparator.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/PageTimeComparator.java
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/PageTimeComparator.java Sat
Jun 7 03:36:31 2008
@@ -35,7 +35,7 @@
// FIXME3.0: move to util package
public class PageTimeComparator
- implements Comparator, Serializable
+ implements Comparator<WikiPage>, Serializable
{
private static final long serialVersionUID = 0L;
@@ -44,11 +44,8 @@
/**
* [EMAIL PROTECTED]
*/
- public int compare( Object o1, Object o2 )
+ public int compare( WikiPage w1, WikiPage w2 )
{
- WikiPage w1 = (WikiPage)o1;
- WikiPage w2 = (WikiPage)o2;
-
if( w1 == null || w2 == null )
{
log.error( "W1 or W2 is NULL in PageTimeComparator!");
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/SearchResultComparator.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/SearchResultComparator.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/SearchResultComparator.java
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/SearchResultComparator.java
Sat Jun 7 03:36:31 2008
@@ -29,7 +29,7 @@
*/
// FIXME3.0: move to the search package
public class SearchResultComparator
- implements Comparator, Serializable
+ implements Comparator<SearchResult>, Serializable
{
private static final long serialVersionUID = 1L;
@@ -39,11 +39,8 @@
*
* [EMAIL PROTECTED]
*/
- public int compare( Object o1, Object o2 )
+ public int compare( SearchResult s1, SearchResult s2 )
{
- SearchResult s1 = (SearchResult)o1;
- SearchResult s2 = (SearchResult)o2;
-
// Bigger scores are first.
int res = s2.getScore() - s1.getScore();
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java
Sat Jun 7 03:36:31 2008
@@ -80,6 +80,11 @@
}
}
+ /**
+ * Reloads the preferences from the PageContext into the WikiContext.
+ *
+ * @param pageContext The page context.
+ */
// FIXME: The way that date preferences are chosen is currently a bit
wacky: it all
// gets saved to the cookie based on the browser state with which
the user
// happened to first arrive to the site with. This, unfortunately,
means that
@@ -192,7 +197,8 @@
/**
* Get Locale according to user-preference settings or the user browser
locale
*
- * @param wikiContext
+ * @param context The context to examine.
+ * @return a Locale object.
* @since 2.8
*/
public static Locale getLocale(WikiContext context)
@@ -308,8 +314,13 @@
*/
public enum TimeFormat
{
+ /** A time format, no date. */
TIME,
+
+ /** A date format, no time. */
DATE,
+
+ /** A date+time format. */
DATETIME
}
}
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/AbstractFileProvider.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/AbstractFileProvider.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/AbstractFileProvider.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/AbstractFileProvider.java
Sat Jun 7 03:36:31 2008
@@ -65,17 +65,19 @@
*/
public static final String FILE_EXT = ".txt";
+ /** The default encoding. */
public static final String DEFAULT_ENCODING = "ISO-8859-1";
private boolean m_windowsHackNeeded = false;
/**
+ * [EMAIL PROTECTED]
* @throws FileNotFoundException If the specified page directory does not
exist.
* @throws IOException In case the specified page directory is a file,
not a directory.
*/
public void initialize( WikiEngine engine, Properties properties )
throws NoRequiredPropertyException,
- IOException
+ IOException, FileNotFoundException
{
log.debug("Initing FileSystemProvider");
m_pageDirectory = WikiEngine.getRequiredProperty( properties,
PROP_PAGEDIR );
@@ -131,7 +133,11 @@
/**
* This makes sure that the queried page name
- * is still readable by the file system.
+ * is still readable by the file system. For example, all XML entities
+ * and slashes are encoded with the percent notation.
+ *
+ * @param pagename The name to mangle
+ * @return The mangled name.
*/
protected String mangleName( String pagename )
{
@@ -165,6 +171,9 @@
/**
* This makes the reverse of mangleName.
+ *
+ * @param filename The filename to unmangle
+ * @return The unmangled name.
*/
protected String unmangleName( String filename )
{
@@ -186,13 +195,18 @@
/**
* Finds a Wiki page from the page repository.
+ *
+ * @param page The name of the page.
+ * @return A File to the page. May be null.
*/
protected File findPage( String page )
{
return new File( m_pageDirectory, mangleName(page)+FILE_EXT );
}
-
+ /**
+ * [EMAIL PROTECTED]
+ */
public boolean pageExists( String page )
{
File pagefile = findPage( page );
@@ -203,6 +217,10 @@
/**
* This implementation just returns the current version, as filesystem
* does not provide versioning information for now.
+ *
+ * @param page [EMAIL PROTECTED]
+ * @param version [EMAIL PROTECTED]
+ * @throws [EMAIL PROTECTED]
*/
public String getPageText( String page, int version )
throws ProviderException
@@ -259,6 +277,9 @@
return result;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void putPageText( WikiPage page, String text )
throws ProviderException
{
@@ -282,12 +303,15 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public Collection getAllPages()
throws ProviderException
{
log.debug("Getting all pages...");
- ArrayList set = new ArrayList();
+ ArrayList<WikiPage> set = new ArrayList<WikiPage>();
File wikipagedir = new File( m_pageDirectory );
@@ -320,11 +344,20 @@
return set;
}
+ /**
+ * Does not work.
+ *
+ * @param date [EMAIL PROTECTED]
+ * @return [EMAIL PROTECTED]
+ */
public Collection getAllChangedSince( Date date )
{
return new ArrayList(); // FIXME
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public int getPageCount()
{
File wikipagedir = new File( m_pageDirectory );
@@ -337,11 +370,14 @@
/**
* Iterates through all WikiPages, matches them against the given query,
* and returns a Collection of SearchResult objects.
+ *
+ * @param query [EMAIL PROTECTED]
+ * @return [EMAIL PROTECTED]
*/
public Collection findPages( QueryItem[] query )
{
File wikipagedir = new File( m_pageDirectory );
- TreeSet res = new TreeSet( new SearchResultComparator() );
+ TreeSet<SearchResult> res = new TreeSet<SearchResult>( new
SearchResultComparator() );
SearchMatcher matcher = new SearchMatcher( m_engine, query );
File[] wikipages = wikipagedir.listFiles( new WikiFileFilter() );
@@ -388,6 +424,11 @@
/**
* Always returns the latest version, since FileSystemProvider
* does not support versioning.
+ *
+ * @param page [EMAIL PROTECTED]
+ * @param version [EMAIL PROTECTED]
+ * @return [EMAIL PROTECTED]
+ * @throws [EMAIL PROTECTED]
*/
public WikiPage getPageInfo( String page, int version )
throws ProviderException
@@ -407,22 +448,32 @@
/**
* The FileSystemProvider provides only one version.
+ *
+ * @param page [EMAIL PROTECTED]
+ * @throws [EMAIL PROTECTED]
+ * @return [EMAIL PROTECTED]
*/
public List getVersionHistory( String page )
throws ProviderException
{
- ArrayList list = new ArrayList();
+ ArrayList<WikiPage> list = new ArrayList<WikiPage>();
list.add( getPageInfo( page, WikiPageProvider.LATEST_VERSION ) );
return list;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public String getProviderInfo()
{
return "";
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void deleteVersion( String pageName, int version )
throws ProviderException
{
@@ -434,6 +485,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void deletePage( String pageName )
throws ProviderException
{
@@ -442,9 +496,16 @@
f.delete();
}
+ /**
+ * A simple filter which filters only those filenames which correspond to
the
+ * file extension used.
+ */
public static class WikiFileFilter
implements FilenameFilter
{
+ /**
+ * [EMAIL PROTECTED]
+ */
public boolean accept( File dir, String name )
{
return name.endsWith( FILE_EXT );
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/BasicAttachmentProvider.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/BasicAttachmentProvider.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/BasicAttachmentProvider.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/BasicAttachmentProvider.java
Sat Jun 7 03:36:31 2008
@@ -79,6 +79,8 @@
{
private WikiEngine m_engine;
private String m_storageDir;
+
+ /** The property name for where the attachments should be stored. Value
is <tt>[EMAIL PROTECTED]</tt>. */
public static final String PROP_STORAGEDIR =
"jspwiki.basicAttachmentProvider.storageDir";
/*
@@ -86,15 +88,24 @@
* since 2.5.96
*/
private Pattern m_disableCache = null;
+
+ /** The property name for specifying which attachments are not cached.
Value is <tt>[EMAIL PROTECTED]</tt>. */
public static final String PROP_DISABLECACHE =
"jspwiki.basicAttachmentProvider.disableCache";
+ /** The name of the property file. */
public static final String PROPERTY_FILE = "attachment.properties";
+ /** The default extension for the page attachment directory name. */
public static final String DIR_EXTENSION = "-att";
+
+ /** The default extension for the attachment directory. */
public static final String ATTDIR_EXTENSION = "-dir";
static final Logger log = Logger.getLogger( BasicAttachmentProvider.class
);
+ /**
+ * [EMAIL PROTECTED]
+ */
public void initialize( WikiEngine engine, Properties properties )
throws NoRequiredPropertyException,
IOException
@@ -249,6 +260,9 @@
* Returns the file extension. For example "test.png" returns "png".
* <p>
* If file has no extension, will return "bin"
+ *
+ * @param filename The file name to check
+ * @return The extension. If no extension is found, returns "bin".
*/
protected static String getFileExtension( String filename )
{
@@ -307,6 +321,9 @@
return props;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void putAttachmentData( Attachment att, InputStream data )
throws ProviderException,
IOException
@@ -368,6 +385,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public String getProviderInfo()
{
return "";
@@ -404,6 +424,9 @@
return f;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public InputStream getAttachmentData( Attachment att )
throws IOException,
ProviderException
@@ -423,10 +446,13 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public Collection listAttachments( WikiPage page )
throws ProviderException
{
- Collection result = new ArrayList();
+ Collection<Attachment> result = new ArrayList<Attachment>();
File dir = findPageDir( page.getName() );
@@ -496,11 +522,17 @@
return result;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public Collection findAttachments( QueryItem[] query )
{
return null;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
// FIXME: Very unoptimized.
public List listAllChanged( Date timestamp )
throws ProviderException
@@ -512,7 +544,7 @@
throw new ProviderException("Specified attachment directory
"+m_storageDir+" does not exist!");
}
- ArrayList list = new ArrayList();
+ ArrayList<Attachment> list = new ArrayList<Attachment>();
String[] pagesWithAttachments = attDir.list( new AttachmentFilter() );
@@ -539,6 +571,9 @@
return list;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public Attachment getAttachmentInfo( WikiPage page, String name, int
version )
throws ProviderException
{
@@ -601,9 +636,12 @@
return att;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public List getVersionHistory( Attachment att )
{
- ArrayList list = new ArrayList();
+ ArrayList<Attachment> list = new ArrayList<Attachment>();
try
{
@@ -629,13 +667,18 @@
return list;
}
-
+ /**
+ * [EMAIL PROTECTED]
+ */
public void deleteVersion( Attachment att )
throws ProviderException
{
// FIXME: Does nothing yet.
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void deleteAttachment( Attachment att )
throws ProviderException
{
@@ -657,6 +700,9 @@
public static class AttachmentFilter
implements FilenameFilter
{
+ /**
+ * [EMAIL PROTECTED]
+ */
public boolean accept( File dir, String name )
{
return name.endsWith( DIR_EXTENSION );
@@ -669,12 +715,19 @@
public static class AttachmentVersionFilter
implements FilenameFilter
{
+ /**
+ * [EMAIL PROTECTED]
+ */
public boolean accept( File dir, String name )
{
return !name.equals( PROPERTY_FILE );
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
+
public void moveAttachmentsForPage( String oldParent, String newParent )
throws ProviderException
{
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingAttachmentProvider.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingAttachmentProvider.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingAttachmentProvider.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingAttachmentProvider.java
Sat Jun 7 03:36:31 2008
@@ -164,13 +164,14 @@
/**
* [EMAIL PROTECTED]
*/
+ @SuppressWarnings("unchecked")
public Collection listAttachments( WikiPage page )
throws ProviderException
{
log.debug("Listing attachments for "+page);
try
{
- Collection c = (Collection)m_cache.getFromCache( page.getName(),
m_refreshPeriod );
+ Collection<Attachment> c =
(Collection<Attachment>)m_cache.getFromCache( page.getName(), m_refreshPeriod );
if( c != null )
{
@@ -187,7 +188,7 @@
{
try
{
- Collection c = refresh( page );
+ Collection<Attachment> c = refresh( page );
return cloneCollection(c);
}
@@ -282,11 +283,12 @@
*
* @return The newly fetched object from the provider.
*/
- private final Collection refresh( WikiPage page )
+ @SuppressWarnings("unchecked")
+ private final Collection<Attachment> refresh( WikiPage page )
throws ProviderException
{
m_cacheMisses++;
- Collection c = m_provider.listAttachments( page );
+ Collection<Attachment> c = m_provider.listAttachments( page );
m_cache.putInCache( page.getName(), c );
return c;
@@ -399,7 +401,9 @@
}
/**
- * Returns the WikiAttachmentProvider that this caching provider delegates
to.
+ * Returns the WikiAttachmentProvider that this caching provider
delegates to.
+ *
+ * @return The real provider underneath this one.
*/
public WikiAttachmentProvider getRealProvider()
{
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingProvider.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingProvider.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingProvider.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/CachingProvider.java
Sat Jun 7 03:36:31 2008
@@ -95,13 +95,19 @@
*/
public static final String PROP_CACHECHECKINTERVAL =
"jspwiki.cachingProvider.cacheCheckInterval";
+
+ /**
+ * The capacity of the cache.
+ */
public static final String PROP_CACHECAPACITY =
"jspwiki.cachingProvider.capacity";
private static final int DEFAULT_CACHECAPACITY = 1000; // Good most
wikis
private static final String OSCACHE_ALGORITHM =
"com.opensymphony.oscache.base.algorithm.LRUCache";
-
+ /**
+ * [EMAIL PROTECTED]
+ */
public void initialize( WikiEngine engine, Properties properties )
throws NoRequiredPropertyException,
IOException
@@ -308,6 +314,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public boolean pageExists( String pageName, int version )
{
if( pageName == null ) return false;
@@ -378,6 +387,9 @@
return false;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public boolean pageExists( String pageName )
{
if( pageName == null ) return false;
@@ -460,6 +472,7 @@
}
/**
+ * [EMAIL PROTECTED]
* @throws RepositoryModifiedException If the page has been externally
modified.
*/
public String getPageText( String pageName, int version )
@@ -562,6 +575,9 @@
return text;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void putPageText( WikiPage page, String text )
throws ProviderException
{
@@ -587,7 +603,9 @@
}
}
-
+ /**
+ * [EMAIL PROTECTED]
+ */
public Collection getAllPages()
throws ProviderException
{
@@ -621,17 +639,26 @@
return all;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public Collection getAllChangedSince( Date date )
{
return m_provider.getAllChangedSince( date );
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public int getPageCount()
throws ProviderException
{
return m_provider.getPageCount();
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public Collection findPages( QueryItem[] query )
{
//
@@ -670,6 +697,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public WikiPage getPageInfo( String pageName, int version )
throws ProviderException,
RepositoryModifiedException
@@ -711,6 +741,9 @@
return page;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public List getVersionHistory( String pageName )
throws ProviderException
{
@@ -745,6 +778,9 @@
return history;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public synchronized String getProviderInfo()
{
return "Real provider: "+m_provider.getClass().getName()+
@@ -755,6 +791,9 @@
". Cache consistency checks: "+m_expiryPeriod+"s";
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void deleteVersion( String pageName, int version )
throws ProviderException
{
@@ -783,6 +822,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void deletePage( String pageName )
throws ProviderException
{
@@ -799,6 +841,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void movePage( String from,
String to )
throws ProviderException
@@ -823,6 +868,7 @@
/**
* Returns the actual used provider.
* @since 2.0
+ * @return The real provider.
*/
public WikiPageProvider getRealProvider()
{
@@ -841,7 +887,7 @@
private static class CacheItemCollector
implements CacheEntryEventListener
{
- private Map m_allItems = new HashMap();
+ private Map<String, WikiPage> m_allItems = new HashMap<String,
WikiPage>();
/**
* Returns a clone of the set - you cannot manipulate this.
@@ -850,7 +896,7 @@
*/
public Set getAllItems()
{
- Set ret = new TreeSet();
+ Set<WikiPage> ret = new TreeSet<WikiPage>();
ret.addAll(m_allItems.values());
return ret;
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/FileSystemProvider.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/FileSystemProvider.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/FileSystemProvider.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/FileSystemProvider.java
Sat Jun 7 03:36:31 2008
@@ -43,6 +43,9 @@
*/
public static final String PROP_EXT = ".properties";
+ /**
+ * [EMAIL PROTECTED]
+ */
public void putPageText( WikiPage page, String text )
throws ProviderException
{
@@ -129,6 +132,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public WikiPage getPageInfo( String page, int version )
throws ProviderException
{
@@ -150,6 +156,9 @@
return p;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void deletePage(String pageName) throws ProviderException
{
super.deletePage(pageName);
@@ -160,6 +169,9 @@
if( file.exists() ) file.delete();
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void movePage( String from,
String to )
throws ProviderException
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/NoSuchVersionException.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/NoSuchVersionException.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/NoSuchVersionException.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/NoSuchVersionException.java
Sat Jun 7 03:36:31 2008
@@ -28,6 +28,11 @@
{
private static final long serialVersionUID = 0L;
+ /**
+ * Creates a ProviderException.
+ *
+ * @param msg [EMAIL PROTECTED]
+ */
public NoSuchVersionException( String msg )
{
super( msg );
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/ProviderException.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/ProviderException.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/ProviderException.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/ProviderException.java
Sat Jun 7 03:36:31 2008
@@ -33,6 +33,11 @@
{
private static final long serialVersionUID = 0L;
+ /**
+ * Creates a ProviderException.
+ *
+ * @param msg [EMAIL PROTECTED]
+ */
public ProviderException( String msg )
{
super( msg );
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/RCSFileProvider.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/RCSFileProvider.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/RCSFileProvider.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/RCSFileProvider.java
Sat Jun 7 03:36:31 2008
@@ -65,10 +65,19 @@
private static final Logger log =
Logger.getLogger(RCSFileProvider.class);
+ /** Property name for the checkin command. Value is <tt>[EMAIL
PROTECTED]</tt>. */
public static final String PROP_CHECKIN =
"jspwiki.rcsFileProvider.checkinCommand";
+
+ /** Property name for the checkout command. Value is <tt>[EMAIL
PROTECTED]</tt>. */
public static final String PROP_CHECKOUT =
"jspwiki.rcsFileProvider.checkoutCommand";
+
+ /** Property name for the log command. Value is <tt>[EMAIL
PROTECTED]</tt>. */
public static final String PROP_LOG =
"jspwiki.rcsFileProvider.logCommand";
+
+ /** Property name for the full log command. Value is <tt>[EMAIL
PROTECTED]</tt>. */
public static final String PROP_FULLLOG =
"jspwiki.rcsFileProvider.fullLogCommand";
+
+ /** Property name for the checkout version command. Value is <tt>[EMAIL
PROTECTED]</tt>. */
public static final String PROP_CHECKOUTVERSION =
"jspwiki.rcsFileProvider.checkoutVersionCommand";
private static final String PATTERN_DATE = "^date:\\s*(.*\\d);";
@@ -81,8 +90,11 @@
// Date format parsers, placed here to save on object creation
private SimpleDateFormat m_rcsdatefmt = new SimpleDateFormat(
RCSFMT_DATE );
- private SimpleDateFormat m_rcsdatefmt_utc = new SimpleDateFormat(
RCSFMT_DATE_UTC );
+ private SimpleDateFormat m_rcsdatefmtUTC = new SimpleDateFormat(
RCSFMT_DATE_UTC );
+ /**
+ * [EMAIL PROTECTED]
+ */
public void initialize( WikiEngine engine, Properties props )
throws NoRequiredPropertyException,
IOException
@@ -110,6 +122,9 @@
log.debug("checkoutversion="+m_checkoutVersionCommand);
}
+ /**
+ * [EMAIL PROTECTED]
+ */
// NB: This is a very slow method.
public WikiPage getPageInfo( String page, int version )
@@ -237,6 +252,9 @@
return info;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public String getPageText( String page, int version )
throws ProviderException
{
@@ -353,6 +371,10 @@
/**
* Puts the page into RCS and makes sure there is a fresh copy in
* the directory as well.
+ *
+ * @param page [EMAIL PROTECTED]
+ * @param text [EMAIL PROTECTED]
+ * @throws [EMAIL PROTECTED]
*/
public void putPageText( WikiPage page, String text )
throws ProviderException
@@ -433,6 +455,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
// FIXME: Put the rcs date formats into properties as well.
public List getVersionHistory( String page )
{
@@ -442,7 +467,7 @@
log.debug("Getting RCS version history");
- ArrayList list = new ArrayList();
+ ArrayList<WikiPage> list = new ArrayList<WikiPage>();
try
{
@@ -481,7 +506,7 @@
list.add( info );
}
- if( matcher.contains( line, datepattern ) )
+ if( matcher.contains( line, datepattern ) && info != null )
{
MatchResult result = matcher.getMatch();
@@ -490,14 +515,14 @@
info.setLastModified( d );
}
- if( matcher.contains( line, userpattern ) )
+ if( matcher.contains( line, userpattern ) && info != null )
{
MatchResult result = matcher.getMatch();
info.setAuthor( TextUtil.urlDecodeUTF8(result.group(1)) );
}
- if( matcher.contains( line, notepattern ) )
+ if( matcher.contains( line, notepattern ) && info != null )
{
MatchResult result = matcher.getMatch();
@@ -543,6 +568,9 @@
/**
* Removes the page file and the RCS archive from the repository.
* This method assumes that the page archive ends with ",v".
+ *
+ * @param page [EMAIL PROTECTED]
+ * @throws [EMAIL PROTECTED]
*/
public void deletePage( String page )
throws ProviderException
@@ -574,6 +602,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void deleteVersion( String page, int version )
{
String line = "<rcs not run>";
@@ -657,7 +688,7 @@
try
{
- d = m_rcsdatefmt_utc.parse( str );
+ d = m_rcsdatefmtUTC.parse( str );
return d;
}
catch ( ParseException pe )
@@ -666,6 +697,9 @@
return d;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void movePage( String from,
String to )
throws ProviderException
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/RepositoryModifiedException.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/RepositoryModifiedException.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/RepositoryModifiedException.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/RepositoryModifiedException.java
Sat Jun 7 03:36:31 2008
@@ -41,7 +41,7 @@
/**
* Constructs the exception.
*
- * @param msg
+ * @param msg The message
* @param pageName The name of the page which was modified
*/
public RepositoryModifiedException( String msg, String pageName )
@@ -51,6 +51,11 @@
m_page = pageName;
}
+ /**
+ * Return the page name given in the constructor.
+ *
+ * @return The page name.
+ */
public String getPageName()
{
return m_page;
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningFileProvider.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningFileProvider.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningFileProvider.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningFileProvider.java
Sat Jun 7 03:36:31 2008
@@ -63,11 +63,17 @@
{
private static final Logger log =
Logger.getLogger(VersioningFileProvider.class);
+ /** Name of the directory where the old versions are stored. */
public static final String PAGEDIR = "OLD";
+
+ /** Name of the property file which stores the metadata. */
public static final String PROPERTYFILE = "page.properties";
private CachedProperties m_cachedProperties;
+ /**
+ * [EMAIL PROTECTED]
+ */
public void initialize( WikiEngine engine, Properties properties )
throws NoRequiredPropertyException,
IOException
@@ -215,7 +221,7 @@
//
// The profiler showed that when calling the history of a page
the propertyfile
// was read just as much times as there were versions of that
file. The loading
- // of a propertyfile is a cpu-intensive jobs. So now hold on to
the last propertyfile
+ // of a propertyfile is a cpu-intensive job. So now hold on to
the last propertyfile
// read because the next method will with a high probability ask
for the same propertyfile.
// The time it took to show a historypage with 267 versions
dropped with 300%.
//
@@ -312,6 +318,9 @@
return requestedVersion;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public synchronized String getPageText( String page, int version )
throws ProviderException
{
@@ -394,6 +403,9 @@
2 Main.txt (2) 1.txt
3 Main.txt (3) 1.txt, 2.txt
*/
+ /**
+ * [EMAIL PROTECTED]
+ */
public synchronized void putPageText( WikiPage page, String text )
throws ProviderException
{
@@ -486,6 +498,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public WikiPage getPageInfo( String page, int version )
throws ProviderException
{
@@ -569,6 +584,9 @@
return p;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public boolean pageExists( String pageName, int version )
{
File dir = findOldPageDir( pageName );
@@ -589,12 +607,13 @@
}
/**
- * FIXME: Does not get user information.
+ * [EMAIL PROTECTED]
*/
+ // FIXME: Does not get user information.
public List getVersionHistory( String page )
throws ProviderException
{
- ArrayList list = new ArrayList();
+ ArrayList<WikiPage> list = new ArrayList<WikiPage>();
int latest = findLatestVersion( page );
@@ -617,6 +636,9 @@
* Removes the relevant page directory under "OLD" -directory as well,
* but does not remove any extra subdirectories from it. It will only
* touch those files that it thinks to be WikiPages.
+ *
+ * @param page [EMAIL PROTECTED]
+ * @throws [EMAIL PROTECTED]
*/
// FIXME: Should log errors.
public void deletePage( String page )
@@ -646,6 +668,9 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void deleteVersion( String page, int version )
throws ProviderException
{
@@ -738,11 +763,14 @@
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
// FIXME: This is kinda slow, we should need to do this only once.
public Collection getAllPages() throws ProviderException
{
Collection pages = super.getAllPages();
- Collection returnedPages = new ArrayList();
+ Collection<WikiPage> returnedPages = new ArrayList<WikiPage>();
for( Iterator i = pages.iterator(); i.hasNext(); )
{
@@ -756,11 +784,17 @@
return returnedPages;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public String getProviderInfo()
{
return "";
}
+ /**
+ * [EMAIL PROTECTED]
+ */
public void movePage( String from,
String to )
throws ProviderException
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningProvider.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningProvider.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningProvider.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningProvider.java
Sat Jun 7 03:36:31 2008
@@ -35,6 +35,10 @@
{
/**
* Return true, if page with a particular version exists.
+ *
+ * @param page The page name to check for
+ * @param version The version to check
+ * @return True, if page exists; false otherwise.
*/
public boolean pageExists( String page, int version );
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/WikiPageProvider.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/WikiPageProvider.java?rev=664311&r1=664310&r2=664311&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/WikiPageProvider.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/WikiPageProvider.java
Sat Jun 7 03:36:31 2008
@@ -45,24 +45,45 @@
extends WikiProvider
{
/**
- * Attempts to save the page text for page "page".
+ * Attempts to save the page text for page "page". Note that the
+ * provider creates a new version regardless of what the version
+ * parameter of the WikiPage is.
+ *
+ * @param page The WikiPage to save
+ * @param text The text to save.
+ * @throws ProviderException If something goes wrong.
*/
public void putPageText( WikiPage page, String text )
throws ProviderException;
/**
* Return true, if page exists.
+ *
+ * @param page The page name.
+ * @return true, if the page exists; false otherwise.
*/
public boolean pageExists( String page );
/**
- * Finds pages based on the query.
+ * Finds pages based on the query. Only applicable to providers
+ * which implement the FastSearch interface. Otherwise JSPWiki
+ * will use its internal cache.
+ * <p>
+ * This method should really be a part of the FastSearch IF.
+ *
+ * @param query An array of QueryItems to match
+ * @return A Collection of WikiPages.
*/
public Collection findPages( QueryItem[] query );
/**
* Returns info about the page.
+ *
+ * @return A filled WikiPage.
+ * @param page The page name
+ * @param version The version number
+ * @throws ProviderException If something goes wrong.
*/
public WikiPage getPageInfo( String page, int version )
throws ProviderException;
@@ -70,6 +91,9 @@
/**
* Returns all pages. Each element in the returned
* Collection should be a WikiPage.
+ *
+ * @return A collection of WikiPages
+ * @throws ProviderException If something goes wrong.
*/
public Collection getAllPages()
@@ -77,6 +101,9 @@
/**
* Gets a list of recent changes.
+ *
+ * @param date The date to check from
+ * @return A Collection of WikiPages
* @since 1.6.4
*/
@@ -84,6 +111,9 @@
/**
* Gets the number of pages.
+ *
+ * @return The number of pages in the repository
+ * @throws ProviderException If something goes wrong
* @since 1.6.4
*/
@@ -94,7 +124,9 @@
* Returns version history. Each element should be
* a WikiPage.
*
- * @return A collection of wiki pages.
+ * @param page The name of the page to get the history from.
+ * @return A collection of WikiPages.
+ * @throws ProviderException If something goes wrong.
*/
public List getVersionHistory( String page )
@@ -107,6 +139,7 @@
* @param version Version of the page to fetch.
*
* @return The content of the page, or null, if the page does not exist.
+ * @throws ProviderException If something goes wrong.
*/
public String getPageText( String page, int version )