Author: jalkanen
Date: Sun May 25 14:16:57 2008
New Revision: 660037
URL: http://svn.apache.org/viewvc?rev=660037&view=rev
Log:
Javadoc, Java5, checkstyle, and comment fixes.
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorInfo.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorTag.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AuthorTag.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/BaseURLTag.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/BreadcrumbsTag.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CalendarTag.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckLockInfo.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckLockTag.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckRequestContextTag.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckVersionTag.java
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CommentLinkTag.java
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorInfo.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorInfo.java?rev=660037&r1=660036&r2=660037&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorInfo.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorInfo.java
Sun May 25 14:16:57 2008
@@ -31,6 +31,10 @@
*/
public class AttachmentsIteratorInfo extends TagExtraInfo
{
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public VariableInfo[] getVariableInfo(TagData data)
{
VariableInfo[] var = { new VariableInfo( data.getAttributeString("id"),
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorTag.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorTag.java?rev=660037&r1=660036&r2=660037&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorTag.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AttachmentsIteratorTag.java
Sun May 25 14:16:57 2008
@@ -42,7 +42,6 @@
* <LI>page - Page name to refer to. Default is the current page.
* </UL>
*
- * @author Janne Jalkanen
* @since 2.0
*/
@@ -54,6 +53,10 @@
static Logger log = Logger.getLogger( AttachmentsIteratorTag.class );
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public final int doStartTag()
{
m_wikiContext = (WikiContext) pageContext.getAttribute(
WikiTagBase.ATTR_CONTEXT,
@@ -118,6 +121,10 @@
return SKIP_BODY;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public final int doAfterBody()
{
if( bodyContent != null )
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AuthorTag.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AuthorTag.java?rev=660037&r1=660036&r2=660037&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AuthorTag.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/AuthorTag.java Sun May
25 14:16:57 2008
@@ -41,6 +41,10 @@
{
private static final long serialVersionUID = 0L;
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public final int doWikiStartTag()
throws IOException
{
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/BaseURLTag.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/BaseURLTag.java?rev=660037&r1=660036&r2=660037&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/BaseURLTag.java
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/BaseURLTag.java Sun May
25 14:16:57 2008
@@ -32,6 +32,10 @@
{
private static final long serialVersionUID = 0L;
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public final int doWikiStartTag()
throws IOException
{
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/BreadcrumbsTag.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/BreadcrumbsTag.java?rev=660037&r1=660036&r2=660037&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/BreadcrumbsTag.java
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/BreadcrumbsTag.java Sun
May 25 14:16:57 2008
@@ -57,6 +57,10 @@
private int m_maxQueueSize = 11;
private String m_separator = ", ";
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public void initTag()
{
super.initTag();
@@ -64,36 +68,61 @@
m_separator = ", ";
}
+ /**
+ * Returns the maxpages. This may differ from what was set by
setMaxpages().
+ *
+ * @return The current size of the pages.
+ */
public int getMaxpages()
{
return m_maxQueueSize;
}
+ /**
+ * Sets how many pages to show.
+ *
+ * @param maxpages The amount.
+ */
public void setMaxpages(int maxpages)
{
m_maxQueueSize = maxpages + 1;
}
+ /**
+ * Get the separator string.
+ *
+ * @return The string set in setSeparator()
+ */
public String getSeparator()
{
return m_separator;
}
+ /**
+ * Set the separator string.
+ *
+ * @param separator A string which separates the page names.
+ */
public void setSeparator(String separator)
{
m_separator = separator;
}
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @SuppressWarnings("unchecked")
+ @Override
public int doWikiStartTag() throws IOException
{
HttpSession session = pageContext.getSession();
- FixedQueue trail = (FixedQueue)
session.getAttribute(BREADCRUMBTRAIL_KEY);
+ FixedQueue<String> trail = (FixedQueue<String>)
session.getAttribute(BREADCRUMBTRAIL_KEY);
String page = m_wikiContext.getPage().getName();
if( trail == null )
{
- trail = new FixedQueue(m_maxQueueSize);
+ trail = new FixedQueue<String>(m_maxQueueSize);
}
if( m_wikiContext.getRequestContext().equals( WikiContext.VIEW ) )
@@ -107,7 +136,7 @@
//
// Don't add the page to the queue if the page was just
refreshed
//
- if( !((String) trail.getLast()).equals(page) )
+ if( !trail.getLast().equals(page) )
{
trail.pushItem(page);
log.debug("added page: " + page);
@@ -132,7 +161,7 @@
for( int i = 0; i < queueSize - 1; i++ )
{
- curPage = (String) trail.get(i);
+ curPage = trail.get(i);
//FIXME: I can't figure out how to detect the appropriate jsp page
to put here, so I hard coded Wiki.jsp
//This breaks when you view an attachment metadata page
@@ -151,8 +180,8 @@
/**
* Extends the LinkedList class to provide a fixed-size queue
implementation
*/
- public static class FixedQueue
- extends LinkedList
+ public static class FixedQueue<T>
+ extends LinkedList<T>
implements Serializable
{
private int m_size;
@@ -163,7 +192,7 @@
m_size = size;
}
- Object pushItem(Object o)
+ T pushItem(T o)
{
add(o);
if( size() > m_size )
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CalendarTag.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CalendarTag.java?rev=660037&r1=660036&r2=660037&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CalendarTag.java
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CalendarTag.java Sun May
25 14:16:57 2008
@@ -66,6 +66,10 @@
private SimpleDateFormat m_monthUrlFormat = null;
private SimpleDateFormat m_dateFormat = new SimpleDateFormat( "ddMMyy" );
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public void initTag()
{
super.initTag();
@@ -85,16 +89,42 @@
}
*/
+ /**
+ * Sets the page format. If a page corresponding to the format is found
when
+ * the calendar is being rendered, a link to that page is created. E.g.
if the
+ * format is set to <tt>'Main_blogentry_'ddMMyy</tt>, it works nicely in
+ * conjuction to the WeblogPlugin.
+ *
+ * @param format The format in the SimpleDateFormat fashion.
+ *
+ * @see SimpleDateFormat
+ * @see com.ecyrd.jspwiki.plugin.WeblogPlugin
+ */
public void setPageformat( String format )
{
m_pageFormat = new SimpleDateFormat(format);
}
+ /**
+ * Set the URL format. If the pageformat is not set, all dates are
+ * links to pages according to this format. The pageformat
+ * takes precedence.
+ *
+ * @param format The URL format in the SimpleDateFormat fashion.
+ * @see SimpleDateFormat
+ */
public void setUrlformat( String format )
{
m_urlFormat = new SimpleDateFormat(format);
}
+ /**
+ * Set the format to be used for links for the months.
+ *
+ * @param format The format to set in the SimpleDateFormat fashion.
+ *
+ * @see SimpleDateFormat
+ */
public void setMonthurlformat( String format )
{
m_monthUrlFormat = new SimpleDateFormat( format );
@@ -241,6 +271,10 @@
return format(result);
}
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public final int doWikiStartTag()
throws IOException,
ProviderException
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckLockInfo.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckLockInfo.java?rev=660037&r1=660036&r2=660037&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckLockInfo.java
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckLockInfo.java Sun
May 25 14:16:57 2008
@@ -24,9 +24,16 @@
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.VariableInfo;
+/**
+ * A companion to CheckLogTag.
+ */
public class CheckLockInfo
extends TagExtraInfo
{
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public VariableInfo[] getVariableInfo(TagData data)
{
VariableInfo[] var = { new VariableInfo( data.getAttributeString("id"),
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckLockTag.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckLockTag.java?rev=660037&r1=660036&r2=660037&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckLockTag.java
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckLockTag.java Sun
May 25 14:16:57 2008
@@ -31,42 +31,64 @@
import javax.servlet.http.HttpSession;
/**
- *
+ * Checks whether the page is locked for editing. If the mode matches,
+ * the tag body is included. The "mode" can be any of the following:
+ *
+ * <ul>
+ * <li><b>locked</b> - The page is currently locked, but the lock is owned by
someone else.</li>
+ * <li><b>owned</b> - The page is currently locked and the current user is
the owner of the lock.</li>
+ * <li><b>unlocked</b> - Nobody has locked the page.</li>
+ * </ul>
+ *
* @since 2.0
*/
public class CheckLockTag
extends WikiTagBase
{
- private static final long serialVersionUID = 0L;
+ private static final long serialVersionUID = 1L;
- public static final int LOCKED = 0;
- public static final int NOTLOCKED = 1;
- public static final int OWNED = 2;
+ private static enum LockState
+ {
+ LOCKED, NOTLOCKED, OWNED
+ }
- private int m_mode;
+ private LockState m_mode;
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public void initTag()
{
super.initTag();
- m_mode = 0;
+ m_mode = LockState.NOTLOCKED;
}
+ /**
+ * Sets the mode to check for.
+ *
+ * @param arg A String for the mode.
+ */
public void setMode( String arg )
{
if( "locked".equals(arg) )
{
- m_mode = LOCKED;
+ m_mode = LockState.LOCKED;
}
else if("owned".equals(arg) )
{
- m_mode = OWNED;
+ m_mode = LockState.OWNED;
}
else
{
- m_mode = NOTLOCKED;
+ m_mode = LockState.NOTLOCKED;
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public final int doWikiStartTag()
throws IOException,
ProviderException
@@ -84,9 +106,9 @@
PageLock userLock = (PageLock)
session.getAttribute("lock-"+page.getName());
- if( (lock != null && m_mode == LOCKED && lock != userLock ) ||
- (lock != null && m_mode == OWNED && lock == userLock ) ||
- (lock == null && m_mode == NOTLOCKED) )
+ if( (lock != null && m_mode == LockState.LOCKED && lock !=
userLock ) ||
+ (lock != null && m_mode == LockState.OWNED && lock == userLock
) ||
+ (lock == null && m_mode == LockState.NOTLOCKED) )
{
String tid = getId();
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckRequestContextTag.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckRequestContextTag.java?rev=660037&r1=660036&r2=660037&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckRequestContextTag.java
(original)
+++
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckRequestContextTag.java
Sun May 25 14:16:57 2008
@@ -27,9 +27,11 @@
import com.ecyrd.jspwiki.providers.ProviderException;
/**
- * Includes body, if the request context matches.
+ * Includes body, if the request context matches. To understand more about
+ * RequestContexts, please look at the WikiContext class.
*
* @since 2.0
+ * @see com.ecyrd.jspwiki.WikiContext
*/
public class CheckRequestContextTag
extends WikiTagBase
@@ -39,7 +41,10 @@
private String m_context;
private String[] m_contextList = {};
-
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public void initTag()
{
super.initTag();
@@ -47,11 +52,21 @@
m_contextList = new String[0];
}
+ /**
+ * Returns the context.
+ *
+ * @return Return the context.
+ */
public String getContext()
{
return m_context;
}
+ /**
+ * Set the context to check for.
+ *
+ * @param arg One of the RequestsContexts.
+ */
public void setContext( String arg )
{
m_context = arg;
@@ -59,6 +74,10 @@
m_contextList = StringUtils.split(arg,'|');
}
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public final int doWikiStartTag()
throws IOException,
ProviderException
Modified:
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckVersionTag.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckVersionTag.java?rev=660037&r1=660036&r2=660037&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckVersionTag.java
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CheckVersionTag.java Sun
May 25 14:16:57 2008
@@ -22,6 +22,7 @@
import java.io.IOException;
+import com.ecyrd.jspwiki.InternalWikiException;
import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.WikiPage;
import com.ecyrd.jspwiki.providers.ProviderException;
@@ -29,8 +30,10 @@
/**
* Does a version check on the page. Mode is as follows:
* <UL>
- * <LI>latest = Include page content, if the page is the latest version.
- * <LI>notlatest = Include page content, if the page is NOT the latest
version.
+ * <LI><b>latest</b> - Include body, if the page is the latest version.</li>
+ * <LI><b>notlatest</b> - Include body, if the page is NOT the latest
version.</li>
+ * <li><b>first</b> - Include body, if page is the first version (version
1)</li>
+ * <li><b>notfirst</b> - Include bodt, if page is NOT the first version
(version 1)</li>
* </UL>
* If the page does not exist, body content is never included.
*
@@ -41,39 +44,52 @@
{
private static final long serialVersionUID = 0L;
- public static final int LATEST = 0;
- public static final int NOTLATEST = 1;
- public static final int FIRST = 2;
- public static final int NOTFIRST = 3;
+ private static enum VersionMode
+ {
+ LATEST, NOTLATEST, FIRST, NOTFIRST
+ }
- private int m_mode;
+ private VersionMode m_mode;
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public void initTag()
{
super.initTag();
- m_mode = 0;
+ m_mode = VersionMode.LATEST;
}
+ /**
+ * Sets the mode.
+ *
+ * @param arg The mode to set.
+ */
public void setMode( String arg )
{
if( "latest".equals(arg) )
{
- m_mode = LATEST;
+ m_mode = VersionMode.LATEST;
}
else if( "notfirst".equals(arg) )
{
- m_mode = NOTFIRST;
+ m_mode = VersionMode.NOTFIRST;
}
else if( "first".equals(arg) )
{
- m_mode = FIRST;
+ m_mode = VersionMode.FIRST;
}
else
{
- m_mode = NOTLATEST;
+ m_mode = VersionMode.NOTLATEST;
}
}
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public final int doWikiStartTag()
throws IOException,
ProviderException
@@ -93,21 +109,24 @@
switch( m_mode )
{
- case LATEST:
- include = (version < 0) || (latest.getVersion() == version);
- break;
-
- case NOTLATEST:
- include = (version > 0) && (latest.getVersion() != version);
- break;
-
- case FIRST:
- include = (version == 1 ) || (version < 0 &&
latest.getVersion() == 1);
- break;
-
- case NOTFIRST:
- include = version > 1;
- break;
+ case LATEST:
+ include = (version < 0) || (latest.getVersion() ==
version);
+ break;
+
+ case NOTLATEST:
+ include = (version > 0) && (latest.getVersion() !=
version);
+ break;
+
+ case FIRST:
+ include = (version == 1 ) || (version < 0 &&
latest.getVersion() == 1);
+ break;
+
+ case NOTFIRST:
+ include = version > 1;
+ break;
+
+ default:
+ throw new InternalWikiException("Mode which is not
available!");
}
if( include )
Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CommentLinkTag.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CommentLinkTag.java?rev=660037&r1=660036&r2=660037&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CommentLinkTag.java
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/tags/CommentLinkTag.java Sun
May 25 14:16:57 2008
@@ -21,10 +21,12 @@
package com.ecyrd.jspwiki.tags;
import java.io.IOException;
+
import javax.servlet.jsp.JspWriter;
-import com.ecyrd.jspwiki.WikiPage;
+import com.ecyrd.jspwiki.InternalWikiException;
import com.ecyrd.jspwiki.WikiContext;
+import com.ecyrd.jspwiki.WikiPage;
/**
* Writes a comment link. Body of the link becomes the link text.
@@ -41,6 +43,10 @@
{
private static final long serialVersionUID = 0L;
+ /**
+ * [EMAIL PROTECTED]
+ */
+ @Override
public final int doWikiStartTag()
throws IOException
{
@@ -74,13 +80,17 @@
switch( m_format )
{
- case ANCHOR:
- out.print("<a href=\""+getCommentURL(pageName)+"\">");
- break;
-
- case URL:
- out.print( getCommentURL(pageName) );
- break;
+ case ANCHOR:
+ out.print("<a href=\""+getCommentURL(pageName)+"\">");
+ break;
+
+ case URL:
+ out.print( getCommentURL(pageName) );
+ break;
+
+ default:
+ throw new InternalWikiException("Impossible format "+m_format);
+
}
return EVAL_BODY_INCLUDE;